All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shuah Khan <shuahkh@osg.samsung.com>
To: Inki Dae <inki.dae@samsung.com>,
	jy0922.shim@samsung.com, sw0312.kim@samsung.com,
	kyungmin.park@samsung.com, airlied@linux.ie, kgene@kernel.org,
	k.kozlowski@samsung.com
Cc: dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org,
	Shuah Khan <shuahkh@osg.samsung.com>
Subject: Re: [PATCH] exynos-drm: Fix display manager failing to start without IOMMU problem
Date: Fri, 12 Aug 2016 11:52:11 -0600	[thread overview]
Message-ID: <57AE0CCB.1010708@osg.samsung.com> (raw)
In-Reply-To: <57AE0736.6020705@osg.samsung.com>

On 08/12/2016 11:28 AM, Shuah Khan wrote:
> On 08/10/2016 05:05 PM, Shuah Khan wrote:
>> On 08/10/2016 04:59 PM, Inki Dae wrote:
>>> Hi Shuah,
>>>
>>> 2016년 08월 11일 02:30에 Shuah Khan 이(가) 쓴 글:
>>>> Fix exynos_drm_gem_create_ioctl() attempts to allocate non-contiguous GEM
>>>> memory without IOMMU. In this case, there is no point in attempting to
>>>
>>> DRM gem can be used for Non-DRM drivers such as GPU, V4L2 based Multimedia device and other DMA devices.
>>> Even though IOMMU support is disabled, other framework based DMA drivers can use IOMMU - i.e., GPU driver -
>>> and they can use non-contiguous GEM buffer through UMM. (DMABUF) 
>>>
>>> So GEM allocation type is not dependent on IOMMU.
>>
>> Hi Inki,
>>
>> I am seeing the following failure without IOMMU and light dm fails
>> to start:
>>
>> [drm:exynos_drm_framebuffer_init] *ERROR* Non-continguous GEM memory is not supported.
>>
>> The change I made fixed that problem and light dm starts without IOMMU.
>> Is there a better way to fix this problem? Currently without IOMMU,
>> light dm doesn't start.
>>
>> This is on linux_next
> 
> Hi Inki,
> 
> I am looking into this further and I am finding inconsistent
> commits with regards to GEM contiguous and non-contiguous
> buffers.
> 
> Okay what you said is that:
> 
> exymod-drm should support non-continguous and contiguous GEM memory
> type with or without IOMMU
> 
> However, the code currently isn't doing that. The following
> commit allocates non-contiguous buffers when IOMMU is enabled
> to handle contiguous allocation failures.
> 
> There are other commits that removed checks for non-contig type.
> Let's look at the following cases to see what should be the driver
> behavior in these cases:
> 
> IOMMU is disabled:
> 
> exynos_drm_gem_create_ioctl() gets called with NONCONTIG
> - driver should try to allocate non-contig
> - if it can't allocate non-contig, allocate contig
>   ( this will allow avoid failure like the one I am seeing)
> 
> exynos_drm_gem_create_ioctl() gets called with CONTIG
> - driver should try to allocate contig
> - if it can't allocate contig, allocate non-contig
> 
> What is confusing is there are several code paths in the
> GEN allocation and checking memory types are enforcing
> non-contig with IOMMU. Check this routine:
> 
> exynos_drm_framebuffer_init() will reject non-contig
> memory type when check_fb_gem_memory_type() rejects
> non-contig GEM memory type without IOMMU.


okay the very first commit that added IOMMU support
introduced the code that rejects non-contig gem memory
type without IOMMU.

commit 0519f9a12d0113caab78980c48a7902d2bd40c2c
Author: Inki Dae <inki.dae@samsung.com>
Date:   Sat Oct 20 07:53:42 2012 -0700

    drm/exynos: add iommu support for exynos drm framework

Anyway, if it is th right change to fix check_fb_gem_memory_type()
to not reject NONCONTIG_BUFFER, then I can make that change
instead of this patch I sent.

> 
> So there is inconsistency in the non-contig vs. contig
> GEM support in exynos-drm. I think this needs to be cleaned
> up to get the desired behavior.
> 
> The following commit allocates non-contiguous buffers when IOMMU is
> enabled to handle contiguous allocation failures.
> 
> There are other commits that removed checks for non-contig type.
> Let's look at the following cases to see what should be the driver
> behavior in these cases:
> 
> commit 122beea84bb90236b1ae545f08267af58591c21b
> Author: Rahul Sharma <Rahul.Sharma@samsung.com>
> Date:   Wed May 7 17:21:29 2014 +0530
> 
>     drm/exynos: allocate non-contigous buffers when iommu is enabled
>     
>     Allow to allocate non-contigous buffers when iommu is enabled.
>     Currently, it tries to allocates contigous buffer which consistently
>     fail for large buffers and then fall back to non contigous. Apart
>     from being slow, this implementation is also very noisy and fills
>     the screen with alloc fail logs.
>     
>     Signed-off-by: Rahul Sharma <Rahul.Sharma@samsung.com>
>     Reviewed-by: Sachin Kamat <sachin.kamat@linaro.org>
>     Signed-off-by: Inki Dae <inki.dae@samsung.com>
> 
> 
> commit ea6d66c3a797376d21b23dc8261733ce35970014
> Author: Inki Dae <inki.dae@samsung.com>
> Date:   Fri Nov 2 16:10:39 2012 +0900
> 
>     drm/exynos: remove EXYNOS_BO_NONCONTIG type checking.
>     
>     With iommu support, non-continuous buffer also is supported so
>     this patch removes these checking from exynos_drm_gem_get/put_dma_addr
>     funciton.
>     
>     This patch is based on the below patch set, "drm/exynos: add
>     iommu support for -next".
>         http://www.spinics.net/lists/dri-devel/msg29041.html
>     
>     Signed-off-by: Inki Dae <inki.dae@samsung.com>
>     Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> 
> commit 2b35892e9da672df40ce890bffc4f9f6119c57e0
> Author: Inki Dae <inki.dae@samsung.com>
> Date:   Fri Mar 16 18:47:05 2012 +0900
> 
>     drm/exynos: update gem and buffer framework.
>     
>     with this patch, we can allocate physically continuous or non-continuous
>     memory and also it creates scatterlist for iommu support so allocated
>     memory region can be mapped to iommu page table using scatterlist.
>     
>     Signed-off-by: Inki Dae <inki.dae@samsung.com>
>     Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>     Signed-off-by: Dave Airlie <airlied@redhat.com>
> 
> -- Shuah
> 

WARNING: multiple messages have this Message-ID (diff)
From: shuahkh@osg.samsung.com (Shuah Khan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] exynos-drm: Fix display manager failing to start without IOMMU problem
Date: Fri, 12 Aug 2016 11:52:11 -0600	[thread overview]
Message-ID: <57AE0CCB.1010708@osg.samsung.com> (raw)
In-Reply-To: <57AE0736.6020705@osg.samsung.com>

