[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH rfcv1 15/23] intel_iommu: process PASID-based Device-TLB invalida
From: |
Zhenzhong Duan |
Subject: |
[PATCH rfcv1 15/23] intel_iommu: process PASID-based Device-TLB invalidation |
Date: |
Mon, 15 Jan 2024 18:37:27 +0800 |
From: Yi Liu <yi.l.liu@intel.com>
This adds an empty handling for PASID-based Device-TLB invalidation.
For now it is enough as it is not necessary to propagate it to host
for passthrough device.
The reason for an empty device tlb invalidation handling is that
iommufd's intel vt-d cache invalidation uapi indicates all caches
related to the mapping. So no need to send device tlb. spec says
an iotlb invalidation should be issued before issuing device tlb
invalidation. This means host should have received a cache invalidation
due to guest iotlb invalidation. Hence no need to send another cache
invalidation due to device tlb invalidation.
Chapter 6.5.2.5:
"Since translation requests-without-PASID from a device may be serviced by
hardware from the IOTLB, software must always request IOTLB invalidation
(iotlb_inv_dsc) before requesting corresponding Device-TLB (dev_tlb_inv_dsc)
invalidation."
Signed-off-by: Yi Liu <yi.l.liu@intel.com>
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
---
hw/i386/intel_iommu_internal.h | 1 +
hw/i386/intel_iommu.c | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h
index ed0d5cd99b..dcf1410fcf 100644
--- a/hw/i386/intel_iommu_internal.h
+++ b/hw/i386/intel_iommu_internal.h
@@ -380,6 +380,7 @@ typedef union VTDInvDesc VTDInvDesc;
#define VTD_INV_DESC_WAIT 0x5 /* Invalidation Wait Descriptor */
#define VTD_INV_DESC_PIOTLB 0x6 /* PASID-IOTLB Invalidate Desc */
#define VTD_INV_DESC_PC 0x7 /* PASID-cache Invalidate Desc */
+#define VTD_INV_DESC_DEV_PIOTLB 0x8 /* PASID-based-DIOTLB inv_desc*/
#define VTD_INV_DESC_NONE 0 /* Not an Invalidate Descriptor */
/* Masks for Invalidation Wait Descriptor*/
diff --git a/hw/i386/intel_iommu.c b/hw/i386/intel_iommu.c
index 2912fc6b88..5e7d445d98 100644
--- a/hw/i386/intel_iommu.c
+++ b/hw/i386/intel_iommu.c
@@ -3950,6 +3950,17 @@ static bool vtd_process_inv_iec_desc(IntelIOMMUState *s,
return true;
}
+static bool vtd_process_device_piotlb_desc(IntelIOMMUState *s,
+ VTDInvDesc *inv_desc)
+{
+ /*
+ * no need to handle it for passthru device, for emulated
+ * devices with device tlb, it may be required, but for now,
+ * return is enough
+ */
+ return true;
+}
+
static bool vtd_process_device_iotlb_desc(IntelIOMMUState *s,
VTDInvDesc *inv_desc)
{
@@ -4066,6 +4077,13 @@ static bool vtd_process_inv_desc(IntelIOMMUState *s)
}
break;
+ case VTD_INV_DESC_DEV_PIOTLB:
+ trace_vtd_inv_desc("device-piotlb", inv_desc.hi, inv_desc.lo);
+ if (!vtd_process_device_piotlb_desc(s, &inv_desc)) {
+ return false;
+ }
+ break;
+
case VTD_INV_DESC_DEVICE:
trace_vtd_inv_desc("device", inv_desc.hi, inv_desc.lo);
if (!vtd_process_device_iotlb_desc(s, &inv_desc)) {
--
2.34.1
- [PATCH rfcv1 05/23] intel_iommu: add a placeholder variable for scalable modern mode, (continued)
- [PATCH rfcv1 05/23] intel_iommu: add a placeholder variable for scalable modern mode, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 06/23] intel_iommu: check and sync host IOMMU cap/ecap in scalable modern mode, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 07/23] intel_iommu: process PASID cache invalidation, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 08/23] intel_iommu: add PASID cache management infrastructure, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 09/23] vfio/iommufd_device: Add ioas_id in IOMMUFDDevice and pass to vIOMMU, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 10/23] intel_iommu: bind/unbind guest page table to host, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 11/23] intel_iommu: ERRATA_772415 workaround, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 12/23] intel_iommu: replay pasid binds after context cache invalidation, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 13/23] intel_iommu: process PASID-based iotlb invalidation, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 14/23] intel_iommu: propagate PASID-based iotlb invalidation to host, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 15/23] intel_iommu: process PASID-based Device-TLB invalidation,
Zhenzhong Duan <=
- [PATCH rfcv1 16/23] intel_iommu: rename slpte in iotlb_entry to pte, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 17/23] intel_iommu: implement firt level translation, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 18/23] intel_iommu: fix the fault reason report, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 21/23] intel_iommu: invalidate piotlb when flush pasid, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 20/23] intel_iommu: piotlb invalidation should notify unmap, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 19/23] intel_iommu: introduce pasid iotlb cache, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 22/23] intel_iommu: refresh pasid bind after pasid cache force reset, Zhenzhong Duan, 2024/01/15
- [PATCH rfcv1 23/23] intel_iommu: modify x-scalable-mode to be string option, Zhenzhong Duan, 2024/01/15