[PATCH V3] vfio: platform: support No-IOMMU mode

2016-05-23 Thread Peng Fan
s making use of this support are named /dev/vfio/noiommu-$GROUP and can only make use of the special VFIO_NOIOMMU_IOMMU for the container. Use of this mode, specifically binding a device without a native IOMMU group to a VFIO bus driver will taint the kernel and should therefore not be considere

Re: [PATCH V2] vfio: platform: support No-IOMMU mode

2016-05-23 Thread Peng Fan
Hi Eric, On Mon, May 23, 2016 at 10:59:24AM +0200, Eric Auger wrote: >Hi Peng, >On 05/23/2016 10:14 AM, Peng Fan wrote: >> The vfio No-IOMMU mode was supported by this >> 'commit 03a76b60f8ba2797 ("vfio: Include No-IOMMU mode")', >> but it only support vfio-pci.

Re: [PATCH V2] vfio: platform: support No-IOMMU mode

2016-05-23 Thread Peng Fan
Hi Eric, On Mon, May 23, 2016 at 10:59:24AM +0200, Eric Auger wrote: >Hi Peng, >On 05/23/2016 10:14 AM, Peng Fan wrote: >> The vfio No-IOMMU mode was supported by this >> 'commit 03a76b60f8ba2797 ("vfio: Include No-IOMMU mode")', >> but it only support vfio-pci.

[PATCH V2] vfio: platform: support No-IOMMU mode

2016-05-23 Thread Peng Fan
dered supported.", Actually, for vfio-platform No-IOMMU mode, the userspace can not do DMA, because the ioctl API of noiommu container only supports VFIO_CHECK_EXTENSION and VFIO_IOMMU_MAP_DMA is not supported. Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Eric Auger &

[PATCH V2] vfio: platform: support No-IOMMU mode

2016-05-23 Thread Peng Fan
dered supported.", Actually, for vfio-platform No-IOMMU mode, the userspace can not do DMA, because the ioctl API of noiommu container only supports VFIO_CHECK_EXTENSION and VFIO_IOMMU_MAP_DMA is not supported. Signed-off-by: Peng Fan Cc: Eric Auger Cc: Baptiste Reynal Cc: Alex Williamson --- V

Re: [PATCH] vfio: platform: use vfio_iommu_group_get/put

2016-05-20 Thread Peng Fan
Hi Eric, On Fri, May 20, 2016 at 11:22:13AM +0200, Eric Auger wrote: >Hi Peng, >On 05/20/2016 10:36 AM, Peng Fan wrote: >> Hi, >> >> On Fri, May 20, 2016 at 10:20:32AM +0200, Baptiste Reynal wrote: >>> Hi, >>> >>> On Fri, May 20, 2016 a

Re: [PATCH] vfio: platform: use vfio_iommu_group_get/put

2016-05-20 Thread Peng Fan
Hi Eric, On Fri, May 20, 2016 at 11:22:13AM +0200, Eric Auger wrote: >Hi Peng, >On 05/20/2016 10:36 AM, Peng Fan wrote: >> Hi, >> >> On Fri, May 20, 2016 at 10:20:32AM +0200, Baptiste Reynal wrote: >>> Hi, >>> >>> On Fri, May 20, 2016 at 9:58

Re: [PATCH] vfio: platform: use vfio_iommu_group_get/put

2016-05-20 Thread Peng Fan
Hi, On Fri, May 20, 2016 at 10:20:32AM +0200, Baptiste Reynal wrote: >Hi, > >On Fri, May 20, 2016 at 9:58 AM, Eric Auger <eric.au...@linaro.org> wrote: >> >> Hi, >> On 05/19/2016 11:01 PM, Alex Williamson wrote: >> > On Tue, 10 May 2016 15:40:28 +0800 &

Re: [PATCH] vfio: platform: use vfio_iommu_group_get/put

2016-05-20 Thread Peng Fan
Hi, On Fri, May 20, 2016 at 10:20:32AM +0200, Baptiste Reynal wrote: >Hi, > >On Fri, May 20, 2016 at 9:58 AM, Eric Auger wrote: >> >> Hi, >> On 05/19/2016 11:01 PM, Alex Williamson wrote: >> > On Tue, 10 May 2016 15:40:28 +0800 >> > Peng Fan wrote: &

[PATCH] pinctrl: imx: fix initialization of imx_pinctrl_desc

2016-05-18 Thread Peng Fan
allcoated imx_pinctrl_desc and switch to dynamically allcate pin controller descriptor for each iomux controller. Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Linus Walleij <linus.wall...@linaro.org> Cc: Shawn Guo <shawn...@kernel.org> Cc: Philipp Zabel <p.za...@pengutronix

[PATCH] pinctrl: imx: fix initialization of imx_pinctrl_desc

2016-05-18 Thread Peng Fan
allcoated imx_pinctrl_desc and switch to dynamically allcate pin controller descriptor for each iomux controller. Signed-off-by: Peng Fan Cc: Linus Walleij Cc: Shawn Guo Cc: Philipp Zabel Cc: Stefan Agner Cc: Vladimir Zapolskiy --- drivers/pinctrl/freescale/pinctrl-imx.c | 25

RE: [PATCH V2 3/3] nvmem: imx-ocotp: handling clock

2016-05-10 Thread Peng Fan
> -Original Message- > From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel- > ow...@vger.kernel.org] On Behalf Of Srinivas Kandagatla > Sent: Tuesday, May 10, 2016 6:32 PM > To: Peng Fan <van.free...@gmail.com> > Cc: shawn...@kernel.org; maxime.rip...@f

