Hello Everyone,
This is yet another attempt to get Exynos SYSMMU driver with integrated
with IOMMU & DMA-mapping subsystems. The main change from previous
version is addition of the patches to define iommu-mapping, which need
to be created during system boot to avoid IOMMU fault by devices, which
has been left enabled by bootloader (i.e. framebuffer displaying slash
screen).
Patches has been also rebased onto v4.1-rc2 with 'arm: dma-mapping: fix
off-by-one check in arm_setup_iommu_dma_ops' patch applied (see commit
1424532b2163bf1580f4b1091a5801e12310fac5 on fixes branch in
git://ftp.arm.linux.org.uk/pub/linux/arm/kernel/git-cur/linux-arm.git,
more information:
http://www.spinics.net/lists/arm-kernel/msg414722.html).
All patches are also available in the following git repository:
https://git.linaro.org/people/marek.szyprowski/linux-srpol.git
branch v4.1-exynos-iommu.
Best regards
Marek Szyprowski
Samsung R&D Institute Poland
Changelog:
v6:
- rebased onto v4.1-rc2 with 'arm: dma-mapping: fix off-by-one check in
arm_setup_iommu_dma_ops' patch
- added exynos 3250 and 4415 dts patches
- added support for devices, which have been left enabled by bootloader
(i.e. framebuffer displaying slash screen)
- fixed freeze in fimd iommu initialization caused by lack of proper
runtime pm management
- resolved issues with power domains by moving pd initialization to
core_initcall
v5: https://lists.linaro.org/pipermail/linaro-mm-sig/2015-February/004442.html
- rebased onto 'Add HDMI support for Exynos5420 platform' patchset
- fixed 'const' issue in 'iommu: exynos: init from dt-specific callback
instead of initcall' patch, thanks to Tobias Jakobi for reporting it
- fixed copy-paste typo in exynos5250 dts patch
v4: http://www.spinics.net/lists/linux-samsung-soc/msg41177.html
- rebased onto v3.19-rc4 and other Exynos DTS queued patches
- added DTS patch for Exynos 5250 & 5420/5422/5800
v3: http://www.spinics.net/lists/linux-samsung-soc/msg39168.html
- rebased onto "[RFC PATCH v4 0/8] Introduce automatic DMA
configuration for IOMMU masters"
- added some minor fixes for iommu and dma-mapping frameworks
v2: http://thread.gmane.org/gmane.linux.kernel.iommu/6472/
- rebased onto "[RFC PATCH v3 0/7] Introduce automatic DMA
configuration for IOMMU masters" patches:
http://www.spinics.net/lists/arm-kernel/msg362076.html
- changed initialization from bus notifiers to DT related callbacks
- removed support for separate IO address spaces - this will be
discussed separately after the basic support gets merged
- removed support for power domain notifier-based runtime power
management - this also will be discussed separately later
v1: https://lkml.org/lkml/2014/8/5/183
- initial version, feature complete, completely rewrote integration
approach
Patch summary:
Marek Szyprowski (25):
arm: dma-mapping: add support for creating reserved mappings in iova
space
arm: exynos: pm_domains: register power domain driver from
core_initcall
drm/exynos: iommu: detach from default dma-mapping domain on init
drm/exynos: fimd: ensure proper hw state in fimd_clear_channel()
iommu: exynos: don't read version register on every tlb operation
iommu: exynos: remove unused functions
iommu: exynos: remove useless spinlock
iommu: exynos: refactor function parameters to simplify code
iommu: exynos: remove unused functions, part 2
iommu: exynos: remove useless device_add/remove callbacks
iommu: exynos: add support for binding more than one sysmmu to master
device
iommu: exynos: add support for runtime_pm
iommu: exynos: rename variables to reflect their purpose
iommu: exynos: use struct exynos_iommu_domain in internal structures
iommu: exynos: document internal structures
iommu: exynos: remove excessive includes and sort others
alphabetically
iommu: exynos: init from dt-specific callback instead of initcall
iommu: exynos: add callback for initializing devices from device tree
iommu: exynos: remove unneeded code
ARM: dts: exynos4: add sysmmu nodes
ARM: dts: exynos3250: add sysmmu nodes
ARM: dts: exynos4415: add sysmmu nodes
ARM: dts: exynos5250: add sysmmu nodes
ARM: dts: exynos5420: add sysmmu nodes
ARM: dts: exynos: add iommu reserved regions for bootloader's splash
screen
Documentation/devicetree/bindings/iommu/iommu.txt | 44 ++
arch/arm/boot/dts/exynos3250-rinato.dts | 1 +
arch/arm/boot/dts/exynos3250.dtsi | 22 +
arch/arm/boot/dts/exynos4.dtsi | 118 ++++++
arch/arm/boot/dts/exynos4210-trats.dts | 1 +
arch/arm/boot/dts/exynos4210-universal_c210.dts | 1 +
arch/arm/boot/dts/exynos4210.dtsi | 23 +
arch/arm/boot/dts/exynos4412-trats2.dts | 1 +
arch/arm/boot/dts/exynos4415.dtsi | 11 +
arch/arm/boot/dts/exynos4x12.dtsi | 82 ++++
arch/arm/boot/dts/exynos5250-snow.dts | 1 +
arch/arm/boot/dts/exynos5250-spring.dts | 1 +
arch/arm/boot/dts/exynos5250.dtsi | 250 +++++++++++
arch/arm/boot/dts/exynos5420-peach-pit.dts | 1 +
arch/arm/boot/dts/exynos5420.dtsi | 181 ++++++++
arch/arm/boot/dts/exynos5800-peach-pi.dts | 1 +
arch/arm/mach-exynos/pm_domains.c | 18 +-
arch/arm/mm/dma-mapping.c | 112 +++++
drivers/gpu/drm/exynos/exynos_drm_fimd.c | 27 +-
drivers/gpu/drm/exynos/exynos_drm_iommu.c | 3 +
drivers/iommu/exynos-iommu.c | 495 ++++++++++------------
21 files changed, 1098 insertions(+), 296 deletions(-)
--
1.9.2
The dmabuf fd can be shared between processes via unix domain
socket. The file of dmabuf fd is came from anon_inode. The inode
has no set and get xattr operations, so it can not be shared
between processes with smack. This patch fixes just to ignore
private inode including anon_inode for smack_file_receive.
Signed-off-by: Seung-Woo Kim <sw0312.kim(a)samsung.com>
---
I think there was some issue sending my previous mail, so I resend patch again.
---
security/smack/smack_lsm.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 69fdc38..d1bb411 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -1673,6 +1673,9 @@ static int smack_file_receive(struct file *file)
struct smk_audit_info ad;
struct inode *inode = file_inode(file);
+ if (unlikely(IS_PRIVATE(inode)))
+ return 0;
+
smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
smk_ad_setfield_u_fs_path(&ad, file->f_path);
/*
--
1.7.4.1
Hi Linus,
May I request you to pull a few dma-buf changes for 4.1-rc1? minor
cleanup only; this could've gone in for the 4.0 merge window, but for
a copy-paste stupidity from me.
It has been in the for-next since then, and no issues reported.
Thanks and best regards,
Sumit.
The following changes since commit 646da63172f660ba84f195c1165360a9b73583ee:
Merge tag 'remoteproc-4.1-next' of
git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc
(2015-04-20 15:40:10 -0700)
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/sumits/dma-buf.git
tags/dma-buf-for-4.1
for you to fetch changes up to 72449cb47b0104c32ff8fb9380ade9113375d8d1:
staging: android: ion: fix wrong init of dma_buf_export_info
(2015-04-21 14:47:16 +0530)
----------------------------------------------------------------
- cleanup of dma_buf_export()
- correction of copy-paste stupidity while doing the cleanup
----------------------------------------------------------------
Sumit Semwal (2):
dma-buf: cleanup dma_buf_export() to make it easily extensible
staging: android: ion: fix wrong init of dma_buf_export_info
Documentation/dma-buf-sharing.txt | 23 +++++++------
drivers/dma-buf/dma-buf.c | 47 ++++++++++++--------------
drivers/gpu/drm/armada/armada_gem.c | 10 ++++--
drivers/gpu/drm/drm_prime.c | 12 ++++---
drivers/gpu/drm/exynos/exynos_drm_dmabuf.c | 9 +++--
drivers/gpu/drm/i915/i915_gem_dmabuf.c | 10 ++++--
drivers/gpu/drm/omapdrm/omap_gem_dmabuf.c | 9 ++++-
drivers/gpu/drm/tegra/gem.c | 10 ++++--
drivers/gpu/drm/ttm/ttm_object.c | 9 +++--
drivers/gpu/drm/udl/udl_dmabuf.c | 9 ++++-
drivers/media/v4l2-core/videobuf2-dma-contig.c | 8 ++++-
drivers/media/v4l2-core/videobuf2-dma-sg.c | 8 ++++-
drivers/media/v4l2-core/videobuf2-vmalloc.c | 8 ++++-
drivers/staging/android/ion/ion.c | 9 +++--
include/linux/dma-buf.h | 34 +++++++++++++++----
15 files changed, 152 insertions(+), 63 deletions(-)
Hello Everyone,
This is yet another attempt to get Exynos SYSMMU driver with integrated
with IOMMU & DMA-mapping subsystems. The main change from previous
version is a rebase onto some more pending Exynos DTS patches and minor
fixes of the reported issues.
Merge plan for this patchset:
1. All iommu related patches (with 'iommu: exynos') can be merged to
iommu tree. They don't have any direct dependencies on the DTS, DRM and
power domain initialization change - without them the driver will simply
not initialize, when no exynos,sysmmu nodes are provided in device tree.
Joerg, could you merge those patches?
2. DTS and power domain patches should go to Samsung Exynos tree. Those
patches depends on earlier DTS patches for Exynos SoCs, which make
this patchset really complete:
- 'ARM: DTS: Exynos: convert to generic power domain bindings'
(http://www.spinics.net/lists/linux-samsung-soc/msg40584.html)
- '[PATCH v4 0/7] Enable HDMI support on Exynos platforms'
(http://www.spinics.net/lists/arm-kernel/msg391148.html)
- '[PATCH 0/2] Add HDMI support for Exynos5420 platform'
(http://www.spinics.net/lists/linux-samsung-soc/msg41364.html)
Kukjin, could you merge those patches?
3. Exynos DRM fix. This patch in my opinion should go Exynos DRM tree.
Inki, could you merge it?
Best regards
Marek Szyprowski
Samsung R&D Institute Poland
Changelog:
v5:
- rebased onto 'Add HDMI support for Exynos5420 platform' patchset
- fixed 'const' issue in 'iommu: exynos: init from dt-specific callback
instead of initcall' patch, thanks to Tobias Jakobi for reporting it
- fixed copy-paste typo in exynos5250 dts patch
v4: http://www.spinics.net/lists/linux-samsung-soc/msg41177.html
- rebased onto v3.19-rc4 and other Exynos DTS queued patches
- added DTS patch for Exynos 5250 & 5420/5422/5800
v3: http://www.spinics.net/lists/linux-samsung-soc/msg39168.html
- rebased onto "[RFC PATCH v4 0/8] Introduce automatic DMA
configuration for IOMMU masters"
- added some minor fixes for iommu and dma-mapping frameworks
v2: http://thread.gmane.org/gmane.linux.kernel.iommu/6472/
- rebased onto "[RFC PATCH v3 0/7] Introduce automatic DMA
configuration for IOMMU masters" patches:
http://www.spinics.net/lists/arm-kernel/msg362076.html
- changed initialization from bus notifiers to DT related callbacks
- removed support for separate IO address spaces - this will be
discussed separately after the basic support gets merged
- removed support for power domain notifier-based runtime power
management - this also will be discussed separately later
v1: https://lkml.org/lkml/2014/8/5/183
- initial version, feature complete, completely rewrote integration
approach
Patch summary:
Marek Szyprowski (18):
drm: exynos: detach from default dma-mapping domain on init
arm: exynos: pm_domains: add support for devices registered before
arch_initcall
ARM: dts: exynos4: add sysmmu nodes
ARM: dts: exynos5250: add sysmmu nodes
ARM: dts: exynos5420: add sysmmu nodes
iommu: exynos: don't read version register on every tlb operation
iommu: exynos: remove unused functions
iommu: exynos: remove useless spinlock
iommu: exynos: refactor function parameters to simplify code
iommu: exynos: remove unused functions, part 2
iommu: exynos: remove useless device_add/remove callbacks
iommu: exynos: add support for binding more than one sysmmu to master
device
iommu: exynos: add support for runtime_pm
iommu: exynos: rename variables to reflect their purpose
iommu: exynos: document internal structures
iommu: exynos: remove excessive includes and sort others
alphabetically
iommu: exynos: init from dt-specific callback instead of initcall
iommu: exynos: add callback for initializing devices from device tree
arch/arm/boot/dts/exynos4.dtsi | 118 +++++++
arch/arm/boot/dts/exynos4210.dtsi | 23 ++
arch/arm/boot/dts/exynos4x12.dtsi | 82 +++++
arch/arm/boot/dts/exynos5250.dtsi | 250 +++++++++++++++
arch/arm/boot/dts/exynos5420.dtsi | 181 +++++++++++
arch/arm/mach-exynos/pm_domains.c | 9 +-
drivers/gpu/drm/exynos/exynos_drm_iommu.c | 3 +
drivers/iommu/exynos-iommu.c | 492 ++++++++++++++----------------
8 files changed, 888 insertions(+), 270 deletions(-)
--
1.9.2
The dmabuf fd can be shared between processes via unix domain
socket. The file of dmabuf fd is came from anon_inode. The inode
has no set and get xattr operations, so it can not be shared
between processes with smack. This patch fixes just to ignore
private inode including anon_inode for smack_file_receive.
Signed-off-by: Seung-Woo Kim <sw0312.kim(a)samsung.com>
---
security/smack/smack_lsm.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c
index 69fdc38..d1bb411 100644
--- a/security/smack/smack_lsm.c
+++ b/security/smack/smack_lsm.c
@@ -1673,6 +1673,9 @@ static int smack_file_receive(struct file *file)
struct smk_audit_info ad;
struct inode *inode = file_inode(file);
+ if (unlikely(IS_PRIVATE(inode)))
+ return 0;
+
smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_PATH);
smk_ad_setfield_u_fs_path(&ad, file->f_path);
/*
--
1.7.4.1
Hello,
On 2015년 04월 17일 00:35, Casey Schaufler wrote:
> On 4/16/2015 6:40 AM, Seung-Woo Kim wrote:
>> The dma-buf fd from anon_inode can be shared across processes, but
>> there is no way to set security permission for the fd. So this
>> patch fix just to ignore private inode from security_file_receive.
>>
>> Signed-off-by: Seung-Woo Kim <sw0312.kim(a)samsung.com>
>> ---
>>
>> If security like smack is enabled, the dmabuf fd can not be shared between
>> processes via unix domain socket. I am not familiar with security, so I am
>> not sure that this kind of patch can be acceptable.
>
> If an IS_PRIVATE() check is appropriate, it should be in
> smack_file_receive(), not security_file_receive(). Why are you
> looking at file->f_path.dentry->d_inode? That's not used in the
> Smack access check. You'd want file->f_inode if anything.
>
> Naked-by: Casey Schaufler <casey(a)schaufler-ca.com>
>
Ok, I will try to do it from smack side. Also checking about file->f_inode.
Thanks and Regards,
- Seung-Woo Kim
>>
>> Is there other option to share dmabuf fd via socket with security check?
>>
>> Best Regards,
>> - Seung-Woo Kim
>>
>> ---
>> security/security.c | 3 +++
>> 1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/security/security.c b/security/security.c
>> index 730ac65..c57354c 100644
>> --- a/security/security.c
>> +++ b/security/security.c
>> @@ -810,6 +810,9 @@ int security_file_send_sigiotask(struct task_struct *tsk,
>>
>> int security_file_receive(struct file *file)
>> {
>> +
>> + if (unlikely(IS_PRIVATE(file->f_path.dentry->d_inode)))
>> + return 0;
>> return security_ops->file_receive(file);
>> }
>>
>
>
--
Seung-Woo Kim
Samsung Software R&D Center
--