[PATCH] drm/i915/gvt: update RING_START reg of vGPU when the context is submitted to i915
Zhenyu Wang
zhenyuw at linux.intel.com
Wed Sep 4 03:51:40 UTC 2019
On 2019.09.02 13:57:59 +0800, Weinan Li wrote:
> The guest may use this register to identify the running state of one
> context. Emulate it as the value in context image as if the context runs
> on the GPU hardware.
>
> Signed-off-by: Weinan Li <weinan.z.li at intel.com>
I was thinking if this could be when we shadow guest context, but even
from point of view on native hw run, those mmio regs may still be updated
until really dispatched. So this seems ok to me for now, unless there's
some regs would be checked by guest immediately after submission, which looks
not the case.
Reviewed-by: Zhenyu Wang <zhenyuw at linux.intel.com>
> ---
> drivers/gpu/drm/i915/gvt/scheduler.c | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c b/drivers/gpu/drm/i915/gvt/scheduler.c
> index 166b998b09b3..6c79d16b381e 100644
> --- a/drivers/gpu/drm/i915/gvt/scheduler.c
> +++ b/drivers/gpu/drm/i915/gvt/scheduler.c
> @@ -568,6 +568,16 @@ static int prepare_shadow_wa_ctx(struct intel_shadow_wa_ctx *wa_ctx)
> return 0;
> }
>
> +static void update_vreg_in_ctx(struct intel_vgpu_workload *workload)
> +{
> + struct intel_vgpu *vgpu = workload->vgpu;
> + struct drm_i915_private *dev_priv = vgpu->gvt->dev_priv;
> + u32 ring_base;
> +
> + ring_base = dev_priv->engine[workload->ring_id]->mmio_base;
> + vgpu_vreg_t(vgpu, RING_START(ring_base)) = workload->rb_start;
> +}
> +
> static void release_shadow_batch_buffer(struct intel_vgpu_workload *workload)
> {
> struct intel_vgpu *vgpu = workload->vgpu;
> @@ -1016,6 +1026,13 @@ static int workload_thread(void *priv)
> if (need_force_wake)
> intel_uncore_forcewake_get(&gvt->dev_priv->uncore,
> FORCEWAKE_ALL);
> + /*
> + * Update the vReg of the vGPU which submitted this
> + * workload. The vGPU may use these registers for checking
> + * the context state. The value comes from GPU commands
> + * in this workload.
> + */
> + update_vreg_in_ctx(workload);
>
> ret = dispatch_workload(workload);
>
> --
> 2.17.1
>
> _______________________________________________
> 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/20190904/ad8dde7d/attachment.sig>
More information about the intel-gvt-dev
mailing list