From: Marek Szyprowski <m.szyprowski@samsung.com> To: Pankaj Dubey <pankaj.dubey@samsung.com>, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: kyungmin.park@samsung.com, jtp.park@samsung.com, mchehab@kernel.org, mchehab@osg.samsung.com, hans.verkuil@cisco.com, krzk@kernel.org, kgene@kernel.org, javier@osg.samsung.com Subject: Re: [PATCH 0/2] s5p-mfc fix for using reserved memory Date: Tue, 20 Dec 2016 12:58:08 +0100 [thread overview] Message-ID: <ea03c72a-a0f4-46e6-bd29-474549a0f145@samsung.com> (raw) In-Reply-To: <1481888915-19624-1-git-send-email-pankaj.dubey@samsung.com> Hi Pankaj On 2016-12-16 12:48, Pankaj Dubey wrote: > It has been observed on ARM64 based Exynos SoC, if IOMMU is not enabled > and we try to use reserved memory for MFC, reqbufs fails with below > mentioned error > --------------------------------------------------------------------------- > V4L2 Codec decoding example application > Kamil Debski <k.debski@samsung.com> > Copyright 2012 Samsung Electronics Co., Ltd. > > Opening MFC. > (mfc.c:mfc_open:58): MFC Info (/dev/video0): driver="s5p-mfc" \ > bus_info="platform:12c30000.mfc0" card="s5p-mfc-dec" fd=0x4[ > 42.339165] Remapping memory failed, error: -6 > > MFC Open Success. > (main.c:main:711): Successfully opened all necessary files and devices > (mfc.c:mfc_dec_setup_output:103): Setup MFC decoding OUTPUT buffer \ > size=4194304 (requested=4194304) > (mfc.c:mfc_dec_setup_output:120): Number of MFC OUTPUT buffers is 2 \ > (requested 2) > > [App] Out buf phy : 0x00000000, virt : 0xffffffff > Output Length is = 0x300000 > Error (mfc.c:mfc_dec_setup_output:145): Failed to MMAP MFC OUTPUT buffer > ------------------------------------------------------------------------- > This is because the device requesting for memory is mfc0.left not the parent mfc0. > Hence setting of alloc_devs need to be done only if IOMMU is enabled > and in that case both the left and right device is treated as mfc0 only. > Also we need to populate vb2_queue's dev pointer with mfc dev pointer. I also got this issue but Your solution is imho not the proper approach. Too much hacking in the driver, while the issue is in the core. ARM64 requires to call arch_setup_dma_ops() for each device that will be used for dma-mapping. So the issue is in drivers/of/of_reserved_mem.c - in of_reserved_mem_device_init_by_idx() function, which should ensure that arch_setup_dma_ops() is called also for the virtual devices for reserved memory. s5p-mfc driver however still requires some patching for dma-mapping/iommu glue used on ARM64 architecture. > Smitha T Murthy (2): > media: s5p-mfc: convert drivers to use the new vb2_queue dev field > media: s5p-mfc: fix MMAP of mfc buffer during reqbufs > > drivers/media/platform/s5p-mfc/s5p_mfc.c | 2 ++ > drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 17 ++++++++++------- > drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 18 +++++++++++------- > 3 files changed, 23 insertions(+), 14 deletions(-) > Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland
WARNING: multiple messages have this Message-ID (diff)
From: m.szyprowski@samsung.com (Marek Szyprowski) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 0/2] s5p-mfc fix for using reserved memory Date: Tue, 20 Dec 2016 12:58:08 +0100 [thread overview] Message-ID: <ea03c72a-a0f4-46e6-bd29-474549a0f145@samsung.com> (raw) In-Reply-To: <1481888915-19624-1-git-send-email-pankaj.dubey@samsung.com> Hi Pankaj On 2016-12-16 12:48, Pankaj Dubey wrote: > It has been observed on ARM64 based Exynos SoC, if IOMMU is not enabled > and we try to use reserved memory for MFC, reqbufs fails with below > mentioned error > --------------------------------------------------------------------------- > V4L2 Codec decoding example application > Kamil Debski <k.debski@samsung.com> > Copyright 2012 Samsung Electronics Co., Ltd. > > Opening MFC. > (mfc.c:mfc_open:58): MFC Info (/dev/video0): driver="s5p-mfc" \ > bus_info="platform:12c30000.mfc0" card="s5p-mfc-dec" fd=0x4[ > 42.339165] Remapping memory failed, error: -6 > > MFC Open Success. > (main.c:main:711): Successfully opened all necessary files and devices > (mfc.c:mfc_dec_setup_output:103): Setup MFC decoding OUTPUT buffer \ > size=4194304 (requested=4194304) > (mfc.c:mfc_dec_setup_output:120): Number of MFC OUTPUT buffers is 2 \ > (requested 2) > > [App] Out buf phy : 0x00000000, virt : 0xffffffff > Output Length is = 0x300000 > Error (mfc.c:mfc_dec_setup_output:145): Failed to MMAP MFC OUTPUT buffer > ------------------------------------------------------------------------- > This is because the device requesting for memory is mfc0.left not the parent mfc0. > Hence setting of alloc_devs need to be done only if IOMMU is enabled > and in that case both the left and right device is treated as mfc0 only. > Also we need to populate vb2_queue's dev pointer with mfc dev pointer. I also got this issue but Your solution is imho not the proper approach. Too much hacking in the driver, while the issue is in the core. ARM64 requires to call arch_setup_dma_ops() for each device that will be used for dma-mapping. So the issue is in drivers/of/of_reserved_mem.c - in of_reserved_mem_device_init_by_idx() function, which should ensure that arch_setup_dma_ops() is called also for the virtual devices for reserved memory. s5p-mfc driver however still requires some patching for dma-mapping/iommu glue used on ARM64 architecture. > Smitha T Murthy (2): > media: s5p-mfc: convert drivers to use the new vb2_queue dev field > media: s5p-mfc: fix MMAP of mfc buffer during reqbufs > > drivers/media/platform/s5p-mfc/s5p_mfc.c | 2 ++ > drivers/media/platform/s5p-mfc/s5p_mfc_dec.c | 17 ++++++++++------- > drivers/media/platform/s5p-mfc/s5p_mfc_enc.c | 18 +++++++++++------- > 3 files changed, 23 insertions(+), 14 deletions(-) > Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland
next prev parent reply other threads:[~2016-12-20 11:58 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <CGME20161216115004epcas1p276eddca803dcafe3470e223386b86da0@epcas1p2.samsung.com> 2016-12-16 11:48 ` [PATCH 0/2] s5p-mfc fix for using reserved memory Pankaj Dubey 2016-12-16 11:48 ` Pankaj Dubey 2016-12-16 11:48 ` Pankaj Dubey 2016-12-16 11:48 ` [PATCH 1/2] media: s5p-mfc: convert drivers to use the new vb2_queue dev field Pankaj Dubey 2016-12-16 11:48 ` Pankaj Dubey 2016-12-16 11:48 ` Pankaj Dubey 2017-02-24 19:22 ` Javier Martinez Canillas 2017-02-24 19:22 ` Javier Martinez Canillas 2017-02-27 3:09 ` pankaj.dubey 2017-02-27 3:09 ` pankaj.dubey 2016-12-16 11:48 ` [PATCH 2/2] media: s5p-mfc: fix MMAP of mfc buffer during reqbufs Pankaj Dubey 2016-12-16 11:48 ` Pankaj Dubey 2016-12-16 11:48 ` Pankaj Dubey 2017-02-24 19:42 ` Javier Martinez Canillas 2017-02-24 19:42 ` Javier Martinez Canillas 2017-02-27 3:17 ` pankaj.dubey 2017-02-27 3:17 ` pankaj.dubey 2016-12-20 11:58 ` Marek Szyprowski [this message] 2016-12-20 11:58 ` [PATCH 0/2] s5p-mfc fix for using reserved memory Marek Szyprowski 2016-12-21 5:44 ` pankaj.dubey 2016-12-21 5:44 ` pankaj.dubey
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=ea03c72a-a0f4-46e6-bd29-474549a0f145@samsung.com \ --to=m.szyprowski@samsung.com \ --cc=hans.verkuil@cisco.com \ --cc=javier@osg.samsung.com \ --cc=jtp.park@samsung.com \ --cc=kgene@kernel.org \ --cc=krzk@kernel.org \ --cc=kyungmin.park@samsung.com \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-media@vger.kernel.org \ --cc=linux-samsung-soc@vger.kernel.org \ --cc=mchehab@kernel.org \ --cc=mchehab@osg.samsung.com \ --cc=pankaj.dubey@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: linkBe 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.