[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 gnumach] cpu_number: Short circuit if smp init not done
From: |
Damien Zammit |
Subject: |
[PATCH v2 gnumach] cpu_number: Short circuit if smp init not done |
Date: |
Sat, 04 Feb 2023 10:15:36 +0000 |
This depends on serialised AP init patch.
Fixes warnings spewing at boot with APIC and SMP
---
i386/i386/cpu_number.c | 5 +++++
i386/i386/mp_desc.h | 2 ++
2 files changed, 7 insertions(+)
diff --git a/i386/i386/cpu_number.c b/i386/i386/cpu_number.c
index 42aa6ea1..1d2fab3a 100644
--- a/i386/i386/cpu_number.c
+++ b/i386/i386/cpu_number.c
@@ -19,12 +19,17 @@
#include <i386/apic.h>
#include <i386/smp.h>
#include <i386/cpu.h>
+#include <i386/mp_desc.h>
#include <kern/printf.h>
#if NCPUS > 1
int cpu_number(void)
{
int kernel_id, apic_id;
+
+ if (bspdone == 0)
+ return 0;
+
apic_id = apic_get_current_cpu();
if (apic_id < 0) {
printf("apic_get_current_cpu() failed, assuming BSP\n");
diff --git a/i386/i386/mp_desc.h b/i386/i386/mp_desc.h
index 59d50e77..fea42cd3 100644
--- a/i386/i386/mp_desc.h
+++ b/i386/i386/mp_desc.h
@@ -76,6 +76,8 @@ extern struct real_descriptor *mp_gdt[NCPUS];
extern uint8_t solid_intstack[];
+extern int bspdone;
+
/*
* Each CPU calls this routine to set up its descriptor tables.
*/
--
2.34.1
- [PATCH v2 gnumach] cpu_number: Short circuit if smp init not done,
Damien Zammit <=