From: Lizhi Hou <lizhi.hou@amd.com>
To: David Zhang <yidong.zhang@amd.com>, <quic_jhugo@quicinc.com>,
<karol.wachowski@linux.intel.com>, <max.zhen@amd.com>,
<ogabbay@kernel.org>, <dri-devel@lists.freedesktop.org>,
<linux-kernel@vger.kernel.org>
Cc: <sonal.santan@amd.com>, <mario.limonciello@amd.com>
Subject: Re: [PATCH] accel/amdxdna: Reject device heap BO when dev_mem_size is not set
Date: Fri, 9 Oct 2026 08:57:32 -0700 [thread overview]
Message-ID: <bcbfc6c2-705e-ec35-6543-ae5e6ecaab6b@amd.com> (raw)
In-Reply-To: <20261008232416.2646054-1-yidong.zhang@amd.com>
On 10/8/26 16:24, David Zhang wrote:
> NPU3 devices do not set dev_mem_size, since they do not use a device
> heap. Creating an AMDXDNA_BO_DEV_HEAP BO on such a device hits the
> WARN_ON(!is_power_of_2(dev_mem_size)) check, which any user with
> access to the device node can trigger.
>
> Return -EOPNOTSUPP when dev_mem_size is 0.
>
> Fixes: d76856beb4a4 ("accel/amdxdna: Refactor GEM BO handling and add helper APIs for address retrieval")
> Signed-off-by: David Zhang <yidong.zhang@amd.com>
> ---
> drivers/accel/amdxdna/amdxdna_gem.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/accel/amdxdna/amdxdna_gem.c b/drivers/accel/amdxdna/amdxdna_gem.c
> index f4832337ec31..f14484bc31ec 100644
> --- a/drivers/accel/amdxdna/amdxdna_gem.c
> +++ b/drivers/accel/amdxdna/amdxdna_gem.c
> @@ -1140,6 +1140,11 @@ amdxdna_drm_create_dev_heap_bo(struct drm_device *dev,
> struct amdxdna_gem_obj *abo;
> int ret;
>
> + if (!xdna->dev_info->dev_mem_size) {
> + XDNA_DBG(xdna, "Device heap is not supported");
> + return ERR_PTR(-EOPNOTSUPP);
> + }
> +
Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
> WARN_ON(!is_power_of_2(xdna->dev_info->dev_mem_size));
> XDNA_DBG(xdna, "Requested dev heap size 0x%llx", args->size);
> if (!args->size || !IS_ALIGNED(args->size, xdna->dev_info->dev_mem_size)) {
prev parent reply other threads:[~2026-10-09 15:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 23:24 David Zhang
2026-10-09 15:57 ` Lizhi Hou [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=bcbfc6c2-705e-ec35-6543-ae5e6ecaab6b@amd.com \
--to=lizhi.hou@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=karol.wachowski@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@amd.com \
--cc=max.zhen@amd.com \
--cc=ogabbay@kernel.org \
--cc=quic_jhugo@quicinc.com \
--cc=sonal.santan@amd.com \
--cc=yidong.zhang@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®