All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: Linux IOMMU <iommu@lists.linux-foundation.org>,
	"linux-samsung-soc@vger.kernel.org"
	<linux-samsung-soc@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	linaro-mm-sig@lists.linaro.org, Arnd Bergmann <arnd@arndb.de>,
	Shaik Ameer Basha <shaik.ameer@samsung.com>,
	Cho KyongHo <pullip.cho@samsung.com>,
	Joerg Roedel <joro@8bytes.org>,
	Thierry Reding <treding@nvidia.com>,
	Olof Johansson <olof@lixom.net>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Will Deacon <will.deacon@arm.com>,
	David Wodhouse <dwmw2@infradead.org>,
	Inki Dae <inki.dae@samsung.com>, Kukjin Kim <kgene@kernel.org>,
	Tomasz Figa <tomasz.figa@gmail.com>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Joonyoung Shim <jy0922.shim@samsung.com>,
	Seung-Woo Kim <sw0312.kim@samsung.com>,
	Javier Martinez Canillas <javier@dowhile0.org>
Subject: Re: [PATCH v6 01/25] arm: dma-mapping: add support for creating reserved mappings in iova space
Date: Mon, 4 May 2015 17:12:00 -0500	[thread overview]
Message-ID: <CAL_JsqKB4F8tspydBFrL-PH3gXcyu-pwQwBETMizJzTpAF3yzg@mail.gmail.com> (raw)
In-Reply-To: <1430727380-10912-2-git-send-email-m.szyprowski@samsung.com>

On Mon, May 4, 2015 at 3:15 AM, Marek Szyprowski
<m.szyprowski@samsung.com> wrote:
> Some devices (like frame buffers) are enabled by bootloader and configured
> to perform DMA operations automatically (like displaying boot logo or splash
> screen). Such devices operate and perform DMA operation usually until the
> proper driver for them is loaded and probed. However before that happens,
> system usually loads IOMMU drivers and configures dma parameters for each
> device. When such initial configuration is created and enabled, it usually
> contains empty translation rules betweem IO address space and physical
> memory, because no buffers nor memory regions have been requested by the
> respective driver.
>
> This patch adds support for "iommu-reserved-mapping", which can be used
> to provide definitions for mappings that need to be created on system
> boot to let such devices (enabled by bootloader) to operate properly
> until respective driver is probed.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  Documentation/devicetree/bindings/iommu/iommu.txt |  44 +++++++++
>  arch/arm/mm/dma-mapping.c                         | 112 ++++++++++++++++++++++
>  2 files changed, 156 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/iommu/iommu.txt b/Documentation/devicetree/bindings/iommu/iommu.txt
> index 5a8b4624defc..fd54e6b597f0 100644
> --- a/Documentation/devicetree/bindings/iommu/iommu.txt
> +++ b/Documentation/devicetree/bindings/iommu/iommu.txt
> @@ -86,6 +86,35 @@ have a means to turn off translation. But it is invalid in such cases to
>  disable the IOMMU's device tree node in the first place because it would
>  prevent any driver from properly setting up the translations.
>
> +Optional properties:
> +--------------------
> +- iommu-reserved-mapping: A list of entries describing additional
> +  reserved mapping, that will be inserted to the default IO address space
> +  created for given master device. Each entry consist of IO address,
> +  physical memory address and size of the region.
> +
> +Some devices (like frame buffers) are enabled by bootloader and configured
> +to perform DMA operations automatically (like displaying boot logo or splash
> +screen). Such devices operate and perform DMA operation usually until the
> +proper driver for them is loaded and probed. However before that happens,
> +system usually loads IOMMU drivers and configures dma parameters for each

s/dma/DMA/

> +device. When such initial configuration is created and enabled, it usually
> +contains empty translation rules betweem IO address space and physical

s/betweem/between/

