AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Frank Min" <Frank.Min@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 6/9] drm/amdgpu: Fix system aperture size for gfx13
Date: Fri, 04 Dec 2026 16:01:25 +0000	[thread overview]
Message-ID: <sashiko-outbox-250149@kernel.org> (raw)
In-Reply-To: <20261204142408.988734-6-Frank.Min@amd.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] drm/amdgpu: fb_start split in gmc_v13_0_vram_gtt_location()
  breaks DMUB
- [Low] drm/amdgpu: missing Fixes trailer for
  gmc_v13_0_vram_gtt_location() bug fix
--

commit 161a9a2ab1dbbfb524cfebbbafa5623789e83c80
Author: Frank Min <Frank.Min@amd.com>

> drm/amdgpu: Fix system aperture size for gfx13
>
> Gfx13 vram layout introduced vram offset, but aperture space should
> not be affected. So fix system aperture size to align with it.
>
> Signed-off-by: Frank Min <Frank.Min@amd.com>
> Reviewed-by: Kevin Wang <kevin.wang@amd.com>

[Severity: Low]
This looks like a bug fix for the GFX13 aperture setup.  Should this
include:

  Fixes: 41a7a8f5012e ("drm/amdgpu: Add gmc v13_0 support")

> diff --git a/drivers/gpu/drm/amd/amdgpu/gmc_v13_0.c b/drivers/gpu/drm/amd/amdgpu/gmc_v13_0.c
> index 49fee18eb5253..b548b748d670e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/gmc_v13_0.c
> +++ b/drivers/gpu/drm/amd/amdgpu/gmc_v13_0.c
> @@ -618,10 +618,14 @@ static int gmc_v13_0_late_init(struct amdgpu_ip_block *ip_block)
>  	return amdgpu_irq_get(adev, &adev->gmc.vm_fault, 0);
>  }
>  
> -static void gmc_v13_0_vram_gtt_location(struct amdgpu_device *adev, struct amdgpu_gmc *mc, u64 base, u64 offset)
> +static void gmc_v13_0_vram_gtt_location(struct amdgpu_device *adev,
> +					struct amdgpu_gmc *mc, u64 base)
>  {
>  	amdgpu_gmc_set_agp_default(adev, mc);
>  	amdgpu_gmc_vram_location(adev, mc, base);
> +
> +	if (!amdgpu_sriov_vf(adev))
> +		mc->fb_start = adev->mmhub.funcs->get_fb_location(adev);
>  	amdgpu_gmc_gart_location(adev, mc, AMDGPU_GART_PLACEMENT_LOW);
>  	if (!amdgpu_sriov_vf(adev) && (amdgpu_agp == 1))
>  		amdgpu_gmc_agp_location(adev, mc);
> @@ -630,7 +634,9 @@ static void gmc_v13_0_vram_gtt_location(struct amdgpu_device *adev, struct amdgp
>  	if (amdgpu_sriov_vf(adev))
>  		adev->vm_manager.vram_base_offset = 0;
>  	else
> -		adev->vm_manager.vram_base_offset = adev->mmhub.funcs->get_mc_fb_offset(adev) + offset;
> +		adev->vm_manager.vram_base_offset =
> +			adev->mmhub.funcs->get_mc_fb_offset(adev) +
> +			mc->vram_start - mc->fb_start;
>  }

[Severity: Medium]
Does splitting mc->fb_start from mc->vram_start here break DMUB address
translation during backdoor firmware loading?

dm_dmub_hw_init() pairs adev->gmc.fb_start with
adev->vm_manager.vram_base_offset:

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_dmub.c:dm_dmub_hw_init() {
	...
	hw_params.soc_fb_info.fb_base = adev->gmc.fb_start;
	hw_params.soc_fb_info.fb_offset = adev->vm_manager.vram_base_offset;
	...
}

On bare-metal GFX13 with a non-zero HDP VRAM offset, mc->fb_start is now
the unshifted FB location while adev->vm_manager.vram_base_offset stays
shifted by (mc->vram_start - mc->fb_start).  When
adev->firmware.load_type is not AMDGPU_FW_LOAD_PSP,
dmub_dcn60_backdoor_load() translates CW0 and CW1 VRAM addresses via
dmub_dcn60_translate_addr() (addr_in - fb_base + fb_offset), which
double-counts that offset.

This shifts DMCUB_REGION3_CW0_OFFSET and DMCUB_REGION3_CW1_OFFSET outside
the DMUB VRAM BO, causing backdoor boot to fail or stack DMA writes to
corrupt VRAM.  Should dm_dmub_hw_init() pair adev->gmc.vram_start with
adev->vm_manager.vram_base_offset instead?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204142408.988734-1-Frank.Min@amd.com?part=6

  reply	other threads:[~2026-12-04 16:01 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04 14:24 [PATCH 1/9] drm/amdgpu: skip vm inv for kiq ring Frank Min
2026-12-04 14:24 ` [PATCH 2/9] drm/amdgpu: disable gfx 13 pipe 1 ring Frank Min
2026-12-04 14:55   ` sashiko-bot
2026-12-04 16:05   ` Alex Deucher
2026-12-04 14:24 ` [PATCH 3/9] drm/amdgpu: update table info retrieval from discovery binary Frank Min
2026-12-04 15:14   ` sashiko-bot
2026-12-04 16:19   ` Alex Deucher
2026-12-04 14:24 ` [PATCH 4/9] drm/amdgpu: add lsdma v8 fw query interface Frank Min
2026-12-04 15:25   ` sashiko-bot
2026-12-04 16:21   ` Alex Deucher
2026-12-04 14:24 ` [PATCH 5/9] drm/amdgpu: add lsdma v8 fw loading support Frank Min
2026-12-04 15:47   ` sashiko-bot
2026-12-04 14:24 ` [PATCH 6/9] drm/amdgpu: Fix system aperture size for gfx13 Frank Min
2026-12-04 16:01   ` sashiko-bot [this message]
2026-12-04 14:24 ` [PATCH 7/9] drm/amdgpu: remove the unused ring parameter in update_spm_vmid() " Frank Min
2026-12-04 16:03   ` Alex Deucher
2026-12-04 16:11   ` sashiko-bot
2026-12-04 14:24 ` [PATCH 8/9] drm/amdgpu: enable uni-mes " Frank Min
2026-12-04 16:41   ` sashiko-bot
2026-12-04 17:24   ` Alex Deucher
2026-12-04 14:24 ` [PATCH 9/9] drm/amdgpu: fix mutex unlock position for ucode loading Frank Min
2026-12-04 16:12   ` Alex Deucher
2026-12-04 16:52   ` sashiko-bot
2026-12-04 14:41 ` [PATCH 1/9] drm/amdgpu: skip vm inv for kiq ring sashiko-bot
2026-12-04 16:16 ` Alex Deucher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-250149@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Min@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox