Request for Comment Patch : Xen PCI Frontend Driver

From Konrad Wilk on xen-devel:

This patch set contains the groundwork and the driver itself for
Xen Paravirtualized (PV) domains to use PCI pass-through devices.
These patches utilize the Xen-SWIOTLB library
(http://lkml.org/lkml/2010/7/27/246) and I don't expect them to
get in the 2.6.36 merge window.
Some of these groundwork patches had been posted in the past, and
gotten some review (and some Acks). Since then work has been done to
expand them, fix bugs, squish them, etc, so that they are feature complete.
I was not sure if I should carry the Ack/Reviewed-by flags, so I've just
reset them to Cc.
Also some of the authors of these patches have moved on, and their e-mails
are bouncing. Any thoughts of what to do about that? I've squished some of
my patches in their work as I want to have the least amount of patches, and
I am de facto the maintainer at this point.
First of Xen PCI frontend driver can be used by PV guests on hardware
that with or without hardware IOMMU. Without an hardware IOMMU you have a
potential security hole wherein a guest domain can use the hardware to map
pages outside its memory range and slurp pages up. As such, this is more
restricted to a Privileged PV domain, aka - device driver domain
(similar to Qubes but a poor-man mechanism [1]).
I am not sure how many folks are actually interested in the internal workings
of the Xen PCI frontend, so I've skipped on that and concentrated on the
other patches (X86 related) which would be more interesting to folks I think.
The first four expose functionality for module drivers to be able to
enumerate and also have the appropriate flag set on PCI devices (_PAGE_IOMAP):
 [PATCH 04/20] x86/io_apic: add get_nr_irqs_gsi()
 [PATCH 12/20] x86/PCI: Clean up pci_cache_line_size
 [PATCH 13/20] x86/PCI: make sure _PAGE_IOMAP it set on pci mappings
 [PATCH 14/20] x86/PCI: Export pci_walk_bus function.
The MSI/MSI-X ones are a mechanism for the MSI/MSI-X framework 'arch_*'
to call into a function pointer structure and call from there the
appropriate sub-platform MSI implementation. On bare-metal this
is still the old code, except that first part of the name has changed
from 'arch' to 'native':
 [PATCH 15/20] x86: Copy-n-paste arch_teardown_msi_irqs from msi.c to io_apic.c.
 [PATCH 16/20] x86: Introduce x86_msi_ops
And lastly, the Xen PCI stub driver. I've put it in the same location
where other sub-platform PCI drivers are (say, OLPC). It hooks up to the
PCI legacy IRQ setup ('pcibios_enable_irq'), and MSI/MSI-X
allocation/de-allocation (via the x86_msi_ops).
 [PATCH 17/20] xen/x86/PCI: Add support for the Xen PCI subsystem
The Xen PCI driver by itself is responsible for hooking up to the PCI
configuration read/write methods via the 'pci_scan_bus_parented' call.
In essence all pci_conf_read/write would be tunneled via
pcifront_bus_[read|write] methods:
 [PATCH 20/20] xen-pcifront: Xen PCI frontend driver.
The rest of the patches are related to the Xen framework and
tweaking it to properly work. Those patches have/are in Jeremy's
tree too since 2.6.31, but it made more sense to have them
logically separated in this patch-set since they are utilized by this
driver.
And here is the full list of patches and the diffstat:
Alex Nixon (3):
      xen: Don't disable the I/O space
      x86/PCI: Clean up pci_cache_line_size
      xen/x86/PCI: Add support for the Xen PCI subsystem
Gerd Hoffmann (2):
      xen: implement pirq type event channels
      xen: set pirq name to something useful.
Jeremy Fitzhardinge (5):
      xen: define BIOVEC_PHYS_MERGEABLE()
      x86/io_apic: add get_nr_irqs_gsi()
      xen: identity map gsi->irqs
      xen: statically initialize cpu_evtchn_mask_p
      x86/PCI: make sure _PAGE_IOMAP it set on pci mappings
Konrad Rzeszutek Wilk (5):
      xen: dynamically allocate irq & event structures
      xen: Find an unbound irq number in reverse order (high to low).
      xen: Provide a variant of xen_poll_irq with timeout.
      x86/PCI: Export pci_walk_bus function.
      x86: Copy-n-paste arch_teardown_msi_irqs from msi.c to io_apic.c.
Noboru Iwamatsu (1):
      xenbus: prevent warnings on unhandled enumeration values
Ryan Wilson (1):
      xen-pcifront: Xen PCI frontend driver.
Stefano Stabellini (1):
      x86: Introduce x86_msi_ops
Weidong Han (1):
      xen: fix shared irq device passthrough
Yosuke Iwamatsu (1):
      xenbus: Xen paravirtualised PCI hotplug support.
P.S.
[1]. In case you prefer to look at git tree:
git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen.git
devel/xen-pcifront-0.5
To get it working, you would need to checkout first:
git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb-2.6.git
devel/linux-next
and then merge the above mentioned branch in it.
[2]: http://qubes-os.org/ which utilizes hardware IOMMU to run separate domains
wherein
each has specific access to hardware.

Read more

Welcome Honda to the Xen Project Board
12/09/2024

We're excited to announce our newest Advisory Board Member Honda, to Xen Project. Since its foundation, Honda has been committed to "creating a society that is useful to people" by utilizing its technologies and ideas. Honda also focuses on environmental responsiveness and traffic safety, and continue

Say hello to our new website
12/05/2024

Hello Xen Community, You may have noticed something different... We've refreshed our existing website! Why did we do this? Well, all these new changes are part of an ongoing effort to increase our visibility and make it easier to find information on pages. We know how important it

Xen Project Announces Performance and Security Advancements with Release of 4.19
08/05/2024

New release marks significant enhancements in performance, security, and versatility across various architectures.  SAN FRANCISCO – July 31st, 2024 – The Xen Project, an open source project under the Linux Foundation, is proud to announce the release of Xen Project 4.19. This release marks a significant milestone in enhancing performance, security,

Upcoming Closure of Xen Project Colo Facility
07/10/2024

Dear Xen Community, We regret to inform you that the Xen Project is currently experiencing unexpected changes due to the sudden shutdown of our colocated (colo) data center facility by Synoptek. This incident is beyond our control and will impact the continuity of OSSTest (the gating Xen Project CI loop)