> +memory, because no buffers nor memory regions have been requested by the
> +respective driver.
> +
> +To avoid IOMMU page fault, one can provide "iommu-reserved-mapping"
> +property, which defines all memory regions which must be mapped to IO
> +address space to boot properly when device has been enabled by the
> +bootloader. More than one region can be defined for given master device.
> +Each region is defined by the following triplet: first entry is IO
> +address (encoded in "address" cells), second is base physical memory
> +address for this regions (also encoded in "address" cells) and the last
> +is size of the region (encoded in "size" cells). To ensure that that
> +given master device will not trigger page fault after enabling IOMMU,
> +one should define identity mapping between physical memory and IO
> +address space for the range of addresses accessed by the device.
> +
>
>  Notes:
>  ======
> @@ -113,6 +142,21 @@ Single-master IOMMU:
>                 iommus = <&{/iommu}>;
>         };
>
> +
> +Single-master IOMMU, which has been left enabled by bootloader:
> +---------------------------------------------------------------
> +
> +       iommu {
> +               #iommu-cells = <0>;
> +       };
> +
> +       master {
> +               iommus = <&{/iommu}>;
> +               /* bootloader configures framebuffer at 0x40000000 (32MiB)
> +               iommu-reserved-mapping = <0x40000000 0x40000000 0x2000000>;

Is there not an ordering problem if kernel initializes the IOMMU
before parsing this for each master? I would think the IOMMU driver
needs to find all of these mappings and cleanly switch the page tables
with the new reserved mapping.

Rob

WARNING: multiple messages have this Message-ID (diff)
From: robh@kernel.org (Rob Herring)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v6 01/25] arm: dma-mapping: add support for creating reserved mappings in iova space
Date: Mon, 4 May 2015 17:12:00 -0500	[thread overview]
Message-ID: <CAL_JsqKB4F8tspydBFrL-PH3gXcyu-pwQwBETMizJzTpAF3yzg@mail.gmail.com> (raw)
In-Reply-To: <1430727380-10912-2-git-send-email-m.szyprowski@samsung.com>

On Mon, May 4, 2015 at 3:15 AM, Marek Szyprowski
<m.szyprowski@samsung.com> wrote:
> Some devices (like frame buffers) are enabled by bootloader and configured
> to perform DMA operations automatically (like displaying boot logo or splash
> screen). Such devices operate and perform DMA operation usually until the
> proper driver for them is loaded and probed. However before that happens,
> system usually loads IOMMU drivers and configures dma parameters for each
> device. When such initial configuration is created and enabled, it usually
> contains empty translation rules betweem IO address space and physical
> memory, because no buffers nor memory regions have been requested by the
> respective driver.
>
> This patch adds support for "iommu-reserved-mapping", which can be used
> to provide definitions for mappings that need to be created on system
> boot to let such devices (enabled by bootloader) to operate properly
> until respective driver is probed.
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> ---
>  Documentation/devicetree/bindings/iommu/iommu.txt |  44 +++++++++
>  arch/arm/mm/dma-mapping.c                         | 112 ++++++++++++++++++++++
>  2 files changed, 156 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/iommu/iommu.txt b/Documentation/devicetree/bindings/iommu/iommu.txt
> index 5a8b4624defc..fd54e6b597f0 100644
> --- a/Documentation/devicetree/bindings/iommu/iommu.txt
> +++ b/Documentation/devicetree/bindings/iommu/iommu.txt
> @@ -86,6 +86,35 @@ have a means to turn off translation. But it is invalid in such cases to
>  disable the IOMMU's device tree node in the first place because it would
>  prevent any driver from properly setting up the translations.
>
> +Optional properties:
> +--------------------
> +- iommu-reserved-mapping: A list of entries describing additional
> +  reserved mapping, that will be inserted to the default IO address space
> +  created for given master device. Each entry consist of IO address,
> +  physical memory address and size of the region.
> +
> +Some devices (like frame buffers) are enabled by bootloader and configured
> +to perform DMA operations automatically (like displaying boot logo or splash
> +screen). Such devices operate and perform DMA operation usually until the
> +proper driver for them is loaded and probed. However before that happens,
> +system usually loads IOMMU drivers and configures dma parameters for each

s/dma/DMA/

> +device. When such initial configuration is created and enabled, it usually
> +contains empty translation rules betweem IO address space and physical

s/betweem/between/

> +memory, because no buffers nor memory regions have been requested by the
> +respective driver.
> +
> +To avoid IOMMU page fault, one can provide "iommu-reserved-mapping"
> +property, which defines all memory regions which must be mapped to IO
> +address space to boot properly when device has been enabled by the
> +bootloader. More than one region can be defined for given master device.
> +Each region is defined by the following triplet: first entry is IO
> +address (encoded in "address" cells), second is base physical memory
> +address for this regions (also encoded in "address" cells) and the last
> +is size of the region (encoded in "size" cells). To ensure that that
> +given master device will not trigger page fault after enabling IOMMU,
> +one should define identity mapping between physical memory and IO
> +address space for the range of addresses accessed by the device.
> +
>
>  Notes:
>  ======
> @@ -113,6 +142,21 @@ Single-master IOMMU:
>                 iommus = <&{/iommu}>;
>         };
>
> +
> +Single-master IOMMU, which has been left enabled by bootloader:
> +---------------------------------------------------------------
> +
> +       iommu {
> +               #iommu-cells = <0>;
> +       };
> +
> +       master {
> +               iommus = <&{/iommu}>;
> +               /* bootloader configures framebuffer at 0x40000000 (32MiB)
> +               iommu-reserved-mapping = <0x40000000 0x40000000 0x2000000>;

Is there not an ordering problem if kernel initializes the IOMMU
before parsing this for each master? I would think the IOMMU driver
needs to find all of these mappings and cleanly switch the page tables
with the new reserved mapping.

Rob

  reply	other threads:[~2015-05-04 22:12 UTC|newest]

Thread overview: 116+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-04  8:15 [PATCH v6 00/25] Exynos SYSMMU (IOMMU) integration with DT and DMA-mapping subsystem Marek Szyprowski
2015-05-04  8:15 ` Marek Szyprowski
2015-05-04  8:15 ` [PATCH v6 02/25] arm: exynos: pm_domains: register power domain driver from core_initcall Marek Szyprowski
2015-05-04  8:15   ` Marek Szyprowski
2015-05-04  8:15 ` [PATCH v6 03/25] drm/exynos: iommu: detach from default dma-mapping domain on init Marek Szyprowski
2015-05-04  8:15   ` Marek Szyprowski
2015-05-04  8:15 ` [PATCH v6 04/25] drm/exynos: fimd: ensure proper hw state in fimd_clear_channel() Marek Szyprowski
2015-05-04  8:15   ` Marek Szyprowski
2015-05-04  8:16 ` [PATCH v6 05/25] iommu: exynos: don't read version register on every tlb operation Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
2015-05-10 12:59   ` Cho KyongHo
2015-05-10 12:59     ` Cho KyongHo
     [not found] ` <1430727380-10912-1-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-05-04  8:15   ` [PATCH v6 01/25] arm: dma-mapping: add support for creating reserved mappings in iova space Marek Szyprowski
2015-05-04  8:15     ` Marek Szyprowski
2015-05-04 22:12     ` Rob Herring [this message]
2015-05-04 22:12       ` Rob Herring
     [not found]       ` <CAL_JsqKB4F8tspydBFrL-PH3gXcyu-pwQwBETMizJzTpAF3yzg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-05-18 12:09         ` Marek Szyprowski
2015-05-18 12:09           ` Marek Szyprowski
2015-05-06 14:01     ` Robin Murphy
2015-05-06 14:01       ` Robin Murphy
2015-05-19 10:49       ` Marek Szyprowski
2015-05-19 10:49         ` Marek Szyprowski
2015-05-04  8:16   ` [PATCH v6 06/25] iommu: exynos: remove unused functions Marek Szyprowski
2015-05-04  8:16     ` Marek Szyprowski
2015-05-10 13:01     ` Cho KyongHo
2015-05-10 13:01       ` Cho KyongHo
2015-05-04 10:30   ` [PATCH v6 27/26] iommu: exynos: add system suspend/resume support Marek Szyprowski
2015-05-04 10:30     ` Marek Szyprowski
2015-05-05 15:05   ` [PATCH v6 00/25] Exynos SYSMMU (IOMMU) integration with DT and DMA-mapping subsystem Joerg Roedel
2015-05-05 15:05     ` Joerg Roedel
2015-05-18 12:16     ` Marek Szyprowski
2015-05-18 12:16       ` Marek Szyprowski
2015-05-04  8:16 ` [PATCH v6 07/25] iommu: exynos: remove useless spinlock Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
2015-05-04  8:16 ` [PATCH v6 08/25] iommu: exynos: refactor function parameters to simplify code Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
     [not found]   ` <1430727380-10912-9-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-05-05 14:52     ` Joerg Roedel
2015-05-05 14:52       ` Joerg Roedel
2015-05-10 13:27     ` Cho KyongHo
2015-05-10 13:27       ` Cho KyongHo
     [not found]       ` <20150510222712.a955a6d326698ba5a09c6fe7-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-05-18 12:58         ` Marek Szyprowski
2015-05-18 12:58           ` Marek Szyprowski
2015-05-04  8:16 ` [PATCH v6 09/25] iommu: exynos: remove unused functions, part 2 Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
     [not found]   ` <1430727380-10912-10-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-05-05 14:53     ` Joerg Roedel
2015-05-05 14:53       ` Joerg Roedel
2015-05-04  8:16 ` [PATCH v6 10/25] iommu: exynos: remove useless device_add/remove callbacks Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
     [not found]   ` <1430727380-10912-11-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-05-05 14:55     ` Joerg Roedel
2015-05-05 14:55       ` Joerg Roedel
     [not found]       ` <20150505145538.GL15736-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-05-18 12:09         ` Marek Szyprowski
2015-05-18 12:09           ` Marek Szyprowski
2015-05-18 17:04           ` Joerg Roedel
2015-05-18 17:04             ` Joerg Roedel
     [not found]             ` <20150518170430.GK20611-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2015-05-18 19:37               ` Laurent Pinchart
2015-05-18 19:37                 ` Laurent Pinchart
2015-05-04  8:16 ` [PATCH v6 11/25] iommu: exynos: add support for binding more than one sysmmu to master device Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
2015-05-10 13:34   ` Cho KyongHo
2015-05-10 13:34     ` Cho KyongHo
     [not found]     ` <20150510223437.b651f6d2f3f0ead49eb72488-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-05-18 13:03       ` Marek Szyprowski
2015-05-18 13:03         ` Marek Szyprowski
2015-05-04  8:16 ` [PATCH v6 12/25] iommu: exynos: add support for runtime_pm Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
2015-05-10 13:38   ` Cho KyongHo
2015-05-10 13:38     ` Cho KyongHo
2015-05-18 12:25     ` Marek Szyprowski
2015-05-18 12:25       ` Marek Szyprowski
2015-05-04  8:16 ` [PATCH v6 13/25] iommu: exynos: rename variables to reflect their purpose Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
2015-05-04  8:16 ` [PATCH v6 14/25] iommu: exynos: use struct exynos_iommu_domain in internal structures Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
2015-05-04  8:16 ` [PATCH v6 15/25] iommu: exynos: document " Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
     [not found]   ` <1430727380-10912-16-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-05-05 15:00     ` Joerg Roedel
2015-05-05 15:00       ` Joerg Roedel
2015-05-04  8:16 ` [PATCH v6 16/25] iommu: exynos: remove excessive includes and sort others alphabetically Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
2015-05-04  8:16 ` [PATCH v6 17/25] iommu: exynos: init from dt-specific callback instead of initcall Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
2015-05-04  8:16 ` [PATCH v6 18/25] iommu: exynos: add callback for initializing devices from device tree Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
2015-05-04  8:16 ` [PATCH v6 19/25] iommu: exynos: remove unneeded code Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
2015-05-04  8:16 ` [PATCH v6 20/25] ARM: dts: exynos4: add sysmmu nodes Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
2015-05-05  4:08   ` Krzysztof Kozłowski
2015-05-05  4:08     ` Krzysztof Kozłowski
2015-05-04  8:16 ` [PATCH v6 21/25] ARM: dts: exynos3250: " Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
2015-05-05  4:10   ` Krzysztof Kozłowski
2015-05-05  4:10     ` Krzysztof Kozłowski
2015-05-04  8:16 ` [PATCH v6 22/25] ARM: dts: exynos4415: " Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
2015-05-05  4:09   ` Krzysztof Kozłowski
2015-05-05  4:09     ` Krzysztof Kozłowski
2015-05-04  8:16 ` [PATCH v6 23/25] ARM: dts: exynos5250: " Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
2015-05-05  4:04   ` Krzysztof Kozłowski
2015-05-05  4:04     ` Krzysztof Kozłowski
2015-05-04  8:16 ` [PATCH v6 24/25] ARM: dts: exynos5420: " Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
2015-05-05  4:10   ` Krzysztof Kozłowski
2015-05-05  4:10     ` Krzysztof Kozłowski
2015-05-04  8:16 ` [PATCH v6 25/25] ARM: dts: exynos: add iommu reserved regions for bootloader's splash screen Marek Szyprowski
2015-05-04  8:16   ` Marek Szyprowski
     [not found]   ` <1430727380-10912-26-git-send-email-m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-05-05  5:50     ` Krzysztof Kozłowski
2015-05-05  5:50       ` Krzysztof Kozłowski
2015-05-11 16:00 ` [PATCH v6 00/25] Exynos SYSMMU (IOMMU) integration with DT and DMA-mapping subsystem Javier Martinez Canillas
2015-05-11 16:00   ` Javier Martinez Canillas
2015-05-12 15:35   ` Javier Martinez Canillas
2015-05-12 15:35     ` Javier Martinez Canillas
2015-05-18 13:26   ` Marek Szyprowski
2015-05-18 13:26     ` Marek Szyprowski
     [not found]     ` <5559E88E.9050108-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2015-05-18 13:32       ` Javier Martinez Canillas
2015-05-18 13:32         ` Javier Martinez Canillas

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=CAL_JsqKB4F8tspydBFrL-PH3gXcyu-pwQwBETMizJzTpAF3yzg@mail.gmail.com \
    --to=robh@kernel.org \
    --cc=arnd@arndb.de \
    --cc=dwmw2@infradead.org \
    --cc=inki.dae@samsung.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=javier@dowhile0.org \
    --cc=joro@8bytes.org \
    --cc=jy0922.shim@samsung.com \
    --cc=kgene@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=olof@lixom.net \
    --cc=pullip.cho@samsung.com \
    --cc=shaik.ameer@samsung.com \
    --cc=sw0312.kim@samsung.com \
    --cc=tomasz.figa@gmail.com \
    --cc=treding@nvidia.com \
    --cc=will.deacon@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.