linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] iommu: apple-dart: Support the ISP DART
@ 2025-03-07 20:07 Sasha Finkelstein via B4 Relay
  2025-03-07 20:07 ` [PATCH v3 1/2] iommu: apple-dart: Increase MAX_DARTS_PER_DEVICE to 3 Sasha Finkelstein via B4 Relay
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sasha Finkelstein via B4 Relay @ 2025-03-07 20:07 UTC (permalink / raw)
  To: Sven Peter, Janne Grunau, Alyssa Rosenzweig, Joerg Roedel,
	Will Deacon, Robin Murphy
  Cc: asahi, linux-arm-kernel, iommu, linux-kernel, Sasha Finkelstein,
	Hector Martin

The ISP block has 3 linked DARTs with mismatched bypass support.
This series adds support for this setup.

(The ISP driver itself is sent as a separate series
https://lore.kernel.org/asahi/20250219-isp-v1-0-6d3e89b67c31@gmail.com/T/ )

Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
---
Changes in v3:
- Just added r-b, effectively a resend
- Link to v2: https://lore.kernel.org/r/20250228-isp-dart-v2-0-0ead81a90e2d@gmail.com

Changes in v2:
- Made comments and code a closer match for each other
- Link to v1: https://lore.kernel.org/r/20250227-isp-dart-v1-0-161e91ef4f46@gmail.com

---
Hector Martin (2):
      iommu: apple-dart: Increase MAX_DARTS_PER_DEVICE to 3
      iommu: apple-dart: Allow mismatched bypass support

 drivers/iommu/apple-dart.c | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
---
base-commit: dd83757f6e686a2188997cb58b5975f744bb7786
change-id: 20250227-isp-dart-f8369baaecb1




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 1/2] iommu: apple-dart: Increase MAX_DARTS_PER_DEVICE to 3
  2025-03-07 20:07 [PATCH v3 0/2] iommu: apple-dart: Support the ISP DART Sasha Finkelstein via B4 Relay
@ 2025-03-07 20:07 ` Sasha Finkelstein via B4 Relay
  2025-03-07 20:07 ` [PATCH v3 2/2] iommu: apple-dart: Allow mismatched bypass support Sasha Finkelstein via B4 Relay
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Sasha Finkelstein via B4 Relay @ 2025-03-07 20:07 UTC (permalink / raw)
  To: Sven Peter, Janne Grunau, Alyssa Rosenzweig, Joerg Roedel,
	Will Deacon, Robin Murphy
  Cc: asahi, linux-arm-kernel, iommu, linux-kernel, Sasha Finkelstein,
	Hector Martin

From: Hector Martin <marcan@marcan.st>

ISP needs this.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
---
 drivers/iommu/apple-dart.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
index 95ba3caeb40177901086076416874b9905a1f40a..edb2fb22333506d7c64ad1b6321df00ebfd07747 100644
--- a/drivers/iommu/apple-dart.c
+++ b/drivers/iommu/apple-dart.c
@@ -36,7 +36,7 @@
 
 #define DART_MAX_STREAMS 256
 #define DART_MAX_TTBR 4
-#define MAX_DARTS_PER_DEVICE 2
+#define MAX_DARTS_PER_DEVICE 3
 
 /* Common registers */
 

-- 
2.48.1




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/2] iommu: apple-dart: Allow mismatched bypass support
  2025-03-07 20:07 [PATCH v3 0/2] iommu: apple-dart: Support the ISP DART Sasha Finkelstein via B4 Relay
  2025-03-07 20:07 ` [PATCH v3 1/2] iommu: apple-dart: Increase MAX_DARTS_PER_DEVICE to 3 Sasha Finkelstein via B4 Relay
