[PATCH net-next v2 16/18] MIPS: mobileye: add EyeQ5 DMA IOCU support

Simon Horman horms at kernel.org
Fri Jun 27 12:15:55 PDT 2025


On Fri, Jun 27, 2025 at 11:09:02AM +0200, Théo Lebrun wrote:
> Both Cadence GEM Ethernet controllers on EyeQ5 are hardwired through CM3
> IO Coherency Units (IOCU). For DMA coherent accesses, BIT(36) must be
> set in DMA addresses.
> 
> Implement that in platform-specific dma_map_ops which get attached to
> both instances of `cdns,eyeq5-gem` through a notifier block.
> 
> Signed-off-by: Théo Lebrun <theo.lebrun at bootlin.com>

...

> diff --git a/arch/mips/mobileye/eyeq5-iocu-dma.c b/arch/mips/mobileye/eyeq5-iocu-dma.c

...

> +const struct dma_map_ops eyeq5_iocu_ops = {
> +	.alloc			= eyeq5_iocu_alloc,
> +	.free			= eyeq5_iocu_free,
> +	.alloc_pages_op		= dma_direct_alloc_pages,
> +	.free_pages		= dma_direct_free_pages,
> +	.mmap			= eyeq5_iocu_mmap,
> +	.get_sgtable		= eyeq5_iocu_get_sgtable,
> +	.map_page		= eyeq5_iocu_map_page,
> +	.unmap_page		= eyeq5_iocu_unmap_page,
> +	.map_sg			= eyeq5_iocu_map_sg,
> +	.unmap_sg		= eyeq5_iocu_unmap_sg,
> +	.get_required_mask	= dma_direct_get_required_mask,
> +};
> +EXPORT_SYMBOL(eyeq5_iocu_ops);

Hi Théo,

Does eyeq5_iocu_ops need to be exported?
If so it should probably be declared in a header file somewhere.
But I if not probably the EXPORT_SYMBOL line should be
dropped, and the structure made static.

Flagged by Sparse.

> +
> +static int eyeq5_iocu_notifier(struct notifier_block *nb,
> +			       unsigned long event,
> +			       void *data)
> +{
> +	struct device *dev = data;
> +
> +	/*
> +	 * IOCU routing is hardwired; we must use our above custom
> +	 * routines for cache-coherent DMA on ethernet interfaces.
> +	 */
> +	if (event == BUS_NOTIFY_ADD_DEVICE &&
> +	    device_is_compatible(dev, "mobileye,eyeq5-gem")) {
> +		set_dma_ops(dev, &eyeq5_iocu_ops);
> +		return NOTIFY_OK;
> +	}
> +
> +	return NOTIFY_DONE;
> +}

...



More information about the linux-riscv mailing list