[PATCH v5 0/5] vPCI capabilities filtering

Stewart Hildebrand posted 5 patches 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20230901045742.235975-1-stewart.hildebrand@amd.com
There is a newer version of this series
xen/arch/x86/msi.c                         | 62 +++++---------
xen/drivers/char/ehci-dbgp.c               |  3 +-
xen/drivers/passthrough/amd/iommu_detect.c |  2 +-
xen/drivers/passthrough/ats.c              |  4 +-
xen/drivers/passthrough/ats.h              |  6 +-
xen/drivers/passthrough/msi.c              |  6 +-
xen/drivers/passthrough/pci.c              | 21 ++---
xen/drivers/passthrough/vtd/quirks.c       | 10 +--
xen/drivers/passthrough/vtd/x86/ats.c      |  3 +-
xen/drivers/pci/pci.c                      | 52 +++++++-----
xen/drivers/vpci/header.c                  | 94 ++++++++++++++++++++++
xen/drivers/vpci/msi.c                     |  4 +-
xen/drivers/vpci/msix.c                    |  4 +-
xen/drivers/vpci/vpci.c                    | 58 +++++++++++--
xen/include/xen/pci.h                      | 14 ++--
xen/include/xen/pci_regs.h                 | 10 +++
xen/include/xen/vpci.h                     | 15 ++++
17 files changed, 255 insertions(+), 113 deletions(-)
[PATCH v5 0/5] vPCI capabilities filtering
Posted by Stewart Hildebrand 8 months ago
This small series enables vPCI to filter which PCI capabilities we expose to a
domU. This series adds vPCI register handlers within
xen/drivers/vpci/header.c:init_bars(), along with some supporting functions.

Note there are minor rebase conflicts with the in-progress vPCI series [1].
These conflicts fall into the category of functions and code being added
adjacent to one another, so are easily resolved. I did not identify any
dependency on the vPCI locking work, and the two series deal with different
aspects of emulating the PCI header.

Future work may involve adding handlers for more registers in the vPCI header,
such as VID/DID, etc. Future work may also involve exposing additional
capabilities to the guest for broader device/driver support.

v4->v5:
* drop ("x86/msi: remove some unused-but-set-variables") as it has been
  committed
* add ("xen/pci: update PCI_STATUS_* constants")
* squash ro_mask patch

v3->v4:
* drop "xen/pci: address a violation of MISRA C:2012 Rule 8.3" as it has been
  committed
* re-order status register handler and capabilities filtering patches
* split an unrelated change from ("xen/pci: convert pci_find_*cap* to pci_sbdf_t")
  into its own patch
* add new patch ("x86/msi: rearrange read_pci_mem_bar slightly") based on
  feedback
* add new RFC patch ("xen/vpci: support ro mask")

v2->v3:
* drop RFC "xen/vpci: header: avoid cast for value passed to vpci_read_val"
* minor misra C violation fixup in preparatory patch
* switch to pci_sbdf_t in preparatory patch
* introduce status handler

v1->v2:
* squash helper functions into the patch where they are used to avoid transient
  dead code situation
* add new RFC patch, possibly throwaway, to get an idea of what it would look
  like to get rid of the (void *)(uintptr_t) cast by introducing a new memory
  allocation

[1] https://lists.xenproject.org/archives/html/xen-devel/2023-07/msg01281.html

Stewart Hildebrand (5):
  xen/pci: convert pci_find_*cap* to pci_sbdf_t
  x86/msi: rearrange read_pci_mem_bar slightly
  xen/pci: update PCI_STATUS_* constants
  xen/vpci: header: status register handler
  xen/vpci: header: filter PCI capabilities

 xen/arch/x86/msi.c                         | 62 +++++---------
 xen/drivers/char/ehci-dbgp.c               |  3 +-
 xen/drivers/passthrough/amd/iommu_detect.c |  2 +-
 xen/drivers/passthrough/ats.c              |  4 +-
 xen/drivers/passthrough/ats.h              |  6 +-
 xen/drivers/passthrough/msi.c              |  6 +-
 xen/drivers/passthrough/pci.c              | 21 ++---
 xen/drivers/passthrough/vtd/quirks.c       | 10 +--
 xen/drivers/passthrough/vtd/x86/ats.c      |  3 +-
 xen/drivers/pci/pci.c                      | 52 +++++++-----
 xen/drivers/vpci/header.c                  | 94 ++++++++++++++++++++++
 xen/drivers/vpci/msi.c                     |  4 +-
 xen/drivers/vpci/msix.c                    |  4 +-
 xen/drivers/vpci/vpci.c                    | 58 +++++++++++--
 xen/include/xen/pci.h                      | 14 ++--
 xen/include/xen/pci_regs.h                 | 10 +++
 xen/include/xen/vpci.h                     | 15 ++++
 17 files changed, 255 insertions(+), 113 deletions(-)


base-commit: 6621932264e3e86df3913db4249ecd3eb100b13f
-- 
2.42.0