Skip to contentSkip to conversation

apic creation should not depend on pci

PATCH Superseded Gleb Natapov 2 participants 3 messages Jun 7, 2009

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 apic creation should not depend on pci

Anybody knows why it currently does?

hw/pc.c +1 -3
index 0934778..15c3efe 100644
@@ -881,11 +881,9 @@ static void pc_init1(ram_addr_t ram_size,
         if (smp_cpus > 1) {
             /* XXX: enable it in all cases */
             env->cpuid_features |= CPUID_APIC;
-        }
-        qemu_register_reset(main_cpu_reset, 0, env);
-        if (pci_enabled) {
             apic_init(env);
         }
+        qemu_register_reset(main_cpu_reset, 0, env);
     }
 
     vmport_init();

--
Gleb.

#1 lore raw
Quoted 10 lines · Gleb Natapov

Anybody knows why it currently does?

hw/pc.c +0 -0
index 0934778..15c3efe 100644
@@ -881,11 +881,9 @@ static void pc_init1(ram_addr_t ram_size,
         if (smp_cpus > 1) {
             /* XXX: enable it in all cases */

hw/pc.c static void pc_init1(ram_addr_t ram_size, · line 889

Quoted 10 lines
hw/pc.c +1 -3
             env->cpuid_features |= CPUID_APIC;
-        }
-        qemu_register_reset(main_cpu_reset, 0, env);
-        if (pci_enabled) {
             apic_init(env);
         }
+        qemu_register_reset(main_cpu_reset, 0, env);
     }
 
     vmport_init();

!pci_enabled means isapc, and that was probably once defined as "shall have no external APIC".

But I wonder if we should change this test into "(env->cpuid_features & CPUID_APIC) || smp_cpus > 1", ie. also include isapc with LAPIC CPU (probably a synthetic case, but a selectable one) and non-LAPIC CPU with external APIC (for SMP).

I also wonder if that explicit setting of CPUID_APIC for smp_cpus > 1 is correct. Either the selected CPU type has one, then it's set via PPRO_FEATURES, or not - then it could still exist externally for SMP, see above.

Does this make some sense?

Jan

#2 lore raw
Quoted 25 lines · Jan Kiszka
Quoted 10 lines · Gleb Natapov

Anybody knows why it currently does?

hw/pc.c +0 -0
index 0934778..15c3efe 100644
@@ -881,11 +881,9 @@ static void pc_init1(ram_addr_t ram_size,
         if (smp_cpus > 1) {
             /* XXX: enable it in all cases */

hw/pc.c static void pc_init1(ram_addr_t ram_size, · line 889

Quoted 10 lines
hw/pc.c +1 -3
             env->cpuid_features |= CPUID_APIC;
-        }
-        qemu_register_reset(main_cpu_reset, 0, env);
-        if (pci_enabled) {
             apic_init(env);
         }
+        qemu_register_reset(main_cpu_reset, 0, env);
     }
 
     vmport_init();

!pci_enabled means isapc, and that was probably once defined as "shall have no external APIC".

Quoted 5 lines

But I wonder if we should change this test into "(env->cpuid_features & CPUID_APIC) || smp_cpus > 1", ie. also include isapc with LAPIC CPU (probably a synthetic case, but a selectable one) and non-LAPIC CPU with external APIC (for SMP).

Using (env->cpuid_features & CPUID_APIC) is definitely more correct that what is there now.

Quoted 4 lines

I also wonder if that explicit setting of CPUID_APIC for smp_cpus > 1 is correct. Either the selected CPU type has one, then it's set via PPRO_FEATURES, or not - then it could still exist externally for SMP, see above.

How software detects presence of apic on 486 smp boards? MPtable?

Quoted 3 lines

Does this make some sense?

Yes (for me at least).

--
Gleb.