[RFC PATCH v1 0/4] PCI devices passthrough on Arm

Rahul Singh posted 4 patches 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/xen tags/patchew/cover.1595511416.git.rahul.singh@arm.com
Maintainers: Stefano Stabellini <sstabellini@kernel.org>, Julien Grall <julien@xen.org>, Anthony PERARD <anthony.perard@citrix.com>, Ian Jackson <ian.jackson@eu.citrix.com>, Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>, Wei Liu <wl@xen.org>
tools/libxl/libxl_arm.c             | 200 ++++++++++++++++++++++++++++
tools/libxl/libxl_types.idl         |   6 +
tools/xl/xl_parse.c                 |   7 +
xen/arch/arm/Kconfig                |   7 +
xen/arch/arm/Makefile               |   2 +
xen/arch/arm/domain.c               |   4 +
xen/arch/arm/pci/Makefile           |   4 +
xen/arch/arm/pci/pci-access.c       | 101 ++++++++++++++
xen/arch/arm/pci/pci-host-common.c  | 198 +++++++++++++++++++++++++++
xen/arch/arm/pci/pci-host-generic.c | 131 ++++++++++++++++++
xen/arch/arm/pci/pci.c              | 112 ++++++++++++++++
xen/arch/arm/physdev.c              |  42 +++++-
xen/arch/arm/setup.c                |   2 +
xen/arch/arm/vpci.c                 | 102 ++++++++++++++
xen/arch/arm/vpci.h                 |  37 +++++
xen/drivers/passthrough/pci.c       |   7 +
xen/include/asm-arm/device.h        |   7 +-
xen/include/asm-arm/domain.h        |   5 +
xen/include/asm-arm/pci.h           |  97 +++++++++++++-
xen/include/public/arch-arm.h       |  32 +++++
20 files changed, 1094 insertions(+), 9 deletions(-)
create mode 100644 xen/arch/arm/pci/Makefile
create mode 100644 xen/arch/arm/pci/pci-access.c
create mode 100644 xen/arch/arm/pci/pci-host-common.c
create mode 100644 xen/arch/arm/pci/pci-host-generic.c
create mode 100644 xen/arch/arm/pci/pci.c
create mode 100644 xen/arch/arm/vpci.c
create mode 100644 xen/arch/arm/vpci.h

[RFC PATCH v1 0/4] PCI devices passthrough on Arm

Posted by Rahul Singh 2 weeks ago
Following up on the discussion on PCI devices passthrough support on Arm
design proposal.Please feel free to give you feedback.

We are submitting the code that we developed to get the early feedback. PCI
passthrough support on ARM is not fully implemented in this patch series for
that reason we are not enabling the HAS_PCI and HAS_VPCI flags for ARM.

We will work on design document that we submitted for feedback on mailing
list and we will submit the next design document to address all the comments.

This patch series is based on v1 of the design document that we submitted for
review. Any comments in the design will be addressed in the later version of
the design document and will subsequently implemented in the code in next
patch series. 

PCI passthrough support is divided into different patches:

Discovering PCI Host Bridge in XEN:
- PCI host bridge discovery in XEN and map the PCI ECAM configuration
space to the XEN memory.

Discovering PCI devices:
- In order to support the PCI passthrough, XEN should be aware of the PCI 
devices.
- Hardware domain is in charge of doing the PCI enumeration and will discover
the PCI devices and then communicate to the XEN via hyper call to add the
PCI devices in XEN.

Enable the existing x86 virtual PCI support for ARM:
- Add VPCI trap handler for each of the PCI device added for config space
access.
- Register the trap handler in XEN for each of the host bridge PCI ECAM config
space access.

Emulated PCI device tree node in libxl:
- Create a virtual PCI device tree node in libxl to enable the guest OS to
discover the virtual PCI during guest boot.

This patch series does not implemented the following features. Following
features will be implemented in the next version of the patch series.
- MSI support for interrupt.
- ACPI support for PCI host bridge discovery within XEN on ARM.
- SMMU modification to support PCI devices.
- Use already defined config option "pci=[]" in place of new "vpci=ecam" config
option to create VPCI bus.
- Map the assigned device PCI BAR values and interrupt to the guest when device
is assigned by xl during domain creation.Currently we are using "iomem=[]"
config options to map the value to the guest.

Rahul Singh (4):
  arm/pci: PCI setup and PCI host bridge discovery within XEN on ARM.
  xen/arm: Discovering PCI devices and add the PCI devices in XEN.
  xen/arm: Enable the existing x86 virtual PCI support for ARM.
  arm/libxl: Emulated PCI device tree node in libxl

 tools/libxl/libxl_arm.c             | 200 ++++++++++++++++++++++++++++
 tools/libxl/libxl_types.idl         |   6 +
 tools/xl/xl_parse.c                 |   7 +
 xen/arch/arm/Kconfig                |   7 +
 xen/arch/arm/Makefile               |   2 +
 xen/arch/arm/domain.c               |   4 +
 xen/arch/arm/pci/Makefile           |   4 +
 xen/arch/arm/pci/pci-access.c       | 101 ++++++++++++++
 xen/arch/arm/pci/pci-host-common.c  | 198 +++++++++++++++++++++++++++
 xen/arch/arm/pci/pci-host-generic.c | 131 ++++++++++++++++++
 xen/arch/arm/pci/pci.c              | 112 ++++++++++++++++
 xen/arch/arm/physdev.c              |  42 +++++-
 xen/arch/arm/setup.c                |   2 +
 xen/arch/arm/vpci.c                 | 102 ++++++++++++++
 xen/arch/arm/vpci.h                 |  37 +++++
 xen/drivers/passthrough/pci.c       |   7 +
 xen/include/asm-arm/device.h        |   7 +-
 xen/include/asm-arm/domain.h        |   5 +
 xen/include/asm-arm/pci.h           |  97 +++++++++++++-
 xen/include/public/arch-arm.h       |  32 +++++
 20 files changed, 1094 insertions(+), 9 deletions(-)
 create mode 100644 xen/arch/arm/pci/Makefile
 create mode 100644 xen/arch/arm/pci/pci-access.c
 create mode 100644 xen/arch/arm/pci/pci-host-common.c
 create mode 100644 xen/arch/arm/pci/pci-host-generic.c
 create mode 100644 xen/arch/arm/pci/pci.c
 create mode 100644 xen/arch/arm/vpci.c
 create mode 100644 xen/arch/arm/vpci.h

-- 
2.17.1