Re: 回复: Re: 回复: Re: [PATCH] drm/amdgpu: fixup bad vram size on gmc v8

Christian König christian.koenig at amd.com
Thu Dec 16 09:48:34 UTC 2021


Hi Zongmin,

well what seems to happen here is that the ASIC is not correctly 
initialized.

Alex knows that better than me, but I think the issue on SI was just 
that the BIOS was somehow buggy didn't correctly initialized the register.

What you have here is most likely something completely different and you 
are just working around the symptoms.

Regards,
Christian.

Am 16.12.21 um 10:35 schrieb 周宗敏:
>
> Hi  Christian,
>
>
> I'm  testing for GPU passthrough feature, so I pass through this GPU 
> to  virtual machine to use. It  based on arm64 system.
>
>
> 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?
>
> the history commit message is below:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0ca223b029a261e82fb2f50c52eb85d510f4260e 
> <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgit.kernel.org%2Fpub%2Fscm%2Flinux%2Fkernel%2Fgit%2Ftorvalds%2Flinux.git%2Fcommit%2F%3Fid%3D0ca223b029a261e82fb2f50c52eb85d510f4260e&data=04%7C01%7Cchristian.koenig%40amd.com%7C4101c805880a478e13d308d9c0777e78%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637752441782176211%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=s%2B1S%2B9HwwZMV9jvitYCGufFpd2Dqjplo9lGOK4xJI3c%3D&reserved=0>
>
> image.png
>
>
> Thanks very much.
>
>
> ----
>
> *主 题:*Re: 回复: Re: [PATCH] drm/amdgpu: fixup bad vram size on gmc v8
> *日 期:*2021-12-16 16:15
> *发件人:*Christian König
> *收件人:*周宗敏Alex Deucher
>
>
> Hi Zongmin,
>
>    that strongly sounds like the ASIC is not correctly initialized 
> when    trying to read the register.
>
>    What board and environment are you using this GPU with? Is that a   
>  normal x86 system?
>
>    Regards,
>    Christian.
>
> Am 16.12.21 um 04:11 schrieb 周宗敏:
>
>> 1.
>>
>>     the problematic boards that I have tested is [AMD/ATI] Lexa      
>>          PRO [Radeon RX 550/550X] ;  and the vbios version :        
>>        113-RXF9310-C09-BT
>>
>> 2.
>>
>>     When an exception occurs I can see the following changes in      
>>          the values of vram size get from RREG32(mmCONFIG_MEMSIZE) ,
>>
>>     it seems to have garbage in the upper 16 bits
>>
>>     image.png
>>
>>
>> 3.
>>
>>     and then I can also see some dmesg like below:
>>
>>     when vram size register have garbage,we may see error      
>>      message like below:
>>
>>     amdgpu 0000:09:00.0: VRAM: 4286582784M 0x000000F400000000 -      
>>          0x000FF8F4FFFFFFFF (4286582784M used)
>>
>>     the correct message should like below:
>>
>>     amdgpu 0000:09:00.0: VRAM: 4096M 0x000000F400000000 -      
>>      0x000000F4FFFFFFFF (4096M used)
>>
>>
>>     if you have any problems,please send me mail.
>>
>>     thanks very much.
>>
>>
>> ----
>>
>> *主 题:*Re: [PATCH] drm/amdgpu:          fixup bad vram size on gmc v8
>> *日 期:*2021-12-16 04:23
>> *发件人:*Alex Deucher
>> *收件人:*Zongmin Zhou
>>
>>
>> On Wed, Dec 15, 2021 at 10:31 AM Zongmin Zhouwrote:
>>          >
>>          > Some boards(like RX550) seem to have garbage in the upper
>>          > 16 bits of the vram size register.  Check for
>>          > this and clamp the size properly.  Fixes
>>          > boards reporting bogus amounts of vram.
>>          >
>>          > after add this patch,the maximum GPU VRAM size is 64GB,
>>          > otherwise only 64GB vram size will be used.
>>
>>          Can you provide some examples of problematic boards and     
>>      possibly a
>>          vbios image from the problematic board?  What values are you 
>>          seeing?
>>          It would be nice to see what the boards are reporting and   
>>        whether the
>>          lower 16 bits are actually correct or if it is some other   
>>        issue.  This
>>          register is undefined until the asic has been initialized.   
>>         The vbios
>>          programs it as part of it's asic init sequence (either via   
>>        vesa/gop or
>>          the OS driver).
>>
>>          Alex
>>
>>
>>          >
>>          > Signed-off-by: Zongmin Zhou
>>            > ---
>>            >  drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 13           
>>  ++++++++++---
>>            >  1 file changed, 10 insertions(+), 3 deletions(-)
>>            >
>>            > diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c 
>>  b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>>            > index 492ebed2915b..63b890f1e8af 100644
>>            > --- a/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>>            > +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c
>>            > @@ -515,10 +515,10 @@ static void   
>>  gmc_v8_0_mc_program(struct amdgpu_device *adev)
>>            >  static int gmc_v8_0_mc_init(struct amdgpu_device       
>>      *adev)
>>            >  {
>>            >         int r;
>>            > +       u32 tmp;
>>            >
>>            >         adev->gmc.vram_width =   
>>  amdgpu_atombios_get_vram_width(adev);
>>            >         if (!adev->gmc.vram_width) {
>>            > -               u32 tmp;
>>            >                 int chansize, numchan;
>>            >
>>            >                 /* Get VRAM informations */
>>            > @@ -562,8 +562,15 @@ static int gmc_v8_0_mc_init(struct 
>>            amdgpu_device *adev)
>>            >                 adev->gmc.vram_width = numchan *         
>>    chansize;
>>            >         }
>>            >         /* size in MB on si */
>>            > -       adev->gmc.mc_vram_size =     
>>  RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL;
>>            > -       adev->gmc.real_vram_size =       
>>  RREG32(mmCONFIG_MEMSIZE) * 1024ULL * 1024ULL;
>>            > +       tmp = RREG32(mmCONFIG_MEMSIZE);
>>            > +       /* some boards may have garbage in the upper 16 
>>            bits */
>>            > +       if (tmp & 0xffff0000) {
>>            > +               DRM_INFO("Probable bad vram size:       
>>      0x%08x\n", tmp);
>>            > +               if (tmp & 0xffff)
>>            > +                       tmp &= 0xffff;
>>            > +       }
>>            > +       adev->gmc.mc_vram_size = tmp * 1024ULL *         
>>    1024ULL;
>>            > +       adev->gmc.real_vram_size =       
>>  adev->gmc.mc_vram_size;
>>            >
>>            >         if (!(adev->flags & AMD_IS_APU)) {
>>            >                 r = amdgpu_device_resize_fb_bar(adev);
>>            > --
>>            > 2.25.1
>>            >
>>            >
>>            > No virus found
>>            >                 Checked by Hillstone Network AntiVirus
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dri-devel/attachments/20211216/3a0d746d/attachment-0001.htm>


More information about the dri-devel mailing list