From 31b3c9d723407b395564d1fff3624cc0083ae520 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Tue, 20 Mar 2012 18:53:10 -0400 Subject: xen/x86: Implement x86_apic_ops Or rather just implement one different function as opposed to the native one : the read function. We synthesize the values. Acked-by: Suresh Siddha [v1: Rebased on top of tip/x86/urgent] [v2: Return 0xfd instead of 0xff in the default case] Signed-off-by: Konrad Rzeszutek Wilk --- arch/x86/xen/Makefile | 2 +- arch/x86/xen/apic.c | 17 +++++++++++++++++ arch/x86/xen/enlighten.c | 2 ++ arch/x86/xen/xen-ops.h | 4 ++++ 4 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 arch/x86/xen/apic.c (limited to 'arch/x86/xen') diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile index add2c2d729ce..96ab2c09cb68 100644 --- a/arch/x86/xen/Makefile +++ b/arch/x86/xen/Makefile @@ -20,5 +20,5 @@ obj-$(CONFIG_EVENT_TRACING) += trace.o obj-$(CONFIG_SMP) += smp.o obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o obj-$(CONFIG_XEN_DEBUG_FS) += debugfs.o -obj-$(CONFIG_XEN_DOM0) += vga.o +obj-$(CONFIG_XEN_DOM0) += apic.o vga.o obj-$(CONFIG_SWIOTLB_XEN) += pci-swiotlb-xen.o diff --git a/arch/x86/xen/apic.c b/arch/x86/xen/apic.c new file mode 100644 index 000000000000..73ade38caa32 --- /dev/null +++ b/arch/x86/xen/apic.c @@ -0,0 +1,17 @@ +#include +#include + +unsigned int xen_io_apic_read(unsigned apic, unsigned reg) +{ + if (reg == 0x1) + return 0x00170020; + else if (reg == 0x0) + return apic << 24; + + return 0xfd; +} + +void __init xen_init_apic(void) +{ + x86_io_apic_ops.read = xen_io_apic_read; +} diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index a8f8844b8d32..c2ea9e9f420d 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -1362,6 +1362,8 @@ asmlinkage void __init xen_start_kernel(void) xen_start_info->console.domU.mfn = 0; xen_start_info->console.domU.evtchn = 0; + xen_init_apic(); + /* Make sure ACS will be enabled */ pci_request_acs(); } diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h index b095739ccd4c..45c0c0667bd9 100644 --- a/arch/x86/xen/xen-ops.h +++ b/arch/x86/xen/xen-ops.h @@ -92,11 +92,15 @@ struct dom0_vga_console_info; #ifdef CONFIG_XEN_DOM0 void __init xen_init_vga(const struct dom0_vga_console_info *, size_t size); +void __init xen_init_apic(void); #else static inline void __init xen_init_vga(const struct dom0_vga_console_info *info, size_t size) { } +static inline void __init xen_init_apic(void) +{ +} #endif /* Declare an asm function, along with symbols needed to make it -- cgit v1.2.1 From 27abd14bd9f1117dc7bdeee81a2de0557e077b61 Mon Sep 17 00:00:00 2001 From: Konrad Rzeszutek Wilk Date: Mon, 16 Apr 2012 13:53:40 -0400 Subject: Revert "xen/x86: Workaround 'x86/ioapic: Add register level checks to detect bogus io-apic entries'" This reverts commit 2531d64b6fe2724dc432b67d8dc66bd45621da0b. The two patches: x86/apic: Replace io_apic_ops with x86_io_apic_ops. xen/x86: Implement x86_apic_ops take care of fixing it properly. Signed-off-by: Konrad Rzeszutek Wilk --- arch/x86/xen/mmu.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'arch/x86/xen') diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c index b8e279479a6b..988828b479ed 100644 --- a/arch/x86/xen/mmu.c +++ b/arch/x86/xen/mmu.c @@ -1859,7 +1859,6 @@ pgd_t * __init xen_setup_kernel_pagetable(pgd_t *pgd, #endif /* CONFIG_X86_64 */ static unsigned char dummy_mapping[PAGE_SIZE] __page_aligned_bss; -static unsigned char fake_ioapic_mapping[PAGE_SIZE] __page_aligned_bss; static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot) { @@ -1900,7 +1899,7 @@ static void xen_set_fixmap(unsigned idx, phys_addr_t phys, pgprot_t prot) * We just don't map the IO APIC - all access is via * hypercalls. Keep the address in the pte for reference. */ - pte = pfn_pte(PFN_DOWN(__pa(fake_ioapic_mapping)), PAGE_KERNEL); + pte = pfn_pte(PFN_DOWN(__pa(dummy_mapping)), PAGE_KERNEL); break; #endif @@ -2065,7 +2064,6 @@ void __init xen_init_mmu_ops(void) pv_mmu_ops = xen_mmu_ops; memset(dummy_mapping, 0xff, PAGE_SIZE); - memset(fake_ioapic_mapping, 0xfd, PAGE_SIZE); } /* Protected by xen_reservation_lock. */ -- cgit v1.2.1 From ab6ec39a191243b9968bb9ac7f26cc7ec30c618b Mon Sep 17 00:00:00 2001 From: Lin Ming Date: Tue, 1 May 2012 00:16:27 +0800 Subject: xen/apic: implement io apic read with hypercall Implements xen_io_apic_read with hypercall, so it returns proper IO-APIC information instead of fabricated one. Fallback to return an emulated IO_APIC values if hypercall fails. [v2: fallback to return an emulated IO_APIC values if hypercall fails] Signed-off-by: Lin Ming Signed-off-by: Konrad Rzeszutek Wilk --- arch/x86/xen/apic.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'arch/x86/xen') diff --git a/arch/x86/xen/apic.c b/arch/x86/xen/apic.c index 73ade38caa32..1913bf2d2a9c 100644 --- a/arch/x86/xen/apic.c +++ b/arch/x86/xen/apic.c @@ -1,8 +1,21 @@ #include #include +#include +#include +#include unsigned int xen_io_apic_read(unsigned apic, unsigned reg) { + struct physdev_apic apic_op; + int ret; + + apic_op.apic_physbase = mpc_ioapic_addr(apic); + apic_op.reg = reg; + ret = HYPERVISOR_physdev_op(PHYSDEVOP_apic_read, &apic_op); + if (!ret) + return apic_op.value; + + /* fallback to return an emulated IO_APIC values */ if (reg == 0x1) return 0x00170020; else if (reg == 0x0) -- cgit v1.2.1 From 87e4baacaeba098e217b14e9d2f6af428fe3f657 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Fri, 18 May 2012 09:34:45 +0200 Subject: x86/xen/apic: Add missing #include This file depends on , but the dependency was hidden due to: -> -> -> With the removal of , this exposed the missing Cc: Len Brown Cc: Konrad Rzeszutek Wilk Cc: Jeremy Fitzhardinge Cc: Jarkko Sakkinen Cc: H. Peter Anvin Link: http://lkml.kernel.org/n/tip-7ccybvue6mw6wje3uxzzcglj@git.kernel.org Signed-off-by: Ingo Molnar --- arch/x86/xen/apic.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'arch/x86/xen') diff --git a/arch/x86/xen/apic.c b/arch/x86/xen/apic.c index 1913bf2d2a9c..ec57bd3818a4 100644 --- a/arch/x86/xen/apic.c +++ b/arch/x86/xen/apic.c @@ -1,9 +1,12 @@ #include + #include #include -#include #include +#include +#include + unsigned int xen_io_apic_read(unsigned apic, unsigned reg) { struct physdev_apic apic_op; -- cgit v1.2.1