Message ID | 20250210-locked-dart-v1-3-5d97fe247f35@rosenzweig.io (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | iommu: apple-dart: Support locked DARTs | expand |
On 2025-02-10 7:39 pm, Alyssa Rosenzweig wrote: > This is required. Now that we can, I'd really rather do this properly and not offer an identity domain in the first place when it's not available. Thanks, Robin. > Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> > --- > drivers/iommu/apple-dart.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c > index 9c74a95eb7e819e94ab2fb47ed0d411a1eba8bf7..9c6f780dc7220096ed6bba692fa1a4bd859b0d61 100644 > --- a/drivers/iommu/apple-dart.c > +++ b/drivers/iommu/apple-dart.c > @@ -941,6 +941,8 @@ static int apple_dart_def_domain_type(struct device *dev) > return IOMMU_DOMAIN_IDENTITY; > if (!cfg->stream_maps[0].dart->supports_bypass) > return IOMMU_DOMAIN_DMA; > + if (cfg->stream_maps[0].dart->locked) > + return IOMMU_DOMAIN_DMA; > > return 0; > } >
Hi Robin, > > This is required. > > Now that we can, I'd really rather do this properly and not offer an > identity domain in the first place when it's not available. I'm reading through iommu.c but I don't see a way to avoid offering an identity domain without the DMA override here, just reading through the logic of iommu_get_default_domain_type. Could you point me to what you have in mind? Thanks, Alyssa > > --- a/drivers/iommu/apple-dart.c > > +++ b/drivers/iommu/apple-dart.c > > @@ -941,6 +941,8 @@ static int apple_dart_def_domain_type(struct device *dev) > > return IOMMU_DOMAIN_IDENTITY; > > if (!cfg->stream_maps[0].dart->supports_bypass) > > return IOMMU_DOMAIN_DMA; > > + if (cfg->stream_maps[0].dart->locked) > > + return IOMMU_DOMAIN_DMA; > > return 0; > > } > > >
On 2025-02-11 6:40 pm, Alyssa Rosenzweig wrote: > Hi Robin, > >>> This is required. >> >> Now that we can, I'd really rather do this properly and not offer an >> identity domain in the first place when it's not available. > > I'm reading through iommu.c but I don't see a way to avoid offering an > identity domain without the DMA override here, just reading through the > logic of iommu_get_default_domain_type. Could you point me to what you > have in mind? Since we finished cleaning up the domain allocation paths, it's finally safe to have per-instance ops, so you can mix and match some with an identity domain and some without, as s390 will be doing[1]. Cheers, Robin. [1] https://lore.kernel.org/linux-iommu/20250207205335.473946-5-mjrosato@linux.ibm.com/ > Thanks, > Alyssa > >>> --- a/drivers/iommu/apple-dart.c >>> +++ b/drivers/iommu/apple-dart.c >>> @@ -941,6 +941,8 @@ static int apple_dart_def_domain_type(struct device *dev) >>> return IOMMU_DOMAIN_IDENTITY; >>> if (!cfg->stream_maps[0].dart->supports_bypass) >>> return IOMMU_DOMAIN_DMA; >>> + if (cfg->stream_maps[0].dart->locked) >>> + return IOMMU_DOMAIN_DMA; >>> return 0; >>> } >>> >>
diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c index 9c74a95eb7e819e94ab2fb47ed0d411a1eba8bf7..9c6f780dc7220096ed6bba692fa1a4bd859b0d61 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-dart.c @@ -941,6 +941,8 @@ static int apple_dart_def_domain_type(struct device *dev) return IOMMU_DOMAIN_IDENTITY; if (!cfg->stream_maps[0].dart->supports_bypass) return IOMMU_DOMAIN_DMA; + if (cfg->stream_maps[0].dart->locked) + return IOMMU_DOMAIN_DMA; return 0; }
This is required. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> --- drivers/iommu/apple-dart.c | 2 ++ 1 file changed, 2 insertions(+)