linux/drivers/accel/amdxdna
Taimuraz Kaitmazov 0ba8e0f900 accel/amdxdna: refuse to flush an imported BO
SYNC_BO clflushes an imported BO's scatterlist. An importer may not do
that: the memory belongs to the exporter, and dma-buf gives the importer
no interface to ask for maintenance on it. Refuse the request instead.

is_import_bo() is (obj)->attach, which covers more than foreign buffers.
A userptr BO arrives through a ubuf, and on a carveout device every share
BO and the device heap arrive through a cbuf, so SYNC_BO answers
-EOPNOTSUPP for those too, including the AMDXDNA_BO_DEV path that flushes
through its heap.

Only the ubuf case gives up maintenance it was getting: on a 64 MiB
userptr BO a 4 KiB sync and a full sync both cost 659 us, this arm having
ignored the range. amdxdna_cbuf_map() fills in only the DMA address and
length, so drm_clflush_sg() already walks zero pages on carveout memory.
Userspace maintains these through the mapping it already holds, as XRT's
buffer::sync() does unless it is told to sync through the driver.

Fixes: dbc8fd7a03 ("accel/amdxdna: Add expandable device heap support")
Reported-by: Christian König <christian.koenig@amd.com>
Link: https://lore.kernel.org/dri-devel/a505f9e5-b416-43e9-934d-c5c29b8a70e9@amd.com/
Suggested-by: Lizhi Hou <lizhi.hou@amd.com>
Signed-off-by: Taimuraz Kaitmazov <taimuraz@kaitmazov.com>
Reviewed-by: Lizhi Hou <lizhi.hou@amd.com>
Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Link: https://patch.msgid.link/20260819224458.257346-5-taimuraz@kaitmazov.com
2026-09-01 11:19:33 -07:00
..
aie_psp.c accel/amdxdna: Add AIE4 firmware loading 2026-04-01 10:27:42 -07:00
aie_smu.c accel/amdxdna: Create common SMU interfaces for AIE2 and AIE4 2026-04-01 10:44:51 -07:00
aie.c accel/amdxdna: Add AIE4 work buffer initialization 2026-05-07 14:09:33 -07:00
aie.h accel/amdxdna: Add AIE4 work buffer initialization 2026-05-07 14:09:33 -07:00
aie2_ctx.c mm.git review status for mm-hotfixes-stable..mm-stable 2026-08-20 18:17:08 -07:00
aie2_error.c accel/amdxdna: Add AIE4 work buffer initialization 2026-05-07 14:09:33 -07:00
aie2_message.c accel/amdxdna: reject a command chain that carries no commands 2026-08-24 09:29:47 -07:00
aie2_msg_priv.h accel/amdxdna: Add expandable device heap support 2026-05-18 16:03:57 -07:00
aie2_pci.c accel/amdxdna: Fix command timeout race 2026-07-19 18:23:40 -07:00
aie2_pci.h accel/amdxdna: Fix command timeout race 2026-07-19 18:23:40 -07:00
aie2_pm.c accel/amdxdna: Add configuring low and medium power mode 2026-04-27 09:04:51 -07:00
aie2_solver.c accel/amdxdna: Set default DPM level based on QoS for temporal-only mode 2026-04-27 09:04:34 -07:00
aie2_solver.h accel/amdxdna: Enhance power management settings 2024-12-16 15:50:32 -06:00
aie4_ctx.c accel/amdxdna: Add command doorbell and wait support 2026-05-07 14:07:34 -07:00
aie4_host_queue.h accel/amdxdna: Add command doorbell and wait support 2026-05-07 14:07:34 -07:00
aie4_message.c accel/amdxdna: Add AIE4 work buffer initialization 2026-05-07 14:09:33 -07:00
aie4_msg_priv.h accel/amdxdna: Add AIE4 work buffer initialization 2026-05-07 14:09:33 -07:00
aie4_pci.c accel/amdxdna: Add AIE4 work buffer initialization 2026-05-07 14:09:33 -07:00
aie4_pci.h accel/amdxdna: Add AIE4 work buffer initialization 2026-05-07 14:09:33 -07:00
aie4_sriov.c accel/amdxdna: Add basic support for AIE4 devices 2026-04-01 10:11:53 -07:00
amdxdna_cbuf.c accel/amdxdna: Add carveout memory support for non-IOMMU systems 2026-05-05 08:27:04 -07:00
amdxdna_cbuf.h accel/amdxdna: Add carveout memory support for non-IOMMU systems 2026-05-05 08:27:04 -07:00
amdxdna_ctx.c accel/amdxdna: put the chained BO when its mapping fails 2026-08-24 09:29:52 -07:00
amdxdna_ctx.h accel/amdxdna: Remove __counted_by from struct amdxdna_cmd_chain 2026-08-24 09:29:41 -07:00
amdxdna_debugfs.c accel/amdxdna: Add carveout memory support for non-IOMMU systems 2026-05-05 08:27:04 -07:00
amdxdna_debugfs.h accel/amdxdna: Add carveout memory support for non-IOMMU systems 2026-05-05 08:27:04 -07:00
amdxdna_error.h accel/amdxdna: Support getting last hardware error 2025-10-16 09:32:48 -07:00
amdxdna_gem.c accel/amdxdna: refuse to flush an imported BO 2026-09-01 11:19:33 -07:00
amdxdna_gem.h accel/amdxdna: Fix potential NULL pointer dereference of abo->client 2026-07-07 20:49:28 -07:00
amdxdna_iommu.c accel/amdxdna: Fix iommu domain lifetime race during device removal 2026-06-29 10:44:03 -07:00
amdxdna_mailbox_helper.c accel/amdxdna: Remove casting mailbox payload pointer 2025-01-13 14:21:39 -06:00
amdxdna_mailbox_helper.h accel/amdxdna: Add IOCTL parameter for telemetry data 2025-11-04 09:04:21 -08:00
amdxdna_mailbox.c accel/amdxdna: Improve tracing for job lifecycle and mailbox RX worker 2026-04-22 08:35:21 -07:00
amdxdna_mailbox.h accel/amdxdna: Add basic support for AIE4 devices 2026-04-01 10:11:53 -07:00
amdxdna_pci_drv.c accel/amdxdna: Check init_srcu_struct() return value 2026-07-07 20:49:19 -07:00
amdxdna_pci_drv.h accel/amdxdna: Fix amdxdna_client lifetime race during device removal 2026-06-29 10:33:30 -07:00
amdxdna_pm.c accel/amdxdna: Fix dead lock for suspend and resume 2026-02-23 09:24:17 -08:00
amdxdna_pm.h accel/amdxdna: Fix dead lock for suspend and resume 2026-02-23 09:24:17 -08:00
amdxdna_sysfs.c accel/amdxdna: Get device revision to derive VBNV string 2026-04-17 09:13:40 -07:00
amdxdna_ubuf.c Merge drm/drm-next into drm-misc-next 2026-05-28 11:27:53 +02:00
amdxdna_ubuf.h accel/amdxdna: Refactor GEM BO handling and add helper APIs for address retrieval 2026-03-20 22:12:49 -07:00
Kconfig accel/amdxdna: Add a new driver for AMD AI Engine 2024-11-22 11:41:26 -07:00
Makefile accel/amdxdna: Add AIE4 VF hardware context create and destroy 2026-05-07 14:07:34 -07:00
npu1_regs.c accel/amdxdna: Add expandable device heap support 2026-05-18 16:03:57 -07:00
npu3_regs.c accel/amdxdna: Add command doorbell and wait support 2026-05-07 14:07:34 -07:00
npu4_regs.c accel/amdxdna: Add expandable device heap support 2026-05-18 16:03:57 -07:00
npu5_regs.c accel/amdxdna: Add expandable device heap support 2026-05-18 16:03:57 -07:00
npu6_regs.c accel/amdxdna: Add expandable device heap support 2026-05-18 16:03:57 -07:00
TODO accel/amdxdna: Support firmware debug buffer 2025-10-20 09:07:12 -07:00