On 08/12/2016 11:28 AM, Shuah Khan wrote:
> On 08/10/2016 05:05 PM, Shuah Khan wrote:
>> On 08/10/2016 04:59 PM, Inki Dae wrote:
>>> Hi Shuah,
>>>
>>> 2016? 08? 11? 02:30? Shuah Khan ?(?) ? ?:
>>>> Fix exynos_drm_gem_create_ioctl() attempts to allocate non-contiguous GEM
>>>> memory without IOMMU. In this case, there is no point in attempting to
>>>
>>> DRM gem can be used for Non-DRM drivers such as GPU, V4L2 based Multimedia device and other DMA devices.
>>> Even though IOMMU support is disabled, other framework based DMA drivers can use IOMMU - i.e., GPU driver -
>>> and they can use non-contiguous GEM buffer through UMM. (DMABUF) 
>>>
>>> So GEM allocation type is not dependent on IOMMU.
>>
>> Hi Inki,
>>
>> I am seeing the following failure without IOMMU and light dm fails
>> to start:
>>
>> [drm:exynos_drm_framebuffer_init] *ERROR* Non-continguous GEM memory is not supported.
>>
>> The change I made fixed that problem and light dm starts without IOMMU.
>> Is there a better way to fix this problem? Currently without IOMMU,
>> light dm doesn't start.
>>
>> This is on linux_next
> 
> Hi Inki,
> 
> I am looking into this further and I am finding inconsistent
> commits with regards to GEM contiguous and non-contiguous
> buffers.
> 
> Okay what you said is that:
> 
> exymod-drm should support non-continguous and contiguous GEM memory
> type with or without IOMMU
> 
> However, the code currently isn't doing that. The following
> commit allocates non-contiguous buffers when IOMMU is enabled
> to handle contiguous allocation failures.
> 
> There are other commits that removed checks for non-contig type.
> Let's look at the following cases to see what should be the driver
> behavior in these cases:
> 
> IOMMU is disabled:
> 
> exynos_drm_gem_create_ioctl() gets called with NONCONTIG
> - driver should try to allocate non-contig
> - if it can't allocate non-contig, allocate contig
>   ( this will allow avoid failure like the one I am seeing)
> 
> exynos_drm_gem_create_ioctl() gets called with CONTIG
> - driver should try to allocate contig
> - if it can't allocate contig, allocate non-contig
> 
> What is confusing is there are several code paths in the
> GEN allocation and checking memory types are enforcing
> non-contig with IOMMU. Check this routine:
> 
> exynos_drm_framebuffer_init() will reject non-contig
> memory type when check_fb_gem_memory_type() rejects
> non-contig GEM memory type without IOMMU.


okay the very first commit that added IOMMU support
introduced the code that rejects non-contig gem memory
type without IOMMU.

commit 0519f9a12d0113caab78980c48a7902d2bd40c2c
Author: Inki Dae <inki.dae@samsung.com>
Date:   Sat Oct 20 07:53:42 2012 -0700

    drm/exynos: add iommu support for exynos drm framework

Anyway, if it is th right change to fix check_fb_gem_memory_type()
to not reject NONCONTIG_BUFFER, then I can make that change
instead of this patch I sent.

