Message ID | 34542c9552ce8cd12a5c292e79589acd964075d5.1730136799.git.robin.murphy@arm.com |
---|---|
State | New |
Headers | show |
Series | Fix omap-iommu bitrot | expand |
Hi On Mon, Oct 28, 2024 at 05:58:36PM +0000, Robin Murphy wrote: > It's no longer practical for the OMAP IOMMU driver to trick > arm_setup_iommu_dma_ops() into ignoring its presence, so let's use the > same tactic as other IOMMU API users on 32-bit ARM and explicitly kick > the arch code's dma_iommu_mapping out of the way to avoid problems. > > Fixes: 4720287c7bf7 ("iommu: Remove struct iommu_ops *iommu from arch_setup_dma_ops()") > Signed-off-by: Robin Murphy <robin.murphy@arm.com> > --- > drivers/media/platform/ti/omap3isp/isp.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/drivers/media/platform/ti/omap3isp/isp.c b/drivers/media/platform/ti/omap3isp/isp.c > index 91101ba88ef0..b2210841a320 100644 > --- a/drivers/media/platform/ti/omap3isp/isp.c > +++ b/drivers/media/platform/ti/omap3isp/isp.c > @@ -1961,6 +1961,13 @@ static int isp_attach_iommu(struct isp_device *isp) > struct dma_iommu_mapping *mapping; > int ret; > > + /* We always want to replace any default mapping from the arch code */ > + mapping = to_dma_iommu_mapping(isp->dev); > + if (mapping) { > + arm_iommu_detach_device(isp->dev); > + arm_iommu_release_mapping(mapping); > + } > + > /* > * Create the ARM mapping, used by the ARM DMA mapping core to allocate > * VAs. This will allocate a corresponding IOMMU domain. > -- > 2.39.2.101.g768bb238c484.dirty > I have finally found time to test this patch on the Nokia N900 and can confirm it is working fine. I was wondering - is there a reason that it is not merged yet? I tested on 6.14-rc2, which did not have it, and notice it is also not in linux-next. If it helps: Tested-by: Sicelo A. Mhlongo <absicsz@gmail.com>
CC'ing Sakari. Sakari, would you pick this patch ? On Sat, Feb 15, 2025 at 08:57:24AM +0200, Sicelo wrote: > On Mon, Oct 28, 2024 at 05:58:36PM +0000, Robin Murphy wrote: > > It's no longer practical for the OMAP IOMMU driver to trick > > arm_setup_iommu_dma_ops() into ignoring its presence, so let's use the > > same tactic as other IOMMU API users on 32-bit ARM and explicitly kick > > the arch code's dma_iommu_mapping out of the way to avoid problems. > > > > Fixes: 4720287c7bf7 ("iommu: Remove struct iommu_ops *iommu from arch_setup_dma_ops()") > > Signed-off-by: Robin Murphy <robin.murphy@arm.com> > > --- > > drivers/media/platform/ti/omap3isp/isp.c | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/drivers/media/platform/ti/omap3isp/isp.c b/drivers/media/platform/ti/omap3isp/isp.c > > index 91101ba88ef0..b2210841a320 100644 > > --- a/drivers/media/platform/ti/omap3isp/isp.c > > +++ b/drivers/media/platform/ti/omap3isp/isp.c > > @@ -1961,6 +1961,13 @@ static int isp_attach_iommu(struct isp_device *isp) > > struct dma_iommu_mapping *mapping; > > int ret; > > > > + /* We always want to replace any default mapping from the arch code */ > > + mapping = to_dma_iommu_mapping(isp->dev); > > + if (mapping) { > > + arm_iommu_detach_device(isp->dev); > > + arm_iommu_release_mapping(mapping); > > + } > > + > > /* > > * Create the ARM mapping, used by the ARM DMA mapping core to allocate > > * VAs. This will allocate a corresponding IOMMU domain. > > -- > > 2.39.2.101.g768bb238c484.dirty > > > > I have finally found time to test this patch on the Nokia N900 and can > confirm it is working fine. > > I was wondering - is there a reason that it is not merged yet? I tested > on 6.14-rc2, which did not have it, and notice it is also not in > linux-next. > > If it helps: > > Tested-by: Sicelo A. Mhlongo <absicsz@gmail.com>
diff --git a/drivers/media/platform/ti/omap3isp/isp.c b/drivers/media/platform/ti/omap3isp/isp.c index 91101ba88ef0..b2210841a320 100644 --- a/drivers/media/platform/ti/omap3isp/isp.c +++ b/drivers/media/platform/ti/omap3isp/isp.c @@ -1961,6 +1961,13 @@ static int isp_attach_iommu(struct isp_device *isp) struct dma_iommu_mapping *mapping; int ret; + /* We always want to replace any default mapping from the arch code */ + mapping = to_dma_iommu_mapping(isp->dev); + if (mapping) { + arm_iommu_detach_device(isp->dev); + arm_iommu_release_mapping(mapping); + } + /* * Create the ARM mapping, used by the ARM DMA mapping core to allocate * VAs. This will allocate a corresponding IOMMU domain.
It's no longer practical for the OMAP IOMMU driver to trick arm_setup_iommu_dma_ops() into ignoring its presence, so let's use the same tactic as other IOMMU API users on 32-bit ARM and explicitly kick the arch code's dma_iommu_mapping out of the way to avoid problems. Fixes: 4720287c7bf7 ("iommu: Remove struct iommu_ops *iommu from arch_setup_dma_ops()") Signed-off-by: Robin Murphy <robin.murphy@arm.com> --- drivers/media/platform/ti/omap3isp/isp.c | 7 +++++++ 1 file changed, 7 insertions(+)