Skip to content

intel_iommu: support scalable mode

Yi Sun qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 10 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3intel_iommu: scalable mode emulationhw/i386/intel_iommu.c hw/i386/intel_iommu_internal.h hw/i386/trace-events +1 more+464 -971 reply
2/3intel_iommu: add 256 bits qi_desc supporthw/i386/intel_iommu.c hw/i386/intel_iommu_internal.h include/hw/i386/intel_iommu.h+38 -120 replies
3/3intel_iommu: add scalable-mode option to make scalable mode workhw/i386/intel_iommu.c hw/i386/intel_iommu_internal.h include/hw/i386/intel_iommu.h+31 -11 reply

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchPeter Xu
1/3R-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [Qemu-devel] [PATCH v1 0/3] intel_iommu: support scalable mode

Intel vt-d rev3.0 [1] introduces a new translation mode called 'scalable mode', which enables PASID-granular translations for first level, second level, nested and pass-through modes. The vt-d scalable mode is the key ingredient to enable Scalable I/O Virtualization (Scalable IOV) [2] [3], which allows sharing a device in minimal possible granularity (ADI - Assignable Device Interface). As a result, previous Extended Context (ECS) mode is deprecated (no production ever implements ECS).

This patch set emulates a minimal capability set of VT-d scalable mode, equivalent to what is available in VT-d legacy mode today:
1. Scalable mode root entry, context entry and PASID table
2. Seconds level translation under scalable mode
3. Queued invalidation (with 256 bits descriptor)
4. Pass-through mode

Corresponding intel-iommu driver support will be included in kernel 5.0:

    https://www.spinics.net/lists/kernel/msg2985279.html

We will add emulation of full scalable mode capability along with guest iommu driver progress later, e.g.:
1. First level translation
2. Nested translation
3. Per-PASID invalidation descriptors
4. Page request services for handling recoverable faults

To verify the patches, below cases were tested according to Peter Xu's suggestions.

    +---------+----------------------------------------------------------------+----------------------------------------------------------------+
    |         |                      w/ Device Passthr                         |                     w/o Device Passthr                         |
    |         +-------------------------------+--------------------------------+-------------------------------+--------------------------------+
    |         | virtio-net-pci, vhost=on      | virtio-net-pci, vhost=off      | virtio-net-pci, vhost=on      | virtio-net-pci, vhost=off      |
    |         +-------------------------------+--------------------------------+-------------------------------+--------------------------------+
    |         | netperf | kernel bld | data cp| netperf | kernel bld | data cp | netperf | kernel bld | data cp| netperf | kernel bld | data cp |
    +---------+-------------------------------+--------------------------------+-------------------------------+--------------------------------+
    | Legacy  | Pass    | Pass       | Pass   | Pass    | Pass       | Pass    | Pass    | Pass       | Pass   | Pass    | Pass       | Pass    |
    +---------+-------------------------------+--------------------------------+-------------------------------+--------------------------------+
    | Scalable| Pass    | Pass       | Pass   | Pass    | Pass       | Pass    | Pass    | Pass       | Pass   | Pass    | Pass       | Pass    |
    +---------+-------------------------------+--------------------------------+-------------------------------+--------------------------------+

References:
[1] https://software.intel.com/en-us/download/intel-virtualization-technology-for-directed-io-architecture-specification
[2] https://software.intel.com/en-us/download/intel-scalable-io-virtualization-technical-specification
[3] https://schd.ws/hosted_files/lc32018/00/LC3-SIOV-final.pdf

---
RFC v2->v1

Patch 1:
- revert unnecessary rename in 'vtd_ce_present".
- use 'ce_size' to judge if it is scalable mode in 'vtd_get_context_entry_from_root'.
- remove some 'inline' declarations.
- remove unnecessary scalable mode check in 'vtd_ce_type_check' and make corresponding changes in 'vtd_dev_to_context_entry'.
- add 'VTD_FR_PASID_TABLE_INV' case in 'vtd_qualified_faults[]'.
- create a macro function to handle a repeated pattern about 'is_fpd_set'.
- explicitly print 'legacy mode' when calling 'trace_vtd_replay_ce_valid'.
Patch 2:
- do "(val & VTD_IQT_QT_256_RSV_BIT)" to be clear.
Patch 3:
- move 's->dma_drain' check from 'vtd_init' to 'vtd_decide_config'.
---

Liu, Yi L (2):
intel_iommu: scalable mode emulation
intel_iommu: add 256 bits qi_desc support

Yi Sun (1):
intel_iommu: add scalable-mode option to make scalable mode work

 hw/i386/intel_iommu.c          | 559 +++++++++++++++++++++++++++++++++--------
 hw/i386/intel_iommu_internal.h |  54 +++-
 hw/i386/trace-events           |   2 +-
 include/hw/i386/intel_iommu.h  |  28 ++-
 4 files changed, 533 insertions(+), 110 deletions(-)
Signature · 1 line
1.9.1