RE: [PATCH V2 3/3] nvmem: imx-ocotp: handling clock

2016-05-10 Thread Peng Fan
> -Original Message- > From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel- > ow...@vger.kernel.org] On Behalf Of Srinivas Kandagatla > Sent: Tuesday, May 10, 2016 6:32 PM > To: Peng Fan > Cc: shawn...@kernel.org; maxime.rip...@free-electrons.com

Re: [PATCH] vfio: platform: use vfio_iommu_group_get/put

2016-05-10 Thread Peng Fan
Hi Alex, On Mon, May 09, 2016 at 09:32:38AM -0600, Alex Williamson wrote: >On Mon, 9 May 2016 18:01:43 +0800 >Peng Fan <van.free...@gmail.com> wrote: > >> Use vfio_iommu_group_get and vfio_iommu_group_put, but not >> iommu_group_get or iommu_group_put. > >I

Re: [PATCH] vfio: platform: use vfio_iommu_group_get/put

2016-05-10 Thread Peng Fan
Hi Alex, On Mon, May 09, 2016 at 09:32:38AM -0600, Alex Williamson wrote: >On Mon, 9 May 2016 18:01:43 +0800 >Peng Fan wrote: > >> Use vfio_iommu_group_get and vfio_iommu_group_put, but not >> iommu_group_get or iommu_group_put. > >I assume you're trying to duplicat

RE: [PATCH V2 3/3] nvmem: imx-ocotp: handling clock

2016-05-09 Thread Peng Fan
Hi, Kindly ping.. Any comments on this patch set? > -Original Message- > From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel- > ow...@vger.kernel.org] On Behalf Of Peng Fan > Sent: Thursday, April 21, 2016 1:26 AM > To: shawn...@kernel.org; srinivas.kandag

RE: [PATCH V2 3/3] nvmem: imx-ocotp: handling clock

2016-05-09 Thread Peng Fan
Hi, Kindly ping.. Any comments on this patch set? > -Original Message- > From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel- > ow...@vger.kernel.org] On Behalf Of Peng Fan > Sent: Thursday, April 21, 2016 1:26 AM > To: shawn...@kernel.org; srinivas.kandag

Re: [PATCH V2 3/3] nvmem: imx-ocotp: handling clock

2016-05-09 Thread Peng Fan
Hi Srinivas, On Mon, May 09, 2016 at 01:28:14PM +0100, Srinivas Kandagatla wrote: >Thanks for the Ping, I totally missed this thread. > >On 20/04/16 18:26, Peng Fan wrote: >>Before access ocotp nvmem area, the clock should be enabled. >>Or, `hexdump nvmem` will hang the syst

Re: [PATCH V2 3/3] nvmem: imx-ocotp: handling clock

2016-05-09 Thread Peng Fan
Hi Srinivas, On Mon, May 09, 2016 at 01:28:14PM +0100, Srinivas Kandagatla wrote: >Thanks for the Ping, I totally missed this thread. > >On 20/04/16 18:26, Peng Fan wrote: >>Before access ocotp nvmem area, the clock should be enabled. >>Or, `hexdump nvmem` will hang the syst

[PATCH] vfio: platform: use vfio_iommu_group_get/put

2016-05-09 Thread Peng Fan
Use vfio_iommu_group_get and vfio_iommu_group_put, but not iommu_group_get or iommu_group_put. Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Baptiste Reynal <b.rey...@virtualopensystems.com> Cc: Alex Williamson <alex.william...@redhat.com> --- drivers/vfio/platform/vfio

[PATCH] vfio: platform: use vfio_iommu_group_get/put

2016-05-09 Thread Peng Fan
Use vfio_iommu_group_get and vfio_iommu_group_put, but not iommu_group_get or iommu_group_put. Signed-off-by: Peng Fan Cc: Baptiste Reynal Cc: Alex Williamson --- drivers/vfio/platform/vfio_platform_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers

[PATCH V2] iommu/arm-smmu: clear cache lock bit of ACR

2016-05-03 Thread Peng Fan
onwards, need to check the major number of IDR7. Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Will Deacon <will.dea...@arm.com> Cc: Robin Murphy <robin.mur...@arm.com> --- V2: Following Robin's comments, need to check IDR7 before clearing CACHE_LOCK bit of ACR. V1: Patch ba

[PATCH V2] iommu/arm-smmu: clear cache lock bit of ACR

2016-05-03 Thread Peng Fan
onwards, need to check the major number of IDR7. Signed-off-by: Peng Fan Cc: Will Deacon Cc: Robin Murphy --- V2: Following Robin's comments, need to check IDR7 before clearing CACHE_LOCK bit of ACR. V1: Patch based on iommu/devel drivers/iommu/arm-smmu.c | 23 ++- 1 file

Re: [PATCH] iommu/arm-smmu: clear cache lock bit of ACR

2016-05-03 Thread Peng Fan
Hi Robin, On Tue, May 03, 2016 at 12:15:52PM +0100, Robin Murphy wrote: >On 03/05/16 11:15, Peng Fan wrote: >>According MMU-500 TRM, section 3.7.1 Auxiliary Control registers, >>You can modify ACTLR only when the ACR.CACHE_LOCK bit is 0. >> >>So before clearing AR

Re: [PATCH] iommu/arm-smmu: clear cache lock bit of ACR

