[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v4 00/28] add vIOMMU support with irq remapping function of virtual VT-d



This patchset is to introduce vIOMMU framework and add virtual VTD's
interrupt remapping support according "Xen virtual IOMMU high level
design doc V3"(https://lists.xenproject.org/archives/html/xen-devel/
2016-11/msg01391.html).

- vIOMMU framework
New framework provides viommu_ops and help functions to abstract
vIOMMU operations(E,G create, destroy, handle irq remapping request
and so on). Vendors(Intel, ARM, AMD and son) can implement their
vIOMMU callbacks.

- Virtual VTD
We enable irq remapping function and covers both
MSI and IOAPIC interrupts. Don't support post interrupt mode emulation
and post interrupt mode enabled on host with virtual VTD. will add
later.

In case of conflicts, this series also can be found in my personal github:
Xen: https://github.com/gc1008/viommu_xen.git vIOMMU4
Qemu: https://github.com/gc1008/viommu_qemu.git vIOMMU3

Any comments would be highly appreciated. And below is change history.

Changes since v3:
 - add logic to build DMAR table for PVH guest. But only very limited tests are
 performed on PVH guest.
 - use one interface to binding guest remappable and non-remappable interrupts
 with physical interrupts. To achieve this, current binding interface should
 be changed. The advantage is that it can simplify the code to support the
 new format guest interrupt. But the disadvantage is clearly incompatible with
 old QEMU.
 - VT-d posted interrupt feature can be used to deliver guest remappable
 interrupt. The guest interrupt attributes (vector, affinity) are decoded from
 guest IRTE and then accordingly written to host IRTE. In this version, when
 guest invalidates an IRTE, the host IRTE will be updated according to the
 new guest IRTE.
 - add draining in-flight interrupt support. When guest invalidates
 an IRTE, the in-flight interrupt related to the IRTE should be drained.
 This version provides a very simple solution: process QI only when no
 interrupt is delivering which definitely implies there is no in-flight
 interrupt.
 - use locks in QI and fault handling sub-feature. These locks guarantee
 the registers/status won't be changed by guest when vvtd is dealing with
 faults or invalidation requests.
 - move viommu structure under hvm domain rather than making it a field of
 struct domain.
 - remove unneeded domctl interface for destroying viommu. Currently, dynamic
 destruction aren't needed.
 - reorder the patches per Roger's suggestion: the viommu abstract goes first,
 then the implementation of emulated VT-d, several hooks of
 configuring/delivering guest interrupt and EOI, and related changes of
 toolstack.
 - fix many coding style issues pointed out by Roger.

Change since v2:
       1) Remove vIOMMU hypercall of query capabilities and introduce when 
necessary.
       2) Remove length field of vIOMMU create parameter of vIOMMU hypercall
       3) Introduce irq remapping mode callback to vIOMMU framework and vIOMMU 
device models
can check irq remapping mode by vendor specific ways.
       4) Update vIOMMU docs.
       5) Other changes please see patches' change logs.

Change since v1:
       1) Fix coding style issues
       2) Add definitions for vIOMMU type and capabilities
       3) Change vIOMMU kconfig and select vIOMMU default on x86
       4) Put vIOMMU creation in libxl__arch_domain_create()
       5) Make vIOMMU structure of tool stack more general for both PV and HVM.

Change since RFC v2:
       1) Move vvtd.c to drivers/passthrough/vtd directroy. 
       2) Make vIOMMU always built in on x86
       3) Add new boot cmd "viommu" to enable viommu function
       4) Fix some code stype issues.

Change since RFC v1:
       1) Add Xen virtual IOMMU doc docs/misc/viommu.txt
       2) Move vIOMMU hypercall of create/destroy vIOMMU and query  
capabilities from dmop to domctl suggested by Paul Durrant. Because
these hypercalls can be done in tool stack and more VM mode(E,G PVH
or other modes don't use Qemu) can be benefit.
       3) Add check of input MMIO address and length.
       4) Add iommu_type in vIOMMU hypercall parameter to specify
vendor vIOMMU device model(E,G Intel VTD, AMD or ARM IOMMU. So far
only support Intel VTD).
       5) Add save and restore support for vvtd

Chao Gao (23):
  vtd: clean-up and preparation for vvtd
  x86/hvm: Introduce a emulated VTD for HVM
  x86/vvtd: Add MMIO handler for VVTD
  x86/vvtd: Set Interrupt Remapping Table Pointer through GCMD
  x86/vvtd: Enable Interrupt Remapping through GCMD
  x86/vvtd: Process interrupt remapping request
  x86/vvtd: decode interrupt attribute from IRTE
  x86/vvtd: add a helper function to decide the interrupt format
  x86/vvtd: Handle interrupt translation faults
  x86/vvtd: Enable Queued Invalidation through GCMD
  x86/vvtd: Add queued invalidation (QI) support
  x86/vvtd: save and restore emulated VT-d
  x86/vioapic: Hook interrupt delivery of vIOAPIC
  x86/vioapic: extend vioapic_get_vector() to support remapping format
    RTE
  xen/pt: when binding guest msi, accept the whole msi message
  vvtd: update hvm_gmsi_info when binding guest msi with pirq or
  x86/vmsi: Hook delivering remapping format msi to guest and handling
    eoi
  tools/libacpi: Add DMA remapping reporting (DMAR) ACPI table
    structures
  tools/libacpi: Add new fields in acpi_config for DMAR table
  tools/libxl: Add an user configurable parameter to control vIOMMU
    attributes
  tools/libxl: build DMAR table for a guest with one virtual VTD
  tools/libxl: create vIOMMU during domain construction
  tools/libxc: Add viommu operations in libxc

Lan Tianyu (5):
  Xen/doc: Add Xen virtual IOMMU doc
  VIOMMU: Add vIOMMU framework and vIOMMU domctl
  VIOMMU: Add irq request callback to deal with irq remapping
  VIOMMU: Add get irq info callback to convert irq remapping request
  VIOMMU: Introduce callback of checking irq remapping mode

 docs/man/xl.cfg.pod.5.in               |   27 +
 docs/misc/viommu.txt                   |  120 +++
 docs/misc/xen-command-line.markdown    |    7 +
 tools/firmware/hvmloader/ovmf.c        |    2 +-
 tools/libacpi/acpi2_0.h                |   61 ++
 tools/libacpi/build.c                  |   61 ++
 tools/libacpi/libacpi.h                |   10 +
 tools/libxc/Makefile                   |    1 +
 tools/libxc/include/xenctrl.h          |   10 +-
 tools/libxc/xc_domain.c                |   14 +-
 tools/libxc/xc_viommu.c                |   51 ++
 tools/libxl/libxl_arch.h               |    1 +
 tools/libxl/libxl_create.c             |   47 ++
 tools/libxl/libxl_types.idl            |   12 +
 tools/libxl/libxl_x86.c                |   21 +-
 tools/libxl/libxl_x86_acpi.c           |   98 ++-
 tools/xl/xl_parse.c                    |   50 +-
 xen/arch/x86/Kconfig                   |    1 +
 xen/arch/x86/hvm/hvm.c                 |    5 +-
 xen/arch/x86/hvm/irq.c                 |    6 +
 xen/arch/x86/hvm/vioapic.c             |   23 +-
 xen/arch/x86/hvm/vmsi.c                |   33 +-
 xen/arch/x86/xen.lds.S                 |    3 +
 xen/common/Kconfig                     |    3 +
 xen/common/Makefile                    |    1 +
 xen/common/domctl.c                    |    7 +
 xen/common/viommu.c                    |  171 +++++
 xen/drivers/passthrough/io.c           |  144 ++--
 xen/drivers/passthrough/vtd/Makefile   |    7 +-
 xen/drivers/passthrough/vtd/iommu.h    |  197 +++--
 xen/drivers/passthrough/vtd/vvtd.c     | 1301 ++++++++++++++++++++++++++++++++
 xen/include/asm-x86/hvm/domain.h       |    3 +
 xen/include/asm-x86/hvm/hvm.h          |    2 +
 xen/include/asm-x86/hvm/irq.h          |    6 +-
 xen/include/asm-x86/viommu.h           |   82 ++
 xen/include/public/arch-x86/hvm/save.h |   18 +-
 xen/include/public/domctl.h            |   39 +-
 xen/include/xen/viommu.h               |   85 +++
 38 files changed, 2603 insertions(+), 127 deletions(-)
 create mode 100644 docs/misc/viommu.txt
 create mode 100644 tools/libxc/xc_viommu.c
 create mode 100644 xen/common/viommu.c
 create mode 100644 xen/drivers/passthrough/vtd/vvtd.c
 create mode 100644 xen/include/asm-x86/viommu.h
 create mode 100644 xen/include/xen/viommu.h

-- 
1.8.3.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.