<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:等线;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"\@等线";
panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:black;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
{mso-style-priority:99;
mso-style-link:"Plain Text Char";
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:black;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{mso-style-priority:34;
margin-top:0in;
margin-right:0in;
margin-bottom:0in;
margin-left:.5in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:black;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
color:black;}
span.PlainTextChar
{mso-style-name:"Plain Text Char";
mso-style-priority:99;
mso-style-link:"Plain Text";
font-family:"Calibri",sans-serif;}
span.EmailStyle21
{mso-style-type:personal;
font-family:"Calibri",sans-serif;}
span.EmailStyle22
{mso-style-type:personal;
font-family:"Calibri",sans-serif;}
span.EmailStyle23
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle24
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:102002723;
mso-list-template-ids:2013818564;}
@list l1
{mso-list-id:241063413;
mso-list-type:hybrid;
mso-list-template-ids:-792188320 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l1:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l1:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l1:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
text-indent:-.25in;}
@list l1:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
text-indent:-9.0pt;}
@list l2
{mso-list-id:1891189321;
mso-list-type:hybrid;
mso-list-template-ids:1902176222 67698703 67698713 67698715 67698703 67698713 67698715 67698703 67698713 67698715;}
@list l2:level1
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:38.5pt;
text-indent:-.25in;}
@list l2:level2
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:74.5pt;
text-indent:-.25in;}
@list l2:level3
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:110.5pt;
text-indent:-9.0pt;}
@list l2:level4
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:146.5pt;
text-indent:-.25in;}
@list l2:level5
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:182.5pt;
text-indent:-.25in;}
@list l2:level6
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:218.5pt;
text-indent:-9.0pt;}
@list l2:level7
{mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:254.5pt;
text-indent:-.25in;}
@list l2:level8
{mso-level-number-format:alpha-lower;
mso-level-tab-stop:none;
mso-level-number-position:left;
margin-left:290.5pt;
text-indent:-.25in;}
@list l2:level9
{mso-level-number-format:roman-lower;
mso-level-tab-stop:none;
mso-level-number-position:right;
margin-left:326.5pt;
text-indent:-9.0pt;}
@list l3
{mso-list-id:1923762004;
mso-list-template-ids:1355700176;}
ol
{margin-bottom:0in;}
ul
{margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body bgcolor="white" lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:windowtext">Hi Christian <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">Thanks for explaining the HOLD for us,
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">My understanding is we still could put CSA to 0~HOLE_START, because we can report UMD the max space is HOLD_START-CSA_SIZE , thus no colliding will hit.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">></span> Now on Vega/Raven/Picasso etc.. (everything with a GFX9) the lower range (0x0-0x8000 0000 0000) is reserved for SVA/ATC use. Since we unfortunately didn't knew that initially we exposed those to older
userspace as usable and also put the CSA in there.<br>
<br>
<o:p></o:p></p>
<p class="MsoNormal">Regarding with above sentence, do you mean this range (0->HOLE_START) shouldn’t be exposed to user space ? I don’t get your point here …<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Putting CSA in 0~HOLD_START is the legacy approach we selected for a long time since very early stage, how comes that you think it is a problem now ?<o:p></o:p></p>
<p class="MsoNormal"><span style="color:windowtext"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:windowtext">/Monk<o:p></o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span style="color:windowtext"> amd-gfx <amd-gfx-bounces@lists.freedesktop.org>
<b>On Behalf Of </b>Koenig, Christian<br>
<b>Sent:</b> Thursday, January 17, 2019 4:30 PM<br>
<b>To:</b> Liu, Monk <Monk.Liu@amd.com>; Lou, Wentao <Wentao.Lou@amd.com>; amd-gfx@lists.freedesktop.org; Zhu, Rex <Rex.Zhu@amd.com><br>
<b>Cc:</b> Deng, Emily <Emily.Deng@amd.com><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: csa_vaddr should not larger than AMDGPU_GMC_HOLE_START<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hi Monk,<br>
<br>
ok let me explain a bit more how the hardware works.<br>
<br>
The GMC manages a virtual 64bit address space, but only 48bit of that virtual address space are handled by the page table walker.<br>
<br>
The 48bits of address space are sign extended, so bit 47 of that are extended into bits 48-63.<br>
<br>
This gives us the following memory layout:<br>
0x0<br>
.... virtual address space<br>
0x8000 0000 0000<br>
.... hole<br>
0xFFFF 8000 0000 0000<br>
.... virtual address space<br>
0xFFFF FFFF FFFF FFFF<br>
<br>
Trying to access the hole results in a range fault interrupt IIRC.<br>
<br>
When doing the VM page table walk the topmost 16bits are ignored, so when programming the page table walker you cut those of and use a linear address again. This is what AMDGPU_GMC_HOLE_MASK is good for.<br>
<br>
Now on Vega/Raven/Picasso etc.. (everything with a GFX9) the lower range (0x0-0x8000 0000 0000) is reserved for SVA/ATC use. Since we unfortunately didn't knew that initially we exposed those to older userspace as usable and also put the CSA in there.<br>
<br>
The most likely cause of this is that we still have a bug somewhere about this, e.g. not correctly using sign extended addresses *OR* using sign extended addresses where we should use linear instead.<br>
<br>
Regards,<br>
Christian.<br>
<br>
Am 17.01.19 um 09:04 schrieb Liu, Monk:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="color:windowtext">Hi Christian </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:windowtext">I believe Wentao can fix the issue we it by below step:</span><o:p></o:p></p>
<ol style="margin-top:0in" start="1" type="1">
<li class="MsoNormal" style="color:windowtext;mso-list:l1 level1 lfo3">Return <b>
Virtual_address_max</b> (UMD use it) to HOLE_START – RESERVED_SIZE <o:p></o:p></li><li class="MsoNormal" style="color:windowtext;mso-list:l1 level1 lfo3">[optional] Still Keep virtual_address_offset to RESERVED_SIZE (current way, I think it’s because previously we put CSA in 0
<span style="font-family:Wingdings">à</span> RESERVED_SIZE space) <o:p></o:p></li><li class="MsoNormal" style="color:windowtext;mso-list:l1 level1 lfo3">Put CSA in HOLE_START – RESERVED_SIZE
<span style="font-family:Wingdings">è</span> HOLE_START (it’s current design) <o:p>
</o:p></li></ol>
<p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:windowtext">I don’t get where above scheme is not correct … can you give more explain for the GMC_HOLE_START ?</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:windowtext">e.g.</span><o:p></o:p></p>
<ol style="margin-top:0in" start="1" type="1">
<li class="MsoNormal" style="color:windowtext;margin-left:2.5pt;mso-list:l2 level1 lfo6">
why you set GMC_HOLE_START to 0x8’000’0000’0000 (half size of MAX of 48bit address space) ? is it for HSA purpose to make sure GPU address can also be used for CPU address ?
<o:p></o:p></li><li class="MsoNormal" style="color:windowtext;margin-left:2.5pt;mso-list:l2 level1 lfo6">
now MAX_PFN is 1’000’0000’0000, do you need to change GMC_HOLE_START ? <o:p></o:p></li></ol>
<p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:windowtext">thanks </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:windowtext">we need some catch up </span>
<o:p></o:p></p>
<p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:windowtext">/Monk</span><o:p></o:p></p>
<p class="MsoNormal"><span style="color:windowtext"> </span><o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="color:windowtext">From:</span></b><span style="color:windowtext"> amd-gfx
<a href="mailto:amd-gfx-bounces@lists.freedesktop.org"><amd-gfx-bounces@lists.freedesktop.org></a>
<b>On Behalf Of </b>Koenig, Christian<br>
<b>Sent:</b> Thursday, January 17, 2019 3:39 PM<br>
<b>To:</b> Lou, Wentao <a href="mailto:Wentao.Lou@amd.com"><Wentao.Lou@amd.com></a>; Liu, Monk
<a href="mailto:Monk.Liu@amd.com"><Monk.Liu@amd.com></a>; <a href="mailto:amd-gfx@lists.freedesktop.org">
amd-gfx@lists.freedesktop.org</a>; Zhu, Rex <a href="mailto:Rex.Zhu@amd.com"><Rex.Zhu@amd.com></a><br>
<b>Cc:</b> Deng, Emily <a href="mailto:Emily.Deng@amd.com"><Emily.Deng@amd.com></a><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: csa_vaddr should not larger than AMDGPU_GMC_HOLE_START</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<p class="MsoNormal">Am 17.01.19 um 04:17 schrieb Lou, Wentao:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">Hi Christian,<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Your solution as:<o:p></o:p></p>
<p class="MsoNormal">addr = (max_pfn - (AMDGPU_VA_RESERVED_SIZE >> AMDGPU_PAGE_SHIFT)) << AMDGPU_PAGE_SHIFT;<o:p></o:p></p>
<p class="MsoNormal">now max_pfn = 0x10 0000 0000, AMDGPU_VA_RESERVED_SIZE = 0x10 0000, AMDGPU_PAGE_SHIFT = 12<o:p></o:p></p>
<p class="MsoNormal">Still got addr = 0xFFFF FFF0 0000, which would cause ring gfx timeout.<o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><br>
But 0xFFFF FFF0 0000 is the correct address, if that is causing a problem then there is a bug somewhere else.<br>
<br>
Please try to use AMDGPU_GMC_HOLE_START-AMDGPU_VA_RESERVED_SIZE as well. Does that work?<br>
<br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">Before commit 1bf621c42137926ac249af761c0190a9258aa0db, vm_size was 32GB, and csa_addr was under AMDGPU_GMC_HOLE_START.<o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><br>
Wait a second why was the vm_size 32GB? This is on a Vega10 isn't it?<br>
<br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">I didn’t understand why csa_addr need to be above AMDGPU_GMC_HOLE_START now.<o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><br>
On Vega10 the lower range, e.g. everything below AMDGPU_GMC_HOLE_START is reserved for SVA.<br>
<br>
Regards,<br>
Christian.<br>
<br>
<br>
<br>
<o:p></o:p></p>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal">Thanks.<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal">BR,<o:p></o:p></p>
<p class="MsoNormal">Wentao<o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b>From:</b> Koenig, Christian <a href="mailto:Christian.Koenig@amd.com">
<Christian.Koenig@amd.com></a> <br>
<b>Sent:</b> Wednesday, January 16, 2019 5:48 PM<br>
<b>To:</b> Lou, Wentao <a href="mailto:Wentao.Lou@amd.com"><Wentao.Lou@amd.com></a>; Liu, Monk
<a href="mailto:Monk.Liu@amd.com"><Monk.Liu@amd.com></a>; <a href="mailto:amd-gfx@lists.freedesktop.org">
amd-gfx@lists.freedesktop.org</a>; Zhu, Rex <a href="mailto:Rex.Zhu@amd.com"><Rex.Zhu@amd.com></a><br>
<b>Cc:</b> Deng, Emily <a href="mailto:Emily.Deng@amd.com"><Emily.Deng@amd.com></a><br>
<b>Subject:</b> Re: [PATCH] drm/amdgpu: csa_vaddr should not larger than AMDGPU_GMC_HOLE_START<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"> <o:p></o:p></p>
<div>
<p class="MsoNormal">Hi Wentao,<br>
<br>
well the problem is you don't seem to understand how the hardware works.<br>
<br>
See the engines see an MC address space with a hole in the middle, similar to the how x86 64bit CPU address space works. But the page tables are programmed linearly.<br>
<br>
So the calculation in amdgpu_driver_open_kms() is correct because it takes the MC address and mages a linear page table index from it again.<br>
<br>
The only thing we might need to fix here is shifting max_pfn before the subtraction and I doubt that even that is necessary.<br>
<br>
Regards,<br>
Christian.<br>
<br>
Am 16.01.19 um 10:34 schrieb Lou, Wentao:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoPlainText">Hi Christian,<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">Now vm_size was set to <span style="background:yellow;mso-highlight:yellow">
0x4 0000</span> GB by below commit:<o:p></o:p></p>
<p class="MsoPlainText">1bf621c42137926ac249af761c0190a9258aa0db drm/amdgpu: Remove unnecessary VM size calculations<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">So that max_pfn would be <span style="background:yellow;mso-highlight:yellow">
0x10 0000 0000.</span><o:p></o:p></p>
<p class="MsoPlainText">amdgpu_csa_vaddr would make max_pfn << 12 to get 0x1 0000 0000 0000, and then minus AMDGPU_VA_RESERVED_SIZE, to get
<span style="background:yellow;mso-highlight:yellow">0xFFFF FFF0 0000</span><o:p></o:p></p>
<p class="MsoPlainText">unfortunately this number was between AMDGPU_GMC_HOLE_START and AMDGPU_GMC_HOLE_END, so that amdgpu_gmc_sign_extend was called to make it
<span style="background:yellow;mso-highlight:yellow">0xFFFF FFFF FFF0 0000</span><o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">in amdgpu_driver_open_kms, extended csa_addr cannot be passed into amdgpu_map_static_csa directly, it would be above the limit of max_pfn.<o:p></o:p></p>
<p class="MsoPlainText">So that csa_addr was restricted by AMDGPU_GMC_HOLE_MASK to make it possible for amdgpu_vm_alloc_pts.<o:p></o:p></p>
<p class="MsoPlainText">But this restriction by AMDGPU_GMC_HOLE_MASK would make the address fall back into AMDGPU_GMC_HOLE again, which causing GPU reset.<o:p></o:p></p>
<p class="MsoPlainText">We just put amdgpu_csa_vaddr back to AMDGPU_GMC_HOLE_START, to avoid the address touching AMDGPU_GMC_HOLE.<o:p></o:p></p>
<p class="MsoPlainText">By the way, if max_pfn was shift much to the left, it would always get zero, with or without min(*,*).<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">BR,<o:p></o:p></p>
<p class="MsoPlainText">Wentao<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">-----Original Message-----<br>
From: Koenig, Christian <a href="mailto:Christian.Koenig@amd.com"><Christian.Koenig@amd.com></a>
<br>
Sent: Tuesday, January 15, 2019 4:02 PM<br>
To: Liu, Monk <a href="mailto:Monk.Liu@amd.com"><Monk.Liu@amd.com></a>; Lou, Wentao
<a href="mailto:Wentao.Lou@amd.com"><Wentao.Lou@amd.com></a>; <a href="mailto:amd-gfx@lists.freedesktop.org">
amd-gfx@lists.freedesktop.org</a>; Zhu, Rex <a href="mailto:Rex.Zhu@amd.com"><Rex.Zhu@amd.com></a><br>
Subject: Re: [PATCH] drm/amdgpu: csa_vaddr should not larger than AMDGPU_GMC_HOLE_START<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">Am 15.01.19 um 07:19 schrieb Liu, Monk:<o:p></o:p></p>
<p class="MsoPlainText">> The max_pfn is now 1'0000'0000'0000'0000 (bytes) which is above 48 bit now, and it with AMDGPU_GMC_HOLE_MASK make it to zero ....<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> And in code "amdgpu_driver_open_kms()" I saw @Zhu, Rex write the code as :<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> "csa_addr = amdgpu_csa_vadr(adev) & AMDGPU_GMC_HOLE_MASK", I think this is wrong since you intentionally place the csa above GMC hole, right ?<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">The fix is just completely incorrect since min(adev->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT, AMDGPU_GMC_HOLE_START) still gives you 0 when we shift max_pfn to much to the left.<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">The correct solution is to substract the reserved size first and then shift. E.g.:<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">addr = (max_pfn - (AMDGPU_VA_RESERVED_SIZE >> AMDGPU_PAGE_SHIFT)) << AMDGPU_PAGE_SHIFT;<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">Regards,<o:p></o:p></p>
<p class="MsoPlainText">Christian.<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> Looks like we should modify this place<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> /Monk<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> -----Original Message-----<o:p></o:p></p>
<p class="MsoPlainText">> From: amd-gfx <<a href="mailto:amd-gfx-bounces@lists.freedesktop.org"><span style="text-decoration:none">amd-gfx-bounces@lists.freedesktop.org</span></a>> On Behalf Of
<o:p></o:p></p>
<p class="MsoPlainText">> Christian K?nig<o:p></o:p></p>
<p class="MsoPlainText">> Sent: Monday, January 14, 2019 9:05 PM<o:p></o:p></p>
<p class="MsoPlainText">> To: Lou, Wentao <<a href="mailto:Wentao.Lou@amd.com"><span style="text-decoration:none">Wentao.Lou@amd.com</span></a>>;
<a href="mailto:amd-gfx@lists.freedesktop.org"><span style="text-decoration:none">amd-gfx@lists.freedesktop.org</span></a><o:p></o:p></p>
<p class="MsoPlainText">> Subject: Re: [PATCH] drm/amdgpu: csa_vaddr should not larger than
<o:p></o:p></p>
<p class="MsoPlainText">> AMDGPU_GMC_HOLE_START<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> Am 14.01.19 um 09:40 schrieb wentalou:<o:p></o:p></p>
<p class="MsoPlainText">>> After removing unnecessary VM size calculations, vm_manager.max_pfn
<o:p></o:p></p>
<p class="MsoPlainText">>> would reach 0x10,0000,0000 max_pfn << AMDGPU_GPU_PAGE_SHIFT exceeding
<o:p></o:p></p>
<p class="MsoPlainText">>> AMDGPU_GMC_HOLE_START would caused GPU reset.<o:p></o:p></p>
<p class="MsoPlainText">>> <o:p></o:p></p>
<p class="MsoPlainText">>> Change-Id: I47ad0be2b0bd9fb7490c4e1d7bb7bdacf71132cb<o:p></o:p></p>
<p class="MsoPlainText">>> Signed-off-by: wentalou <<a href="mailto:Wentao.Lou@amd.com"><span style="text-decoration:none">Wentao.Lou@amd.com</span></a>><o:p></o:p></p>
<p class="MsoPlainText">> NAK, that is incorrect. We intentionally place the csa above the GMC hole.<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">> Regards,<o:p></o:p></p>
<p class="MsoPlainText">> Christian.<o:p></o:p></p>
<p class="MsoPlainText">> <o:p></o:p></p>
<p class="MsoPlainText">>> ---<o:p></o:p></p>
<p class="MsoPlainText">>> drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c | 3 ++-<o:p></o:p></p>
<p class="MsoPlainText">>> 1 file changed, 2 insertions(+), 1 deletion(-)<o:p></o:p></p>
<p class="MsoPlainText">>> <o:p></o:p></p>
<p class="MsoPlainText">>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c<o:p></o:p></p>
<p class="MsoPlainText">>> b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c<o:p></o:p></p>
<p class="MsoPlainText">>> index 7e22be7..dd3bd01 100644<o:p></o:p></p>
<p class="MsoPlainText">>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c<o:p></o:p></p>
<p class="MsoPlainText">>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_csa.c<o:p></o:p></p>
<p class="MsoPlainText">>> @@ -26,7 +26,8 @@<o:p></o:p></p>
<p class="MsoPlainText">>> <o:p></o:p></p>
<p class="MsoPlainText">>> uint64_t amdgpu_csa_vaddr(struct amdgpu_device *adev)<o:p></o:p></p>
<p class="MsoPlainText">>> {<o:p></o:p></p>
<p class="MsoPlainText">>> - uint64_t addr = adev->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT;<o:p></o:p></p>
<p class="MsoPlainText">>> + uint64_t addr = min(adev->vm_manager.max_pfn << AMDGPU_GPU_PAGE_SHIFT,<o:p></o:p></p>
<p class="MsoPlainText">>> + AMDGPU_GMC_HOLE_START);<o:p></o:p></p>
<p class="MsoPlainText">>> <o:p></o:p></p>
<p class="MsoPlainText">>> addr -= AMDGPU_VA_RESERVED_SIZE;<o:p></o:p></p>
<p class="MsoPlainText">>> addr = amdgpu_gmc_sign_extend(addr);<o:p></o:p></p>
<p class="MsoPlainText">> _______________________________________________<o:p></o:p></p>
<p class="MsoPlainText">> amd-gfx mailing list<o:p></o:p></p>
<p class="MsoPlainText">> <a href="mailto:amd-gfx@lists.freedesktop.org"><span style="text-decoration:none">amd-gfx@lists.freedesktop.org</span></a><o:p></o:p></p>
<p class="MsoPlainText">> <a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">
<span style="text-decoration:none">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</span></a><o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
</blockquote>
<p class="MsoNormal"> <o:p></o:p></p>
</blockquote>
<p class="MsoNormal"> <o:p></o:p></p>
</blockquote>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>