trusty-virtio: Update dma_map_ops callbacks to physical addresses Update trusty-virtio to match the physical address DMA APIs from https://lore.kernel.org/all/[email protected]/ and https://lore.kernel.org/all/[email protected]/ Bug: 474509114 Change-Id: I3285c627983ff38c338bea5618530f493e2b10d5 Signed-off-by: Andrei Homescu <[email protected]>
diff --git a/drivers/trusty/trusty-virtio.c b/drivers/trusty/trusty-virtio.c index 2e1c0e4..0a2588f 100644 --- a/drivers/trusty/trusty-virtio.c +++ b/drivers/trusty/trusty-virtio.c
@@ -826,19 +826,33 @@ return ret; } +#if (KERNEL_VERSION(6, 19, 0) > LINUX_VERSION_CODE) static dma_addr_t trusty_virtio_dma_map_page(struct device *dev, struct page *page, - unsigned long offset, size_t size, + unsigned long offset, +#else +static dma_addr_t trusty_virtio_dma_map_phys(struct device *dev, + phys_addr_t phys, +#endif + size_t size, enum dma_data_direction dir, unsigned long attrs) { +#if (KERNEL_VERSION(6, 19, 0) > LINUX_VERSION_CODE) struct tipc_msg_buf *buf = page_to_virt(page) + offset; +#else + struct tipc_msg_buf *buf = phys_to_virt(phys); +#endif return buf->buf_id; } /* The kernel requires this to exist, but doesn't require it do anything */ +#if (KERNEL_VERSION(6, 19, 0) > LINUX_VERSION_CODE) static void trusty_virtio_dma_unmap_page(struct device *dev, +#else +static void trusty_virtio_dma_unmap_phys(struct device *dev, +#endif dma_addr_t dma_handle, size_t size, enum dma_data_direction dir, @@ -871,8 +885,13 @@ } static const struct dma_map_ops trusty_virtio_dma_map_ops = { +#if (KERNEL_VERSION(6, 19, 0) > LINUX_VERSION_CODE) .map_page = trusty_virtio_dma_map_page, .unmap_page = trusty_virtio_dma_unmap_page, +#else + .map_phys = trusty_virtio_dma_map_phys, + .unmap_phys = trusty_virtio_dma_unmap_phys, +#endif .map_sg = trusty_virtio_dma_map_sg, .unmap_sg = trusty_virtio_dma_unmap_sg, };