This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 0936c97d3e arch/x86_64: Fix SMP startup for ACRN Hypervisor
0936c97d3e is described below

commit 0936c97d3e6597977c8275e545c5b369606d849f
Author: ouyangxiangzhen <[email protected]>
AuthorDate: Mon Jul 8 17:10:32 2024 +0800

    arch/x86_64: Fix SMP startup for ACRN Hypervisor
    
    This patch fixed SMP startup for ACRN Hypervisor.
    
    Signed-off-by: ouyangxiangzhen <[email protected]>
---
 arch/x86_64/src/intel64/intel64_cpustart.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/arch/x86_64/src/intel64/intel64_cpustart.c 
b/arch/x86_64/src/intel64/intel64_cpustart.c
index efd347982b..26715398b4 100644
--- a/arch/x86_64/src/intel64/intel64_cpustart.c
+++ b/arch/x86_64/src/intel64/intel64_cpustart.c
@@ -80,7 +80,8 @@ static int x86_64_ap_startup(int cpu)
 
   /* Send an INIT IPI to the CPU */
 
-  regval = MSR_X2APIC_ICR_INIT | dest;
+  regval = MSR_X2APIC_ICR_INIT | MSR_X2APIC_ICR_ASSERT
+           | MSR_X2APIC_ICR_LEVEL | dest;
   write_msr(MSR_X2APIC_ICR, regval);
 
   /* Wait for 10 ms */
@@ -95,16 +96,13 @@ static int x86_64_ap_startup(int cpu)
 
   /* Wait for AP ready */
 
-  up_udelay(300);
-  SP_DMB();
-
-  /* Check CPU ready flag */
-
-  if (x86_64_cpu_ready_get(cpu) == false)
+  do
     {
-      sinfo("failed to startup cpu=%d\n", cpu);
-      return -EBUSY;
+      up_udelay(300);
+      SP_DMB();
+      sinfo("wait for startup cpu=%d...\n", cpu);
     }
+  while (x86_64_cpu_ready_get(cpu) == false);
 
   return OK;
 }

Reply via email to