From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
To: Bjorn Andersson <bjorn.andersson@linaro.org>,
Thierry Reding <thierry.reding@gmail.com>
Cc: Will Deacon <will@kernel.org>,
linux-arm-msm@vger.kernel.org,
Ioana Ciornei <ioana.ciornei@nxp.com>,
Russell King - ARM Linux admin <linux@armlinux.org.uk>,
iommu@lists.linux-foundation.org,
Diana Craciun <diana.craciun@oss.nxp.com>,
linux-tegra@vger.kernel.org, Robin Murphy <robin.murphy@arm.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC 0/2] iommu: arm-smmu: Add support for early direct mappings
Date: Wed, 4 Mar 2020 15:48:53 +0200 [thread overview]
Message-ID: <fb4d4ab5-0b9f-5912-a4c1-2f18bf273e11@nxp.com> (raw)
In-Reply-To: <20200228025700.GA856087@builder>
Hello,
On 28.02.2020 04:57, Bjorn Andersson wrote:
> On Mon 09 Dec 07:07 PST 2019, Thierry Reding wrote:
>
>> From: Thierry Reding <treding@nvidia.com>
>>
>
> Sorry for the slow response on this, finally got the time to go through
> this in detail and try it out on some Qualcomm boards.
>
>> On some platforms, the firmware will setup hardware to read from a given
>> region of memory. One such example is a display controller that is
>> scanning out a splash screen from physical memory.
>>
>
> This particular use case is the one that we need to figure out for
> Qualcomm devices as well; on some devices it's a simple splash screen
> (that on many devices can be disabled), but for others we have EFIFB
> on the display and no (sane) means to disable this.
>
>> During Linux' boot process, the ARM SMMU will configure all contexts to
>> fault by default. This means that memory accesses that happen by an SMMU
>> master before its driver has had a chance to properly set up the IOMMU
>> will cause a fault. This is especially annoying for something like the
>> display controller scanning out a splash screen because the faults will
>> result in the display controller getting bogus data (all-ones on Tegra)
>> and since it repeatedly scans that framebuffer, it will keep triggering
>> such faults and spam the boot log with them.
>>
>
> As my proposed patches indicated, the Qualcomm platform boots with
> stream mapping setup for the hardware used by the bootloader, but
> relying on the associated context banks not being enabled.
>
> USFCFG in SCR0 is set and any faults resulting of this will trap into
> secure world and the device will be reset.
>
>> In order to work around such problems, scan the device tree for IOMMU
>> masters and set up a special identity domain that will map 1:1 all of
>> the reserved regions associated with them. This happens before the SMMU
>> is enabled, so that the mappings are already set up before translations
>> begin.
>>
>> One thing that was pointed out earlier, and which I don't have a good
>> idea on how to solve it, is that the early identity domain is not
>> discarded. The assumption is that the standard direct mappings code of
>> the IOMMU framework will replace the early identity domain once devices
>> are properly attached to domains, but we don't have a good point in time
>> when it would be safe to remove the early identity domain.
>>
>> One option that I can think of would be to create an early identity
>> domain for each master and inherit it when that master is attached to
>> the domain later on, but that seems rather complicated from an book-
>> keeping point of view and tricky because we need to be careful not to
>> map regions twice, etc.
>>
>
> The one concern I ran into with this approach (after resolving below
> issues) is that when the display driver probes a new domain will be
> created automatically and I get a stream of "Unhandled context fault" in
> the log until the driver has mapped the framebuffer in the newly
> allocated context.
>
> This is normally not a problem, as we seem to be able to do this
> initialization in a few frames, but for the cases where the display
> driver probe defer this is a problem.
Also gave this a go on one of NXP's layerscape platforms, and
encountered the same issue. However, given that in our case it's not
about a framebuffer device but a firmware, it cause it to crash. :-(
Another apparent problem is that in the current implementation only one
memory-region per device is supported. Actually it appears that this is
a limitation of the DT reservation binding - it doesn't seem to allow
specifying multiple regions per device. In our firmware case we would
need support for multiple reserved regions (FW memory, FW i/o registers
a.s.o).
---
Best Regards, Laurentiu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
next prev parent reply other threads:[~2020-03-04 13:49 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-09 15:07 [RFC 0/2] iommu: arm-smmu: Add support for early direct mappings Thierry Reding
2019-12-09 15:07 ` [RFC 1/2] iommu: arm-smmu: Extract arm_smmu_of_parse() Thierry Reding
2019-12-09 15:07 ` [RFC 2/2] iommu: arm-smmu: Add support for early direct mappings Thierry Reding
2020-01-11 4:56 ` [RFC 0/2] " Saravana Kannan via iommu
2020-01-13 14:07 ` Thierry Reding
2020-01-13 22:01 ` Saravana Kannan via iommu
2020-01-14 0:11 ` Bjorn Andersson
2020-02-28 2:57 ` Bjorn Andersson
2020-03-04 13:48 ` Laurentiu Tudor [this message]
2020-05-14 19:32 ` bjorn.andersson
2020-05-26 20:34 ` John Stultz
2020-05-27 9:06 ` Laurentiu Tudor
2020-05-27 11:03 ` Will Deacon
2020-06-02 6:32 ` Bjorn Andersson
2020-06-03 11:00 ` Robin Murphy
2020-07-01 7:40 ` Bjorn Andersson
2020-07-01 10:54 ` Will Deacon
2020-06-03 11:11 ` Will Deacon
2020-06-03 17:23 ` Bjorn Andersson
2020-06-02 11:02 ` Thierry Reding
2020-06-02 19:32 ` Bjorn Andersson
2020-06-03 10:24 ` Thierry Reding
2020-06-03 17:17 ` Bjorn Andersson
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=fb4d4ab5-0b9f-5912-a4c1-2f18bf273e11@nxp.com \
--to=laurentiu.tudor@nxp.com \
--cc=bjorn.andersson@linaro.org \
--cc=diana.craciun@oss.nxp.com \
--cc=ioana.ciornei@nxp.com \
--cc=iommu@lists.linux-foundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=robin.murphy@arm.com \
--cc=thierry.reding@gmail.com \
--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;
as well as URLs for NNTP newsgroup(s).