[PATCH] drm/i915/gvt: cancel dma map only for not present ggtt entry
Zhang, Xiaolin
xiaolin.zhang at intel.com
Wed May 15 06:20:18 UTC 2019
On 05/15/2019 02:08 PM, Zhenyu Wang wrote:
> On 2019.05.15 14:05:59 +0800, Xiaolin Zhang wrote:
>> only cancel ggtt entry dma map for invalid ggtt entry, don't do it
>> for paritial update or old ggtt entry.
>>
>> this change can address DMA "fault reason 23" issue for win guest with
>> intel iommu on.
>>
>> Signed-off-by: Xiaolin Zhang <xiaolin.zhang at intel.com>
>> ---
>> drivers/gpu/drm/i915/gvt/gtt.c | 17 +++++++----------
>> 1 file changed, 7 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c
>> index c2f7d20f6346..6d021d830f37 100644
>> --- a/drivers/gpu/drm/i915/gvt/gtt.c
>> +++ b/drivers/gpu/drm/i915/gvt/gtt.c
>> @@ -2243,7 +2243,12 @@ static int emulate_ggtt_mmio_write(struct intel_vgpu *vgpu, unsigned int off,
>> }
>> }
>>
>> - if (!partial_update && (ops->test_present(&e))) {
>> + if (!ops->test_present(&e)) {
>> + ggtt_get_host_entry(ggtt_mm, &m, g_gtt_index);
>> + ggtt_invalidate_pte(vgpu, &m);
>> + ops->set_pfn(&m, gvt->gtt.scratch_mfn);
>> + ops->clear_present(&m);
>> + } else if (!partial_update && (ops->test_present(&e))) {
>> gfn = ops->get_pfn(&e);
>> m = e;
> I think this makes condition check a bit cumbersome, as the special case
> you need to handle is for partial_update instead of test_present.
I agree with to remove this additional test_present check in "else if"
and I will remove it and then do more test.
>>
>> @@ -2266,19 +2271,11 @@ static int emulate_ggtt_mmio_write(struct intel_vgpu *vgpu, unsigned int off,
>> ops->set_pfn(&m, gvt->gtt.scratch_mfn);
>> } else
>> ops->set_pfn(&m, dma_addr >> PAGE_SHIFT);
>> - } else {
>> - ops->set_pfn(&m, gvt->gtt.scratch_mfn);
>> - ops->clear_present(&m);
>> }
>> -
>> out:
>> - ggtt_set_guest_entry(ggtt_mm, &e, g_gtt_index);
>> -
>> - ggtt_get_host_entry(ggtt_mm, &e, g_gtt_index);
>> - ggtt_invalidate_pte(vgpu, &e);
> Can we do unmap for !partial_update only and remove above clear_present?
> So still use scratch for host in case of partial update.
>
>> -
>> ggtt_set_host_entry(ggtt_mm, &m, g_gtt_index);
>> ggtt_invalidate(gvt->dev_priv);
>> + ggtt_set_guest_entry(ggtt_mm, &e, g_gtt_index);
>> return 0;
>> }
>>
>> --
>> 2.15.1
>>
More information about the intel-gvt-dev
mailing list