From 6d8454e26ebc4318855402b660f59055ee6033a8 Mon Sep 17 00:00:00 2001 From: Juan Quintela Date: Mon, 26 Nov 2007 08:53:42 +0100 Subject: [PATCH] xen dom0: Set up basic IO permissions for dom0. Add the direct mapping area for ISA bus access, and enable IO space access for the guest when running as dom0. Signed-off-by: Jeremy Fitzhardinge Signed-off-by: Juan Quintela --- arch/x86/mm/ioremap_32.c | 3 --- arch/x86/xen/enlighten.c | 21 +++++++++++++++++++++ arch/x86/xen/setup.c | 3 ++- include/asm-x86/io_32.h | 4 ++++ 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/arch/x86/mm/ioremap_32.c b/arch/x86/mm/ioremap_32.c index 0b27831..63a301a 100644 --- a/arch/x86/mm/ioremap_32.c +++ b/arch/x86/mm/ioremap_32.c @@ -18,9 +18,6 @@ #include #include -#define ISA_START_ADDRESS 0xa0000 -#define ISA_END_ADDRESS 0x100000 - /* * Generic mapping function (not visible outside): */ diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index aaae640..e6c4fba 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -45,6 +45,7 @@ #include #include #include +#include #include "xen-ops.h" #include "mmu.h" @@ -860,6 +861,20 @@ static __init void xen_pagetable_setup_done(pgd_t *base) pin_pagetable_pfn(level, PFN_DOWN(__pa(base))); } + + /* + * If we're dom0, then 1:1 map the ISA machine addresses into + * the kernel's address space. + */ + if (is_initial_xendomain()) { + unsigned i; + + for(i = ISA_START_ADDRESS; i < ISA_END_ADDRESS; i += PAGE_SIZE) + set_pte_mfn(PAGE_OFFSET + i, PFN_DOWN(i), PAGE_KERNEL); + + reserve_bootmem(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS); + printk(KERN_INFO "Xen: setup ISA identity maps\n"); + } } /* This is called once we have the cpu_possible_map */ @@ -1211,6 +1226,12 @@ asmlinkage void __init xen_start_kernel(void) if (xen_feature(XENFEAT_supervisor_mode_kernel)) pv_info.kernel_rpl = 0; + if (is_initial_xendomain()) { + struct physdev_set_iopl set_iopl; + set_iopl.iopl = 1; + HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl); + } + /* set the limit of our address space */ xen_reserve_top(); diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c index f84e772..3c84287 100644 --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -105,7 +105,8 @@ void __init xen_arch_setup(void) xen_fill_possible_map(); #endif - paravirt_disable_iospace(); + if (!is_initial_xendomain()) + paravirt_disable_iospace(); fiddle_vdso(); } diff --git a/include/asm-x86/io_32.h b/include/asm-x86/io_32.h index fe881cd..e2b916e 100644 --- a/include/asm-x86/io_32.h +++ b/include/asm-x86/io_32.h @@ -139,6 +139,10 @@ extern void __iomem *fix_ioremap(unsigned idx, unsigned long phys); #define dmi_iounmap bt_iounmap #define dmi_alloc alloc_bootmem + +#define ISA_START_ADDRESS 0xa0000 +#define ISA_END_ADDRESS 0x100000 + /* * ISA I/O bus memory addresses are 1:1 with the physical address. */ -- 1.5.3.4