Applied to drm-misc-next 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 <[email protected]> --- 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); + } + 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)) {
