Re: [PATCH 2/4] dmaengine: sh: rcar-dmac: SMMU doesn't need IPMMU workaround

Frank Li <[email protected]>
Newsgroups org.kernel.vger.linux-renesas-soc,org.kernel.vger.dmaengine
Message-ID <ao220Qqu23yeq1hb@SMW015318>
On Tue, Aug 25, 2026 at 04:15:44PM +0200, Wolfram Sang wrote:
> R-Car Gen5 doesn't use an IPMMU anymore, but a SMMU. So, the workaround
> for the IPMMU becomes optional. Add a flag to distinguish. No functional
> change.
>
> Signed-off-by: Wolfram Sang <[email protected]>
> ---
>  drivers/dma/sh/rcar-dmac.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/sh/rcar-dmac.c b/drivers/dma/sh/rcar-dmac.c
> index cf07c17847d0..9c5210257097 100644
> --- a/drivers/dma/sh/rcar-dmac.c
> +++ b/drivers/dma/sh/rcar-dmac.c
> @@ -219,10 +219,12 @@ struct rcar_dmac {
>   * struct rcar_dmac_of_data - This driver's OF data
>   * @chan_offset_base: DMAC channels base offset
>   * @chan_offset_stride: DMAC channels offset stride
> + * @has_ipmmu: flag telling if DMAC is connected to an IPMMU
>   */
>  struct rcar_dmac_of_data {
>  	u32 chan_offset_base;
>  	u32 chan_offset_stride;
> +	unsigned int has_ipmmu:1;

Nit: most similar case use bool

Reviewed-by: Frank Li <[email protected]>

>  };
>
>  /* -----------------------------------------------------------------------------
> @@ -1877,8 +1879,9 @@ static int rcar_dmac_probe(struct platform_device *pdev)
>  	 * can't use it with the IPMMU. As the IOMMU API operates at the device
>  	 * level we can't disable it selectively, so ignore channel 0 for now if
>  	 * the device is part of an IOMMU group.
> +	 * Not applicable if system uses something else than IPMMU like SMMU.
>  	 */
> -	if (device_iommu_mapped(&pdev->dev))
> +	if (data->has_ipmmu && device_iommu_mapped(&pdev->dev))
>  		dmac->channels_mask &= ~BIT(0);
>
>  	dmac->channels = devm_kcalloc(&pdev->dev, dmac->n_channels,
> @@ -2000,11 +2003,13 @@ static void rcar_dmac_shutdown(struct platform_device *pdev)
>  static const struct rcar_dmac_of_data rcar_dmac_data = {
>  	.chan_offset_base = 0x8000,
>  	.chan_offset_stride = 0x80,
> +	.has_ipmmu = 1,
>  };
>
>  static const struct rcar_dmac_of_data rcar_gen4_dmac_data = {
>  	.chan_offset_base = 0x0,
>  	.chan_offset_stride = 0x1000,
> +	.has_ipmmu = 1,
>  };
>
>  static const struct of_device_id rcar_dmac_of_ids[] = {
> --
> 2.47.3
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.