[PATCH 2/2] drm/i915/gvt: Update PDPs after a vGPU mm object is pinned.

Zhenyu Wang zhenyuw at linux.intel.com
Thu Feb 8 03:27:17 UTC 2018


On 2018.02.07 18:12:15 +0800, Zhi Wang wrote:
> The PDPs of a shadow page will only be valid after a vGPU mm is pinned.
> So the PDPs in the shadow context should be updated then.
> 
> Signed-off-by: Zhi Wang <zhi.a.wang at intel.com>
> ---

hmm, looks like a good catch, any known bug related to this one?
And need to cc stable too?

Reviewed-by: Zhenyu Wang <zhenyuw at linux.intel.com>

>  drivers/gpu/drm/i915/gvt/scheduler.c | 28 +++++++++++++++++++++++++---
>  1 file changed, 25 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c b/drivers/gpu/drm/i915/gvt/scheduler.c
> index 9a64bd0..eae96ae 100644
> --- a/drivers/gpu/drm/i915/gvt/scheduler.c
> +++ b/drivers/gpu/drm/i915/gvt/scheduler.c
> @@ -52,6 +52,29 @@ static void set_context_pdp_root_pointer(
>  		pdp_pair[i].val = pdp[7 - i];
>  }
>  
> +static void update_shadow_pdps(struct intel_vgpu_workload *workload)
> +{
> +	struct intel_vgpu *vgpu = workload->vgpu;
> +	int ring_id = workload->ring_id;
> +	struct i915_gem_context *shadow_ctx = vgpu->submission.shadow_ctx;
> +	struct drm_i915_gem_object *ctx_obj =
> +		shadow_ctx->engine[ring_id].state->obj;
> +	struct execlist_ring_context *shadow_ring_context;
> +	struct page *page;
> +
> +	if (WARN_ON(!workload->shadow_mm))
> +		return;
> +
> +	if (WARN_ON(!atomic_read(&workload->shadow_mm->pincount)))
> +		return;
> +
> +	page = i915_gem_object_get_page(ctx_obj, LRC_STATE_PN);
> +	shadow_ring_context = kmap(page);
> +	set_context_pdp_root_pointer(shadow_ring_context,
> +			(void *)workload->shadow_mm->ppgtt_mm.shadow_pdps);
> +	kunmap(page);
> +}
> +
>  static int populate_shadow_context(struct intel_vgpu_workload *workload)
>  {
>  	struct intel_vgpu *vgpu = workload->vgpu;
> @@ -112,9 +135,6 @@ static int populate_shadow_context(struct intel_vgpu_workload *workload)
>  	}
>  #undef COPY_REG
>  
> -	set_context_pdp_root_pointer(shadow_ring_context,
> -				     (void *)workload->shadow_mm->ppgtt_mm.shadow_pdps);
> -
>  	intel_gvt_hypervisor_read_gpa(vgpu,
>  			workload->ring_context_gpa +
>  			sizeof(*shadow_ring_context),
> @@ -504,6 +524,8 @@ static int prepare_workload(struct intel_vgpu_workload *workload)
>  		return ret;
>  	}
>  
> +	update_shadow_pdps(workload);
> +
>  	ret = intel_vgpu_sync_oos_pages(workload->vgpu);
>  	if (ret) {
>  		gvt_vgpu_err("fail to vgpu sync oos pages\n");
> -- 
> 2.7.4
> 
> _______________________________________________
> intel-gvt-dev mailing list
> intel-gvt-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gvt-dev

-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20180208/3e1a5f57/attachment.sig>


More information about the intel-gvt-dev mailing list