<div dir="ltr"><div>Is the issue reproducible with the same board in bare metal on x86? Or does it only happen with passthrough on ARM? Looking through the archives, the SI patch I made was for an x86 laptop. <span class="gmail-Lm gmail-ng">It</span> would be nice to root cause this, but there weren't any gfx8 boards with more than 64G of vram, so I think it's safe. That said, if you see similar issues with newer gfx IPs then we have an issue since the upper bit will be meaningful, so it would be nice to root cause this.<br></div><div><br></div><div>Alex</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Dec 16, 2021 at 4:36 AM 周宗敏 <<a href="mailto:zhouzongmin@kylinos.cn" target="_blank">zhouzongmin@kylinos.cn</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p>Hi Christian,</p><p><br></p><p>I'm testing for GPU passthrough feature, so I pass through this GPU to virtual machine to use. It based on arm64 system.</p><br><p>As far as i know, Alex had dealt with a similar problems on dri/radeon/si.c . Maybe they have a same reason to cause it?</p><p>the history commit message is below:</p><p><a href="https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0ca223b029a261e82fb2f50c52eb85d510f4260e" target="_blank">https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0ca223b029a261e82fb2f50c52eb85d510f4260e</a></p><p><img src="http:///nsmail/js/ueditor/php/upload/image/20211216/1639647221165090.png" title="1639647221165090.png" alt="image.png"></p><p><br></p><p>Thanks very much.</p><p> <br></p><p>----</p><p> </p><p><strong>主 题:</strong><span id="gmail-m_5152471305805756242gmail-m_8043105273083894711subject">Re: 回复: Re: [PATCH] drm/amdgpu: fixup bad vram size on gmc v8</span>
<br><strong>日 期:</strong><span id="gmail-m_5152471305805756242gmail-m_8043105273083894711date">2021-12-16 16:15</span>
<br><strong>发件人:</strong><span id="gmail-m_5152471305805756242gmail-m_8043105273083894711from">Christian König</span>
<br><strong>收件人:</strong><span id="gmail-m_5152471305805756242gmail-m_8043105273083894711to">周宗敏Alex Deucher</span>
</p><p><br>
</p><p>Hi Zongmin,<br>
<br>
that strongly sounds like the ASIC is not correctly initialized when
trying to read the register.<br>
<br>
What board and environment are you using this GPU with? Is that a
normal x86 system?<br>
<br>
Regards,<br>
Christian.<br>
<br>
</p><p>Am 16.12.21 um 04:11 schrieb 周宗敏:<br>
</p><blockquote type="cite"><ol style="list-style-type:decimal"><li><p>the problematic boards that I have tested is [AMD/ATI] Lexa
PRO [Radeon RX 550/550X] ; and the vbios version :
113-RXF9310-C09-BT</p></li><li><p>When an exception occurs I can see the following changes in
the values of vram size get from RREG32(mmCONFIG_MEMSIZE) ,</p><p>it seems to have garbage in the upper 16 bits </p><p><img src="http:///nsmail/js/ueditor/php/upload/image/20211216/1639623655693645.png" title="1639623655693645.png" alt="image.png"><br>
</p><p><br>
</p></li><li><p>and then I can also see some dmesg like below:</p><p>when vram size register have garbage,we may see error
message like below:</p><p>amdgpu 0000:09:00.0: VRAM: 4286582784M 0x000000F400000000 -
0x000FF8F4FFFFFFFF (4286582784M used)</p><p>the correct message should like below:</p><p>amdgpu 0000:09:00.0: VRAM: 4096M 0x000000F400000000 -
0x000000F4FFFFFFFF (4096M used)</p><p><br>
</p><p>if you have any problems,please send me mail.</p><p>thanks very much.</p><p><br>
</p></li></ol><p>---- </p><p><strong>主 题:</strong><span id="gmail-m_5152471305805756242gmail-m_8043105273083894711subject">Re: [PATCH] drm/amdgpu:
fixup bad vram size on gmc v8</span> <br>
<strong>日 期:</strong><span id="gmail-m_5152471305805756242gmail-m_8043105273083894711date">2021-12-16 04:23</span>
<br>
<strong>发件人:</strong><span id="gmail-m_5152471305805756242gmail-m_8043105273083894711from">Alex Deucher</span>
<br>
<strong>收件人:</strong><span id="gmail-m_5152471305805756242gmail-m_8043105273083894711to">Zongmin Zhou</span>
</p><p><br>
</p><p>On Wed, Dec 15, 2021 at 10:31 AM Zongmin Zhou<u></u>wrote:<br>
><br>
> Some boards(like RX550) seem to have garbage in the upper<br>
> 16 bits of the vram size register. Check for<br>
> this and clamp the size properly. Fixes<br>
> boards reporting bogus amounts of vram.<br>
><br>
> after add this patch,the maximum GPU VRAM size is 64GB,<br>
> otherwise only 64GB vram size will be used.<br>
<br>
Can you provide some examples of problematic boards and
possibly a<br>
vbios image from the problematic board? What values are you
seeing?<br>
It would be nice to see what the boards are reporting and
whether the<br>
lower 16 bits are actually correct or if it is some other
issue. This<br>
register is undefined until the asic has been initialized.
The vbios<br>
programs it as part of it's asic init sequence (either via
vesa/gop or<br>
the OS driver).<br>
<br>
Alex<br>
<br>
<br>
><br>
> Signed-off-by: Zongmin Zhou<u></u><br>
> ---<br>
> drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 13
++++++++++---<br>
> 1 file changed, 10 insertions(+), 3 deletions(-)<br>
><br>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c<br>
> index 492ebed2915b..63b890f1e8af 100644<br>
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c<br>
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c<br>
> @@ -515,10 +515,10 @@ static void
gmc_v8_0_mc_program(struct amdgpu_device *adev)<br>
> static int gmc_v8_0_mc_init(struct amdgpu_device
*adev)<br>
> {<br>
> int r;<br>
> + u32 tmp;<br>
><br>
> adev->gmc.vram_width =
amdgpu_atombios_get_vram_width(adev);<br>
> if (!adev->gmc.vram_width) {<br>
> - u32 tmp;<br>
> int chansize, numchan;<br>
><br>
> /* Get VRAM informations */<br>
> @@ -562,8 +562,15 @@ static int gmc_v8_0_mc_init(struct
amdgpu_device *adev)<br>
> adev->gmc.vram_width = numchan *
chansize;<br>
> }<br>
> /* size in MB on si */<br>
> - adev->gmc.mc_vram_size =
RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL;<br>
> - adev->gmc.real_vram_size =
RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL;<br>
> + tmp = RREG32(mmCONFIG_MEMSIZE);<br>
> + /* some boards may have garbage in the upper 16
bits */<br>
> + if (tmp & 0xffff0000) {<br>
> + DRM_INFO("Probable bad vram size:
0x%08x\n", tmp);<br>
> + if (tmp & 0xffff)<br>
> + tmp &= 0xffff;<br>
> + }<br>
> + adev->gmc.mc_vram_size = tmp * 1024ULL *
1024ULL;<br>
> + adev->gmc.real_vram_size =
adev->gmc.mc_vram_size;<br>
><br>
> if (!(adev->flags & AMD_IS_APU)) {<br>
> r = amdgpu_device_resize_fb_bar(adev);<br>
> --<br>
> 2.25.1<br>
><br>
><br>
> No virus found<br>
> Checked by Hillstone Network AntiVirus<br>
<u></u><u></u></p></blockquote><p><br>
</p></blockquote></div>