[PATCH] drm/i915/gvt: set shadow entry to scratch page when guest driver only update partial of the GGTT entry
Zhenyu Wang
zhenyuw at linux.intel.com
Wed Mar 22 02:59:56 UTC 2017
On 2017.03.21 17:59:28 +0800, Xiaoguang Chen wrote:
> Sometimes guest driver only update partial of GGTT entry then
> access it. In this situation the gfn we got from the GGTT table
> is invalid and can not be translate to a valid mfn.
> p2m translation should happen only when the whole parts of a
> GGTT entry got updated.
>
> Setting the shadow entry pointing to a scratch page instead if only
> partial of GGTT entry updated.
>
> Signed-off-by: Zhi Wang <zhi.a.wang at intel.com>
> SIgned-off-by: Xiaoguang Chen <xiaoguang.chen at intel.com
^^^^
ok, I might need to update with this new one, but pls use 'git commit -s'
for proper signed-off, use '-v N' to send with patch version, use '--in-reply-to'
with good threading.
> drivers/gpu/drm/i915/gvt/gtt.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
> index da73127..119cd30 100644
> --- a/drivers/gpu/drm/i915/gvt/gtt.c
> +++ b/drivers/gpu/drm/i915/gvt/gtt.c
> @@ -1837,11 +1837,21 @@ static int emulate_gtt_mmio_write(struct intel_vgpu *vgpu, unsigned int off,
> ret = gtt_entry_p2m(vgpu, &e, &m);
> if (ret) {
> gvt_vgpu_err("fail to translate guest gtt entry\n");
> - return ret;
> + /* guest driver may read/write the entry when only
> + * partial of the guest entry got updated.
> + * In this situation the gfn we got from GGTT table is
> + * invalid and can not be translated to a valid mfn.
> + * p2m translation should happen only after the whole
> + * parts of a GGTT entry got updated.
> + *
> + * Setting the shadow entry pointing to a scratch page
> + * instead while GGTT entry only got partial update.
> + */
> + ops->set_pfn(&m, gvt->gtt.scratch_ggtt_mfn);
> }
> } else {
> m = e;
> - m.val64 = 0;
> + ops->set_pfn(&m, gvt->gtt.scratch_ggtt_mfn);
> }
>
> ggtt_set_shadow_entry(ggtt_mm, &m, g_gtt_index);
> --
> 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: 163 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/intel-gvt-dev/attachments/20170322/368bf7d4/attachment.sig>
More information about the intel-gvt-dev
mailing list