intel_iommu_accel: Bypass PASID entry addition for just deleted entry
For VTD_INV_DESC_PASIDC_G_PASID_SI typed pc_inv_dsc invalidation, if an pasid entry is just removed, it can never be a new entry to add. So calling vtd_replay_pasid_bind_for_dev() is unnecessary. Introduce a new field accel_pce_deleted in VTDPASIDCacheInfo to mark this case and to do the bypassing. Suggested-by: Yi Liu <yi.l.liu@intel.com> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Yi Liu <yi.l.liu@intel.com> Tested-by: Xudong Hao <xudong.hao@intel.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-Id: <20260527054658.1021096-14-zhenzhong.duan@intel.com>
Zhenzhong Duan committed
May 27, 2026 at 01:46 UTC
6afd98cef5f040754ff20fb512fcf92068d114cf
2 files changed
+14
-3
hw/i386/intel_iommu_accel.c
+13
-3
@@ -280,10 +280,15 @@ static void vtd_accel_fill_pc(VTDHostIOMMUDevice *vtd_hiod, uint32_t pasid,
280
QLIST_INSERT_HEAD(&vtd_hiod->pasid_cache_list, vtd_pce, next);
281
}
282
283
-static void vtd_accel_delete_pc(VTDAccelPASIDCacheEntry *vtd_pce)
283
+static void vtd_accel_delete_pc(VTDAccelPASIDCacheEntry *vtd_pce,
284
+ VTDPASIDCacheInfo *pc_info)
285
{
286
QLIST_REMOVE(vtd_pce, next);
287
g_free(vtd_pce);
288
+
289
+ if (pc_info->type == VTD_INV_DESC_PASIDC_G_PASID_SI) {
290
+ pc_info->accel_pce_deleted = true;
291
+ }
292
}
293
294
static void
@@ -319,7 +324,7 @@ vtd_accel_pasid_cache_invalidate_one(VTDAccelPASIDCacheEntry *vtd_pce,
324
* to be either all-zero or non-present. Either case means existing
325
* pasid cache should be invalidated.
326
*/
322
- vtd_accel_delete_pc(vtd_pce);
327
+ vtd_accel_delete_pc(vtd_pce, pc_info);
328
}
329
}
330
@@ -472,7 +477,12 @@ void vtd_accel_pasid_cache_sync(IntelIOMMUState *s, VTDPASIDCacheInfo *pc_info)
477
* removals before additions to optimize the replay process.
478
*/
479
vtd_accel_pasid_cache_invalidate(vtd_hiod, pc_info);
475
- vtd_accel_replay_pasid_bind_for_dev(vtd_hiod, start, end, pc_info);
480
+
481
+ if (pc_info->accel_pce_deleted) {
482
+ pc_info->accel_pce_deleted = false;
483
+ } else {
484
+ vtd_accel_replay_pasid_bind_for_dev(vtd_hiod, start, end, pc_info);
485
+ }
486
}
487
}
488
hw/i386/intel_iommu_internal.h
+1
@@ -630,6 +630,7 @@ typedef struct VTDPASIDCacheInfo {
630
uint8_t type;
631
uint16_t did;
632
uint32_t pasid;
633
+ bool accel_pce_deleted;
634
} VTDPASIDCacheInfo;
635
636
typedef struct VTDPIOTLBInvInfo {