2016-05-03 Thread Peng Fan
Hi Robin, On Tue, May 03, 2016 at 12:15:52PM +0100, Robin Murphy wrote: >On 03/05/16 11:15, Peng Fan wrote: >>According MMU-500 TRM, section 3.7.1 Auxiliary Control registers, >>You can modify ACTLR only when the ACR.CACHE_LOCK bit is 0. >> >>So before clearing AR

[PATCH] iommu/arm-smmu: clear cache lock bit of ACR

2016-05-03 Thread Peng Fan
According MMU-500 TRM, section 3.7.1 Auxiliary Control registers, You can modify ACTLR only when the ACR.CACHE_LOCK bit is 0. So before clearing ARM_MMU500_ACTLR_CPRE of each context bank, need clear CACHE_LOCK bit of ACR register first. Signed-off-by: Peng Fan <van.free...@gmail.com&

[PATCH] iommu/arm-smmu: clear cache lock bit of ACR

2016-05-03 Thread Peng Fan
According MMU-500 TRM, section 3.7.1 Auxiliary Control registers, You can modify ACTLR only when the ACR.CACHE_LOCK bit is 0. So before clearing ARM_MMU500_ACTLR_CPRE of each context bank, need clear CACHE_LOCK bit of ACR register first. Signed-off-by: Peng Fan Cc: Will Deacon Cc: Robin Murphy

[PATCH V2 3/3] nvmem: imx-ocotp: handling clock

2016-04-20 Thread Peng Fan
Before access ocotp nvmem area, the clock should be enabled. Or, `hexdump nvmem` will hang the system. So, use such flow: " 1. clock_enable_prepare 2. read nvmem ocotp area 3. clock_disable_unprepare " Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Srinivas Kandagatla &

[PATCH V2 3/3] nvmem: imx-ocotp: handling clock

2016-04-20 Thread Peng Fan
Before access ocotp nvmem area, the clock should be enabled. Or, `hexdump nvmem` will hang the system. So, use such flow: " 1. clock_enable_prepare 2. read nvmem ocotp area 3. clock_disable_unprepare " Signed-off-by: Peng Fan Cc: Srinivas Kandagatla Cc: Maxime Ripard Cc:

[PATCH V2 1/3] arm: dts: imx6qdl: add clocks property for ocotp node

2016-04-20 Thread Peng Fan
Add clocks property for ocotp node. Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Shawn Guo <shawn...@kernel.org> Cc: Sascha Hauer <ker...@pengutronix.de> Cc: Rob Herring <robh...@kernel.org> --- V2: none arch/arm/boot/dts/imx6qdl.dtsi | 1 + 1 file changed, 1

[PATCH V2 1/3] arm: dts: imx6qdl: add clocks property for ocotp node

2016-04-20 Thread Peng Fan
Add clocks property for ocotp node. Signed-off-by: Peng Fan Cc: Shawn Guo Cc: Sascha Hauer Cc: Rob Herring --- V2: none arch/arm/boot/dts/imx6qdl.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi index b42822a..6b2ef6c

[PATCH V2 2/3] arm: dts: imx6sl: add clocks property for ocotp node

2016-04-20 Thread Peng Fan
Add clocks property for ocotp node. Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Shawn Guo <shawn...@kernel.org> Cc: Sascha Hauer <ker...@pengutronix.de> Cc: Rob Herring <robh...@kernel.org> --- V2: none arch/arm/boot/dts/imx6sl.dtsi | 1 + 1 file changed, 1

[PATCH V2 2/3] arm: dts: imx6sl: add clocks property for ocotp node

2016-04-20 Thread Peng Fan
Add clocks property for ocotp node. Signed-off-by: Peng Fan Cc: Shawn Guo Cc: Sascha Hauer Cc: Rob Herring --- V2: none arch/arm/boot/dts/imx6sl.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi index d12b250..b37da94

Re: [PATCH 3/3] nvmem: imx-ocotp: handling clock

