]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
accel/amdxdna: Support read-only user-pointer BO mappings
authorMax Zhen <max.zhen@amd.com>
Tue, 31 Mar 2026 17:26:35 +0000 (10:26 -0700)
committerLizhi Hou <lizhi.hou@amd.com>
Thu, 2 Apr 2026 05:19:58 +0000 (22:19 -0700)
commitf649e63d4a6423eda8eb208638849fd6396aedd7
treedd26dd96c3f86403975b969b7857dd05c4b35a61
parent43c9a66ea129cc5fd5d8920700ea75f4a6c42942
accel/amdxdna: Support read-only user-pointer BO mappings

Update the amdxdna user-pointer (ubuf) BO path to support creating buffer
objects from read-only user mappings.

Detect read-only VMAs by checking VMA permissions across all user virtual
address ranges associated with the BO. When all entries are read-only, pin
user pages without FOLL_WRITE and export the resulting dmabuf as read-only
(O_RDONLY).

This allows userptr BOs backed by read-only mappings to be safely imported
and used without requiring write access, which was previously rejected due
to unconditional FOLL_WRITE usage.

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Signed-off-by: Max Zhen <max.zhen@amd.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260331172635.3275296-1-lizhi.hou@amd.com
drivers/accel/amdxdna/amdxdna_ubuf.c