@@ -1745,6 +1745,11 @@ void intel_vgpu_unpin_mm(struct intel_vgpu_mm *mm)
return;
atomic_dec(&mm->pincount);
+
+ if (mm->need_rebuild) {
+ invalidate_mm(mm);
+ mm->need_rebuild = false;
+ }
}
/**
@@ -1798,6 +1803,24 @@ static int reclaim_one_mm(struct intel_gvt *gvt)
return 0;
}
+static void retire_vgpu_ppgtt_mm(struct intel_vgpu *vgpu)
+{
+ struct intel_vgpu_mm *mm;
+ struct list_head *pos;
+
+ list_for_each(pos, &vgpu->gtt.mm_list_head) {
+ mm = container_of(pos, struct intel_vgpu_mm, list);
+
+ if (mm->type != INTEL_GVT_MM_PPGTT)
+ continue;
+ if (atomic_read(&mm->pincount)) {
+ mm->need_rebuild = true;
+ continue;
+ }
+ invalidate_mm(mm);
+ }
+}
+
/*
* GMA translation APIs.
*/
@@ -147,6 +147,7 @@ struct intel_vgpu_mm {
int type;
bool initialized;
bool shadowed;
+ bool need_rebuild;
int page_table_entry_type;
u32 page_table_entry_size;
Introduce a new function to retiring all shadow PPGTTs of a vGPU. The shadow PPPGTs of a vGPU need to be invalidated if a guest modifies the virtual private PPAT since the mapping between the virtual PPAT indexes and the shadow PPAT indexes will be re-built after a guest writes a new virtual PPAT configruation. Signed-off-by: Zhi Wang <zhi.a.wang@intel.com> --- drivers/gpu/drm/i915/gvt/gtt.c | 23 +++++++++++++++++++++++ drivers/gpu/drm/i915/gvt/gtt.h | 1 + 2 files changed, 24 insertions(+)