Re: [PATCH v5 5/9] iommu/arm-smmu: Attach to host1x context device bus
On Mon, May 16, 2022 at 02:20:18PM +0300, Mikko Perttunen wrote: > On 5/16/22 13:44, Robin Murphy wrote: > > On 2022-05-16 11:13, Mikko Perttunen wrote: > > > On 5/16/22 13:07, Will Deacon wrote: > > > > On Mon, May 16, 2022 at 11:52:54AM +0300, cyn...@kapsi.fi wrote: > > > > > From: Mikko Perttunen > > > > > > > > > > Set itself as the IOMMU for the host1x context device bus, containing > > > > > "dummy" devices used for Host1x context isolation. > > > > > > > > > > Signed-off-by: Mikko Perttunen > > > > > --- > > > > > drivers/iommu/arm/arm-smmu/arm-smmu.c | 13 + > > > > > 1 file changed, 13 insertions(+) > > > > > > > > > > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c > > > > > b/drivers/iommu/arm/arm-smmu/arm-smmu.c > > > > > index 568cce590ccc..9ff54eaecf81 100644 > > > > > --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c > > > > > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c > > > > > @@ -39,6 +39,7 @@ > > > > > #include > > > > > #include > > > > > +#include > > > > > #include "arm-smmu.h" > > > > > @@ -2053,8 +2054,20 @@ static int arm_smmu_bus_init(struct > > > > > iommu_ops *ops) > > > > > goto err_reset_pci_ops; > > > > > } > > > > > #endif > > > > > +#ifdef CONFIG_TEGRA_HOST1X_CONTEXT_BUS > > > > > + if (!iommu_present(_context_device_bus_type)) { > > > > > + err = bus_set_iommu(_context_device_bus_type, ops); > > > > > + if (err) > > > > > + goto err_reset_fsl_mc_ops; > > > > > + } > > > > > +#endif > > > > > + > > > > > return 0; > > > > > +err_reset_fsl_mc_ops: __maybe_unused; > > > > > +#ifdef CONFIG_FSL_MC_BUS > > > > > + bus_set_iommu(_mc_bus_type, NULL); > > > > > +#endif > > > > > > > > bus_set_iommu() is going away: > > > > > > > > https://lore.kernel.org/r/cover.1650890638.git.robin.mur...@arm.com > > > > > > > > Will > > > > > > Thanks for the heads-up. Robin had pointed out that this work was > > > ongoing but I hadn't seen the patches yet. I'll look into it. > > > > Although that *is* currently blocked on the mystery intel-iommu problem > > that I can't reproduce... If this series is ready to land right now for > > 5.19 then in principle that might be the easiest option overall. > > Hopefully at least patch #2 could sneak in so that the compile-time > > dependencies are ready for me to roll up host1x into the next rebase of > > "iommu: Always register bus notifiers". > > > > Cheers, > > Robin. > > My guess is that the series as a whole is not ready to land in the 5.19 > timeframe, but #2 could be possible. > > Thierry, any opinion? Dave and Daniel typically want new material to be in by -rc6 and I've already sent the PR for this cycle. I can ask them if they'd take another one, though, if it make things simpler for the next cycle. Thierry signature.asc Description: PGP signature
Re: [PATCH v5 5/9] iommu/arm-smmu: Attach to host1x context device bus
On 5/16/22 13:44, Robin Murphy wrote: On 2022-05-16 11:13, Mikko Perttunen wrote: On 5/16/22 13:07, Will Deacon wrote: On Mon, May 16, 2022 at 11:52:54AM +0300, cyn...@kapsi.fi wrote: From: Mikko Perttunen Set itself as the IOMMU for the host1x context device bus, containing "dummy" devices used for Host1x context isolation. Signed-off-by: Mikko Perttunen --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index 568cce590ccc..9ff54eaecf81 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -39,6 +39,7 @@ #include #include +#include #include "arm-smmu.h" @@ -2053,8 +2054,20 @@ static int arm_smmu_bus_init(struct iommu_ops *ops) goto err_reset_pci_ops; } #endif +#ifdef CONFIG_TEGRA_HOST1X_CONTEXT_BUS + if (!iommu_present(_context_device_bus_type)) { + err = bus_set_iommu(_context_device_bus_type, ops); + if (err) + goto err_reset_fsl_mc_ops; + } +#endif + return 0; +err_reset_fsl_mc_ops: __maybe_unused; +#ifdef CONFIG_FSL_MC_BUS + bus_set_iommu(_mc_bus_type, NULL); +#endif bus_set_iommu() is going away: https://lore.kernel.org/r/cover.1650890638.git.robin.mur...@arm.com Will Thanks for the heads-up. Robin had pointed out that this work was ongoing but I hadn't seen the patches yet. I'll look into it. Although that *is* currently blocked on the mystery intel-iommu problem that I can't reproduce... If this series is ready to land right now for 5.19 then in principle that might be the easiest option overall. Hopefully at least patch #2 could sneak in so that the compile-time dependencies are ready for me to roll up host1x into the next rebase of "iommu: Always register bus notifiers". Cheers, Robin. My guess is that the series as a whole is not ready to land in the 5.19 timeframe, but #2 could be possible. Thierry, any opinion? Thanks, Mikko
Re: [PATCH v5 5/9] iommu/arm-smmu: Attach to host1x context device bus
On 2022-05-16 11:13, Mikko Perttunen wrote: On 5/16/22 13:07, Will Deacon wrote: On Mon, May 16, 2022 at 11:52:54AM +0300, cyn...@kapsi.fi wrote: From: Mikko Perttunen Set itself as the IOMMU for the host1x context device bus, containing "dummy" devices used for Host1x context isolation. Signed-off-by: Mikko Perttunen --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index 568cce590ccc..9ff54eaecf81 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -39,6 +39,7 @@ #include #include +#include #include "arm-smmu.h" @@ -2053,8 +2054,20 @@ static int arm_smmu_bus_init(struct iommu_ops *ops) goto err_reset_pci_ops; } #endif +#ifdef CONFIG_TEGRA_HOST1X_CONTEXT_BUS + if (!iommu_present(_context_device_bus_type)) { + err = bus_set_iommu(_context_device_bus_type, ops); + if (err) + goto err_reset_fsl_mc_ops; + } +#endif + return 0; +err_reset_fsl_mc_ops: __maybe_unused; +#ifdef CONFIG_FSL_MC_BUS + bus_set_iommu(_mc_bus_type, NULL); +#endif bus_set_iommu() is going away: https://lore.kernel.org/r/cover.1650890638.git.robin.mur...@arm.com Will Thanks for the heads-up. Robin had pointed out that this work was ongoing but I hadn't seen the patches yet. I'll look into it. Although that *is* currently blocked on the mystery intel-iommu problem that I can't reproduce... If this series is ready to land right now for 5.19 then in principle that might be the easiest option overall. Hopefully at least patch #2 could sneak in so that the compile-time dependencies are ready for me to roll up host1x into the next rebase of "iommu: Always register bus notifiers". Cheers, Robin.
Re: [PATCH v5 5/9] iommu/arm-smmu: Attach to host1x context device bus
On 5/16/22 13:07, Will Deacon wrote: On Mon, May 16, 2022 at 11:52:54AM +0300, cyn...@kapsi.fi wrote: From: Mikko Perttunen Set itself as the IOMMU for the host1x context device bus, containing "dummy" devices used for Host1x context isolation. Signed-off-by: Mikko Perttunen --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index 568cce590ccc..9ff54eaecf81 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -39,6 +39,7 @@ #include #include +#include #include "arm-smmu.h" @@ -2053,8 +2054,20 @@ static int arm_smmu_bus_init(struct iommu_ops *ops) goto err_reset_pci_ops; } #endif +#ifdef CONFIG_TEGRA_HOST1X_CONTEXT_BUS + if (!iommu_present(_context_device_bus_type)) { + err = bus_set_iommu(_context_device_bus_type, ops); + if (err) + goto err_reset_fsl_mc_ops; + } +#endif + return 0; +err_reset_fsl_mc_ops: __maybe_unused; +#ifdef CONFIG_FSL_MC_BUS + bus_set_iommu(_mc_bus_type, NULL); +#endif bus_set_iommu() is going away: https://lore.kernel.org/r/cover.1650890638.git.robin.mur...@arm.com Will Thanks for the heads-up. Robin had pointed out that this work was ongoing but I hadn't seen the patches yet. I'll look into it. Mikko
Re: [PATCH v5 5/9] iommu/arm-smmu: Attach to host1x context device bus
On Mon, May 16, 2022 at 11:52:54AM +0300, cyn...@kapsi.fi wrote: > From: Mikko Perttunen > > Set itself as the IOMMU for the host1x context device bus, containing > "dummy" devices used for Host1x context isolation. > > Signed-off-by: Mikko Perttunen > --- > drivers/iommu/arm/arm-smmu/arm-smmu.c | 13 + > 1 file changed, 13 insertions(+) > > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c > b/drivers/iommu/arm/arm-smmu/arm-smmu.c > index 568cce590ccc..9ff54eaecf81 100644 > --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c > @@ -39,6 +39,7 @@ > > #include > #include > +#include > > #include "arm-smmu.h" > > @@ -2053,8 +2054,20 @@ static int arm_smmu_bus_init(struct iommu_ops *ops) > goto err_reset_pci_ops; > } > #endif > +#ifdef CONFIG_TEGRA_HOST1X_CONTEXT_BUS > + if (!iommu_present(_context_device_bus_type)) { > + err = bus_set_iommu(_context_device_bus_type, ops); > + if (err) > + goto err_reset_fsl_mc_ops; > + } > +#endif > + > return 0; > > +err_reset_fsl_mc_ops: __maybe_unused; > +#ifdef CONFIG_FSL_MC_BUS > + bus_set_iommu(_mc_bus_type, NULL); > +#endif bus_set_iommu() is going away: https://lore.kernel.org/r/cover.1650890638.git.robin.mur...@arm.com Will >
[PATCH v5 5/9] iommu/arm-smmu: Attach to host1x context device bus
From: Mikko Perttunen Set itself as the IOMMU for the host1x context device bus, containing "dummy" devices used for Host1x context isolation. Signed-off-by: Mikko Perttunen --- drivers/iommu/arm/arm-smmu/arm-smmu.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c b/drivers/iommu/arm/arm-smmu/arm-smmu.c index 568cce590ccc..9ff54eaecf81 100644 --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c @@ -39,6 +39,7 @@ #include #include +#include #include "arm-smmu.h" @@ -2053,8 +2054,20 @@ static int arm_smmu_bus_init(struct iommu_ops *ops) goto err_reset_pci_ops; } #endif +#ifdef CONFIG_TEGRA_HOST1X_CONTEXT_BUS + if (!iommu_present(_context_device_bus_type)) { + err = bus_set_iommu(_context_device_bus_type, ops); + if (err) + goto err_reset_fsl_mc_ops; + } +#endif + return 0; +err_reset_fsl_mc_ops: __maybe_unused; +#ifdef CONFIG_FSL_MC_BUS + bus_set_iommu(_mc_bus_type, NULL); +#endif err_reset_pci_ops: __maybe_unused; #ifdef CONFIG_PCI bus_set_iommu(_bus_type, NULL); -- 2.36.1