[RFC v3.1 05/22] hw/pci: add pci_device_setup_iommu

2020-02-22 Thread Liu Yi L
HostIOMMUContext was introduced to provide an explicit way for vIOMMU emulators call into pass-through components (e.g. VFIO). vIOMMU needs to get the HostIOMMUContext before using it. This patch adds a new callback in PCIDevice, which would be set by pass-through components, and be used by vIOMMU

[RFC v3.1 17/22] intel_iommu: do not pass down pasid bind for PASID #0

2020-02-22 Thread Liu Yi L
RID_PASID field was introduced in VT-d 3.0 spec, it is used for DMA requests w/o PASID in scalable mode VT-d. It is also known as IOVA. And in VT-d 3.1 spec, there is definition on it: "Implementations not supporting RID_PASID capability (ECAP_REG.RPS is 0b), use a PASID value of 0 to perform

[RFC v3.1 16/22] intel_iommu: replay pasid binds after context cache invalidation

2020-02-22 Thread Liu Yi L
This patch replays guest pasid bindings after context cache invalidation. This is a behavior to ensure safety. Actually, programmer should issue pasid cache invalidation with proper granularity after issuing a context cache invalidation. Cc: Kevin Tian Cc: Jacob Pan Cc: Peter Xu Cc: Yi Sun

[RFC v3.1 03/22] vfio: check VFIO_TYPE1_NESTING_IOMMU support

2020-02-22 Thread Liu Yi L
VFIO needs to check VFIO_TYPE1_NESTING_IOMMU support with Kernel before further using it. e.g. requires to check IOMMU UAPI version. Cc: Kevin Tian Cc: Jacob Pan Cc: Peter Xu Cc: Eric Auger Cc: Yi Sun Cc: David Gibson Cc: Alex Williamson Signed-off-by: Liu Yi L Signed-off-by: Yi Sun ---

[RFC v3.1 08/22] vfio/common: add pasid_alloc/free support

2020-02-22 Thread Liu Yi L
This patch adds VFIO pasid alloc/free support to allow host intercept in PASID allocation for VM by adding VFIO implementation of HostIOMMUOps. pasid_alloc/free callbacks. Cc: Kevin Tian Cc: Jacob Pan Cc: Peter Xu Cc: Eric Auger Cc: Yi Sun Cc: David Gibson Cc: Alex Williamson

[RFC v3.1 01/22] scripts/update-linux-headers: Import iommu.h

2020-02-22 Thread Liu Yi L
From: Eric Auger Update the script to import the new iommu.h uapi header. Cc: Kevin Tian Cc: Jacob Pan Cc: Peter Xu Cc: Yi Sun Cc: Michael S. Tsirkin Cc: Cornelia Huck Cc: Paolo Bonzini Acked-by: Cornelia Huck Signed-off-by: Eric Auger --- scripts/update-linux-headers.sh | 2 +- 1

[RFC v3.1 09/22] hw/pci: add pci_device_host_iommu_context()

2020-02-22 Thread Liu Yi L
This patch adds pci_device_host_iommu_context() to expose HostIOMMUContext to vIOMMU emulators via pci layer. Cc: Kevin Tian Cc: Jacob Pan Cc: Peter Xu Cc: Eric Auger Cc: Yi Sun Cc: David Gibson Cc: Michael S. Tsirkin Signed-off-by: Liu Yi L --- hw/pci/pci.c | 8

<    1   2