linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Arnd Bergmann <arnd@arndb.de>, linux-arm-kernel@lists.infradead.org
Cc: Thierry Reding <treding@nvidia.com>,
	Rob Herring <robh@kernel.org>,
	"linux-samsung-soc@vger.kernel.org" 
	<linux-samsung-soc@vger.kernel.org>,
	Shaik Ameer Basha <shaik.ameer@samsung.com>,
	Inki Dae <inki.dae@samsung.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Joerg Roedel <joro@8bytes.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Tomasz Figa <tomasz.figa@gmail.com>,
	"linaro-mm-sig@lists.linaro.org" <linaro-mm-sig@lists.linaro.org>,
	"iommu@lists.linux-foundation.org"
	<iommu@lists.linux-foundation.org>,
	Kukjin Kim <kgene.kim@samsung.com>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Olof Johansson <olof@lixom.net>,
	Kyungmin Park <kyungmin.park@samsung.com>,
	Cho KyongHo <pullip.cho@samsung.com>
Subject: Re: [PATCH 10/29] drivers: add DRIVER_HAS_OWN_IOMMU_MANAGER flag
Date: Mon, 01 Sep 2014 12:47:08 +0200	[thread overview]
Message-ID: <54044EAC.6010701@samsung.com> (raw)
In-Reply-To: <4621634.jlJLccozTJ@wuerfel>

Hello,

