mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu/gmc6: fix in case the PCI BAR is larger than the actual amount of vram
@ 2023-08-15  6:54 hongao
  2023-08-15 15:50 ` Alex Deucher
  0 siblings, 1 reply; 3+ messages in thread
From: hongao @ 2023-08-15  6:54 UTC (permalink / raw)
  To: alexander.deucher, Xinhui.Pan, airlied, daniel, lijo.lazar,
	mario.limonciello
  Cc: amd-gfx, dri-devel, linux-kernel, hongao

[why]
limit visible_vram_size to real_vram_size in case
the PCI BAR is larger than the actual amount of vram.

Signed-off-by: hongao <hongao@uniontech.com>
---
 drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
index b7dad4e67813..c0de7496bfd1 100644
--- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
@@ -320,6 +320,8 @@ static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
 	adev->gmc.aper_base = pci_resource_start(adev->pdev, 0);
 	adev->gmc.aper_size = pci_resource_len(adev->pdev, 0);
 	adev->gmc.visible_vram_size = adev->gmc.aper_size;
+	if (adev->gmc.visible_vram_size > adev->gmc.real_vram_size)
+		adev->gmc.visible_vram_size = adev->gmc.real_vram_size;
 
 	/* set the gart size */
 	if (amdgpu_gart_size == -1) {
-- 
2.20.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu/gmc6: fix in case the PCI BAR is larger than the actual amount of vram
  2023-08-15  6:54 [PATCH] drm/amdgpu/gmc6: fix in case the PCI BAR is larger than the actual amount of vram hongao
@ 2023-08-15 15:50 ` Alex Deucher
  2023-08-16  9:44   ` Christian König
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Deucher @ 2023-08-15 15:50 UTC (permalink / raw)
  To: hongao
  Cc: alexander.deucher, Xinhui.Pan, airlied, daniel, lijo.lazar,
	mario.limonciello, dri-devel, amd-gfx, linux-kernel

Applied.  Thanks!

On Tue, Aug 15, 2023 at 3:13 AM hongao <hongao@uniontech.com> wrote:
>
> [why]
> limit visible_vram_size to real_vram_size in case
> the PCI BAR is larger than the actual amount of vram.
>
> Signed-off-by: hongao <hongao@uniontech.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> index b7dad4e67813..c0de7496bfd1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
> @@ -320,6 +320,8 @@ static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
>         adev->gmc.aper_base = pci_resource_start(adev->pdev, 0);
>         adev->gmc.aper_size = pci_resource_len(adev->pdev, 0);
>         adev->gmc.visible_vram_size = adev->gmc.aper_size;
> +       if (adev->gmc.visible_vram_size > adev->gmc.real_vram_size)
> +               adev->gmc.visible_vram_size = adev->gmc.real_vram_size;
>
>         /* set the gart size */
>         if (amdgpu_gart_size == -1) {
> --
> 2.20.1
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu/gmc6: fix in case the PCI BAR is larger than the actual amount of vram
  2023-08-15 15:50 ` Alex Deucher
@ 2023-08-16  9:44   ` Christian König
  0 siblings, 0 replies; 3+ messages in thread
From: Christian König @ 2023-08-16  9:44 UTC (permalink / raw)
  To: Alex Deucher, hongao
  Cc: Xinhui.Pan, amd-gfx, lijo.lazar, linux-kernel, dri-devel,
	mario.limonciello, daniel, alexander.deucher, airlied

Wait a second.

This is unnecessary because we have this check in 
amdgpu_gmc_vram_location():

         if (mc->real_vram_size < mc->visible_vram_size)
                 mc->visible_vram_size = mc->real_vram_size;


Which makes sure that the visible VRAM size is never larger than the 
actual size for all HW generations.

Regards,
Christian.

Am 15.08.23 um 17:50 schrieb Alex Deucher:
> Applied.  Thanks!
>
> On Tue, Aug 15, 2023 at 3:13 AM hongao <hongao@uniontech.com> wrote:
>> [why]
>> limit visible_vram_size to real_vram_size in case
>> the PCI BAR is larger than the actual amount of vram.
>>
>> Signed-off-by: hongao <hongao@uniontech.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
>> index b7dad4e67813..c0de7496bfd1 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v6_0.c
>> @@ -320,6 +320,8 @@ static int gmc_v6_0_mc_init(struct amdgpu_device *adev)
>>          adev->gmc.aper_base = pci_resource_start(adev->pdev, 0);
>>          adev->gmc.aper_size = pci_resource_len(adev->pdev, 0);
>>          adev->gmc.visible_vram_size = adev->gmc.aper_size;
>> +       if (adev->gmc.visible_vram_size > adev->gmc.real_vram_size)
>> +               adev->gmc.visible_vram_size = adev->gmc.real_vram_size;
>>
>>          /* set the gart size */
>>          if (amdgpu_gart_size == -1) {
>> --
>> 2.20.1
>>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-16  9:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-15  6:54 [PATCH] drm/amdgpu/gmc6: fix in case the PCI BAR is larger than the actual amount of vram hongao
2023-08-15 15:50 ` Alex Deucher
2023-08-16  9:44   ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®