From: Mario Limonciello <mario.limonciello@amd.com>
To: Dan Carpenter <dan.carpenter@linaro.org>,
Jesse Zhang <jesse.zhang@amd.com>
Cc: "Alex Deucher" <alexander.deucher@amd.com>,
"Christian König" <christian.koenig@amd.com>,
"Xinhui Pan" <Xinhui.Pan@amd.com>,
"David Airlie" <airlied@gmail.com>,
"Simona Vetter" <simona@ffwll.ch>,
"Hawking Zhang" <Hawking.Zhang@amd.com>,
"Tim Huang" <tim.huang@amd.com>, "Likun Gao" <Likun.Gao@amd.com>,
"Yang Wang" <kevinyang.wang@amd.com>, "Le Ma" <le.ma@amd.com>,
amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] drm/amdgpu: Fix shift type in amdgpu_debugfs_sdma_sched_mask_set()
Date: Wed, 8 Jan 2025 12:39:38 -0600 [thread overview]
Message-ID: <4372d931-865f-4b91-8122-fa5cd1b554f2@amd.com> (raw)
In-Reply-To: <d39a9325-87a4-4543-b6ec-1c61fca3a6fc@stanley.mountain>
On 1/8/2025 03:41, Dan Carpenter wrote:
> The "mask" and "val" variables are type u64. The problem is that the
> BIT() macros are type unsigned long which is just 32 bits on 32bit
> systems.
>
> It's unlikely that people will be using this driver on 32bit kernels
> and even if they did we only use the lower AMDGPU_MAX_SDMA_INSTANCES (16)
> bits. So this bug does not affect anything in real life.
>
> Still, for correctness sake, u64 bit masks should use BIT_ULL().
>
> Fixes: d2e3961ae371 ("drm/amdgpu: add amdgpu_sdma_sched_mask debugfs")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
Applied, thanks!
> drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> index 632295bf3875..174badca27e7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
> @@ -362,13 +362,13 @@ static int amdgpu_debugfs_sdma_sched_mask_set(void *data, u64 val)
> if (!adev)
> return -ENODEV;
>
> - mask = (1 << adev->sdma.num_instances) - 1;
> + mask = BIT_ULL(adev->sdma.num_instances) - 1;
> if ((val & mask) == 0)
> return -EINVAL;
>
> for (i = 0; i < adev->sdma.num_instances; ++i) {
> ring = &adev->sdma.instance[i].ring;
> - if (val & (1 << i))
> + if (val & BIT_ULL(i))
> ring->sched.ready = true;
> else
> ring->sched.ready = false;
prev parent reply other threads:[~2025-01-08 18:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-08 9:41 Dan Carpenter
2025-01-08 18:39 ` Mario Limonciello [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=4372d931-865f-4b91-8122-fa5cd1b554f2@amd.com \
--to=mario.limonciello@amd.com \
--cc=Hawking.Zhang@amd.com \
--cc=Likun.Gao@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dan.carpenter@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jesse.zhang@amd.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kevinyang.wang@amd.com \
--cc=le.ma@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=simona@ffwll.ch \
--cc=tim.huang@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
all inboxes | Powered by JetHome®