devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5 0/5] iommu: Support mappings/reservations in reserved-memory regions
@ 2022-05-12 19:00 Thierry Reding
  2022-05-12 19:00 ` [PATCH v5 1/5] dt-bindings: reserved-memory: Document iommu-addresses Thierry Reding
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Thierry Reding @ 2022-05-12 19:00 UTC (permalink / raw)
  To: Rob Herring, Joerg Roedel
  Cc: Will Deacon, Robin Murphy, Nicolin Chen, Krishna Reddy,
	Dmitry Osipenko, Alyssa Rosenzweig, Janne Grunau, Sameer Pujar,
	devicetree, iommu, linux-tegra

From: Thierry Reding <treding@nvidia.com>

Hi,

this is another attempt at solving the problem of passing IOMMU
configuration via device tree. It has significantly evolved since the
last attempt, based on the discussion that followed. The discussion can
be found here:

  https://lore.kernel.org/all/20210423163234.3651547-1-thierry.reding@gmail.com/

Rather than using a memory-region specifier, this new version introduces
a new "iommu-addresses" property for the reserved-memory regions
themselves. These are used to describe either a static mapping or
reservation that should be created for a given device. If both "reg" and
"iommu-addresses" properties are given, a mapping will be created
(typically this would be an identity mapping) whereas if only an
"iommu-addresses" property is specified, a reservation for the specified
range will be installed.

An example is included in the DT bindings, but here is an extract of
what I've used to test this:

	reserved-memory {
		#address-cells = <2>;
		#size-cells = <2>;
		ranges;

		/*
		 * Creates an identity mapping for the framebuffer that
		 * the firmware has setup to scan out a bootsplash from.
		 */
		fb: framebuffer@92cb2000 {
			reg = <0x0 0x92cb2000 0x0 0x00800000>;
			iommu-addresses = <&dc0 0x0 0x92cb2000 0x0 0x00800000>;
		};

		/*
		 * Creates a reservation in the IOVA space to prevent
		 * any buffers from being mapped to that region. Note
		 * that on Tegra the range is actually quite different
		 * from this, but it would conflict with the display
		 * driver that I tested this against, so this is just
		 * a dummy region for testing.
		 */
		adsp: reservation-adsp {
			iommu-addresses = <&dc0 0x0 0x90000000 0x0 0x00010000>;
		};
	};

	host1x@50000000 {
		dc@54200000 {
			memory-region = <&fb>, <&adsp>;
		};
	};

This is abbreviated a little to focus on the essentials. Note also that
the ADSP reservation is not actually used on this device and the driver
for this doesn't exist yet, but I wanted to include this variant for
testing, because we'll want to use these bindings for the reservation
use-case as well at some point.

Adding Alyssa and Janne who have in the past tried to make these
bindings work on Apple M1. Also adding Sameer from the Tegra audio team
to look at the ADSP reservation and double-check that this is suitable
for our needs.

Thierry

Navneet Kumar (1):
  iommu/tegra-smmu: Support managed domains

Thierry Reding (4):
  dt-bindings: reserved-memory: Document iommu-addresses
  iommu: Implement of_iommu_get_resv_regions()
  iommu: dma: Use of_iommu_get_resv_regions()
  iommu/tegra-smmu: Add support for reserved regions

 .../reserved-memory/reserved-memory.txt       |  1 -
 .../reserved-memory/reserved-memory.yaml      | 62 +++++++++++++
 drivers/iommu/dma-iommu.c                     |  3 +
 drivers/iommu/of_iommu.c                      | 90 +++++++++++++++++++
 drivers/iommu/tegra-smmu.c                    | 82 +++++++++++++----
 include/dt-bindings/reserved-memory.h         |  8 ++
 include/linux/of_iommu.h                      |  8 ++
 7 files changed, 235 insertions(+), 19 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt
 create mode 100644 include/dt-bindings/reserved-memory.h

-- 
2.36.1


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

end of thread, other threads:[~2022-05-18 15:29 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-12 19:00 [PATCH v5 0/5] iommu: Support mappings/reservations in reserved-memory regions Thierry Reding
2022-05-12 19:00 ` [PATCH v5 1/5] dt-bindings: reserved-memory: Document iommu-addresses Thierry Reding
2022-05-13 12:33   ` Rob Herring
2022-05-15 10:45   ` Janne Grunau
2022-05-18 13:01     ` Thierry Reding
2022-05-12 19:00 ` [PATCH v5 2/5] iommu: Implement of_iommu_get_resv_regions() Thierry Reding
2022-05-15 11:10   ` Janne Grunau
2022-05-18 12:42     ` Thierry Reding
2022-05-12 19:00 ` [PATCH v5 3/5] iommu: dma: Use of_iommu_get_resv_regions() Thierry Reding
2022-05-12 19:00 ` [PATCH v5 4/5] iommu/tegra-smmu: Add support for reserved regions Thierry Reding
2022-05-12 19:00 ` [PATCH v5 5/5] iommu/tegra-smmu: Support managed domains Thierry Reding
2022-05-16 18:30   ` Dmitry Osipenko
2022-05-15 10:35 ` [PATCH v5 0/5] iommu: Support mappings/reservations in reserved-memory regions Janne Grunau
2022-05-18 15:29   ` Thierry Reding

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