From: Robin Murphy <robin.murphy@arm.com>
To: Janne Grunau <j@jannau.net>, Alyssa Rosenzweig <alyssa@rosenzweig.io>
Cc: Sven Peter <sven@svenpeter.dev>, Joerg Roedel <joro@8bytes.org>,
Will Deacon <will@kernel.org>,
asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
iommu@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/5] iommu/dart: Assert !locked when configuring
Date: Tue, 11 Feb 2025 21:13:13 +0000 [thread overview]
Message-ID: <97dfb0d9-1d7d-4174-9a7d-aac6f4ffaea8@arm.com> (raw)
In-Reply-To: <20250211192152.GA810942@robin.jannau.net>
On 2025-02-11 7:21 pm, Janne Grunau wrote:
> On Tue, Feb 11, 2025 at 06:41:00PM +0000, Robin Murphy wrote:
>> On 2025-02-10 7:39 pm, Alyssa Rosenzweig wrote:
>>> Configuration is only possible and needed for non-locked DARTs and will
>>> fail for locked DARTs. We cannot try -- assert that we do not.
>>
>> Except now we absolutely will - if a locked DART and its client device
>> are advertised to Linux, instead of gracefully refusing to touch it,
>> we'll now attach the client to a DMA domain, firing a barrage of
>> multiple WARNs in the process, and give it DMA ops which still cannot
>> work. I'm not really convinced this series on its own leaves us in a
>> better position than we're already in now... :/
>>
>> How hideous is the rest of what's required to actually make this usable?
>
> The TTBR can not be changed but the preset first level table can
> modified at will. The driver keeps a shadow first label table and syncs
> that to the preset 1st level table on flush_tbl().
> It gets more complicated by the fact that the iommu for the display
> coprocessor is locked and mappings for its firmware and boot framebuffer
> are preinstalled and have to be maintained or restored on
> initialization.
> This is handled via reserved memory with translation.
>
> Downstream change to handle this is in
> https://github.com/AsahiLinux/linux/commit/d90cc3590ea460e1c574b4b7c47fdafb2794af6a
> not including the change to parse / handle reserved memory with
> translation in iommu core.
Oh, if we handwave away the reserved region stuff for now, it doesn't
seem *too* terrible, so definitely worth trying to land the bones of it
along with this prep work, I reckon. From a quick look I think it might
possibly be even cleaner as an io-pgtable quirk, to essentially skip
allocating/freeing L1 and have some mechanism to fill in data->pgd with
the remap afterwards (possible super cheeky version - also prepopulate
cfg->apple_dart_cfg.ttbr and have alloc/free handle the
remapping/unmapping themselves...). I'm not 100% sure off-hand, but
since you avoid the DMA API and don't seem to have any other dependency
on data->pgd having a linear map VA (other than the virt_to_phys() in
the normal alloc path which you'd skip anyway), it feels like it ought
to work out.
I guess to support multiple domains you do still end up having to
save/restore the L1 contents at the driver level when attaching, so some
kind of shadow table notion isn't entirely unavoidable... oh well, it's
a thought, at least.
Thanks,
Robin.
next prev parent reply other threads:[~2025-02-11 21:13 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-10 19:39 [PATCH 0/5] iommu: apple-dart: Support locked DARTs Alyssa Rosenzweig
2025-02-10 19:39 ` [PATCH 1/5] iommu/dart: Track if the DART is locked Alyssa Rosenzweig
2025-02-10 19:39 ` [PATCH 2/5] iommu/dart: Skip reset for locked DARTs Alyssa Rosenzweig
2025-02-11 18:34 ` Robin Murphy
2025-02-11 18:44 ` Alyssa Rosenzweig
2025-02-10 19:39 ` [PATCH 3/5] iommu/dart: Set DMA domain " Alyssa Rosenzweig
2025-02-11 18:25 ` Robin Murphy
2025-02-11 18:40 ` Alyssa Rosenzweig
2025-02-11 20:37 ` Robin Murphy
2025-02-10 19:39 ` [PATCH 4/5] iommu/dart: Reject identity " Alyssa Rosenzweig
2025-02-11 6:07 ` Nick Chan
2025-02-11 12:17 ` Alyssa Rosenzweig
2025-02-10 19:39 ` [PATCH 5/5] iommu/dart: Assert !locked when configuring Alyssa Rosenzweig
2025-02-11 18:41 ` Robin Murphy
2025-02-11 19:20 ` Alyssa Rosenzweig
2025-02-11 19:21 ` Janne Grunau
2025-02-11 21:13 ` Robin Murphy [this message]
2025-02-10 19:48 ` [PATCH 0/5] iommu: apple-dart: Support locked DARTs Neal Gompa
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=97dfb0d9-1d7d-4174-9a7d-aac6f4ffaea8@arm.com \
--to=robin.murphy@arm.com \
--cc=alyssa@rosenzweig.io \
--cc=asahi@lists.linux.dev \
--cc=iommu@lists.linux.dev \
--cc=j@jannau.net \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sven@svenpeter.dev \
--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