@ 2025-03-07 20:07 ` Sasha Finkelstein via B4 Relay
  2025-03-08  9:54 ` [PATCH v3 0/2] iommu: apple-dart: Support the ISP DART Sven Peter
  2025-03-10  8:30 ` Joerg Roedel
  3 siblings, 0 replies; 5+ messages in thread
From: Sasha Finkelstein via B4 Relay @ 2025-03-07 20:07 UTC (permalink / raw)
  To: Sven Peter, Janne Grunau, Alyssa Rosenzweig, Joerg Roedel,
	Will Deacon, Robin Murphy
  Cc: asahi, linux-arm-kernel, iommu, linux-kernel, Sasha Finkelstein,
	Hector Martin

From: Hector Martin <marcan@marcan.st>

This is needed by ISP, which has DART0 with bypass and DART1/2 without.

Signed-off-by: Hector Martin <marcan@marcan.st>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
---
 drivers/iommu/apple-dart.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
index edb2fb22333506d7c64ad1b6321df00ebfd07747..13ccb801f52a4d34f6653f78e92787af7dfed1bc 100644
--- a/drivers/iommu/apple-dart.c
+++ b/drivers/iommu/apple-dart.c
@@ -277,6 +277,9 @@ struct apple_dart_domain {
  * @streams: streams for this device
  */
 struct apple_dart_master_cfg {
+	/* Intersection of DART capabilitles */
+	u32 supports_bypass : 1;
+
 	struct apple_dart_stream_map stream_maps[MAX_DARTS_PER_DEVICE];
 };
 
@@ -684,7 +687,7 @@ static int apple_dart_attach_dev_identity(struct iommu_domain *domain,
 	struct apple_dart_stream_map *stream_map;
 	int i;
 
-	if (!cfg->stream_maps[0].dart->supports_bypass)
+	if (!cfg->supports_bypass)
 		return -EINVAL;
 
 	for_each_stream_map(i, cfg, stream_map)
@@ -792,20 +795,24 @@ static int apple_dart_of_xlate(struct device *dev,
 		return -EINVAL;
 	sid = args->args[0];
 
-	if (!cfg)
+	if (!cfg) {
 		cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
+
+		/* Will be ANDed with DART capabilities */
+		cfg->supports_bypass = true;
+	}
 	if (!cfg)
 		return -ENOMEM;
 	dev_iommu_priv_set(dev, cfg);
 
 	cfg_dart = cfg->stream_maps[0].dart;
 	if (cfg_dart) {
-		if (cfg_dart->supports_bypass != dart->supports_bypass)
-			return -EINVAL;
 		if (cfg_dart->pgsize != dart->pgsize)
 			return -EINVAL;
 	}
 
+	cfg->supports_bypass &= dart->supports_bypass;
+
 	for (i = 0; i < MAX_DARTS_PER_DEVICE; ++i) {
 		if (cfg->stream_maps[i].dart == dart) {
 			set_bit(sid, cfg->stream_maps[i].sidmap);
@@ -945,7 +952,7 @@ static int apple_dart_def_domain_type(struct device *dev)
 
 	if (cfg->stream_maps[0].dart->pgsize > PAGE_SIZE)
 		return IOMMU_DOMAIN_IDENTITY;
-	if (!cfg->stream_maps[0].dart->supports_bypass)
+	if (!cfg->supports_bypass)
 		return IOMMU_DOMAIN_DMA;
 
 	return 0;

-- 
2.48.1




^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 0/2] iommu: apple-dart: Support the ISP DART
  2025-03-07 20:07 [PATCH v3 0/2] iommu: apple-dart: Support the ISP DART Sasha Finkelstein via B4 Relay
  2025-03-07 20:07 ` [PATCH v3 1/2] iommu: apple-dart: Increase MAX_DARTS_PER_DEVICE to 3 Sasha Finkelstein via B4 Relay
  2025-03-07 20:07 ` [PATCH v3 2/2] iommu: apple-dart: Allow mismatched bypass support Sasha Finkelstein via B4 Relay
@ 2025-03-08  9:54 ` Sven Peter
  2025-03-10  8:30 ` Joerg Roedel
  3 siblings, 0 replies; 5+ messages in thread
From: Sven Peter @ 2025-03-08  9:54 UTC (permalink / raw)
  To: Sasha Finkelstein, Janne Grunau, Alyssa Rosenzweig, Joerg Roedel,
	Will Deacon, Robin Murphy
  Cc: asahi, linux-arm-kernel, iommu, linux-kernel, Hector Martin

Hi,


On Fri, Mar 7, 2025, at 21:07, Sasha Finkelstein via B4 Relay wrote:
> The ISP block has 3 linked DARTs with mismatched bypass support.
> This series adds support for this setup.
>
> (The ISP driver itself is sent as a separate series
> https://lore.kernel.org/asahi/20250219-isp-v1-0-6d3e89b67c31@gmail.com/T/ )
>
> Signed-off-by: Sasha Finkelstein <fnkl.kernel@gmail.com>
> ---

For the entire series:

Reviewed-by: Sven Peter <sven@svenpeter.dev>


Thanks,

Sven


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v3 0/2] iommu: apple-dart: Support the ISP DART
  2025-03-07 20:07 [PATCH v3 0/2] iommu: apple-dart: Support the ISP DART Sasha Finkelstein via B4 Relay
                   ` (2 preceding siblings ...)
  2025-03-08  9:54 ` [PATCH v3 0/2] iommu: apple-dart: Support the ISP DART Sven Peter
@ 2025-03-10  8:30 ` Joerg Roedel
  3 siblings, 0 replies; 5+ messages in thread
From: Joerg Roedel @ 2025-03-10  8:30 UTC (permalink / raw)
  To: fnkl.kernel
  Cc: Sven Peter, Janne Grunau, Alyssa Rosenzweig, Will Deacon,
	Robin Murphy, asahi, linux-arm-kernel, iommu, linux-kernel,
	Hector Martin

On Fri, Mar 07, 2025 at 09:07:44PM +0100, Sasha Finkelstein via B4 Relay wrote:
> Hector Martin (2):
>       iommu: apple-dart: Increase MAX_DARTS_PER_DEVICE to 3
>       iommu: apple-dart: Allow mismatched bypass support
> 
>  drivers/iommu/apple-dart.c | 19 +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)

Applied, thanks.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-03-10  8:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-07 20:07 [PATCH v3 0/2] iommu: apple-dart: Support the ISP DART Sasha Finkelstein via B4 Relay
2025-03-07 20:07 ` [PATCH v3 1/2] iommu: apple-dart: Increase MAX_DARTS_PER_DEVICE to 3 Sasha Finkelstein via B4 Relay
2025-03-07 20:07 ` [PATCH v3 2/2] iommu: apple-dart: Allow mismatched bypass support Sasha Finkelstein via B4 Relay
2025-03-08  9:54 ` [PATCH v3 0/2] iommu: apple-dart: Support the ISP DART Sven Peter
2025-03-10  8:30 ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).