mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
accel/amdxdna: Reject device heap BO when dev_mem_size is not set
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: d76856beb4 ("accel/amdxdna: Refactor GEM BO handling and add helper APIs for address retrieval")
Signed-off-by: David Zhang <yidong.zhang@amd.com>
Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20261008232416.2646054-1-yidong.zhang@amd.com
This commit is contained in:
parent
fc9370d7b1
commit
3e32932d36
|
|
@ -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)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user