From: "Janne Grunau" <j@jannau.net>
To: "Sven Peter" <sven@kernel.org>,
"Alyssa Rosenzweig" <alyssa@rosenzweig.io>,
"Neal Gompa" <neal@gompa.dev>, "Joerg Roedel" <joro@8bytes.org>,
"Will Deacon" <will@kernel.org>,
"Robin Murphy" <robin.murphy@arm.com>
Cc: asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
iommu@lists.linux.dev, LKML <linux-kernel@vger.kernel.org>,
"Hector Martin" <marcan@marcan.st>
Subject: Re: [PATCH 3/3] iommu: apple-dart: Add 4-level page table support
Date: Sat, 16 Aug 2025 16:19:33 +0200 [thread overview]
Message-ID: <2d3e818d-5bc3-4156-a0c6-6d756f814c86@app.fastmail.com> (raw)
In-Reply-To: <c9440d31-add4-4c0f-ac2a-184e771ab455@kernel.org>
Hej,
On Sat, Aug 16, 2025, at 15:50, Sven Peter wrote:
> On 14.08.25 10:40, Janne Grunau wrote:
>> From: Hector Martin <marcan@marcan.st>
>>
>> The T8110 variant DART implementation on T602x SoCs indicates an IAS
>> of 42, which requires an extra page table level. The extra level is
>> optional, but let's implement it.
>>
>> Since the driver failed at IO page table creation with 42-bit IAS add
>> "apple,t6020-dart" as separate compatible using the T8110 HW data.
>
> Is the commit description outdated? I don't see this change anywhere.
yes, I decided to handle this as missing feature / bug. Both end up with
the same result and as far as we can tell it is fully compatible.
Removed locally.
>> Later it might be useful to restrict this based on the actual
>> attached devices, since most won't need that much address space
>> anyway.
>>
>> Signed-off-by: Hector Martin <marcan@marcan.st> Signed-off-by: Janne
>> Grunau <j@jannau.net>
>> ---
>> drivers/iommu/apple-dart.c | 23 +++++++++++++++++------ 1 file
>> changed, 17 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/iommu/apple-dart.c b/drivers/iommu/apple-dart.c
>> index e72a93e78e26ca61b233c83d439dbdfadf040fc6..bb48e8603d6c84bcf107-
>> 294d851c2f2fc1273298 100644 --- a/drivers/iommu/apple-dart.c +++ b/drivers/iommu/apple-
>> dart.c @@ -133,6 +133,7 @@ #define DART_T8110_TCR
>> 0x1000 #define DART_T8110_TCR_REMAP GENMASK(11, 8)
>> #define DART_T8110_TCR_REMAP_EN BIT(7) +#define
>> DART_T8110_TCR_FOUR_LEVEL BIT(3) #define
>> DART_T8110_TCR_BYPASS_DAPF BIT(2) #define
>> DART_T8110_TCR_BYPASS_DART BIT(1) #define
>> DART_T8110_TCR_TRANSLATE_ENABLE BIT(0) @@ -177,6 +178,7 @@ struct
>> apple_dart_hw { u32 tcr_enabled; u32 tcr_disabled; u32
>> tcr_bypass;
>> + u32 tcr_4level;
>>
>> u32 ttbr; u32 ttbr_valid; @@ -217,6 +219,7 @@ struct apple_dart
>> { u32 pgsize; u32 num_streams; u32 supports_bypass : 1;
>> + u32 four_level : 1;
>>
>> struct iommu_group *sid2group[DART_MAX_STREAMS]; struct
>> iommu_device iommu; @@ -305,13 +308,16 @@ static struct
>> apple_dart_domain *to_dart_domain(struct iommu_domain *dom) }
>>
>> static void -apple_dart_hw_enable_translation(struct
>> apple_dart_stream_map *stream_map)
>> +apple_dart_hw_enable_translation(struct apple_dart_stream_map
>> *stream_map, int levels) { struct apple_dart *dart = stream_map-
>> >dart; int sid;
>>
>> + WARN_ON(levels != 3 && levels != 4);
>> + WARN_ON(levels == 4 && !dart->four_level); for_each_set_bit(sid,
>> stream_map->sidmap, dart->num_streams)
>> - writel(dart->hw->tcr_enabled, dart->regs +
>> DART_TCR(dart, sid));
>> + writel(dart->hw->tcr_enabled | (levels == 4 ? dart->hw-
>> >tcr_4level : 0),
>> + dart->regs + DART_TCR(dart, sid));
>
> This is a bit hard to read, I'd prefer an explicit if (dart->hw-
> >tcr_4level) here.
you mean `if (levels == 4)`? `dart->hw->tcr_4level` will be `BIT(3)` for
t8110 darts even when they use just 3 page table levels.
Changed locally to
u32 tcr = dart->hw->tcr_enabled; if (levels == 4) tcr |= dart->hw-
>tcr_4level;
and then writel(tcr, ...) in the loop.
I've change prefix of all commits in this series to "iommu/apple-dart"
and "iommu/io-pgtable-dart".
thanks,
Janne
next prev parent reply other threads:[~2025-08-16 14:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 8:40 [PATCH 0/3] iommu: apple-dart: Four level " Janne Grunau
2025-08-14 8:40 ` [PATCH 1/3] iommu: apple-dart: Make the hw register fields u32s Janne Grunau
2025-08-16 13:51 ` Sven Peter
2025-08-14 8:40 ` [PATCH 2/3] iommu: io-pgtable: Add 4-level page table support Janne Grunau
2025-08-16 14:02 ` Sven Peter
2025-08-14 8:40 ` [PATCH 3/3] iommu: apple-dart: " Janne Grunau
2025-08-16 13:50 ` Sven Peter
2025-08-16 14:19 ` Janne Grunau [this message]
2025-08-16 15:26 ` Sven Peter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2d3e818d-5bc3-4156-a0c6-6d756f814c86@app.fastmail.com \
--to=j@jannau.net \
--cc=alyssa@rosenzweig.io \
--cc=asahi@lists.linux.dev \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcan@marcan.st \
--cc=neal@gompa.dev \
--cc=robin.murphy@arm.com \
--cc=sven@kernel.org \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®