From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH v9 00/11] vpci: PCI config space emulation
Date: Wed, 14 Mar 2018 14:03:57 +0000 [thread overview]
Message-ID: <20180314140408.40947-1-roger.pau@citrix.com> (raw)
Hello,
The following series contain an implementation of handlers for the PCI
configuration space inside of Xen. This allows Xen to detect accesses
to the PCI configuration space and react accordingly.
Why is this needed? IMHO, there are two main points of doing all this
emulation inside of Xen, the first one is to prevent adding a bunch of
duplicated Xen PV specific code to each OS we want to support in PVH
mode. This just promotes Xen code duplication amongst OSes, which
leads to a higher maintainership burden.
The second reason would be that this code (or it's functionality to be
more precise) already exists in QEMU (and pciback to a degree), and
it's code that we already support and maintain. By moving it into the
hypervisor itself every guest type can make use of it, and should be
shared between them all. I know that the code in this series is not
yet suitable for DomU HVM guests in it's current state, but it should
be in due time.
As usual, each patch contains a changeset summary between versions,
I'm not going to copy the list of changes here.
The branch containing the patches can be found at:
git://xenbits.xen.org/people/royger/xen.git vpci_v9
Note that this is only safe to use for the hardware domain (that's
trusted), any non-trusted domain will need a lot more handlers before it
can freely access the PCI configuration space.
Roger Pau Monne (11):
vpci: introduce basic handlers to trap accesses to the PCI config
space
x86/mmcfg: add handlers for the PVH Dom0 MMCFG areas
x86/physdev: enable PHYSDEVOP_pci_mmcfg_reserved for PVH Dom0
pci: split code to size BARs from pci_add_device
pci: add support to size ROM BARs to pci_size_mem_bar
xen: introduce rangeset_consume_ranges
vpci/bars: add handlers to map the BARs
x86/pt: mask MSI vectors on unbind
vpci/msi: add MSI handlers
vpci: add a priority parameter to the vPCI register initializer
vpci/msix: add MSI-X handlers
.gitignore | 3 +
tools/libxl/libxl_x86.c | 2 +-
tools/tests/Makefile | 1 +
tools/tests/vpci/Makefile | 37 +++
tools/tests/vpci/emul.h | 134 +++++++++
tools/tests/vpci/main.c | 309 +++++++++++++++++++++
xen/arch/arm/xen.lds.S | 14 +
xen/arch/x86/Kconfig | 1 +
xen/arch/x86/domain.c | 6 +-
xen/arch/x86/hvm/dom0_build.c | 23 +-
xen/arch/x86/hvm/hvm.c | 7 +
xen/arch/x86/hvm/hypercall.c | 5 +
xen/arch/x86/hvm/io.c | 293 ++++++++++++++++++++
xen/arch/x86/hvm/ioreq.c | 4 +
xen/arch/x86/hvm/vmsi.c | 231 ++++++++++++++++
xen/arch/x86/msi.c | 3 +
xen/arch/x86/physdev.c | 11 +
xen/arch/x86/setup.c | 3 +-
xen/arch/x86/x86_64/mmconfig.h | 4 -
xen/arch/x86/xen.lds.S | 14 +
xen/common/rangeset.c | 28 ++
xen/drivers/Kconfig | 2 +
xen/drivers/Makefile | 1 +
xen/drivers/passthrough/io.c | 15 +
xen/drivers/passthrough/pci.c | 107 +++++---
xen/drivers/vpci/Kconfig | 4 +
xen/drivers/vpci/Makefile | 1 +
xen/drivers/vpci/header.c | 563 ++++++++++++++++++++++++++++++++++++++
xen/drivers/vpci/msi.c | 335 +++++++++++++++++++++++
xen/drivers/vpci/msix.c | 458 +++++++++++++++++++++++++++++++
xen/drivers/vpci/vpci.c | 483 ++++++++++++++++++++++++++++++++
xen/include/asm-x86/domain.h | 1 +
xen/include/asm-x86/hvm/domain.h | 7 +
xen/include/asm-x86/hvm/io.h | 20 ++
xen/include/asm-x86/msi.h | 3 +
xen/include/asm-x86/pci.h | 6 +
xen/include/public/arch-x86/xen.h | 5 +-
xen/include/xen/irq.h | 1 +
xen/include/xen/pci.h | 9 +
xen/include/xen/pci_regs.h | 8 +
xen/include/xen/rangeset.h | 10 +
xen/include/xen/sched.h | 4 +
xen/include/xen/vpci.h | 226 +++++++++++++++
43 files changed, 3356 insertions(+), 46 deletions(-)
create mode 100644 tools/tests/vpci/Makefile
create mode 100644 tools/tests/vpci/emul.h
create mode 100644 tools/tests/vpci/main.c
create mode 100644 xen/drivers/vpci/Kconfig
create mode 100644 xen/drivers/vpci/Makefile
create mode 100644 xen/drivers/vpci/header.c
create mode 100644 xen/drivers/vpci/msi.c
create mode 100644 xen/drivers/vpci/msix.c
create mode 100644 xen/drivers/vpci/vpci.c
create mode 100644 xen/include/xen/vpci.h
--
2.16.2
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel
next reply other threads:[~2018-03-14 14:13 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-14 14:03 Roger Pau Monne [this message]
2018-03-14 14:03 ` [PATCH v9 01/11] vpci: introduce basic handlers to trap accesses to the PCI config space Roger Pau Monne
2018-03-14 14:31 ` Jan Beulich
2018-03-15 9:50 ` Roger Pau Monné
2018-03-15 10:23 ` Jan Beulich
2018-03-15 15:21 ` Doug Goldstein
2018-03-14 14:03 ` [PATCH v9 02/11] x86/mmcfg: add handlers for the PVH Dom0 MMCFG areas Roger Pau Monne
2018-03-14 14:04 ` [PATCH v9 03/11] x86/physdev: enable PHYSDEVOP_pci_mmcfg_reserved for PVH Dom0 Roger Pau Monne
2018-03-14 14:04 ` [PATCH v9 04/11] pci: split code to size BARs from pci_add_device Roger Pau Monne
2018-03-14 14:04 ` [PATCH v9 05/11] pci: add support to size ROM BARs to pci_size_mem_bar Roger Pau Monne
2018-03-14 14:04 ` [PATCH v9 06/11] xen: introduce rangeset_consume_ranges Roger Pau Monne
2018-03-14 14:04 ` [PATCH v9 07/11] vpci/bars: add handlers to map the BARs Roger Pau Monne
2018-03-14 16:13 ` Jan Beulich
2018-03-15 11:33 ` Roger Pau Monné
2018-03-15 12:41 ` Jan Beulich
2018-03-15 13:59 ` Roger Pau Monné
2018-03-15 14:31 ` Jan Beulich
2018-03-14 14:04 ` [PATCH v9 08/11] x86/pt: mask MSI vectors on unbind Roger Pau Monne
2018-03-14 14:04 ` [PATCH v9 09/11] vpci/msi: add MSI handlers Roger Pau Monne
2018-03-14 16:51 ` Jan Beulich
2018-03-15 11:48 ` Roger Pau Monné
2018-03-15 12:44 ` Jan Beulich
2018-03-15 15:54 ` Roger Pau Monné
2018-03-15 16:19 ` Jan Beulich
2018-03-14 14:04 ` [PATCH v9 10/11] vpci: add a priority parameter to the vPCI register initializer Roger Pau Monne
2018-03-14 14:04 ` [PATCH v9 11/11] vpci/msix: add MSI-X handlers Roger Pau Monne
2018-03-14 17:04 ` Jan Beulich
2018-03-15 12:01 ` Roger Pau Monné
2018-03-15 12:45 ` Jan Beulich
2018-03-15 16:33 ` Roger Pau Monné
2018-03-16 7:36 ` Jan Beulich
2018-03-16 11:03 ` Roger Pau Monné
2018-03-16 11:42 ` Jan Beulich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180314140408.40947-1-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).