> 
> So there is inconsistency in the non-contig vs. contig
> GEM support in exynos-drm. I think this needs to be cleaned
> up to get the desired behavior.
> 
> The following commit allocates non-contiguous buffers when IOMMU is
> enabled to handle contiguous allocation failures.
> 
> There are other commits that removed checks for non-contig type.
> Let's look at the following cases to see what should be the driver
> behavior in these cases:
> 
> commit 122beea84bb90236b1ae545f08267af58591c21b
> Author: Rahul Sharma <Rahul.Sharma@samsung.com>
> Date:   Wed May 7 17:21:29 2014 +0530
> 
>     drm/exynos: allocate non-contigous buffers when iommu is enabled
>     
>     Allow to allocate non-contigous buffers when iommu is enabled.
>     Currently, it tries to allocates contigous buffer which consistently
>     fail for large buffers and then fall back to non contigous. Apart
>     from being slow, this implementation is also very noisy and fills
>     the screen with alloc fail logs.
>     
>     Signed-off-by: Rahul Sharma <Rahul.Sharma@samsung.com>
>     Reviewed-by: Sachin Kamat <sachin.kamat@linaro.org>
>     Signed-off-by: Inki Dae <inki.dae@samsung.com>
> 
> 
> commit ea6d66c3a797376d21b23dc8261733ce35970014
> Author: Inki Dae <inki.dae@samsung.com>
> Date:   Fri Nov 2 16:10:39 2012 +0900
> 
>     drm/exynos: remove EXYNOS_BO_NONCONTIG type checking.
>     
>     With iommu support, non-continuous buffer also is supported so
>     this patch removes these checking from exynos_drm_gem_get/put_dma_addr
>     funciton.
>     
>     This patch is based on the below patch set, "drm/exynos: add
>     iommu support for -next".
>         http://www.spinics.net/lists/dri-devel/msg29041.html
>     
>     Signed-off-by: Inki Dae <inki.dae@samsung.com>
>     Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> 
> commit 2b35892e9da672df40ce890bffc4f9f6119c57e0
> Author: Inki Dae <inki.dae@samsung.com>
> Date:   Fri Mar 16 18:47:05 2012 +0900
> 
>     drm/exynos: update gem and buffer framework.
>     
>     with this patch, we can allocate physically continuous or non-continuous
>     memory and also it creates scatterlist for iommu support so allocated
>     memory region can be mapped to iommu page table using scatterlist.
>     
>     Signed-off-by: Inki Dae <inki.dae@samsung.com>
>     Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
>     Signed-off-by: Dave Airlie <airlied@redhat.com>
> 
> -- Shuah
> 

  reply	other threads:[~2016-08-12 17:52 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20160810214111epcas1p4dd2a581353b550a1992fc7695e846da7@epcas1p4.samsung.com>
2016-08-10 17:30 ` [PATCH] exynos-drm: Fix display manager failing to start without IOMMU problem Shuah Khan
2016-08-10 17:30   ` Shuah Khan
2016-08-10 17:30   ` Shuah Khan
2016-08-10 17:41   ` Javier Martinez Canillas
2016-08-10 17:41     ` Javier Martinez Canillas
2016-08-10 17:41     ` Javier Martinez Canillas
2016-08-10 22:59   ` Inki Dae
2016-08-10 22:59     ` Inki Dae
2016-08-10 22:59     ` Inki Dae
2016-08-10 23:05     ` Shuah Khan
2016-08-10 23:05       ` Shuah Khan
2016-08-12 17:28       ` Shuah Khan
2016-08-12 17:28         ` Shuah Khan
2016-08-12 17:52         ` Shuah Khan [this message]
2016-08-12 17:52           ` Shuah Khan
2016-08-16  4:40           ` Inki Dae
2016-08-16  4:40             ` Inki Dae
2016-08-16  4:40             ` Inki Dae
2016-10-12 23:11             ` Shuah Khan
2016-10-12 23:11               ` Shuah Khan
2016-10-12 23:11               ` Shuah Khan
2016-10-12 23:15               ` Shuah Khan
2016-10-12 23:15                 ` Shuah Khan
2016-10-17 19:45                 ` exynos-drm: display manager fails " Shuah Khan
2016-10-19 16:23                   ` Tobias Jakobi
2016-10-19 16:23                     ` Tobias Jakobi
2016-10-19 16:23                     ` Tobias Jakobi
2016-10-19 22:56                     ` Shuah Khan
2016-10-19 22:56                       ` Shuah Khan
2016-10-19 14:16               ` [PATCH] exynos-drm: Fix display manager failing " Inki Dae
2016-10-19 14:16                 ` Inki Dae
2016-10-19 14:16                 ` Inki Dae
2016-10-19 22:27                 ` Shuah Khan
2016-10-19 22:27                   ` Shuah Khan
2016-10-25 16:37                   ` Shuah Khan
2016-10-25 16:37                     ` Shuah Khan
2016-10-25 17:57                     ` Tobias Jakobi
2016-10-25 17:57                       ` Tobias Jakobi
2016-10-25 17:57                       ` Tobias Jakobi
2016-10-25 18:53                       ` Shuah Khan
2016-10-25 18:53                         ` Shuah Khan

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=57AE0CCB.1010708@osg.samsung.com \
    --to=shuahkh@osg.samsung.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=inki.dae@samsung.com \
    --cc=jy0922.shim@samsung.com \
    --cc=k.kozlowski@samsung.com \
    --cc=kgene@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=sw0312.kim@samsung.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.