On 2014-09-01 11:38, Arnd Bergmann wrote:
> On Monday 01 September 2014 09:53:29 Marek Szyprowski wrote:
>> On 2014-09-01 09:07, Thierry Reding wrote:
>>> On Mon, Sep 01, 2014 at 07:22:32AM +0200, Marek Szyprowski wrote:
>>>> Hi Greg,
>>>>
>>>> On 2014-08-05 12:47, Marek Szyprowski wrote:
>>>>> This patch adds a new flags for device drivers. This flag instructs
>>>>> kernel that the device driver does it own management of IOMMU assisted
>>>>> IO address space translations, so no default dma-mapping structures
>>>>> should be initialized.
>>>>>
>>>>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>>>>> ---
>>>>>     include/linux/device.h | 2 ++
>>>>>     1 file changed, 2 insertions(+)
>>>>>
>>>>> diff --git a/include/linux/device.h b/include/linux/device.h
>>>>> index 5f4ff02..2e62371 100644
>>>>> --- a/include/linux/device.h
>>>>> +++ b/include/linux/device.h
>>>>> @@ -253,6 +253,8 @@ struct device_driver {
>>>>>     
>>>>>     /* disables bind/unbind via sysfs */
>>>>>     #define DRIVER_SUPPRESS_BIND_ATTRS       (1 << 0)
>>>>> +/* driver uses own methods to manage IO address space */
>>>>> +#define DRIVER_HAS_OWN_IOMMU_MANAGER       (1 << 1)
>>>>>     
>>>>>     extern int __must_check driver_register(struct device_driver *drv);
>>>>>     extern void driver_unregister(struct device_driver *drv);
>>>> Could you comment if the approach of using flags in the struct driver
>>>> could be accepted? I've converted suppress_bind_attrs entry to flags to
>>>> avoid extending the structure, please see patch "[PATCH 05/29] drivers:
>>>> convert suppress_bind_attrs parameter into flags".
>>> Is this really necessary? What I did as part of an RFC series for Tegra
>>> IOMMU support is keep this knowledge within the IOMMU driver rather than
>>> export it to the driver core.i
>> The problem with embedding the list of drivers that you would need to update
>> it everytime when you modify or extend iommu support in the other drivers.
>> I've tried also other approach, like adding respective notifiers to
>> individual
>> drivers to initialize custom iommu support (or disable default iommu
>> mapping)
>> before iommu driver gets initialized, but such solution is in my opinion too
>> complex and hard to understand if one is not familiar will all this stuff.
>>
>> All in all it turned out that the simplest and most generic way is to simply
>> add the flag to the driver core. Flags might be also used in the future
>> to model other kinds of dependencies between device drivers and/or driver
>> core.
> I don't get it yet. I would expect that a driver doing its own management
> of the iommu gets to use the linux/iommu.h interfaces, while a driver
> using the default iommu setup uses linux/dma-mapping.h.

You are right.

> Who do you think needs to set this flag, and who needs to read it?

In the proposed solution Exynos IOMMU driver creates a separate IO 
address space
for every client device in a system and binds it to the default 
dma-mapping space
for the given device. When drivers are doing its own management of IO 
address
space, instead of relying on what is available by default with dma-mapping
interface, this will require releasing of the previously created default
structures and resources. So this flag is set by the driver doing its own
management of io address space. The flags is then checked by Exynos 
IOMMU driver
to avoid creating the default dma-mapping address space for devices 
which driver
does its own management.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


  reply	other threads:[~2014-09-01 10:47 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-05 10:47 [PATCH 00/29] Exynos SYSMMU (IOMMU) integration with DT and DMA-mapping subsystem Marek Szyprowski
2014-08-05 10:47 ` [PATCH 01/29] pm: Add PM domain notifications Marek Szyprowski
2014-08-05 10:47 ` [PATCH 02/29] ARM: Exynos: bind power domains earlier, on device creation Marek Szyprowski
2014-08-05 10:47 ` [PATCH 03/29] clk: exynos: add missing smmu_g2d clock and update comments Marek Szyprowski
2014-08-18 11:26   ` Tomasz Figa
2014-08-05 10:47 ` [PATCH 04/29] drivers: base: add notifier for failed driver bind Marek Szyprowski
2014-08-21 19:46   ` Laurent Pinchart
2014-08-25 20:05   ` Greg Kroah-Hartman
2014-08-26  6:23     ` Marek Szyprowski
2014-08-25 21:18   ` Joerg Roedel
2014-08-26  6:30     ` Marek Szyprowski
2014-08-05 10:47 ` [PATCH 05/29] drivers: convert suppress_bind_attrs parameter into flags Marek Szyprowski
2014-08-05 10:47 ` [PATCH 06/29] drivers: iommu: add notify about failed bind Marek Szyprowski
2014-08-05 10:47 ` [PATCH 07/29] ARM: dma-mapping: arm_iommu_attach_device: automatically set max_seg_size Marek Szyprowski
2014-08-05 10:47 ` [PATCH 08/29] ARM: dma-mapping: add helpers for managing default per-device dma mappings Marek Szyprowski
2014-08-05 10:47 ` [PATCH 09/29] ARM: dma-mapping: provide stubs if no ARM_DMA_USE_IOMMU has been selected Marek Szyprowski
2014-08-05 10:47 ` [PATCH 10/29] drivers: add DRIVER_HAS_OWN_IOMMU_MANAGER flag Marek Szyprowski
2014-09-01  5:22   ` Marek Szyprowski
2014-09-01  7:07     ` Thierry Reding
2014-09-01  7:53       ` Marek Szyprowski
2014-09-01  9:38         ` Arnd Bergmann
2014-09-01 10:47           ` Marek Szyprowski [this message]
2014-09-01 11:56             ` Arnd Bergmann
2014-09-01 12:07               ` Marek Szyprowski
2014-09-01 13:14                 ` [Linaro-mm-sig] " Arnd Bergmann
2014-08-05 10:47 ` [PATCH 11/29] DRM: exynos: add DRIVER_HAS_OWN_IOMMU_MANAGER flag to all sub-drivers Marek Szyprowski
2014-08-05 10:47 ` [PATCH 12/29] DRM: Exynos: fix window clear code Marek Szyprowski
2014-09-01 13:37   ` Inki Dae
2014-08-05 10:47 ` [PATCH 13/29] temporary: media: s5p-mfc: remove DT hacks & initialization custom memory init code Marek Szyprowski
2014-08-05 10:47 ` [PATCH 14/29] devicetree: Update Exynos SYSMMU device tree bindings Marek Szyprowski
2014-08-05 10:47 ` [PATCH 15/29] ARM: DTS: Exynos4: add System MMU nodes Marek Szyprowski
2014-08-05 10:47 ` [PATCH 16/29] iommu: exynos: make driver multiarch friendly Marek Szyprowski
2014-08-05 10:47 ` [PATCH 17/29] iommu: exynos: don't read version register on every tlb operation Marek Szyprowski
2014-08-05 10:47 ` [PATCH 18/29] iommu: exynos: remove unused functions Marek Szyprowski
2014-08-05 10:47 ` [PATCH 19/29] iommu: exynos: remove useless spinlock Marek Szyprowski
2014-08-05 10:47 ` [PATCH 20/29] iommu: exynos: refactor function parameters to simplify code Marek Szyprowski
2014-08-05 10:47 ` [PATCH 21/29] iommu: exynos: remove unused functions, part 2 Marek Szyprowski
2014-08-05 10:47 ` [PATCH 22/29] iommu: exynos: add support for binding more than one sysmmu to master device Marek Szyprowski
2014-08-05 10:47 ` [PATCH 23/29] iommu: exynos: init iommu controllers from device tree Marek Szyprowski
2014-08-05 10:47 ` [PATCH 24/29] iommu: exynos: create default iommu-based dma-mapping for master devices Marek Szyprowski
2014-08-05 10:47 ` [PATCH 25/29] iommu: exynos: add support for runtime_pm Marek Szyprowski
2014-08-05 10:47 ` [PATCH 26/29] iommu: exynos: rename variables to reflect their purpose Marek Szyprowski
2014-08-05 10:47 ` [PATCH 27/29] iommu: exynos: document internal structures Marek Szyprowski
2014-08-05 10:47 ` [PATCH 28/29] iommu: exynos: remove excessive includes and sort others alphabetically Marek Szyprowski
2014-08-05 10:47 ` [PATCH 29/29] temporary: media: s5p-mfc: add support for IOMMU Marek Szyprowski
2014-08-18 23:32 ` [PATCH 00/29] Exynos SYSMMU (IOMMU) integration with DT and DMA-mapping subsystem Joerg Roedel
2014-08-19  6:07   ` Marek Szyprowski
2014-08-19 11:39     ` Andreas Färber
2014-08-19 12:01       ` Marek Szyprowski
2014-08-19 12:30         ` Andreas Färber

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=54044EAC.6010701@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=inki.dae@samsung.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=joro@8bytes.org \
    --cc=kgene.kim@samsung.com \
    --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-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=pullip.cho@samsung.com \
    --cc=rjw@rjwysocki.net \
    --cc=robh@kernel.org \
    --cc=s.nawrocki@samsung.com \
    --cc=shaik.ameer@samsung.com \
    --cc=tomasz.figa@gmail.com \
    --cc=treding@nvidia.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 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).