2016-04-19 Thread Peng Fan
Hi Fabio, On Tue, Apr 19, 2016 at 07:42:17AM -0300, Fabio Estevam wrote: >Hi Peng, > >On Tue, Apr 19, 2016 at 5:33 AM, Peng Fan <van.free...@gmail.com> wrote: > >> @@ -46,11 +48,15 @@ static int imx_ocotp_read(void *context, const void >> *reg, size_t reg_size, >&

Re: [PATCH 3/3] nvmem: imx-ocotp: handling clock

2016-04-19 Thread Peng Fan
Hi Fabio, On Tue, Apr 19, 2016 at 07:42:17AM -0300, Fabio Estevam wrote: >Hi Peng, > >On Tue, Apr 19, 2016 at 5:33 AM, Peng Fan wrote: > >> @@ -46,11 +48,15 @@ static int imx_ocotp_read(void *context, const void >> *reg, size_t reg_size, >> if

[PATCH 2/3] arm: dts: imx6ul: add ocotp node

2016-04-19 Thread Peng Fan
Add ocotp node for i.MX6UL Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Shawn Guo <shawn...@kernel.org> Cc: Sascha Hauer <ker...@pengutronix.de> Cc: Rob Herring <robh...@kernel.org> --- arch/arm/boot/dts/imx6ul.dtsi | 6 ++ 1 file changed, 6 insertions(+) di

[PATCH 2/3] arm: dts: imx6ul: add ocotp node

2016-04-19 Thread Peng Fan
Add ocotp node for i.MX6UL Signed-off-by: Peng Fan Cc: Shawn Guo Cc: Sascha Hauer Cc: Rob Herring --- arch/arm/boot/dts/imx6ul.dtsi | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi index 7177899..aebd607 100644 --- a/arch

[PATCH 3/3] nvmem: imx-ocotp: support i.MX6UL

2016-04-19 Thread Peng Fan
Add of_device_id entry for i.MX6UL to let imx-ocotp driver support i.MX6UL. Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Srinivas Kandagatla <srinivas.kandaga...@linaro.org> Cc: Maxime Ripard <maxime.rip...@free-electrons.com> Cc: Shawn Guo <shawn...@kernel.org>

[PATCH 1/3] documentation: nvmem: imx-ocotp: Add i.MX6UL support

2016-04-19 Thread Peng Fan
Add i.MX6UL support in documentation. Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Srinivas Kandagatla <srinivas.kandaga...@linaro.org> Cc: Maxime Ripard <maxime.rip...@free-electrons.com> Cc: Rob Herring <robh...@kernel.org> --- Documentation/devicetree/bindings

[PATCH 3/3] nvmem: imx-ocotp: support i.MX6UL

2016-04-19 Thread Peng Fan
Add of_device_id entry for i.MX6UL to let imx-ocotp driver support i.MX6UL. Signed-off-by: Peng Fan Cc: Srinivas Kandagatla Cc: Maxime Ripard Cc: Shawn Guo --- drivers/nvmem/imx-ocotp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvmem/imx-ocotp.c b/drivers/nvmem/imx-ocotp.c

[PATCH 1/3] documentation: nvmem: imx-ocotp: Add i.MX6UL support

2016-04-19 Thread Peng Fan
Add i.MX6UL support in documentation. Signed-off-by: Peng Fan Cc: Srinivas Kandagatla Cc: Maxime Ripard Cc: Rob Herring --- Documentation/devicetree/bindings/nvmem/imx-ocotp.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/nvmem

[PATCH 2/3] arm: dts: imx6sl: add clocks property for ocotp node

2016-04-19 Thread Peng Fan
Add clocks property for ocotp node. Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Shawn Guo <shawn...@kernel.org> Cc: Sascha Hauer <ker...@pengutronix.de> Cc: Rob Herring <robh...@kernel.org> --- arch/arm/boot/dts/imx6sl.dtsi | 1 + 1 file changed, 1 insertion(+

[PATCH 2/3] arm: dts: imx6sl: add clocks property for ocotp node

2016-04-19 Thread Peng Fan
Add clocks property for ocotp node. Signed-off-by: Peng Fan Cc: Shawn Guo Cc: Sascha Hauer Cc: Rob Herring --- arch/arm/boot/dts/imx6sl.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/imx6sl.dtsi b/arch/arm/boot/dts/imx6sl.dtsi index d12b250..b37da94 100644

[PATCH 1/3] arm: dts: imx6qdl: add clocks property for ocotp node

2016-04-19 Thread Peng Fan
Add clocks property for ocotp node. Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Shawn Guo <shawn...@kernel.org> Cc: Sascha Hauer <ker...@pengutronix.de> Cc: Rob Herring <robh...@kernel.org> --- arch/arm/boot/dts/imx6qdl.dtsi | 1 + 1 file changed, 1 insertion(+

[PATCH 3/3] nvmem: imx-ocotp: handling clock

2016-04-19 Thread Peng Fan
Before access ocotp nvmem area, the clock should be enabled. Or, `hexdump nvmem` will hang the system. So, use such flow: " 1. clock_enable_prepare 2. read nvmem ocotp area 3. clock_disable_unprepare " Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Srinivas Kandagatla &

[PATCH 1/3] arm: dts: imx6qdl: add clocks property for ocotp node

2016-04-19 Thread Peng Fan
Add clocks property for ocotp node. Signed-off-by: Peng Fan Cc: Shawn Guo Cc: Sascha Hauer Cc: Rob Herring --- arch/arm/boot/dts/imx6qdl.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/imx6qdl.dtsi b/arch/arm/boot/dts/imx6qdl.dtsi index b42822a..6b2ef6c 100644

[PATCH 3/3] nvmem: imx-ocotp: handling clock

2016-04-19 Thread Peng Fan
Before access ocotp nvmem area, the clock should be enabled. Or, `hexdump nvmem` will hang the system. So, use such flow: " 1. clock_enable_prepare 2. read nvmem ocotp area 3. clock_disable_unprepare " Signed-off-by: Peng Fan Cc: Srinivas Kandagatla Cc: Maxime Ripard Cc:

[RFC 1/1] xen: interface: correct comments

2015-11-25 Thread Peng Fan
According to definition of structure evtchn_alloc_unbound, there is an entry "domid_t remote_dom", no "rdom". So using "remote_dom" in comments instead of "rdom". Signed-off-by: Peng Fan Cc: Konrad Rzeszutek Wilk Cc: Boris Ostrovsky Cc: David Vrabel --

[RFC 1/1] xen: block: correct setting for xen_blkif_max_ring_order

2015-11-25 Thread Peng Fan
max_ring_order using XENBUS_MAX_RING_GRANT_ORDER, but not 0. Signed-off-by: Peng Fan Cc: Konrad Rzeszutek Wilk Cc: Boris Ostrovsky Cc: David Vrabel Cc: "Roger Pau Monné" --- Hi, I am new to xen and reading related soure code, not sure whether this is correct. Please comments. Thanks dr

[RFC 1/1] xen: block: correct setting for xen_blkif_max_ring_order

2015-11-25 Thread Peng Fan
max_ring_order using XENBUS_MAX_RING_GRANT_ORDER, but not 0. Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Konrad Rzeszutek Wilk <konrad.w...@oracle.com> Cc: Boris Ostrovsky <boris.ostrov...@oracle.com> Cc: David Vrabel <david.vra...@citrix.com> Cc: "Roger Pau Monné&

[RFC 1/1] xen: interface: correct comments

2015-11-25 Thread Peng Fan
According to definition of structure evtchn_alloc_unbound, there is an entry "domid_t remote_dom", no "rdom". So using "remote_dom" in comments instead of "rdom". Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Konrad Rzeszutek Wilk <konrad.w

Re: [RFC V4] iommu: arm-smmu: correct group reference count

2015-11-20 Thread Peng Fan
>Since we are adding one device, the flow is (2) and the group reference >count will be increased by 2. So, we need to add iommu_group_put at the >end of arm_smmu_add_device to decrease the count by 1. > >Also take the failure path into consideration when fail to add a device. > &g

Re: [RFC V4] iommu: arm-smmu: correct group reference count

2015-11-20 Thread Peng Fan
>Since we are adding one device, the flow is (2) and the group reference >count will be increased by 2. So, we need to add iommu_group_put at the >end of arm_smmu_add_device to decrease the count by 1. > >Also take the failure path into consideration when fail to add a device. >

Re: [RFC V3] iommu: arm-smmu: correct group reference count

2015-11-19 Thread Peng Fan
Hi Will, On Tue, Nov 17, 2015 at 04:17:46PM +, Will Deacon wrote: >On Tue, Nov 10, 2015 at 09:56:26AM +0800, Peng Fan wrote: >> The basic flow for add a device: >> arm_smmu_add_device >> |->iommu_group_get_for_dev >> |->iommu_group_get >

Re: [RFC V3] iommu: arm-smmu: correct group reference count

2015-11-19 Thread Peng Fan
Hi Will, On Tue, Nov 17, 2015 at 04:17:46PM +, Will Deacon wrote: >On Tue, Nov 10, 2015 at 09:56:26AM +0800, Peng Fan wrote: >> The basic flow for add a device: >> arm_smmu_add_device >> |->iommu_group_get_for_dev >> |->iommu_group_get >

[RFC V3] iommu: arm-smmu: correct group reference count

2015-11-09 Thread Peng Fan
reference count by 1. return group (2) |->return 0; Since we are adding one device, the flow is (2) and the group reference count will be increased by 2. So, we need to add iommu_group_put at the end of arm_smmu_add_device to decrease the count by 1. Signed-of

Re: [RFC V2] iommu: correct group reference count

2015-11-09 Thread Peng Fan
Hi Alex, On Mon, Nov 09, 2015 at 08:28:09AM -0700, Alex Williamson wrote: >On Mon, 2015-11-09 at 14:13 +0800, Peng Fan wrote: >> The basic flow for iommu_group_for_dev is: >> iommu_group_get_for_dev >> |-> iommu_group_get : increase reference count by 1. >

Re: [RFC V2] iommu: correct group reference count

2015-11-09 Thread Peng Fan
Hi Will, On Mon, Nov 09, 2015 at 10:10:59AM +, Will Deacon wrote: >On Mon, Nov 09, 2015 at 02:13:28PM +0800, Peng Fan wrote: >> The basic flow for iommu_group_for_dev is: >> iommu_group_get_for_dev >> |-> iommu_group_get : increase reference count by 1. >

Re: [RFC V2] iommu: correct group reference count

2015-11-09 Thread Peng Fan
Hi Will, On Mon, Nov 09, 2015 at 10:10:59AM +, Will Deacon wrote: >On Mon, Nov 09, 2015 at 02:13:28PM +0800, Peng Fan wrote: >> The basic flow for iommu_group_for_dev is: >> iommu_group_get_for_dev >> |-> iommu_group_get : increase reference count by 1. >

[RFC V3] iommu: arm-smmu: correct group reference count

2015-11-09 Thread Peng Fan
reference count by 1. return group (2) |->return 0; Since we are adding one device, the flow is (2) and the group reference count will be increased by 2. So, we need to add iommu_group_put at the end of arm_smmu_add_device to decrease the count by 1. Signe

Re: [RFC V2] iommu: correct group reference count

2015-11-09 Thread Peng Fan
Hi Alex, On Mon, Nov 09, 2015 at 08:28:09AM -0700, Alex Williamson wrote: >On Mon, 2015-11-09 at 14:13 +0800, Peng Fan wrote: >> The basic flow for iommu_group_for_dev is: >> iommu_group_get_for_dev >> |-> iommu_group_get : increase reference count by 1. >

[RFC V2] iommu: correct group reference count

2015-11-08 Thread Peng Fan
nly increase reference count by 1. Signed-off-by: Peng Fan Cc: Joerg Roedel Cc: Will Deacon --- V1 thread: https://lkml.org/lkml/2015/11/3/304 Changes V2: I did not see the update about device_group when I worked out V1. So redo the patch and refine commit msg and rebased to latest linus'

Re: [RFC] iommu: arm-smmu: correct reference count

2015-11-08 Thread Peng Fan
Hi Will, On Fri, Nov 06, 2015 at 12:23:39PM +, Will Deacon wrote: >On Wed, Nov 04, 2015 at 10:48:28AM +0800, Peng Fan wrote: >> On Tue, Nov 03, 2015 at 01:17:34PM +, Will Deacon wrote: >> >On Tue, Nov 03, 2015 at 08:59:17PM +0800, Peng Fan wrote: >> >> iom

[RFC V2] iommu: correct group reference count

2015-11-08 Thread Peng Fan
nly increase reference count by 1. Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Joerg Roedel <j...@8bytes.org> Cc: Will Deacon <will.dea...@arm.com> --- V1 thread: https://lkml.org/lkml/2015/11/3/304 Changes V2: I did not see the update about device_group when I wor

Re: [RFC] iommu: arm-smmu: correct reference count

2015-11-08 Thread Peng Fan
Hi Will, On Fri, Nov 06, 2015 at 12:23:39PM +, Will Deacon wrote: >On Wed, Nov 04, 2015 at 10:48:28AM +0800, Peng Fan wrote: >> On Tue, Nov 03, 2015 at 01:17:34PM +, Will Deacon wrote: >> >On Tue, Nov 03, 2015 at 08:59:17PM +0800, Peng Fan wrote: >> >> iom

[PATCH] mfd: syscon: check 'property' before of_node_put

2015-11-05 Thread Peng Fan
When 'property' is not NULL, of_parse_phandle will return the node pointer with refcount incremented. So when of_node_put, also need to check property. Signed-off-by: Peng Fan Cc: Lee Jones Cc: Arnd Bergmann --- drivers/mfd/syscon.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion

[PATCH] mfd: syscon: check 'property' before of_node_put

2015-11-05 Thread Peng Fan
When 'property' is not NULL, of_parse_phandle will return the node pointer with refcount incremented. So when of_node_put, also need to check property. Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Lee Jones <lee.jo...@linaro.org> Cc: Arnd Bergmann <a...@arndb.de> --- dr

Re: [RFC] iommu: arm-smmu: correct reference count

2015-11-03 Thread Peng Fan
Hi Will, On Tue, Nov 03, 2015 at 01:17:34PM +, Will Deacon wrote: >On Tue, Nov 03, 2015 at 08:59:17PM +0800, Peng Fan wrote: >> iommu_group_alloc will initialize the reference count for group to 1. >> iommu_group_add_device also increase the group reference count, >> if

[RFC] iommu: arm-smmu: correct reference count

2015-11-03 Thread Peng Fan
iommu_group_alloc will initialize the reference count for group to 1. iommu_group_add_device also increase the group reference count, if nothing bad happends. And we need to add iommu_group_put to decrease the reference count for group. Signed-off-by: Peng Fan Cc: Will Deacon Cc: Joerg Roedel

[RFC] iommu: arm-smmu: correct reference count

2015-11-03 Thread Peng Fan
iommu_group_alloc will initialize the reference count for group to 1. iommu_group_add_device also increase the group reference count, if nothing bad happends. And we need to add iommu_group_put to decrease the reference count for group. Signed-off-by: Peng Fan <van.free...@gmail.com&

Re: [RFC] iommu: arm-smmu: correct reference count

2015-11-03 Thread Peng Fan
Hi Will, On Tue, Nov 03, 2015 at 01:17:34PM +, Will Deacon wrote: >On Tue, Nov 03, 2015 at 08:59:17PM +0800, Peng Fan wrote: >> iommu_group_alloc will initialize the reference count for group to 1. >> iommu_group_add_device also increase the group reference count, >> if

Re: [PATCH] drivers: of: check input parameter name for __of_find_property

2015-09-16 Thread Peng Fan
On Tue, Sep 15, 2015 at 09:27:59PM -0500, Rob Herring wrote: > On 09/15/2015 07:16 PM, Peng Fan wrote: > > Hi Rob, > > > > On Tue, Sep 15, 2015 at 10:56:28AM -0500, Rob Herring wrote: > >> On 09/11/2015 08:44 AM, Peng Fan wrote: > >>> Check input parame

Re: [PATCH] drivers: of: check input parameter name for __of_find_property

2015-09-16 Thread Peng Fan
On Tue, Sep 15, 2015 at 09:27:59PM -0500, Rob Herring wrote: > On 09/15/2015 07:16 PM, Peng Fan wrote: > > Hi Rob, > > > > On Tue, Sep 15, 2015 at 10:56:28AM -0500, Rob Herring wrote: > >> On 09/11/2015 08:44 AM, Peng Fan wrote: > >>> Check input parame

Re: [PATCH] drivers: of: check input parameter name for __of_find_property

2015-09-15 Thread Peng Fan
Hi Rob, On Tue, Sep 15, 2015 at 10:56:28AM -0500, Rob Herring wrote: > On 09/11/2015 08:44 AM, Peng Fan wrote: > > Check input parameter 'name' for __of_find_property. If name is NULL, > > of_prop_cmp->strcasecmp may trigger panic. > > Arguably that could be a featur

Re: [PATCH] drivers: of: check input parameter name for __of_find_property

2015-09-15 Thread Peng Fan
Hi Rob, On Tue, Sep 15, 2015 at 10:56:28AM -0500, Rob Herring wrote: > On 09/11/2015 08:44 AM, Peng Fan wrote: > > Check input parameter 'name' for __of_find_property. If name is NULL, > > of_prop_cmp->strcasecmp may trigger panic. > > Arguably that could be a featur

[PATCH] drivers: of: check input parameter name for __of_find_property

2015-09-11 Thread Peng Fan
Check input parameter 'name' for __of_find_property. If name is NULL, of_prop_cmp->strcasecmp may trigger panic. Signed-off-by: Peng Fan Cc: Rob Herring Cc: Frank Rowand Cc: Grant Likely --- drivers/of/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/driv

[PATCH v2] mtd: blktrans: fix multiplication overflow

2015-09-11 Thread Peng Fan
e cast u64 to fix the multiplication overflow issue. Signed-off-by: Peng Fan Cc: David Woodhouse Cc: Brian Norris --- Changes V2: use type cast to avoid build break for platforms which does not support 64 bit multilplication. drivers/mtd/mtd_blkdevs.c | 2 +- 1 file changed, 1 insertion(+), 1 d

[PATCH v2] mtd: blktrans: fix multiplication overflow

2015-09-11 Thread Peng Fan
e cast u64 to fix the multiplication overflow issue. Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: David Woodhouse <dw...@infradead.org> Cc: Brian Norris <computersforpe...@gmail.com> --- Changes V2: use type cast to avoid build break for platforms which does not support 64 bit

[PATCH] drivers: of: check input parameter name for __of_find_property

2015-09-11 Thread Peng Fan
Check input parameter 'name' for __of_find_property. If name is NULL, of_prop_cmp->strcasecmp may trigger panic. Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Rob Herring <robh...@kernel.org> Cc: Frank Rowand <frowand.l...@gmail.com> Cc: Grant Likely <grant.lik...@

[PATCH] pinctrl: core: handle pinctrl_get failure

2015-09-10 Thread Peng Fan
Need to do error handling path when pinctrl_get fails. Also when pinctrl_get success, insert 'pctldev->node' to pinctrldev_list. Signed-off-by: Peng Fan Cc: Linus Walleij --- drivers/pinctrl/core.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/pinc

[PATCH] pinctrl: core: handle pinctrl_get failure

2015-09-10 Thread Peng Fan
Need to do error handling path when pinctrl_get fails. Also when pinctrl_get success, insert 'pctldev->node' to pinctrldev_list. Signed-off-by: Peng Fan <van.free...@gmail.com> Cc: Linus Walleij <linus.wall...@linaro.org> --- drivers/pinctrl/core.c | 10 ++ 1 file change

Re: [PATCH] mtd: blktrans: fix integer overflow

2015-09-05 Thread Peng Fan
On Wed, Sep 02, 2015 at 10:02:49AM -0700, Brian Norris wrote: > On Fri, Aug 21, 2015 at 10:57:31PM +0800, Peng Fan wrote: > > In drivers/mtd/mtd_blkdevs.c: > > 406 set_capacity(gd, (new->size * tr->blksize) >> 9); > > The type of new->size is unsigned lon

Re: [PATCH] gpio: gpiolib: use devm_* API to simplify driver code

2015-09-05 Thread Peng Fan
On Tue, Aug 25, 2015 at 11:38:47AM +0300, Grygorii Strashko wrote: > On 08/24/2015 03:05 PM, Peng Fan wrote: > >Use devm_* API to simplify driver code. > > > >Signed-off-by: Peng Fan > >Cc: Linus Walleij > >Cc: Alexandre Courbot > --- > > drivers/g

Re: [PATCH] gpio: gpiolib: use devm_* API to simplify driver code

2015-09-05 Thread Peng Fan
On Tue, Aug 25, 2015 at 11:38:47AM +0300, Grygorii Strashko wrote: > On 08/24/2015 03:05 PM, Peng Fan wrote: > >Use devm_* API to simplify driver code. > > > >Signed-off-by: Peng Fan <van.free...@gmail.com> > >Cc: Linus Walleij <linus.wall...@linaro.org> >

Re: [PATCH] mtd: blktrans: fix integer overflow

2015-09-05 Thread Peng Fan
On Wed, Sep 02, 2015 at 10:02:49AM -0700, Brian Norris wrote: > On Fri, Aug 21, 2015 at 10:57:31PM +0800, Peng Fan wrote: > > In drivers/mtd/mtd_blkdevs.c: > > 406 set_capacity(gd, (new->size * tr->blksize) >> 9); > > The type of new->size is unsigned lon

[PATCH] staging: iio: adc: lpc32xx: use correct reutrn value

2015-08-30 Thread Peng Fan
To lpc32xx_adc driver, when platform_get_resource or platform_get_irq failed, we should use -ENXIO as a return value, but not -EBUSY. Signed-off-by: Peng Fan Cc: Jonathan Cameron Cc: Hartmut Knaack Cc: Lars-Peter Clausen Cc: Peter Meerwald Cc: Greg Kroah-Hartman Cc: Tapasweni Pathak

[PATCH] staging: iio: adc: lpc32xx: use correct reutrn value

2015-08-30 Thread Peng Fan
To lpc32xx_adc driver, when platform_get_resource or platform_get_irq failed, we should use -ENXIO as a return value, but not -EBUSY. Signed-off-by: Peng Fan van.free...@gmail.com Cc: Jonathan Cameron ji...@kernel.org Cc: Hartmut Knaack knaac...@gmx.de Cc: Lars-Peter Clausen l...@metafoo.de Cc

[PATCH] input: gpio-keys: report error when invalid key number

2015-08-24 Thread Peng Fan
pio-keys# we want 'echo 77 > keys' to report an error, but not silence to give us an fake illusion that all is 'ok'. Signed-off-by: Peng Fan Cc: Dmitry Torokhov Cc: Linus Walleij Cc: Alexander Stein Cc: Tejun Heo Cc: Andrew Morton Cc: Wolfram Sang Cc: Fabio Estevam --- drivers/input/ke

[PATCH] gpio: gpiolib: use devm_* API to simplify driver code

2015-08-24 Thread Peng Fan
Use devm_* API to simplify driver code. Signed-off-by: Peng Fan Cc: Linus Walleij Cc: Alexandre Courbot --- drivers/gpio/gpiolib.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 6bc612b..f9470b0 100644

[PATCH] gpio: gpiolib: use devm_* API to simplify driver code

2015-08-24 Thread Peng Fan
Use devm_* API to simplify driver code. Signed-off-by: Peng Fan van.free...@gmail.com Cc: Linus Walleij linus.wall...@linaro.org Cc: Alexandre Courbot gnu...@gmail.com --- drivers/gpio/gpiolib.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/gpio

[PATCH] input: gpio-keys: report error when invalid key number

2015-08-24 Thread Peng Fan
-keys# we want 'echo 77 keys' to report an error, but not silence to give us an fake illusion that all is 'ok'. Signed-off-by: Peng Fan van.free...@gmail.com Cc: Dmitry Torokhov dmitry.torok...@gmail.com Cc: Linus Walleij linus.wall...@linaro.org Cc: Alexander Stein alexander.st...@systec

[PATCH 1/2] gpio: mxc: need to check return value of irq_alloc_generic_chip

2015-08-23 Thread Peng Fan
Need to check return value of irq_alloc_generic_chip, because it may return NULL. 1. Change mxc_gpio_init_gc return type from void to int. 2. Add a new lable out_irqdomain_remove to remove the irq domain when mxc_gpio_init_gc fail. Signed-off-by: Peng Fan Cc: Linus Walleij Cc: Alexandre

[PATCH 2/2] gpio: mxs: need to check return value of irq_alloc_generic_chip

2015-08-23 Thread Peng Fan
Need to check return value of irq_alloc_generic_chip, because it may return NULL. 1. Change mxs_gpio_init_gc return type from void to int. 2. Add a new lable out_irqdomain_remove to remove the irq domain when mxc_gpio_init_gc fail. Signed-off-by: Peng Fan Cc: Linus Walleij Cc: Alexandre

[PATCH 1/2] gpio: mxc: need to check return value of irq_alloc_generic_chip

2015-08-23 Thread Peng Fan
Need to check return value of irq_alloc_generic_chip, because it may return NULL. 1. Change mxc_gpio_init_gc return type from void to int. 2. Add a new lable out_irqdomain_remove to remove the irq domain when mxc_gpio_init_gc fail. Signed-off-by: Peng Fan van.free...@gmail.com Cc: Linus

[PATCH 2/2] gpio: mxs: need to check return value of irq_alloc_generic_chip

2015-08-23 Thread Peng Fan
Need to check return value of irq_alloc_generic_chip, because it may return NULL. 1. Change mxs_gpio_init_gc return type from void to int. 2. Add a new lable out_irqdomain_remove to remove the irq domain when mxc_gpio_init_gc fail. Signed-off-by: Peng Fan van.free...@gmail.com Cc: Linus

[PATCH] mtd: blktrans: fix integer overflow

2015-08-21 Thread Peng Fan
pe of entry size of mtd_blktrans_dev to unsigned long long to fix the overflow issue. Signed-off-by: Peng Fan Cc: David Woodhouse Cc: Brian Norris --- include/linux/mtd/blktrans.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mtd/blktrans.h b/include/linux/m

[PATCH] mtd: blktrans: fix integer overflow

2015-08-21 Thread Peng Fan
long long to fix the overflow issue. Signed-off-by: Peng Fan van.free...@gmail.com Cc: David Woodhouse dw...@infradead.org Cc: Brian Norris computersforpe...@gmail.com --- include/linux/mtd/blktrans.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/mtd/blktrans.h b

[PATCH] staging: sm750fb: fix sparse warning for lock

2015-08-05 Thread Peng Fan
in 'lynxfb_ops_copyarea' - different lock contexts for basic block drivers/staging/sm750fb/sm750.c:247:13: warning: context imbalance in 'lynxfb_ops_imageblit' - different lock contexts for basic block Signed-off-by: Peng Fan Cc: Sudip Mukherjee Cc: Teddy Wang Cc: Greg Kroah-Hartman

[PATCH] staging: sm750fb: fix sparse warning for lock

2015-08-05 Thread Peng Fan
in 'lynxfb_ops_copyarea' - different lock contexts for basic block drivers/staging/sm750fb/sm750.c:247:13: warning: context imbalance in 'lynxfb_ops_imageblit' - different lock contexts for basic block Signed-off-by: Peng Fan van.free...@gmail.com Cc: Sudip Mukherjee sudipm.mukher...@gmail.com Cc

Re: [PATCH] mmc: host: sdhci check parameters before call dma_free_coherent

2015-07-17 Thread Peng Fan
Hi, On Mon, Jun 22, 2015 at 10:04:22AM +0300, Adrian Hunter wrote: > On 22/06/15 06:41, Peng Fan wrote: > > We should not call dma_free_coherent if host->adma_table is NULL, > > otherwise may trigger panic. > > > >>From DMA-API.txt: > > " > > voi

<    4   5   6   7   8   9   10   >