<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#317100;margin:15pt;" align="Left">
[AMD Public Use]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Christian, Can you cc stable when you apply it to drm-misc?</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Alex<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Kuehling, Felix <Felix.Kuehling@amd.com><br>
<b>Sent:</b> Wednesday, July 29, 2020 10:15 AM<br>
<b>To:</b> Koenig, Christian <Christian.Koenig@amd.com>; dri-devel@lists.freedesktop.org <dri-devel@lists.freedesktop.org>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>; Deucher, Alexander <Alexander.Deucher@amd.com><br>
<b>Cc:</b> Morichetti, Laurent <Laurent.Morichetti@amd.com><br>
<b>Subject:</b> Re: [PATCH 1/1] drm/ttm: fix offset in VMAs with a pg_offs in ttm_bo_vm_access</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Am 2020-07-29 um 4:08 a.m. schrieb Christian König:<br>
> Am 28.07.20 um 20:27 schrieb Felix Kuehling:<br>
>> VMAs with a pg_offs that's offset from the start of the vma_node need<br>
>> to adjust the offset within the BO accordingly. This matches the<br>
>> offset calculation in ttm_bo_vm_fault_reserved.<br>
>><br>
>> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com><br>
>> Tested-by: Laurent Morichetti <laurent.morichetti@amd.com><br>
><br>
> Reviewed-by: Christian König <christian.koenig@amd.com><br>
><br>
> Going to pick that up for inclusion in drm-misc-next.<br>
<br>
Thanks. I'll submit it to amd-staging-drm-next so it makes its way into<br>
our DKMS branch quickly.<br>
<br>
Alex, would you push this to drm-fixes?<br>
<br>
Regards,<br>
Felix<br>
<br>
<br>
><br>
>> ---<br>
>> drivers/gpu/drm/ttm/ttm_bo_vm.c | 4 +++-<br>
>> 1 file changed, 3 insertions(+), 1 deletion(-)<br>
>><br>
>> diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c<br>
>> b/drivers/gpu/drm/ttm/ttm_bo_vm.c<br>
>> index 389128b8c4dd..60b41447bec8 100644<br>
>> --- a/drivers/gpu/drm/ttm/ttm_bo_vm.c<br>
>> +++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c<br>
>> @@ -405,8 +405,10 @@ static int ttm_bo_vm_access_kmap(struct<br>
>> ttm_buffer_object *bo,<br>
>> int ttm_bo_vm_access(struct vm_area_struct *vma, unsigned long addr,<br>
>> void *buf, int len, int write)<br>
>> {<br>
>> - unsigned long offset = (addr) - vma->vm_start;<br>
>> struct ttm_buffer_object *bo = vma->vm_private_data;<br>
>> + unsigned long offset = (addr) - vma->vm_start +<br>
>> + ((vma->vm_pgoff - drm_vma_node_start(&bo->base.vma_node))<br>
>> + << PAGE_SHIFT);<br>
>> int ret;<br>
>> if (len < 1 || (offset + len) >> PAGE_SHIFT > bo->num_pages)<br>
><br>
</div>
</span></font></div>
</div>
</body>
</html>