linux/arch/x86/xen
Konrad Rzeszutek Wilk ec35a69c46 xen: set IO permission early (before early_cpu_init())
This patch is based off "xen dom0: Set up basic IO permissions for dom0."
by Juan Quintela <quintela@redhat.com>.

On AMD machines when we boot the kernel as Domain 0 we get this nasty:

mapping kernel into physical memory
Xen: setup ISA identity maps
about to get started...
(XEN) traps.c:475:d0 Unhandled general protection fault fault/trap [#13] on VCPU 0 [ec=0000]
(XEN) domain_crash_sync called from entry.S
(XEN) Domain 0 (vcpu#0) crashed on cpu#0:
(XEN) ----[ Xen-4.1-101116  x86_64  debug=y  Not tainted ]----
(XEN) CPU:    0
(XEN) RIP:    e033:[<ffffffff8130271b>]
(XEN) RFLAGS: 0000000000000282   EM: 1   CONTEXT: pv guest
(XEN) rax: 000000008000c068   rbx: ffffffff8186c680   rcx: 0000000000000068
(XEN) rdx: 0000000000000cf8   rsi: 000000000000c000   rdi: 0000000000000000
(XEN) rbp: ffffffff81801e98   rsp: ffffffff81801e50   r8:  ffffffff81801eac
(XEN) r9:  ffffffff81801ea8   r10: ffffffff81801eb4   r11: 00000000ffffffff
(XEN) r12: ffffffff8186c694   r13: ffffffff81801f90   r14: ffffffffffffffff
(XEN) r15: 0000000000000000   cr0: 000000008005003b   cr4: 00000000000006f0
(XEN) cr3: 0000000221803000   cr2: 0000000000000000
(XEN) ds: 0000   es: 0000   fs: 0000   gs: 0000   ss: e02b   cs: e033
(XEN) Guest stack trace from rsp=ffffffff81801e50:

RIP points to read_pci_config() function.

The issue is that we don't set IO permissions for the Linux kernel early enough.

The call sequence used to be:

    xen_start_kernel()
	x86_init.oem.arch_setup = xen_setup_arch;
        setup_arch:
           - early_cpu_init
               - early_init_amd
                  - read_pci_config
           - x86_init.oem.arch_setup [ xen_arch_setup ]
               - set IO permissions.

We need to set the IO permissions earlier on, which this patch does.

Acked-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
2010-11-22 12:10:31 -08:00
..
debugfs.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
debugfs.h xen: add debugfs support 2008-08-21 13:52:58 +02:00
enlighten.c xen: set IO permission early (before early_cpu_init()) 2010-11-22 12:10:31 -08:00
grant-table.c xen: make grant table arch portable 2008-04-24 23:57:32 +02:00
irq.c x86: Move irq_init to x86_init_ops 2009-08-31 09:35:45 +02:00
Kconfig Merge branch 'stable/xen-pcifront-0.8.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen 2010-10-28 17:11:17 -07:00
Makefile Merge branch 'stable/xen-swiotlb-0.8.6' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen 2010-08-12 09:09:41 -07:00
mmu.c xen: implement XENMEM_machphys_mapping 2010-11-12 15:00:06 -08:00
mmu.h xen: make install_p2mtop_page() static 2010-10-22 12:57:23 -07:00
multicalls.c x86, xen: do multicall callbacks with interrupts disabled 2009-02-16 08:56:41 +01:00
multicalls.h Merge commit 'v2.6.29-rc4' into core/percpu 2009-02-09 14:58:11 +01:00
pci-swiotlb-xen.c Merge branch 'stable/xen-pcifront-0.8.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen 2010-10-28 17:11:17 -07:00
platform-pci-unplug.c xen: pvhvm: rename xen_emul_unplug=ignore to =unnnecessary 2010-08-23 11:59:29 +01:00
setup.c xen: set IO permission early (before early_cpu_init()) 2010-11-22 12:10:31 -08:00
smp.c Merge branch 'stable/xen-pcifront-0.8.2' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen 2010-10-28 17:11:17 -07:00
spinlock.c Fix IRQ flag handling naming 2010-10-07 14:08:55 +01:00
suspend.c x86: Use xen_vcpuop_clockevent, xen_clocksource and xen wallclock. 2010-07-26 23:13:25 -07:00
time.c xen: do not initialize PV timers on HVM if !xen_have_vector_callback 2010-10-05 13:39:23 +01:00
vdso.h i386: move xen 2007-10-11 11:16:51 +02:00
xen-asm_32.S percpu: remove per_cpu__ prefix. 2009-10-29 22:34:15 +09:00
xen-asm_64.S xen: use iret for return from 64b kernel to 32b usermode 2009-12-03 11:14:54 -08:00
xen-asm.h xen: make direct versions of irq_enable/disable/save/restore to common code 2009-02-04 16:59:04 -08:00
xen-asm.S x86: style cleanups for xen assemblies 2009-02-05 20:25:41 +01:00
xen-head.S x86: use _types.h headers in asm where available 2009-02-13 11:35:01 -08:00
xen-ops.h xen: add support for PAT 2010-10-22 12:57:31 -07:00