From: "Christian König" <christian.koenig@amd.com>
To: Ellen Pan <yunru.pan@amd.com>, amd-gfx@lists.freedesktop.org
Cc: Alexander.Deucher@amd.com, Shravankumar.Gande@amd.com
Subject: Re: [PATCH 4/6] drm/amdgpu: Reuse fw_vram_usage_* for dynamic critical region in SRIOV
Date: Thu, 9 Oct 2025 14:26:28 +0200 [thread overview]
Message-ID: <95dab445-9720-4b10-8a1d-2ee76933ff6b@amd.com> (raw)
In-Reply-To: <20251009033047.25004-1-yunru.pan@amd.com>
On 09.10.25 05:30, Ellen Pan wrote:
> - During guest driver init, asa VFs receive PF msg to
> init dynamic critical region(v2), VFs reuse fw_vram_usage_*
> from ttm to store critical region tables in a 5MB chunk.
>
> Signed-off-by: Ellen Pan <yunru.pan@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 33 +++++++++++++-----------
> drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c | 8 ++++++
> 2 files changed, 26 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> index 96bd0185f936..4ba34ba74671 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
> @@ -1943,23 +1943,26 @@ int amdgpu_ttm_init(struct amdgpu_device *adev)
> if (r)
> return r;
>
> - /*
> - *The reserved vram for driver must be pinned to the specified
> - *place on the VRAM, so reserve it early.
> - */
> - r = amdgpu_ttm_drv_reserve_vram_init(adev);
> - if (r)
> - return r;
> -
> - /*
> - * only NAVI10 and onwards ASIC support for IP discovery.
> - * If IP discovery enabled, a block of memory should be
> - * reserved for IP discovey.
> - */
> - if (adev->mman.discovery_bin) {
> - r = amdgpu_ttm_reserve_tmr(adev);
> + /* VFs using dynamic critical regions(v2) won't need to reserve for below memory */
> + if (!amdgpu_sriov_vf(adev) || (adev->virt.req_init_data_ver != GPU_CRIT_REGION_V2)) {
That comment says what is done, but not why it is done.
> + /*
> + *The reserved vram for driver must be pinned to the specified
> + *place on the VRAM, so reserve it early.
> + */
> + r = amdgpu_ttm_drv_reserve_vram_init(adev);
> if (r)
> return r;
> +
> + /*
> + * only NAVI10 and onwards ASIC support for IP discovery.
> + * If IP discovery enabled, a block of memory should be
> + * reserved for IP discovey.
While at it there are a couple of typos in the comment, please fix.
> + */
> + if (adev->mman.discovery_bin) {
> + r = amdgpu_ttm_reserve_tmr(adev);
> + if (r)
> + return r;
> + }
> }
>
> /* allocate memory as required for VGA
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> index 46c19e96086a..e9dbab53cb06 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c
> @@ -931,6 +931,14 @@ int amdgpu_virt_init_critical_region(struct amdgpu_device *adev)
> adev->virt.crit_region_sizes_kb[AMD_SRIOV_MSG_BAD_PAGE_INFO_TABLE_ID] =
> init_data_hdr->bad_page_size_in_kb;
>
> + /* reserved memory starts from crit region base offset with the size of 5MB */
> + adev->mman.fw_vram_usage_start_offset = adev->virt.crit_region_base_offset;
> + adev->mman.fw_vram_usage_size = adev->virt.crit_region_size_in_kb << 10;
> + DRM_INFO("critical region v%d requested to reserve memory start at %08x with %d KB.\n",
> + init_data_hdr->version,
> + adev->mman.fw_vram_usage_start_offset,
> + adev->mman.fw_vram_usage_size >> 10);
> +
Same as on the other patch, using dev_info might be more adequate than DRM_INFO.
Regards,
Christian.
> adev->virt.init_data_done = true;
> break;
> default:
next prev parent reply other threads:[~2025-10-09 12:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-09 3:30 [PATCH 4/6] drm/amdgpu: Reuse fw_vram_usage_* for dynamic critical region in SRIOV Ellen Pan
2025-10-09 12:26 ` Christian König [this message]
2025-10-09 12:52 ` Alex Deucher
2025-10-09 13:59 ` Lazar, Lijo
-- strict thread matches above, loose matches on Subject: below --
2025-10-10 4:43 [PATCH 1/6] drm/amdgpu: Updated naming of SRIOV critical region offsets/sizes with _V1 suffix Ellen Pan
2025-10-10 4:43 ` [PATCH 4/6] drm/amdgpu: Reuse fw_vram_usage_* for dynamic critical region in SRIOV Ellen Pan
2025-10-10 10:33 ` Lazar, Lijo
2025-10-10 15:10 ` 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=95dab445-9720-4b10-8a1d-2ee76933ff6b@amd.com \
--to=christian.koenig@amd.com \
--cc=Alexander.Deucher@amd.com \
--cc=Shravankumar.Gande@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=yunru.pan@amd.com \
/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