[PATCH 00 of 38] xen: add more Xen dom0 support
- From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
- Date: Thu, 13 Nov 2008 11:09:58 -0800
Hi Ingo,
Here's the chunk of patches to add Xen Dom0 support (it's probably
worth creating a new xen/dom0 topic branch for it).
A dom0 Xen domain is basically the same as a normal domU domain, but
it has extra privileges to directly access hardware. There are two
issues to deal with:
- translating to and from the domain's pseudo-physical addresses and
real machine addresses (for ioremap and setting up DMA)
- routing hardware interrupts into the domain
ioremap is relatively easy to deal with. An earlier patch introduced
the _PAGE_IOMAP pte flag, which we use to distinguish between a
regular pseudo-physical mapping and a real machine mapping.
Everything falls out pretty cleanly. A consequence is that the
various pieces of table-parsing code - DMI, ACPI, MP, etc - work out
of the box.
Similarly, the series adds hooks into swiotlb so that architectures
can allocate the swiotlb memory appropriately; on the x86/xen side,
Xen hooks these allocation functions to make special hypercalls to
guarantee that the allocated memory is contiguous in machine memory.
Interrupts are a very different affair. The descriptions in each
patch describe how it all fits together in detail, but the overview
is:
1. Xen owns the local APICs; the dom0 kernel controls the IO APICs
2. Hardware interrupts are delivered on event channels like everything else
3. To set this up, we intercept at pcibios_enable_irq:
- given a dev+pin, we use ACPI to get a gsi
- hook acpi_register_gsi to call xen_register_gsi, which
- allocates an irq (generally not 1:1 with the gsi)
- asks Xen for a vector and event channel for the irq
- program the IO APIC to deliver the hardware interrupt to the
allocated vector
The upshot is that the device driver gets an irq, and when the
hardware raises an interrupt, it gets delivered on that irq.
We maintain our own irq allocation space, since the hardware-bound
event channel irqs are intermixed with all the other normal Xen event
channel irqs (inter-domain, timers, IPIs, etc). For compatibility the
irqs 0-15 are reserved for legacy device interrupts, but the rest of
the range is dynamically allocated.
Initialization also requires care. The dom0 kernel parses the ACPI
tables as usual, in order to discover the local and IO APICs, and all
the rest of the ACPI-provided data the kernel requires. However,
because the kernel doesn't own the local APICs and can't directly map
the IO APICs, we must be sure to avoid actually touching the hardware
when running under Xen.
TODO: work out how to fit MSI into all this.
So, in summary, this series contains:
- dom0 console support
- dom0 xenbus support
- CPU features and IO access for a privleged domain
- mtrrs
- making ioremap work on machine addresses
- swiotlb allocation hooks
- interrupts
- introduce PV io_apic operations
- add Xen-specific IRQ allocator
- switch to using all-Xen event delivery
- add pirq Xen interrupt type
- table parsing and setup
- intercept driver interrupt registration
All this code will compile away to nothing when CONFIG_XEN_DOM0 is not
enabled. If it is enabled, it will only have an effect if booted as a
dom0 kernel; normal native execution and domU execution should be
unaffected.
Thanks,
J
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
- Follow-Ups:
- [PATCH 26 of 38] xen: forcibly disable PAT support
- From: Jeremy Fitzhardinge
- [PATCH 34 of 38] xen: remove irq bindcount
- From: Jeremy Fitzhardinge
- [PATCH 32 of 38] xen: use our own eventchannel->irq path
- From: Jeremy Fitzhardinge
- [PATCH 35 of 38] xen: implement pirq type event channels
- From: Jeremy Fitzhardinge
- [PATCH 37 of 38] xen: bind pirq to vector and event channel
- From: Jeremy Fitzhardinge
- [PATCH 24 of 38] xen dom0: Add support for the platform_ops hypercall
- From: Jeremy Fitzhardinge
- [PATCH 25 of 38] xen mtrr: Add mtrr_ops support for Xen mtrr
- From: Jeremy Fitzhardinge
- [PATCH 36 of 38] xen: route hardware irqs via Xen
- From: Jeremy Fitzhardinge
- [PATCH 38 of 38] xen: make sure that softirqs get handled at the end of event processing
- From: Jeremy Fitzhardinge
- [PATCH 33 of 38] xen: pack all irq-related info together
- From: Jeremy Fitzhardinge
- [PATCH 30 of 38] xen: implement io_apic_ops
- From: Jeremy Fitzhardinge
- [PATCH 27 of 38] xen/dom0: use _PAGE_IOMAP in ioremap to do machine mappings
- From: Jeremy Fitzhardinge
- [PATCH 28 of 38] paravirt/xen: add pvop for page_is_ram
- From: Jeremy Fitzhardinge
- [PATCH 31 of 38] xen: set irq_chip disable
- From: Jeremy Fitzhardinge
- [PATCH 20 of 38] xen dom0: Make hvc_xen console work for dom0
- From: Jeremy Fitzhardinge
- [PATCH 16 of 38] x86: include linux/init.h in asm/numa_64.h
- From: Jeremy Fitzhardinge
- [PATCH 29 of 38] xen: create dummy ioapic mapping
- From: Jeremy Fitzhardinge
- [PATCH 22 of 38] xen dom0: Set up basic IO permissions for dom0
- From: Jeremy Fitzhardinge
- [PATCH 19 of 38] x86: add arch specific version of the swiotlb virt<->bus<->virt functions
- From: Jeremy Fitzhardinge
- [PATCH 18 of 38] x86: unify pci iommu setup and allow swiotlb to compile for 32 bit
- From: Jeremy Fitzhardinge
- [PATCH 14 of 38] x86: add mp_find_ioapic_pin
- From: Jeremy Fitzhardinge
- [PATCH 23 of 38] xen-dom0: only selectively disable cpu features
- From: Jeremy Fitzhardinge
- [PATCH 13 of 38] x86: unstatic mp_find_ioapic so it can be used elsewhere
- From: Jeremy Fitzhardinge
- [PATCH 21 of 38] xen dom0: Initialize xenbus for dom0
- From: Jeremy Fitzhardinge
- [PATCH 17 of 38] x86: add swiotlb allocation functions
- From: Jeremy Fitzhardinge
- [PATCH 15 of 38] x86: unstatic ioapic entry funcs
- From: Jeremy Fitzhardinge
- [PATCH 12 of 38] xen/dom0: handle acpi lapic parsing in Xen dom0
- From: Jeremy Fitzhardinge
- [PATCH 10 of 38] x86: add handle_irq() to allow interrupt injection
- From: Jeremy Fitzhardinge
- [PATCH 11 of 38] x86: define no-op exit_idle() on 32-bit
- From: Jeremy Fitzhardinge
- [PATCH 07 of 38] x86: add io_apic_ops
- From: Jeremy Fitzhardinge
- [PATCH 09 of 38] x86: make sure we really have an hpet mapping before using it
- From: Jeremy Fitzhardinge
- [PATCH 08 of 38] x86: make apic_* operations inline functions
- From: Jeremy Fitzhardinge
- [PATCH 06 of 38] xen: clean up asm-x86/xen/hypervisor.h
- From: Jeremy Fitzhardinge
- [PATCH 05 of 38] swiotlb: allow architectures to override virt<->bus<->virt conversions
- From: Jeremy Fitzhardinge
- [PATCH 04 of 38] swiotlb: move some definitions to header
- From: Jeremy Fitzhardinge
- [PATCH 03 of 38] swiotlb: allow architectures to override swiotlb pool allocation
- From: Jeremy Fitzhardinge
- [PATCH 02 of 38] x86: remove unused iommu_nr_pages
- From: Jeremy Fitzhardinge
- [PATCH 01 of 38] xen: various whitespace and other formatting cleanups
- From: Jeremy Fitzhardinge
- [PATCH 26 of 38] xen: forcibly disable PAT support
- Prev by Date: Re: [stable] Suspend regression in stable kernel 2.6.27.4 on Mac mini Core Duo
- Next by Date: [PATCH 01 of 38] xen: various whitespace and other formatting cleanups
- Previous by thread: [PATCH] New IDE/block driver for OCTEON SOC Compact Flash interface.
- Next by thread: [PATCH 01 of 38] xen: various whitespace and other formatting cleanups
- Index(es):
Relevant Pages
|