PVH guests don't have an emulated lapic. --- sys/amd64/amd64/mp_machdep.c | 10 ++++++---- sys/amd64/include/apicvar.h | 1 + sys/i386/include/apicvar.h | 1 + sys/i386/xen/xen_machdep.c | 2 ++ sys/x86/x86/local_apic.c | 8 +++++--- sys/x86/xen/pv.c | 3 +++ 6 files changed, 18 insertions(+), 7 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index 0738a37..fd6eace 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c _at__at_ -707,7 +707,8 _at__at_ init_secondary(void) wrmsr(MSR_SF_MASK, PSL_NT|PSL_T|PSL_I|PSL_C|PSL_D); /* Disable local APIC just to be sure. */ - lapic_disable(); + if (lapic_valid) + lapic_disable(); /* signal our startup to the BSP. */ mp_naps++; _at__at_ -733,7 +734,7 _at__at_ init_secondary(void) /* A quick check from sanity claus */ cpuid = PCPU_GET(cpuid); - if (PCPU_GET(apic_id) != lapic_id()) { + if (lapic_valid && (PCPU_GET(apic_id) != lapic_id())) { printf("SMP: cpuid = %d\n", cpuid); printf("SMP: actual apic_id = %d\n", lapic_id()); printf("SMP: correct apic_id = %d\n", PCPU_GET(apic_id)); _at__at_ -749,7 +750,8 _at__at_ init_secondary(void) mtx_lock_spin(&ap_boot_mtx); /* Init local apic for irq's */ - lapic_setup(1); + if (lapic_valid) + lapic_setup(1); /* Set memory range attributes for this CPU to match the BSP */ mem_range_AP_init(); _at__at_ -764,7 +766,7 _at__at_ init_secondary(void) if (cpu_logical > 1 && PCPU_GET(apic_id) % cpu_logical != 0) CPU_SET(cpuid, &logical_cpus_mask); - if (bootverbose) + if (lapic_valid && bootverbose) lapic_dump("AP"); if (smp_cpus == mp_ncpus) { diff --git a/sys/amd64/include/apicvar.h b/sys/amd64/include/apicvar.h index e7423a3..c04a238 100644 --- a/sys/amd64/include/apicvar.h +++ b/sys/amd64/include/apicvar.h _at__at_ -169,6 +169,7 _at__at_ inthand_t extern vm_paddr_t lapic_paddr; extern int apic_cpuids[]; +extern bool lapic_valid; u_int apic_alloc_vector(u_int apic_id, u_int irq); u_int apic_alloc_vectors(u_int apic_id, u_int *irqs, u_int count, diff --git a/sys/i386/include/apicvar.h b/sys/i386/include/apicvar.h index df99ebe..ea8a3c3 100644 --- a/sys/i386/include/apicvar.h +++ b/sys/i386/include/apicvar.h _at__at_ -168,6 +168,7 _at__at_ inthand_t extern vm_paddr_t lapic_paddr; extern int apic_cpuids[]; +extern bool lapic_valid; u_int apic_alloc_vector(u_int apic_id, u_int irq); u_int apic_alloc_vectors(u_int apic_id, u_int *irqs, u_int count, diff --git a/sys/i386/xen/xen_machdep.c b/sys/i386/xen/xen_machdep.c index 09c01f1..25b9cfc 100644 --- a/sys/i386/xen/xen_machdep.c +++ b/sys/i386/xen/xen_machdep.c _at__at_ -59,6 +59,7 _at__at_ __FBSDID("$FreeBSD$"); #include <machine/intr_machdep.h> #include <machine/md_var.h> #include <machine/asmacros.h> +#include <machine/apicvar.h> _at__at_ -912,6 +913,7 _at__at_ initvalues(start_info_t *startinfo) #endif xen_start_info = startinfo; HYPERVISOR_start_info = startinfo; + lapic_valid = false; xen_phys_machine = (xen_pfn_t *)startinfo->mfn_list; IdlePTD = (pd_entry_t *)((uint8_t *)startinfo->pt_base + PAGE_SIZE); diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c index 41bd602..fddf1fb 100644 --- a/sys/x86/x86/local_apic.c +++ b/sys/x86/x86/local_apic.c _at__at_ -156,6 +156,7 _at__at_ extern inthand_t IDTVEC(rsvd); volatile lapic_t *lapic; vm_paddr_t lapic_paddr; +bool lapic_valid = true; static u_long lapic_timer_divisor; static struct eventtimer lapic_et; _at__at_ -1367,9 +1368,10 _at__at_ apic_setup_io(void *dummy __unused) if (retval != 0) printf("%s: Failed to setup I/O APICs: returned %d\n", best_enum->apic_name, retval); -#ifdef XEN - return; -#endif + + if (!lapic_valid) + return; + /* * Finish setting up the local APIC on the BSP once we know how to * properly program the LINT pins. diff --git a/sys/x86/xen/pv.c b/sys/x86/xen/pv.c index 22fd6a6..6ea1e2a 100644 --- a/sys/x86/xen/pv.c +++ b/sys/x86/xen/pv.c _at__at_ -53,6 +53,7 _at__at_ __FBSDID("$FreeBSD$"); #include <machine/clock.h> #include <machine/pc/bios.h> #include <machine/smp.h> +#include <machine/apicvar.h> #include <xen/xen-os.h> #include <xen/hypervisor.h> _at__at_ -315,4 +316,6 _at__at_ xen_pv_set_init_ops(void) { /* Init ops for Xen PV */ init_ops = xen_init_ops; + /* Disable lapic */ + lapic_valid = false; } -- 1.7.7.5 (Apple Git-26)Received on Thu Jan 02 2014 - 14:55:31 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:46 UTC