2

i'm running minix 3.1.2a ,my goal is to start APs procesoors other than the BSP ,i followed the universal startup algorithm :

  • BSP sends AP an INIT IPI
  • BSP DELAYs (10mSec)
  • BSP sends AP a STARTUP IPI
  • BSP DELAYs (200μSEC)
  • BSP sends AP a STARTUP IPI
  • BSP DELAYs (200μSEC)

here's the Function to do INIT IPI AND STARTUP IPI after reading the ACPI table:

void START_APs2()
    {

 u32_t trampoline_addr;
 int UseCPU = 1;
 u32_t reg;
 /* Try to allocate the trampoline for APs to start */
                if ((trampoline_addr=find_trampoline())) 
                 {



 reg = LOCAL_APIC_READ(LOCAL_APIC_SPIV);
   reg |= 0x1FF;    /* Disable apic */
   LOCAL_APIC_WRITE(LOCAL_APIC_SPIV, reg);


                        /*======================== INIT IPI==============================*/



                     CLI();

                        /*LOCAL_APIC_WRITE(LOCAL_APIC_ICR_HIGH, (unsigned long)cpus[UseCPU].ApicID << 24);*/
                       LOCAL_APIC_WRITE(LOCAL_APIC_ICR_LOW,  (unsigned long)  (0x4500) | (trampoline_addr>>12)|(DEST_OTHERS << DEST_SHORT_SHIFT));
                        /*wait_for_ipi_completion();*/
                       VerifyLoop();

                       /*Some delay ...*/
                      milli_delay(100);

                       /*=============================STARTUP IPI==============================*/


                      /* LOCAL_APIC_WRITE(LOCAL_APIC_ICR_HIGH, (unsigned long)cpus[UseCPU].ApicID <<24);*/
                       LOCAL_APIC_WRITE(LOCAL_APIC_ICR_LOW,  (unsigned long)  (0x5600) | (trampoline_addr>>12)|(DEST_OTHERS << DEST_SHORT_SHIFT));
                       VerifyLoop();

                          /*Some delay ...*/
                      milli_delay(200);

                       /* send the IPI */

                       /*LOCAL_APIC_WRITE(LOCAL_APIC_ICR_HIGH, (unsigned long)cpus[UseCPU].ApicID <<24);*/
                       LOCAL_APIC_WRITE(LOCAL_APIC_ICR_LOW,  (unsigned long)  (0x5600) | (trampoline_addr>>12)|(DEST_OTHERS << DEST_SHORT_SHIFT));
                       VerifyLoop();

                          /*Some delay ...*/
                      milli_delay(200);

                      STI();
                     /* enable_cpu(this_cpu, WITHOUT_ECHO);*/
                       if (! AP_running()) 
                          {
                              Aprintf(("\n\n*** WARNING! AP# %d  is not running ***\n\n",(unsigned long)cpus[UseCPU].ApicID));

                          }
                          else
                          {
                               Aprintf("\n\n***AP RUNNING SUCCESSFULLY");

                          }

                 }
}

i'd like to note that i run on a core i7 host machine with windows 7 ,64-bit and i have 3 different virtual M/Cs :

  • VMWARE WORKSTATION
  • VBOX
  • QEMU MANAGER

1-on VMWARE:

mainly i run my guest minix on VMWARE ,when i run the previously mentioned code :

  • when i choose the number of processors i.e 4 and number of cores 1,and run that code the system will keep in restarting.
  • when i choose the number of processors i.e 1 and number of cores 4,and run that code the system will hang.

2-on VBOX:

  • when i choose the number of processors 4 and run that code the system will hang.

3-on QEMU: first the acpi checksum is incorrect ,so i enter the CPUAPIC ID manually just to test i.e APIC ID =1 - when i choose the number of cpus 4 ,and run that code the system will hang.

actually i stuck in that problem for more than 10 days and i pull out my all hair ,i can't reconize why is not starting ,so if any one can help i'll be appreciated

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
user2963216
  • 391
  • 2
  • 4
  • 11
  • 1
    Have you enabled the LAPIC in the IA32_APIC_BASE MSR? When sending the IPI, the vector field must be 0, the assert bit should be 0 and the Destination Mode bit should be 1 (seems you are using shorthands). When sending the SIPI, Destination Mode bit should be 1 too and you should not set the Delivery Status bit. Finally remember that the vector field is only 8 bit long, so your trampoline must not be over 0ff000h. –  Jun 11 '15 at 06:23
  • thanks alot it works now – user2963216 Jun 12 '15 at 16:58
  • A more generic howto: http://stackoverflow.com/questions/16364817/assessing-the-apic-and-creating-ipis-in-x86-assembly?lq=1 – Ciro Santilli OurBigBook.com Nov 07 '15 at 20:43

0 Answers0