linux/x86: Disable all accesses to the IO-APIC pages
PATCH 2/2 linux/x86: Disable all accesses to the IO-APIC pages
Similar to the local APIC changes, the IO-APIC access mechanisms should also be restricted to the Xen-specific ones (other than for the local APIC, where the access mechanisms must be entirely suppressed). A nice side effect of this is that the fixmap area shrinks quite a bit, allowing 32-bits to use a little more low memory.
Signed-off-by Jan Beulich <[email protected]>
Subject: Disallow all accesses to the IO-APIC pages
arch/i386/kernel/io_apic-xen.c +0 -29
@@ -45,9 +45,6 @@#ifdef CONFIG_XEN -#include <xen/interface/xen.h> -#include <xen/interface/physdev.h> -/* Fake i8259 */ #define make_8259A_irq (_irq) (io_apic_irqs &= ~(1UL<<(_irq)))#define disable_8259A_irq (_irq) ((void)0)
@@ -55,32 +52,6 @@unsigned long io_apic_irqs; -static inline unsigned int xen_io_apic_read (unsigned int apic,unsigned int reg) -{ -struct physdev_apic apic_op; -int ret; - - apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr; - apic_op.reg = reg; - ret =HYPERVISOR_physdev_op (PHYSDEVOP_apic_read, &apic_op); -if (ret) -return ret; -return apic_op.value; -} - -static inline void xen_io_apic_write (unsigned int apic,unsigned int reg,unsigned int value) -{ -struct physdev_apic apic_op; - - apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr; - apic_op.reg = reg; - apic_op.value = value; -HYPERVISOR_physdev_op (PHYSDEVOP_apic_write, &apic_op); -} - -#define io_apic_read (a,r) xen_io_apic_read(a,r) -#define io_apic_write (a,r,v) xen_io_apic_write(a,r,v) -#endif /* CONFIG_XEN */ int (*ioapic_renumber_irq)(int ioapic,int irq);
arch/x86_64/kernel/io_apic-xen.c +0 -29
@@ -92,9 +92,6 @@ int vector_irq[NR_VECTORS] __read_mostly#ifdef CONFIG_XEN -#include <xen/interface/xen.h> -#include <xen/interface/physdev.h> -/* Fake i8259 */ #define make_8259A_irq (_irq) (io_apic_irqs &= ~(1UL<<(_irq)))#define disable_8259A_irq (_irq) ((void)0)
@@ -102,32 +99,6 @@ int vector_irq[NR_VECTORS] __read_mostlyunsigned long io_apic_irqs; -static inline unsigned int xen_io_apic_read (unsigned int apic,unsigned int reg) -{ -struct physdev_apic apic_op; -int ret; - - apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr; - apic_op.reg = reg; - ret =HYPERVISOR_physdev_op (PHYSDEVOP_apic_read, &apic_op); -if (ret) -return ret; -return apic_op.value; -} - -static inline void xen_io_apic_write (unsigned int apic,unsigned int reg,unsigned int value) -{ -struct physdev_apic apic_op; - - apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr; - apic_op.reg = reg; - apic_op.value = value; -HYPERVISOR_physdev_op (PHYSDEVOP_apic_write, &apic_op); -} - -#define io_apic_read (a,r) xen_io_apic_read(a,r) -#define io_apic_write (a,r,v) xen_io_apic_write(a,r,v) -#define clear_IO_APIC () ((void)0)#else
include/asm-i386/io_apic.h +30 -0
@@ -53,9 +53,14 @@ static inline void end_edge_ioapic_irq (#define end_edge_ioapic end_edge_ioapic_irq#endif +#ifndef CONFIG_XEN #define IO_APIC_BASE (idx) \ ((volatile int *)(__fix_to_virt(FIX_IO_APIC_BASE_0 + idx) \ + (mp_ioapics[idx].mpc_apicaddr & ~PAGE_MASK))) +#else +#include <xen/interface/xen.h> +#include <xen/interface/physdev.h> +#endif /* * The structure of the IO-APIC:
@@ -162,14 +167,35 @@ extern int mpc_default_type;static inline unsigned int io_apic_read (unsigned int apic,unsigned int reg) { +#ifndef CONFIG_XEN *IO_APIC_BASE (apic) = reg;return *(IO_APIC_BASE (apic)+4 ); +#else +struct physdev_apic apic_op; +int ret; + + apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr; + apic_op.reg = reg; + ret =HYPERVISOR_physdev_op (PHYSDEVOP_apic_read, &apic_op); +if (ret) +return ret; +return apic_op.value; +#endif }static inline void io_apic_write (unsigned int apic,unsigned int reg,unsigned int value) { +#ifndef CONFIG_XEN *IO_APIC_BASE (apic) = reg; *(IO_APIC_BASE (apic)+4 ) = value; +#else +struct physdev_apic apic_op; + + apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr; + apic_op.reg = reg; + apic_op.value = value; +HYPERVISOR_physdev_op (PHYSDEVOP_apic_write, &apic_op); +#endif }/*
@@ -179,12 +205,16 @@ static inline void io_apic_write(unsigne* Older SiS APIC requires we rewrite the index regiser */ extern int sis_apic_bug; +#ifndef CONFIG_XEN static inline void io_apic_modify (unsigned int apic,unsigned int reg,unsigned int value) {if (sis_apic_bug) *IO_APIC_BASE (apic) = reg; *(IO_APIC_BASE (apic)+4 ) = value; } +#else +#define io_apic_modify io_apic_write +#endif /* 1 if "noapic" boot option passed */ extern int skip_ioapic_setup;
include/asm-i386/mach-xen/asm/fixmap.h +3 -1
@@ -53,13 +53,15 @@ extern unsigned long __FIXADDR_TOP;*/ enum fixed_addresses {FIX_HOLE , -#if defined(CONFIG_X86_LOCAL_APIC ) && !defined(CONFIG_XEN ) +#ifndef CONFIG_XEN +#ifdef CONFIG_X86_LOCAL_APIC FIX_APIC_BASE ,/* local (CPU) APIC) -- required for SMP or not */ #endif #ifdef CONFIG_X86_IO_APIC FIX_IO_APIC_BASE_0 ,FIX_IO_APIC_BASE_END =FIX_IO_APIC_BASE_0 +MAX_IO_APICS -1 ,#endif +#endif #ifdef CONFIG_X86_VISWS_APICFIX_CO_CPU ,/* Cobalt timer */ FIX_CO_APIC ,/* Cobalt APIC Redirection Table */
include/asm-x86_64/io_apic.h +32 -0
@@ -55,9 +55,14 @@ static inline void end_edge_ioapic_irq (#define APIC_MISMATCH_DEBUG +#ifndef CONFIG_XEN #define IO_APIC_BASE (idx) \ ((volatile int *)(__fix_to_virt(FIX_IO_APIC_BASE_0 + idx) \ + (mp_ioapics[idx].mpc_apicaddr & ~PAGE_MASK))) +#else +#include <xen/interface/xen.h> +#include <xen/interface/physdev.h> +#endif /* * The structure of the IO-APIC:
@@ -164,16 +169,39 @@ extern int mpc_default_type;static inline unsigned int io_apic_read (unsigned int apic,unsigned int reg) { +#ifndef CONFIG_XEN *IO_APIC_BASE (apic) = reg;return *(IO_APIC_BASE (apic)+4 ); +#else +struct physdev_apic apic_op; +int ret; + + apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr; + apic_op.reg = reg; + ret =HYPERVISOR_physdev_op (PHYSDEVOP_apic_read, &apic_op); +if (ret) +return ret; +return apic_op.value; +#endif }static inline void io_apic_write (unsigned int apic,unsigned int reg,unsigned int value) { +#ifndef CONFIG_XEN *IO_APIC_BASE (apic) = reg; *(IO_APIC_BASE (apic)+4 ) = value; +#else +struct physdev_apic apic_op; + + apic_op.apic_physbase = mp_ioapics[apic].mpc_apicaddr; + apic_op.reg = reg; + apic_op.value = value; +HYPERVISOR_physdev_op (PHYSDEVOP_apic_write, &apic_op); +#endif } +#ifndef CONFIG_XEN +/* * Re-write a value: to be used for read-modify-write * cycles where the read already set up the index register.
@@ -192,6 +220,10 @@ static inline void io_apic_sync(unsigned (void) *(IO_APIC_BASE(apic)+4); } +#else +#define io_apic_modify io_apic_write +#endif +/* 1 if "noapic" boot option passed */ extern int skip_ioapic_setup;
include/asm-x86_64/mach-xen/asm/fixmap.h +3 -1
@@ -40,13 +40,15 @@ enum fixed_addresses {VSYSCALL_FIRST_PAGE =VSYSCALL_LAST_PAGE + ((VSYSCALL_END -VSYSCALL_START ) >>PAGE_SHIFT ) -1 ,VSYSCALL_HPET ,FIX_HPET_BASE , -#if defined(CONFIG_X86_LOCAL_APIC ) && !defined(CONFIG_XEN ) +#ifndef CONFIG_XEN +#ifdef CONFIG_X86_LOCAL_APIC FIX_APIC_BASE, /* local (CPU) APIC) -- required for SMP or not */#endif #ifdef CONFIG_X86_IO_APIC FIX_IO_APIC_BASE_0, FIX_IO_APIC_BASE_END = FIX_IO_APIC_BASE_0 + MAX_IO_APICS-1,#endif +#endif #ifdef CONFIG_ACPI FIX_ACPI_BEGIN , FIX_ACPI_END = FIX_ACPI_BEGIN + FIX_ACPI_PAGES - 1,
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel