iommu.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [RFC 0/2] iommu: arm-smmu: Add support for early direct mappings
@ 2019-12-09 15:07 Thierry Reding
  2019-12-09 15:07 ` [RFC 1/2] iommu: arm-smmu: Extract arm_smmu_of_parse() Thierry Reding
                   ` (3 more replies)
  0 siblings, 4 replies; 23+ messages in thread
From: Thierry Reding @ 2019-12-09 15:07 UTC (permalink / raw)
  To: Joerg Roedel
  Cc: linux-tegra, Robin Murphy, iommu, Will Deacon, linux-arm-kernel

From: Thierry Reding <treding@nvidia.com>

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.

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.

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.

Any good ideas on how to solve this? It'd also be interesting to see if
there's a more generic way of doing this. I know that something like
this isn't necessary on earlier Tegra SoCs with the custom Tegra SMMU
because translations are only enabled when the devices are attached to a
domain. I'm not sure about other IOMMUs, but in the absence of a struct
device, I suspect that we can't really do anything really generic that
would work across drivers.

Thierry

Thierry Reding (2):
  iommu: arm-smmu: Extract arm_smmu_of_parse()
  iommu: arm-smmu: Add support for early direct mappings

 drivers/iommu/arm-smmu.c | 195 +++++++++++++++++++++++++++++++++++++--
 drivers/iommu/arm-smmu.h |   2 +
 2 files changed, 189 insertions(+), 8 deletions(-)

-- 
2.23.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

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

end of thread, other threads:[~2020-07-01 10:55 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).