[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] cpu_number: Short circuit if smp init not done
From: |
Damien Zammit |
Subject: |
[PATCH] cpu_number: Short circuit if smp init not done |
Date: |
Sat, 04 Feb 2023 03:30:45 +0000 |
This depends on serialised AP init patch.
Fixes warnings spewing at boot with APIC and SMP
---
i386/i386/cpu_number.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/i386/i386/cpu_number.c b/i386/i386/cpu_number.c
index ad4c4b01..eca95d7a 100644
--- a/i386/i386/cpu_number.c
+++ b/i386/i386/cpu_number.c
@@ -21,10 +21,16 @@
#include <i386/cpu.h>
#include <kern/printf.h>
+extern int bspdone;
+
#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");
@@ -36,5 +42,7 @@ int cpu_number(void)
printf("apic_get_cpu_kernel_id() failed, assuming BSP\n");
kernel_id = 0;
}
+
+ return kernel_id;
}
#endif
--
2.34.1
- [PATCH] cpu_number: Short circuit if smp init not done,
Damien Zammit <=