All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Alex Deucher" <alexander.deucher@amd.com>,
	amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH 01/11] drm/amdgpu/userq: Add INFO IOCTL query for doorbell ranges
Date: Wed, 18 Nov 2026 23:04:20 +0000	[thread overview]
Message-ID: <sashiko-outbox-222141@kernel.org> (raw)
In-Reply-To: <20261118223712.2518580-1-alexander.deucher@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] drm/amdgpu: amdgpu_info_ioctl() returns combined GFX/compute
  doorbell range
--

commit 81484698f4a74ac4cd4b7b1d2435342b60989454
Author: Alex Deucher <alexander.deucher@amd.com>

drm/amdgpu/userq: Add INFO IOCTL query for doorbell ranges

This commit adds the AMDGPU_INFO_UQ_DOORBELL_RANGE subquery to
amdgpu_info_ioctl() so userspace can query the per-page doorbell byte offset
and size for GFX, compute, and SDMA user queues.

> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> index 8e7e522a89e42..23858589dd15c 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c
> @@ -1452,6 +1452,26 @@ int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp)
>  			return -EINVAL;
>  		}
>  	}
> +	case AMDGPU_INFO_UQ_DOORBELL_RANGE: {
> +		struct drm_amdgpu_info_doorbell_range db_range = {};
> +
> +		switch (info->query_hw_ip.type) {
> +		case AMDGPU_HW_IP_GFX:
> +		case AMDGPU_HW_IP_COMPUTE:
> +			db_range.offset_bytes = adev->doorbell_index.kiq << 3;
> +			db_range.size_bytes = (adev->doorbell_index.sdma_engine[0] -
> +					       adev->doorbell_index.kiq) << 3;

[Severity: High]
Should AMDGPU_HW_IP_GFX and AMDGPU_HW_IP_COMPUTE return separate doorbell
sub-ranges instead of the combined [kiq, sdma_engine[0]) range?

On GFX11 and GFX12, the CP doorbell range registers partition each doorbell
page into disjoint ranges for compute (kiq..userqueue_end) and graphics
(gfx_ring0..gfx_userqueue_end):

drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:gfx_v11_0_cp_set_doorbell_range() {
	...
	/* set graphics engine doorbell range */
	WREG32_SOC15(GC, 0, regCP_RB_DOORBELL_RANGE_LOWER,
		     (adev->doorbell_index.gfx_ring0 * 2) << 2);
	WREG32_SOC15(GC, 0, regCP_RB_DOORBELL_RANGE_UPPER,
		     (adev->doorbell_index.gfx_userqueue_end * 2) << 2);

	/* set compute engine doorbell range */
	WREG32_SOC15(GC, 0, regCP_MEC_DOORBELL_RANGE_LOWER,
		     (adev->doorbell_index.kiq * 2) << 2);
	WREG32_SOC15(GC, 0, regCP_MEC_DOORBELL_RANGE_UPPER,
		     (adev->doorbell_index.userqueue_end * 2) << 2);
}

As noted in fd0ed91ae8a2 ("drm/amdgpu: correct cp doorbell range"), hardware
and firmware rely on these ranges to distinguish GFX and compute doorbell
activity for power-saving states.  Returning the combined range for both IP
types causes userspace to allocate GFX doorbells inside the MEC compute
range and compute doorbells inside the CP_RB graphics range.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261118223712.2518580-1-alexander.deucher@amd.com?part=1

      parent reply	other threads:[~2026-11-18 23:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 22:37 [PATCH 01/11] drm/amdgpu/userq: Add INFO IOCTL query for doorbell ranges Alex Deucher
2026-11-18 22:37 ` [PATCH 02/11] drm/amdgpu/mes11: add API for gang submit Alex Deucher
2026-11-18 22:37 ` [PATCH 03/11] drm/amdgpu/mes: add callback " Alex Deucher
2026-11-18 22:37 ` [PATCH 04/11] drm/amdgpu/mes11: add support for setting " Alex Deucher
2026-11-18 22:37 ` [PATCH 05/11] drm/amdgpu/mes12: " Alex Deucher
2026-11-18 22:37 ` [PATCH 06/11] drm/amdgpu/userq: add callback for gang setup Alex Deucher
2026-11-18 22:37 ` [PATCH 07/11] drm/amdgpu/userq/mes: implement set gang submit Alex Deucher
2026-11-18 22:44   ` sashiko-bot
2026-11-18 22:37 ` [PATCH 08/11] drm/amdgpu/userq: add handling for set_gang Alex Deucher
2026-11-18 22:54   ` sashiko-bot
2026-11-18 22:37 ` [PATCH 09/11] drm/amdgpu: add UAPI to create user queue gangs Alex Deucher
2026-11-20  5:15   ` Mohan Marimuthu, Yogesh
2026-11-20 19:28     ` Alex Deucher
2026-11-18 22:37 ` [PATCH 10/11] drm/amdgpu/userq: enable support for creating gangs Alex Deucher
2026-11-18 22:58   ` sashiko-bot
2026-11-18 22:37 ` [PATCH 11/11] drm/amdgpu: bump driver version for userq updates Alex Deucher
2026-11-18 23:04 ` sashiko-bot [this message]

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-222141@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=alexander.deucher@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.