* Re: [PATCH v8 18/18] drm/virtio: kconfig: Fixup white space.
From: Lee Jones @ 2016-08-30 9:54 UTC (permalink / raw)
To: Peter Griffin
Cc: devicetree, kernel, vinod.koul, linux-remoteproc, patrice.chotard,
dri-devel, linux-kernel, airlied, dmaengine, dan.j.williams,
bjorn.andersson, virtualization, linux-arm-kernel
In-Reply-To: <1472223413-7254-19-git-send-email-peter.griffin@linaro.org>
On Fri, 26 Aug 2016, Peter Griffin wrote:
> Use tabs instead of spaces.
>
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
> drivers/gpu/drm/virtio/Kconfig | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
For my own reference:
Acked-by: Lee Jones <lee.jones@linaro.org>
> diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
> index 90357d9..2d83932 100644
> --- a/drivers/gpu/drm/virtio/Kconfig
> +++ b/drivers/gpu/drm/virtio/Kconfig
> @@ -2,10 +2,10 @@ config DRM_VIRTIO_GPU
> tristate "Virtio GPU driver"
> depends on DRM
> select VIRTIO
> - select DRM_KMS_HELPER
> - select DRM_TTM
> + select DRM_KMS_HELPER
> + select DRM_TTM
> help
> This is the virtual GPU driver for virtio. It can be used with
> - QEMU based VMMs (like KVM or Xen).
> + QEMU based VMMs (like KVM or Xen).
>
> If unsure say M.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH v8 17/18] drm/virtio: kconfig: Fix recursive dependency.
From: Lee Jones @ 2016-08-30 9:55 UTC (permalink / raw)
To: Peter Griffin
Cc: devicetree, kernel, vinod.koul, linux-remoteproc, patrice.chotard,
dri-devel, linux-kernel, airlied, dmaengine, dan.j.williams,
bjorn.andersson, virtualization, linux-arm-kernel
In-Reply-To: <1472223413-7254-18-git-send-email-peter.griffin@linaro.org>
On Fri, 26 Aug 2016, Peter Griffin wrote:
> [..]
> drivers/video/fbdev/Kconfig:5:error: recursive dependency detected!
> For a resolution refer to Documentation/kbuild/kconfig-language.txt
> subsection "Kconfig recursive dependency limitations"
> drivers/video/fbdev/Kconfig:5: symbol FB is selected by DRM_KMS_FB_HELPER
> For a resolution refer to Documentation/kbuild/kconfig-language.txt
> subsection "Kconfig recursive dependency limitations"
> drivers/gpu/drm/Kconfig:42: symbol DRM_KMS_FB_HELPER depends on DRM_KMS_HELPER
> For a resolution refer to Documentation/kbuild/kconfig-language.txt
> subsection "Kconfig recursive dependency limitations"
> drivers/gpu/drm/Kconfig:36: symbol DRM_KMS_HELPER is selected by DRM_VIRTIO_GPU
> For a resolution refer to Documentation/kbuild/kconfig-language.txt
> subsection "Kconfig recursive dependency limitations"
> drivers/gpu/drm/virtio/Kconfig:1: symbol DRM_VIRTIO_GPU depends on VIRTIO
> For a resolution refer to Documentation/kbuild/kconfig-language.txt
> subsection "Kconfig recursive dependency limitations"
> drivers/virtio/Kconfig:1: symbol VIRTIO is selected by REMOTEPROC
> For a resolution refer to Documentation/kbuild/kconfig-language.txt
> subsection "Kconfig recursive dependency limitations"
> drivers/remoteproc/Kconfig:4: symbol REMOTEPROC is selected by ST_SLIM_REMOTEPROC
> For a resolution refer to Documentation/kbuild/kconfig-language.txt
> subsection "Kconfig recursive dependency limitations"
> drivers/remoteproc/Kconfig:103: symbol ST_SLIM_REMOTEPROC is selected by ST_FDMA
> For a resolution refer to Documentation/kbuild/kconfig-language.txt
> subsection "Kconfig recursive dependency limitations"
> drivers/dma/Kconfig:440: symbol ST_FDMA depends on DMADEVICES
> For a resolution refer to Documentation/kbuild/kconfig-language.txt
> subsection "Kconfig recursive dependency limitations"
> drivers/dma/Kconfig:5: symbol DMADEVICES is selected by SND_SOC_SH4_SIU
> For a resolution refer to Documentation/kbuild/kconfig-language.txt
> subsection "Kconfig recursive dependency limitations"
> sound/soc/sh/Kconfig:29: symbol SND_SOC_SH4_SIU is selected by SND_SIU_MIGOR
> For a resolution refer to Documentation/kbuild/kconfig-language.txt
> subsection "Kconfig recursive dependency limitations"
> sound/soc/sh/Kconfig:64: symbol SND_SIU_MIGOR depends on I2C
> For a resolution refer to Documentation/kbuild/kconfig-language.txt
> subsection "Kconfig recursive dependency limitations"
> drivers/i2c/Kconfig:7: symbol I2C is selected by FB_DDC
> For a resolution refer to Documentation/kbuild/kconfig-language.txt
> subsection "Kconfig recursive dependency limitations"
> drivers/video/fbdev/Kconfig:63: symbol FB_DDC is selected by FB_CYBER2000_DDC
> For a resolution refer to Documentation/kbuild/kconfig-language.txt
> subsection "Kconfig recursive dependency limitations"
> drivers/video/fbdev/Kconfig:378: symbol FB_CYBER2000_DDC depends on FB_CYBER2000
> For a resolution refer to Documentation/kbuild/kconfig-language.txt
> subsection "Kconfig recursive dependency limitations"
> drivers/video/fbdev/Kconfig:366: symbol FB_CYBER2000 depends on FB
An explanation of why this is happening and why your fix works is
usually helpful here.
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
> drivers/gpu/drm/virtio/Kconfig | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
> index e1afc3d..90357d9 100644
> --- a/drivers/gpu/drm/virtio/Kconfig
> +++ b/drivers/gpu/drm/virtio/Kconfig
> @@ -1,6 +1,7 @@
> config DRM_VIRTIO_GPU
> tristate "Virtio GPU driver"
> - depends on DRM && VIRTIO
> + depends on DRM
> + select VIRTIO
> select DRM_KMS_HELPER
> select DRM_TTM
> help
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH v8 16/18] ARM: DT: STi: stihxxx-b2120: Add DT nodes for STi audio card
From: Lee Jones @ 2016-08-30 9:56 UTC (permalink / raw)
To: Peter Griffin
Cc: devicetree, kernel, vinod.koul, Arnaud Pouliquen,
linux-remoteproc, patrice.chotard, dri-devel, linux-kernel,
airlied, dmaengine, dan.j.williams, bjorn.andersson,
virtualization, linux-arm-kernel
In-Reply-To: <1472223413-7254-17-git-send-email-peter.griffin@linaro.org>
On Fri, 26 Aug 2016, Peter Griffin wrote:
> This patch enables the uniperif players 2 & 3 for b2120 boards
> and also adds the "simple-audio-card" device node to interconnect
> the SoC sound device and the codec.
>
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
> arch/arm/boot/dts/stihxxx-b2120.dtsi | 45 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 45 insertions(+)
Acked-by: Lee Jones <lee.jones@linaro.org>
> diff --git a/arch/arm/boot/dts/stihxxx-b2120.dtsi b/arch/arm/boot/dts/stihxxx-b2120.dtsi
> index 722c63f..1f64bb6 100644
> --- a/arch/arm/boot/dts/stihxxx-b2120.dtsi
> +++ b/arch/arm/boot/dts/stihxxx-b2120.dtsi
> @@ -131,5 +131,50 @@
> dvb-card = <STV0367_TDA18212_NIMA_1>;
> };
> };
> +
> + sti_uni_player2: sti-uni-player@2 {
> + status = "okay";
> + };
> +
> + sti_uni_player3: sti-uni-player@3 {
> + status = "okay";
> + };
> +
> + sti_sasg_codec: sti-sasg-codec {
> + status = "okay";
> + pinctrl-names = "default";
> + pinctrl-0 = <&pinctrl_spdif_out>;
> + };
> +
> + sound {
> + compatible = "simple-audio-card";
> + simple-audio-card,name = "sti audio card";
> + status = "okay";
> +
> + simple-audio-card,dai-link@0 {
> + /* DAC */
> + format = "i2s";
> + mclk-fs = <256>;
> + cpu {
> + sound-dai = <&sti_uni_player2>;
> + };
> +
> + codec {
> + sound-dai = <&sti_sasg_codec 1>;
> + };
> + };
> + simple-audio-card,dai-link@1 {
> + /* SPDIF */
> + format = "left_j";
> + mclk-fs = <128>;
> + cpu {
> + sound-dai = <&sti_uni_player3>;
> + };
> +
> + codec {
> + sound-dai = <&sti_sasg_codec 0>;
> + };
> + };
> + };
> };
> };
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH v8 18/18] drm/virtio: kconfig: Fixup white space.
From: Lee Jones @ 2016-08-30 9:57 UTC (permalink / raw)
To: Peter Griffin
Cc: devicetree, kernel, vinod.koul, linux-remoteproc, patrice.chotard,
dri-devel, linux-kernel, airlied, dmaengine, dan.j.williams,
bjorn.andersson, virtualization, linux-arm-kernel
In-Reply-To: <20160830095425.GK1661@dell>
On Tue, 30 Aug 2016, Lee Jones wrote:
> On Fri, 26 Aug 2016, Peter Griffin wrote:
>
> > Use tabs instead of spaces.
> >
> > Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> > ---
> > drivers/gpu/drm/virtio/Kconfig | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
>
> For my own reference:
> Acked-by: Lee Jones <lee.jones@linaro.org>
Whoops! Please ignore the "For my own reference" part. I used the
wrong key-combo shortcut.
> > diff --git a/drivers/gpu/drm/virtio/Kconfig b/drivers/gpu/drm/virtio/Kconfig
> > index 90357d9..2d83932 100644
> > --- a/drivers/gpu/drm/virtio/Kconfig
> > +++ b/drivers/gpu/drm/virtio/Kconfig
> > @@ -2,10 +2,10 @@ config DRM_VIRTIO_GPU
> > tristate "Virtio GPU driver"
> > depends on DRM
> > select VIRTIO
> > - select DRM_KMS_HELPER
> > - select DRM_TTM
> > + select DRM_KMS_HELPER
> > + select DRM_TTM
> > help
> > This is the virtual GPU driver for virtio. It can be used with
> > - QEMU based VMMs (like KVM or Xen).
> > + QEMU based VMMs (like KVM or Xen).
> >
> > If unsure say M.
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH v2 2/2] vfio: add virtio pci quirk
From: kbuild test robot @ 2016-08-30 9:59 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Feng Wu, kvm, qemu-devel, linux-kernel, virtualization,
Julia Lawall, Yongji Xie, kbuild-all, Paolo Bonzini,
Dan Carpenter
In-Reply-To: <1472523968-9540-3-git-send-email-mst@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1077 bytes --]
Hi Michael,
[auto build test ERROR on vfio/next]
[also build test ERROR on v4.8-rc4 next-20160825]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on]
[Check https://git-scm.com/docs/git-format-patch for more information]
url: https://github.com/0day-ci/linux/commits/Michael-S-Tsirkin/vfio-blacklist-legacy-virtio-devices/20160830-124010
base: https://github.com/awilliam/linux-vfio.git next
config: x86_64-rhel (attached as .config)
compiler: gcc-6 (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All errors (new ones prefixed by >>):
>> ERROR: "vfio_is_noiommu_group_dev" [drivers/vfio/pci/vfio-pci.ko] undefined!
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 37603 bytes --]
[-- Attachment #3: Type: text/plain, Size: 183 bytes --]
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH v8 15/18] ARM: STi: DT: STiH407: Add uniperif reader dt nodes
From: Lee Jones @ 2016-08-30 10:01 UTC (permalink / raw)
To: Peter Griffin
Cc: devicetree, kernel, vinod.koul, Arnaud Pouliquen,
linux-remoteproc, patrice.chotard, dri-devel, linux-kernel,
airlied, dmaengine, dan.j.williams, bjorn.andersson,
virtualization, linux-arm-kernel
In-Reply-To: <1472223413-7254-16-git-send-email-peter.griffin@linaro.org>
On Fri, 26 Aug 2016, Peter Griffin wrote:
> This patch adds the DT node for the uniperif reader
> IP block found on STiH407 family silicon.
>
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
> arch/arm/boot/dts/stih407-family.dtsi | 26 ++++++++++++++++++++++++++
> 1 file changed, 26 insertions(+)
>
> diff --git a/arch/arm/boot/dts/stih407-family.dtsi b/arch/arm/boot/dts/stih407-family.dtsi
> index d263c96..bdddf2c 100644
> --- a/arch/arm/boot/dts/stih407-family.dtsi
> +++ b/arch/arm/boot/dts/stih407-family.dtsi
> @@ -956,5 +956,31 @@
> st,version = <5>;
> st,mode = "SPDIF";
> };
> +
> + sti_uni_reader0: sti-uni-reader@0 {
> + compatible = "st,sti-uni-reader";
> + status = "disabled";
I find it's normally nicer to place the status of the node at the
bottom, separated by a '\n'. There isn't a functional difference
admittedly, but it would be my preference, since it's not describing
the device per se.
> + #sound-dai-cells = <0>;
> + st,syscfg = <&syscfg_core>;
> + reg = <0x8D83000 0x158>;
We usually use lower-case for the address.
Since this has a 'reg' property, the '0' in the node name does not
look appropriate.
> + interrupts = <GIC_SPI 87 IRQ_TYPE_NONE>;
> + dmas = <&fdma0 5 0 1>;
> + dma-names = "rx";
> + dai-name = "Uni Reader #0 (PCM IN)";
Oooo, not seen something like this before.
If it does not already have one, it would require a DT Ack.
> + st,version = <3>;
This will likely need a DT Ack too. We usually encode this sort of
information in the compatible string.
> + };
> +
> + sti_uni_reader1: sti-uni-reader@1 {
> + compatible = "st,sti-uni-reader";
> + status = "disabled";
> + #sound-dai-cells = <0>;
> + st,syscfg = <&syscfg_core>;
> + reg = <0x8D84000 0x158>;
> + interrupts = <GIC_SPI 88 IRQ_TYPE_NONE>;
> + dmas = <&fdma0 6 0 1>;
> + dma-names = "rx";
> + dai-name = "Uni Reader #1 (HDMI RX)";
> + st,version = <3>;
> + };
All as above.
> };
> };
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH v8 14/18] ARM: STi: DT: STiH407: Add uniperif player dt nodes
From: Lee Jones @ 2016-08-30 10:02 UTC (permalink / raw)
To: Peter Griffin
Cc: devicetree, kernel, vinod.koul, Arnaud Pouliquen,
linux-remoteproc, patrice.chotard, dri-devel, linux-kernel,
airlied, dmaengine, dan.j.williams, bjorn.andersson,
virtualization, linux-arm-kernel
In-Reply-To: <1472223413-7254-15-git-send-email-peter.griffin@linaro.org>
On Fri, 26 Aug 2016, Peter Griffin wrote:
> This patch adds the DT nodes for the uniperif player
> IP blocks found on STiH407 family silicon.
>
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
> arch/arm/boot/dts/stih407-family.dtsi | 76 +++++++++++++++++++++++++++++++++++
> 1 file changed, 76 insertions(+)
Same comments as in patch 14.
> diff --git a/arch/arm/boot/dts/stih407-family.dtsi b/arch/arm/boot/dts/stih407-family.dtsi
> index d1258d5..d263c96 100644
> --- a/arch/arm/boot/dts/stih407-family.dtsi
> +++ b/arch/arm/boot/dts/stih407-family.dtsi
> @@ -880,5 +880,81 @@
> status = "disabled";
> st,syscfg = <&syscfg_core>;
> };
> +
> + sti_uni_player0: sti-uni-player@0 {
> + compatible = "st,sti-uni-player";
> + status = "disabled";
> + #sound-dai-cells = <0>;
> + st,syscfg = <&syscfg_core>;
> + clocks = <&clk_s_d0_flexgen CLK_PCM_0>;
> + assigned-clocks = <&clk_s_d0_quadfs 0>, <&clk_s_d0_flexgen CLK_PCM_0>;
> + assigned-clock-parents = <0>, <&clk_s_d0_quadfs 0>;
> + assigned-clock-rates = <50000000>;
> + reg = <0x8D80000 0x158>;
> + interrupts = <GIC_SPI 84 IRQ_TYPE_NONE>;
> + dmas = <&fdma0 2 0 1>;
> + dai-name = "Uni Player #0 (HDMI)";
> + dma-names = "tx";
> + st,uniperiph-id = <0>;
> + st,version = <5>;
> + st,mode = "HDMI";
> + };
> +
> + sti_uni_player1: sti-uni-player@1 {
> + compatible = "st,sti-uni-player";
> + status = "disabled";
> + #sound-dai-cells = <0>;
> + st,syscfg = <&syscfg_core>;
> + clocks = <&clk_s_d0_flexgen CLK_PCM_1>;
> + assigned-clocks = <&clk_s_d0_quadfs 1>, <&clk_s_d0_flexgen CLK_PCM_1>;
> + assigned-clock-parents = <0>, <&clk_s_d0_quadfs 1>;
> + assigned-clock-rates = <50000000>;
> + reg = <0x8D81000 0x158>;
> + interrupts = <GIC_SPI 85 IRQ_TYPE_NONE>;
> + dmas = <&fdma0 3 0 1>;
> + dai-name = "Uni Player #1 (PIO)";
> + dma-names = "tx";
> + st,uniperiph-id = <1>;
> + st,version = <5>;
> + st,mode = "PCM";
> + };
> +
> + sti_uni_player2: sti-uni-player@2 {
> + compatible = "st,sti-uni-player";
> + status = "disabled";
> + #sound-dai-cells = <0>;
> + st,syscfg = <&syscfg_core>;
> + clocks = <&clk_s_d0_flexgen CLK_PCM_2>;
> + assigned-clocks = <&clk_s_d0_quadfs 2>, <&clk_s_d0_flexgen CLK_PCM_2>;
> + assigned-clock-parents = <0>, <&clk_s_d0_quadfs 2>;
> + assigned-clock-rates = <50000000>;
> + reg = <0x8D82000 0x158>;
> + interrupts = <GIC_SPI 86 IRQ_TYPE_NONE>;
> + dmas = <&fdma0 4 0 1>;
> + dai-name = "Uni Player #1 (DAC)";
> + dma-names = "tx";
> + st,uniperiph-id = <2>;
> + st,version = <5>;
> + st,mode = "PCM";
> + };
> +
> + sti_uni_player3: sti-uni-player@3 {
> + compatible = "st,sti-uni-player";
> + status = "disabled";
> + #sound-dai-cells = <0>;
> + st,syscfg = <&syscfg_core>;
> + clocks = <&clk_s_d0_flexgen CLK_SPDIFF>;
> + assigned-clocks = <&clk_s_d0_quadfs 3>, <&clk_s_d0_flexgen CLK_SPDIFF>;
> + assigned-clock-parents = <0>, <&clk_s_d0_quadfs 3>;
> + assigned-clock-rates = <50000000>;
> + reg = <0x8D85000 0x158>;
> + interrupts = <GIC_SPI 89 IRQ_TYPE_NONE>;
> + dmas = <&fdma0 7 0 1>;
> + dma-names = "tx";
> + dai-name = "Uni Player #1 (PIO)";
> + st,uniperiph-id = <3>;
> + st,version = <5>;
> + st,mode = "SPDIF";
> + };
> };
> };
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH v8 14/18] ARM: STi: DT: STiH407: Add uniperif player dt nodes
From: Lee Jones @ 2016-08-30 10:03 UTC (permalink / raw)
To: Peter Griffin
Cc: devicetree, kernel, vinod.koul, Arnaud Pouliquen,
linux-remoteproc, patrice.chotard, dri-devel, linux-kernel,
airlied, dmaengine, dan.j.williams, bjorn.andersson,
virtualization, linux-arm-kernel
In-Reply-To: <20160830100258.GP1661@dell>
On Tue, 30 Aug 2016, Lee Jones wrote:
> On Fri, 26 Aug 2016, Peter Griffin wrote:
>
> > This patch adds the DT nodes for the uniperif player
> > IP blocks found on STiH407 family silicon.
> >
> > Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> > Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> > ---
> > arch/arm/boot/dts/stih407-family.dtsi | 76 +++++++++++++++++++++++++++++++++++
> > 1 file changed, 76 insertions(+)
>
> Same comments as in patch 14.
s/14/15/
> > diff --git a/arch/arm/boot/dts/stih407-family.dtsi b/arch/arm/boot/dts/stih407-family.dtsi
> > index d1258d5..d263c96 100644
> > --- a/arch/arm/boot/dts/stih407-family.dtsi
> > +++ b/arch/arm/boot/dts/stih407-family.dtsi
> > @@ -880,5 +880,81 @@
> > status = "disabled";
> > st,syscfg = <&syscfg_core>;
> > };
> > +
> > + sti_uni_player0: sti-uni-player@0 {
> > + compatible = "st,sti-uni-player";
> > + status = "disabled";
> > + #sound-dai-cells = <0>;
> > + st,syscfg = <&syscfg_core>;
> > + clocks = <&clk_s_d0_flexgen CLK_PCM_0>;
> > + assigned-clocks = <&clk_s_d0_quadfs 0>, <&clk_s_d0_flexgen CLK_PCM_0>;
> > + assigned-clock-parents = <0>, <&clk_s_d0_quadfs 0>;
> > + assigned-clock-rates = <50000000>;
> > + reg = <0x8D80000 0x158>;
> > + interrupts = <GIC_SPI 84 IRQ_TYPE_NONE>;
> > + dmas = <&fdma0 2 0 1>;
> > + dai-name = "Uni Player #0 (HDMI)";
> > + dma-names = "tx";
> > + st,uniperiph-id = <0>;
> > + st,version = <5>;
> > + st,mode = "HDMI";
> > + };
> > +
> > + sti_uni_player1: sti-uni-player@1 {
> > + compatible = "st,sti-uni-player";
> > + status = "disabled";
> > + #sound-dai-cells = <0>;
> > + st,syscfg = <&syscfg_core>;
> > + clocks = <&clk_s_d0_flexgen CLK_PCM_1>;
> > + assigned-clocks = <&clk_s_d0_quadfs 1>, <&clk_s_d0_flexgen CLK_PCM_1>;
> > + assigned-clock-parents = <0>, <&clk_s_d0_quadfs 1>;
> > + assigned-clock-rates = <50000000>;
> > + reg = <0x8D81000 0x158>;
> > + interrupts = <GIC_SPI 85 IRQ_TYPE_NONE>;
> > + dmas = <&fdma0 3 0 1>;
> > + dai-name = "Uni Player #1 (PIO)";
> > + dma-names = "tx";
> > + st,uniperiph-id = <1>;
> > + st,version = <5>;
> > + st,mode = "PCM";
> > + };
> > +
> > + sti_uni_player2: sti-uni-player@2 {
> > + compatible = "st,sti-uni-player";
> > + status = "disabled";
> > + #sound-dai-cells = <0>;
> > + st,syscfg = <&syscfg_core>;
> > + clocks = <&clk_s_d0_flexgen CLK_PCM_2>;
> > + assigned-clocks = <&clk_s_d0_quadfs 2>, <&clk_s_d0_flexgen CLK_PCM_2>;
> > + assigned-clock-parents = <0>, <&clk_s_d0_quadfs 2>;
> > + assigned-clock-rates = <50000000>;
> > + reg = <0x8D82000 0x158>;
> > + interrupts = <GIC_SPI 86 IRQ_TYPE_NONE>;
> > + dmas = <&fdma0 4 0 1>;
> > + dai-name = "Uni Player #1 (DAC)";
> > + dma-names = "tx";
> > + st,uniperiph-id = <2>;
> > + st,version = <5>;
> > + st,mode = "PCM";
> > + };
> > +
> > + sti_uni_player3: sti-uni-player@3 {
> > + compatible = "st,sti-uni-player";
> > + status = "disabled";
> > + #sound-dai-cells = <0>;
> > + st,syscfg = <&syscfg_core>;
> > + clocks = <&clk_s_d0_flexgen CLK_SPDIFF>;
> > + assigned-clocks = <&clk_s_d0_quadfs 3>, <&clk_s_d0_flexgen CLK_SPDIFF>;
> > + assigned-clock-parents = <0>, <&clk_s_d0_quadfs 3>;
> > + assigned-clock-rates = <50000000>;
> > + reg = <0x8D85000 0x158>;
> > + interrupts = <GIC_SPI 89 IRQ_TYPE_NONE>;
> > + dmas = <&fdma0 7 0 1>;
> > + dma-names = "tx";
> > + dai-name = "Uni Player #1 (PIO)";
> > + st,uniperiph-id = <3>;
> > + st,version = <5>;
> > + st,mode = "SPDIF";
> > + };
> > };
> > };
>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH v8 13/18] ARM: STi: DT: STiH407: Add sti-sasg-codec dt node
From: Lee Jones @ 2016-08-30 10:03 UTC (permalink / raw)
To: Peter Griffin
Cc: devicetree, kernel, vinod.koul, Arnaud Pouliquen,
linux-remoteproc, patrice.chotard, dri-devel, linux-kernel,
airlied, dmaengine, dan.j.williams, bjorn.andersson,
virtualization, linux-arm-kernel
In-Reply-To: <1472223413-7254-14-git-send-email-peter.griffin@linaro.org>
On Fri, 26 Aug 2016, Peter Griffin wrote:
> This patch adds the dt node for the internal audio
> codec IP.
>
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
> arch/arm/boot/dts/stih407-family.dtsi | 7 +++++++
> 1 file changed, 7 insertions(+)
Acked-by: Lee Jones <lee.jones@linaro.org>
> diff --git a/arch/arm/boot/dts/stih407-family.dtsi b/arch/arm/boot/dts/stih407-family.dtsi
> index 45cab30..d1258d5 100644
> --- a/arch/arm/boot/dts/stih407-family.dtsi
> +++ b/arch/arm/boot/dts/stih407-family.dtsi
> @@ -873,5 +873,12 @@
> <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
> <&clk_s_c0_flexgen CLK_EXT2F_A9>;
> };
> +
> + sti_sasg_codec: sti-sasg-codec {
> + compatible = "st,stih407-sas-codec";
> + #sound-dai-cells = <1>;
> + status = "disabled";
> + st,syscfg = <&syscfg_core>;
> + };
> };
> };
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH v8 12/18] ARM: DT: STiH407: Add spdif_out pinctrl config
From: Lee Jones @ 2016-08-30 10:22 UTC (permalink / raw)
To: Peter Griffin
Cc: devicetree, kernel, vinod.koul, Arnaud Pouliquen,
linux-remoteproc, patrice.chotard, dri-devel, linux-kernel,
airlied, dmaengine, dan.j.williams, bjorn.andersson,
virtualization, linux-arm-kernel
In-Reply-To: <1472223413-7254-13-git-send-email-peter.griffin@linaro.org>
On Fri, 26 Aug 2016, Peter Griffin wrote:
> This patch adds the pinctrl config for the spidf out
> pins used by the sasg codec IP.
>
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
> arch/arm/boot/dts/stih407-pinctrl.dtsi | 8 ++++++++
> 1 file changed, 8 insertions(+)
Acked-by: Lee Jones <lee.jones@linaro.org>
> diff --git a/arch/arm/boot/dts/stih407-pinctrl.dtsi b/arch/arm/boot/dts/stih407-pinctrl.dtsi
> index 537db7e..598dbab 100644
> --- a/arch/arm/boot/dts/stih407-pinctrl.dtsi
> +++ b/arch/arm/boot/dts/stih407-pinctrl.dtsi
> @@ -1114,6 +1114,14 @@
> };
> };
>
> + spdif_out {
> + pinctrl_spdif_out: spdif_out{
> + st,pins {
> + spdif_out = <&pio34 7 ALT1 OUT>;
> + };
> + };
> + };
> +
> serial3 {
> pinctrl_serial3: serial3-0 {
> st,pins {
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH v8 11/18] ARM: DT: STiH407: Add i2s_in pinctrl configuration
From: Lee Jones @ 2016-08-30 10:23 UTC (permalink / raw)
To: Peter Griffin
Cc: devicetree, kernel, vinod.koul, Arnaud Pouliquen,
linux-remoteproc, patrice.chotard, dri-devel, linux-kernel,
airlied, dmaengine, dan.j.williams, bjorn.andersson,
virtualization, linux-arm-kernel
In-Reply-To: <1472223413-7254-12-git-send-email-peter.griffin@linaro.org>
On Fri, 26 Aug 2016, Peter Griffin wrote:
> This patch adds the pinctrl config for the i2s_in pins
> used by the uniperif reader IP.
>
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
> arch/arm/boot/dts/stih407-pinctrl.dtsi | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
Acked-by: Lee Jones <lee.jones@linaro.org>
> diff --git a/arch/arm/boot/dts/stih407-pinctrl.dtsi b/arch/arm/boot/dts/stih407-pinctrl.dtsi
> index 0fb5c8a..537db7e 100644
> --- a/arch/arm/boot/dts/stih407-pinctrl.dtsi
> +++ b/arch/arm/boot/dts/stih407-pinctrl.dtsi
> @@ -1090,6 +1090,30 @@
> };
> };
>
> + i2s_in {
> + pinctrl_i2s_8ch_in: i2s_8ch_in{
> + st,pins {
> + mclk = <&pio32 5 ALT1 IN>;
> + lrclk = <&pio32 7 ALT1 IN>;
> + sclk = <&pio32 6 ALT1 IN>;
> + data0 = <&pio32 4 ALT1 IN>;
> + data1 = <&pio33 0 ALT1 IN>;
> + data2 = <&pio33 1 ALT1 IN>;
> + data3 = <&pio33 2 ALT1 IN>;
> + data4 = <&pio33 3 ALT1 IN>;
> + };
> + };
> +
> + pinctrl_i2s_2ch_in: i2s_2ch_in{
> + st,pins {
> + mclk = <&pio32 5 ALT1 IN>;
> + lrclk = <&pio32 7 ALT1 IN>;
> + sclk = <&pio32 6 ALT1 IN>;
> + data0 = <&pio32 4 ALT1 IN>;
> + };
> + };
> + };
> +
> serial3 {
> pinctrl_serial3: serial3-0 {
> st,pins {
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH v8 10/18] ARM: DT: STiH407: Add i2s_out pinctrl configuration
From: Lee Jones @ 2016-08-30 10:24 UTC (permalink / raw)
To: Peter Griffin
Cc: devicetree, kernel, vinod.koul, Arnaud Pouliquen,
linux-remoteproc, patrice.chotard, dri-devel, linux-kernel,
airlied, dmaengine, dan.j.williams, bjorn.andersson,
virtualization, linux-arm-kernel
In-Reply-To: <1472223413-7254-11-git-send-email-peter.griffin@linaro.org>
On Fri, 26 Aug 2016, Peter Griffin wrote:
> This patch adds the pinctrl config for the i2s_out pins
> used by the uniperif player IP.
>
> Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
> arch/arm/boot/dts/stih407-pinctrl.dtsi | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
Acked-by: Lee Jones <lee.jones@linaro.org>
> diff --git a/arch/arm/boot/dts/stih407-pinctrl.dtsi b/arch/arm/boot/dts/stih407-pinctrl.dtsi
> index a538ae5..0fb5c8a 100644
> --- a/arch/arm/boot/dts/stih407-pinctrl.dtsi
> +++ b/arch/arm/boot/dts/stih407-pinctrl.dtsi
> @@ -1067,6 +1067,29 @@
> };
> };
>
> + i2s_out {
> + pinctrl_i2s_8ch_out: i2s_8ch_out{
> + st,pins {
> + mclk = <&pio33 5 ALT1 OUT>;
> + lrclk = <&pio33 7 ALT1 OUT>;
> + sclk = <&pio33 6 ALT1 OUT>;
> + data0 = <&pio33 4 ALT1 OUT>;
> + data1 = <&pio34 0 ALT1 OUT>;
> + data2 = <&pio34 1 ALT1 OUT>;
> + data3 = <&pio34 2 ALT1 OUT>;
> + };
> + };
> +
> + pinctrl_i2s_2ch_out: i2s_2ch_out{
> + st,pins {
> + mclk = <&pio33 5 ALT1 OUT>;
> + lrclk = <&pio33 7 ALT1 OUT>;
> + sclk = <&pio33 6 ALT1 OUT>;
> + data0 = <&pio33 4 ALT1 OUT>;
> + };
> + };
> + };
> +
> serial3 {
> pinctrl_serial3: serial3-0 {
> st,pins {
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH v8 09/18] ARM: multi_v7_defconfig: Enable STi and simple-card drivers.
From: Lee Jones @ 2016-08-30 10:25 UTC (permalink / raw)
To: Peter Griffin
Cc: devicetree, kernel, vinod.koul, arnaud.pouliquen,
linux-remoteproc, patrice.chotard, dri-devel, linux-kernel,
airlied, broonie, dmaengine, dan.j.williams, bjorn.andersson,
virtualization, linux-arm-kernel
In-Reply-To: <1472223413-7254-10-git-send-email-peter.griffin@linaro.org>
Nit: Remove full-stop from $SUBJECT
On Fri, 26 Aug 2016, Peter Griffin wrote:
> This patch enables the STi ALSA drivers found on STi platforms
> as well as the simple-card driver which is a dependency to have
> working sound.
>
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> Cc: arnaud.pouliquen@st.com
> Cc: broonie@kernel.org
> ---
> arch/arm/configs/multi_v7_defconfig | 3 +++
> 1 file changed, 3 insertions(+)
Acked-by: Lee Jones <lee.jones@linaro.org>
> diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
> index 998578a..51a38b1 100644
> --- a/arch/arm/configs/multi_v7_defconfig
> +++ b/arch/arm/configs/multi_v7_defconfig
> @@ -644,6 +644,9 @@ CONFIG_SND_SOC_AK4642=m
> CONFIG_SND_SOC_SGTL5000=m
> CONFIG_SND_SOC_SPDIF=m
> CONFIG_SND_SOC_WM8978=m
> +CONFIG_SND_SOC_STI=m
> +CONFIG_SND_SOC_STI_SAS=m
> +CONFIG_SND_SIMPLE_CARD=m
> CONFIG_USB=y
> CONFIG_USB_XHCI_HCD=y
> CONFIG_USB_XHCI_MVEBU=y
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH v8 06/18] ARM: STi: DT: STiH407: Add FDMA driver dt nodes.
From: Lee Jones @ 2016-08-30 10:26 UTC (permalink / raw)
To: Peter Griffin
Cc: devicetree, kernel, vinod.koul, linux-remoteproc, patrice.chotard,
dri-devel, linux-kernel, airlied, dmaengine, dan.j.williams,
bjorn.andersson, virtualization, linux-arm-kernel
In-Reply-To: <1472223413-7254-7-git-send-email-peter.griffin@linaro.org>
On Fri, 26 Aug 2016, Peter Griffin wrote:
> These nodes are required to get the fdma driver working
> on STiH407 based silicon.
>
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
> arch/arm/boot/dts/stih407-family.dtsi | 52 +++++++++++++++++++++++++++++++++++
> 1 file changed, 52 insertions(+)
Acked-by: Lee Jones <lee.jones@linaro.org>
> diff --git a/arch/arm/boot/dts/stih407-family.dtsi b/arch/arm/boot/dts/stih407-family.dtsi
> index d294e82..45cab30 100644
> --- a/arch/arm/boot/dts/stih407-family.dtsi
> +++ b/arch/arm/boot/dts/stih407-family.dtsi
> @@ -821,5 +821,57 @@
> clock-frequency = <600000000>;
> st,syscfg = <&syscfg_core 0x224>;
> };
> +
> + /* fdma audio */
> + fdma0: dma-controller@8e20000 {
> + compatible = "st,stih407-fdma-mpe31-11", "st,slim-rproc";
> + reg = <0x8e20000 0x8000>,
> + <0x8e30000 0x3000>,
> + <0x8e37000 0x1000>,
> + <0x8e38000 0x8000>;
> + reg-names = "slimcore", "dmem", "peripherals", "imem";
> + clocks = <&clk_s_c0_flexgen CLK_FDMA>,
> + <&clk_s_c0_flexgen CLK_EXT2F_A9>,
> + <&clk_s_c0_flexgen CLK_EXT2F_A9>,
> + <&clk_s_c0_flexgen CLK_EXT2F_A9>;
> + interrupts = <GIC_SPI 5 IRQ_TYPE_NONE>;
> + dma-channels = <16>;
> + #dma-cells = <3>;
> + };
> +
> + /* fdma app */
> + fdma1: dma-controller@8e40000 {
> + compatible = "st,stih407-fdma-mpe31-12", "st,slim-rproc";
> + reg = <0x8e40000 0x8000>,
> + <0x8e50000 0x3000>,
> + <0x8e57000 0x1000>,
> + <0x8e58000 0x8000>;
> + reg-names = "slimcore", "dmem", "peripherals", "imem";
> + clocks = <&clk_s_c0_flexgen CLK_FDMA>,
> + <&clk_s_c0_flexgen CLK_TX_ICN_DMU>,
> + <&clk_s_c0_flexgen CLK_TX_ICN_DMU>,
> + <&clk_s_c0_flexgen CLK_EXT2F_A9>;
> +
> + interrupts = <GIC_SPI 7 IRQ_TYPE_NONE>;
> + dma-channels = <16>;
> + #dma-cells = <3>;
> + };
> +
> + /* fdma free running */
> + fdma2: dma-controller@8e60000 {
> + compatible = "st,stih407-fdma-mpe31-13", "st,slim-rproc";
> + reg = <0x8e60000 0x8000>,
> + <0x8e70000 0x3000>,
> + <0x8e77000 0x1000>,
> + <0x8e78000 0x8000>;
> + reg-names = "slimcore", "dmem", "peripherals", "imem";
> + interrupts = <GIC_SPI 9 IRQ_TYPE_NONE>;
> + dma-channels = <16>;
> + #dma-cells = <3>;
> + clocks = <&clk_s_c0_flexgen CLK_FDMA>,
> + <&clk_s_c0_flexgen CLK_EXT2F_A9>,
> + <&clk_s_c0_flexgen CLK_TX_ICN_DISP_0>,
> + <&clk_s_c0_flexgen CLK_EXT2F_A9>;
> + };
> };
> };
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH v8 02/18] MAINTAINERS: Add st slim core rproc driver to STi section.
From: Lee Jones @ 2016-08-30 10:27 UTC (permalink / raw)
To: Peter Griffin
Cc: devicetree, kernel, vinod.koul, linux-remoteproc, patrice.chotard,
dri-devel, linux-kernel, airlied, dmaengine, dan.j.williams,
bjorn.andersson, virtualization, linux-arm-kernel
In-Reply-To: <1472223413-7254-3-git-send-email-peter.griffin@linaro.org>
On Fri, 26 Aug 2016, Peter Griffin wrote:
> This patch adds the slim core rproc driver to the STi section
> of the MAINTAINERS file.
>
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
> MAINTAINERS | 2 ++
> 1 file changed, 2 insertions(+)
Acked-by: Lee Jones <lee.jones@linaro.org>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 0bbe4b1..5dd3b24 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1749,6 +1749,7 @@ F: drivers/phy/phy-stih407-usb.c
> F: drivers/phy/phy-stih41x-usb.c
> F: drivers/pinctrl/pinctrl-st.c
> F: drivers/remoteproc/st_remoteproc.c
> +F: drivers/remoteproc/st_slim_rproc.c
> F: drivers/reset/sti/
> F: drivers/rtc/rtc-st-lpc.c
> F: drivers/tty/serial/st-asc.c
> @@ -1757,6 +1758,7 @@ F: drivers/usb/host/ehci-st.c
> F: drivers/usb/host/ohci-st.c
> F: drivers/watchdog/st_lpc_wdt.c
> F: drivers/ata/ahci_st.c
> +F: include/linux/remoteproc/st_slim_rproc.h
>
> ARM/STM32 ARCHITECTURE
> M: Maxime Coquelin <mcoquelin.stm32@gmail.com>
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH v8 01/18] remoteproc: st_slim_rproc: add a slimcore rproc driver
From: Lee Jones @ 2016-08-30 12:34 UTC (permalink / raw)
To: Peter Griffin
Cc: devicetree, kernel, vinod.koul, linux-remoteproc, patrice.chotard,
dri-devel, linux-kernel, airlied, dmaengine, dan.j.williams,
bjorn.andersson, virtualization, linux-arm-kernel
In-Reply-To: <1472223413-7254-2-git-send-email-peter.griffin@linaro.org>
On Fri, 26 Aug 2016, Peter Griffin wrote:
> slim core is used as a basis for many IPs in the STi
> chipsets such as fdma and demux. To avoid duplicating
> the elf loading code in each device driver a slim
> rproc driver has been created.
>
> This driver is designed to be used by other device drivers
> such as fdma, or demux whose IP is based around a slim core.
> The device driver can call slim_rproc_alloc() to allocate
> a slim rproc and slim_rproc_put() when finished.
>
> This driver takes care of ioremapping the slim
> registers (dmem, imem, slimcore, peripherals), whose offsets
> and sizes can change between IP's. It also obtains and enables
> any clocks used by the device. This approach avoids having
> a double mapping of the registers as slim_rproc does not register
> its own platform device. It also maps well to device tree
> abstraction as it allows us to have one dt node for the whole
> device.
>
> All of the generic rproc elf loading code can be reused, and
> we provide start() stop() hooks to start and stop the slim
> core once the firmware has been loaded. This has been tested
> successfully with fdma driver.
Nit. It would be good to use a constant line-wrap.
'M-x post-mode' will help with this.
> Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> ---
> drivers/remoteproc/Kconfig | 8 +
> drivers/remoteproc/Makefile | 1 +
> drivers/remoteproc/st_slim_rproc.c | 364 +++++++++++++++++++++++++++++++
> include/linux/remoteproc/st_slim_rproc.h | 53 +++++
> 4 files changed, 426 insertions(+)
> create mode 100644 drivers/remoteproc/st_slim_rproc.c
> create mode 100644 include/linux/remoteproc/st_slim_rproc.h
>
> diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
> index 1a8bf76a..06765e0 100644
> --- a/drivers/remoteproc/Kconfig
> +++ b/drivers/remoteproc/Kconfig
> @@ -100,4 +100,12 @@ config ST_REMOTEPROC
> processor framework.
> This can be either built-in or a loadable module.
>
> +config ST_SLIM_REMOTEPROC
> + tristate "ST Slim remoteproc support"
> + select REMOTEPROC
> + help
> + Say y here to support firmware loading on IP based around
> + the Slim core.
> + If unsure say N.
> +
> endmenu
> diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
> index 92d3758..db1dae7 100644
> --- a/drivers/remoteproc/Makefile
> +++ b/drivers/remoteproc/Makefile
> @@ -14,3 +14,4 @@ obj-$(CONFIG_DA8XX_REMOTEPROC) += da8xx_remoteproc.o
> obj-$(CONFIG_QCOM_MDT_LOADER) += qcom_mdt_loader.o
> obj-$(CONFIG_QCOM_Q6V5_PIL) += qcom_q6v5_pil.o
> obj-$(CONFIG_ST_REMOTEPROC) += st_remoteproc.o
> +obj-$(CONFIG_ST_SLIM_REMOTEPROC) += st_slim_rproc.o
> diff --git a/drivers/remoteproc/st_slim_rproc.c b/drivers/remoteproc/st_slim_rproc.c
> new file mode 100644
> index 0000000..f4bf2d7
> --- /dev/null
> +++ b/drivers/remoteproc/st_slim_rproc.c
> @@ -0,0 +1,364 @@
> +/*
> + * st_slim_rproc.c
These serve no purpose and have a habit of becoming out-of-date.
Please remove it and replace with a nice succinct description
instead.
> + * Copyright (C) 2016 STMicroelectronics
Nit: '\n' here.
> + * Author: Peter Griffin <peter.griffin@linaro.org>
Nit: '\n' here.
> + * License terms: GNU General Public License (GPL), version 2
Are you sure ST are okay with the shortened version of the GPL?
> + */
> +
> +#include <linux/clk.h>
> +#include <linux/err.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
> +#include <linux/of_device.h>
> +#include <linux/platform_device.h>
> +#include <linux/remoteproc.h>
> +#include <linux/remoteproc/st_slim_rproc.h>
> +#include "remoteproc_internal.h"
> +
> +/* slimcore registers */
What's it called? slimcore, slim core, ST Slim?
Please be consistent. Use the name from the datasheet.
> +#define SLIM_ID_OFST 0x0
> +#define SLIM_VER_OFST 0x4
> +
> +#define SLIM_EN_OFST 0x8
> +#define SLIM_EN_RUN BIT(0)
> +
> +#define SLIM_CLK_GATE_OFST 0xC
> +#define SLIM_CLK_GATE_DIS BIT(0)
> +#define SLIM_CLK_GATE_RESET BIT(2)
> +
> +#define SLIM_SLIM_PC_OFST 0x20
> +
> +/* dmem registers */
> +#define SLIM_REV_ID_OFST 0x0
> +#define SLIM_REV_ID_MIN_MASK GENMASK(15, 8)
> +#define SLIM_REV_ID_MIN(id) ((id & SLIM_REV_ID_MIN_MASK) >> 8)
> +#define SLIM_REV_ID_MAJ_MASK GENMASK(23, 16)
> +#define SLIM_REV_ID_MAJ(id) ((id & SLIM_REV_ID_MAJ_MASK) >> 16)
> +
> +
> +/* peripherals registers */
> +#define SLIM_STBUS_SYNC_OFST 0xF88
> +#define SLIM_STBUS_SYNC_DIS BIT(0)
> +
> +#define SLIM_INT_SET_OFST 0xFD4
> +#define SLIM_INT_CLR_OFST 0xFD8
> +#define SLIM_INT_MASK_OFST 0xFDC
> +
> +#define SLIM_CMD_CLR_OFST 0xFC8
> +#define SLIM_CMD_MASK_OFST 0xFCC
> +
> +static const char *mem_names[ST_SLIM_MEM_MAX] = {
> + [ST_SLIM_DMEM] = "dmem",
> + [ST_SLIM_IMEM] = "imem",
> +};
> +
> +static int slim_clk_get(struct st_slim_rproc *slim_rproc, struct device *dev)
> +{
> + int clk, err;
> +
> + for (clk = 0; clk < ST_SLIM_MAX_CLK; clk++) {
> + slim_rproc->clks[clk] = of_clk_get(dev->of_node, clk);
> + if (IS_ERR(slim_rproc->clks[clk])) {
> + err = PTR_ERR(slim_rproc->clks[clk]);
> + if (err == -EPROBE_DEFER)
> + goto err_put_clks;
> + slim_rproc->clks[clk] = NULL;
> + break;
> + }
> + }
> +
> + return 0;
> +
> +err_put_clks:
> + while (--clk >= 0)
> + clk_put(slim_rproc->clks[clk]);
> +
> + return err;
> +}
> +
> +static void slim_clk_disable(struct st_slim_rproc *slim_rproc)
> +{
> + int clk;
> +
> + for (clk = 0; clk < ST_SLIM_MAX_CLK && slim_rproc->clks[clk]; clk++)
> + clk_disable_unprepare(slim_rproc->clks[clk]);
> +}
> +
> +static int slim_clk_enable(struct st_slim_rproc *slim_rproc)
> +{
> + int clk, ret;
> +
> + for (clk = 0; clk < ST_SLIM_MAX_CLK && slim_rproc->clks[clk]; clk++) {
> + ret = clk_prepare_enable(slim_rproc->clks[clk]);
> + if (ret)
> + goto err_disable_clks;
> + }
> +
> + return 0;
> +
> +err_disable_clks:
> + while (--clk >= 0)
> + clk_disable_unprepare(slim_rproc->clks[clk]);
> +
> + return ret;
> +}
> +
> +/**
> + * Remoteproc slim specific device handlers
> + */
I suggest not using kernel-doc format for this type of comment.
> +static int slim_rproc_start(struct rproc *rproc)
> +{
> + struct device *dev = &rproc->dev;
> + struct st_slim_rproc *slim_rproc = rproc->priv;
> + unsigned long hw_id, hw_ver, fw_rev;
> + u32 val;
> + int ret;
> +
> + ret = slim_clk_enable(slim_rproc);
> + if (ret) {
> + dev_err(dev, "Failed to enable clocks\n");
> + return ret;
> + }
> +
> + /* disable CPU pipeline clock & reset cpu pipeline */
Be consistent. Is it 'cpu' or 'CPU'. Personally I find using
'correct English' to be the most consistent way of formatting
comments i.e. Capitals for names, acronyms and at the start of a
sentence.
> + val = SLIM_CLK_GATE_DIS | SLIM_CLK_GATE_RESET;
> + writel(val, slim_rproc->slimcore + SLIM_CLK_GATE_OFST);
> +
> + /* disable SLIM core STBus sync */
> + writel(SLIM_STBUS_SYNC_DIS, slim_rproc->peri + SLIM_STBUS_SYNC_OFST);
> +
> + /* enable cpu pipeline clock */
> + writel(!SLIM_CLK_GATE_DIS,
> + slim_rproc->slimcore + SLIM_CLK_GATE_OFST);
> +
> + /* clear int & cmd mailbox */
> + writel(~0U, slim_rproc->peri + SLIM_INT_CLR_OFST);
> + writel(~0U, slim_rproc->peri + SLIM_CMD_CLR_OFST);
> +
> + /* enable all channels cmd & int */
> + writel(~0U, slim_rproc->peri + SLIM_INT_MASK_OFST);
> + writel(~0U, slim_rproc->peri + SLIM_CMD_MASK_OFST);
> +
> + /* enable cpu */
> + writel(SLIM_EN_RUN, slim_rproc->slimcore + SLIM_EN_OFST);
> +
> + hw_id = readl_relaxed(slim_rproc->slimcore + SLIM_ID_OFST);
> + hw_ver = readl_relaxed(slim_rproc->slimcore + SLIM_VER_OFST);
> +
> + fw_rev = readl(slim_rproc->mem[ST_SLIM_DMEM].cpu_addr +
> + SLIM_REV_ID_OFST);
> +
> + dev_info(dev, "fw rev:%ld.%ld on SLIM %ld.%ld\n",
> + SLIM_REV_ID_MAJ(fw_rev), SLIM_REV_ID_MIN(fw_rev),
> + hw_id, hw_ver);
> +
> + return 0;
> +}
> +
> +static int slim_rproc_stop(struct rproc *rproc)
> +{
> + struct st_slim_rproc *slim_rproc = rproc->priv;
> + u32 val;
> +
> + /* mask all (cmd & int) channels */
> + writel(0UL, slim_rproc->peri + SLIM_INT_MASK_OFST);
> + writel(0UL, slim_rproc->peri + SLIM_CMD_MASK_OFST);
> +
> + /* disable cpu pipeline clock */
> + writel(SLIM_CLK_GATE_DIS, slim_rproc->slimcore + SLIM_CLK_GATE_OFST);
> +
> + writel(!SLIM_EN_RUN, slim_rproc->slimcore + SLIM_EN_OFST);
> +
> + val = readl(slim_rproc->slimcore + SLIM_EN_OFST);
> + if (val & SLIM_EN_RUN)
> + dev_warn(&rproc->dev, "Failed to disable SLIM");
> +
> + slim_clk_disable(slim_rproc);
> +
> + dev_dbg(&rproc->dev, "slim stopped\n");
> +
> + return 0;
> +}
> +
> +static void *slim_rproc_da_to_va(struct rproc *rproc, u64 da, int len)
> +{
> + struct st_slim_rproc *slim_rproc = rproc->priv;
> + void *va = NULL;
> + int i;
> +
> + for (i = 0; i < ST_SLIM_MEM_MAX; i++) {
> + if (da != slim_rproc->mem[i].bus_addr)
> + continue;
> +
> + if (len <= slim_rproc->mem[i].size) {
> + /* __force to make sparse happy with type conversion */
> + va = (__force void *)slim_rproc->mem[i].cpu_addr;
> + break;
> + }
> + }
> +
> + dev_dbg(&rproc->dev, "%s: da = 0x%llx len = 0x%x va = 0x%p\n",
> + __func__, da, len, va);
Non-consistent with other debug prints. I suggest dropping the
_func_. It's a nice to have during initial debugging, but I don't
usually find them useful upstream.
> + return va;
> +}
> +
> +static struct rproc_ops slim_rproc_ops = {
> + .start = slim_rproc_start,
> + .stop = slim_rproc_stop,
> + .da_to_va = slim_rproc_da_to_va,
> +};
> +
> +/**
> + * Firmware handler operations: sanity, boot address, load ...
> + */
Don't use kernel-doc for these.
> +static struct resource_table empty_rsc_tbl = {
> + .ver = 1,
> + .num = 0,
> +};
This should go away soon.
Be prepared to remove this once the code lands.
> +static struct resource_table *slim_rproc_find_rsc_table(struct rproc *rproc,
> + const struct firmware *fw,
> + int *tablesz)
> +{
> + *tablesz = sizeof(empty_rsc_tbl);
> + return &empty_rsc_tbl;
> +}
> +
> +static struct rproc_fw_ops slim_rproc_fw_ops = {
> + .find_rsc_table = slim_rproc_find_rsc_table,
> +};
> +
> +/**
> + * st_slim_rproc_alloc() - allocate and initialise slim rproc
> + * @pdev: Pointer to the platform_device struct
> + * @fw_name: Name of firmware for rproc to use
> + *
> + * Function for allocating and initialising a slim rproc for use by
> + * device drivers whose IP is based around the slim slim core. It
"slim slim"? Do you mean "really slim"? ;)
> + * obtains and enables any clocks required by the slim core and also
> + * ioremaps the various IO.
> + *
> + * Returns st_slim_rproc pointer or PTR_ERR() on error.
> + */
> +
> +struct st_slim_rproc *st_slim_rproc_alloc(struct platform_device *pdev,
> + char *fw_name)
> +{
> + struct device *dev = &pdev->dev;
> + struct st_slim_rproc *slim_rproc;
> + struct device_node *np = dev->of_node;
> + struct rproc *rproc;
> + struct resource *res;
> + int err, i;
> + const struct rproc_fw_ops *elf_ops;
> +
> + if (WARN_ON(!np || !fw_name))
> + return ERR_PTR(-EINVAL);
!np should not happen, ever. You can remove the check.
> + if (!of_device_is_compatible(np, "st,slim-rproc"))
> + return ERR_PTR(-EINVAL);
> +
> + rproc = rproc_alloc(dev, np->name, &slim_rproc_ops,
> + fw_name, sizeof(*slim_rproc));
> + if (!rproc)
> + return ERR_PTR(-ENOMEM);
> +
> + rproc->has_iommu = false;
> +
> + slim_rproc = rproc->priv;
> + slim_rproc->rproc = rproc;
> +
> + elf_ops = rproc->fw_ops;
> + /* Use some generic elf ops */
> + slim_rproc_fw_ops.load = elf_ops->load;
> + slim_rproc_fw_ops.sanity_check = elf_ops->sanity_check;
> +
> + rproc->fw_ops = &slim_rproc_fw_ops;
> +
> + /* get imem and dmem */
> + for (i = 0; i < ARRAY_SIZE(mem_names); i++) {
> +
Superfluous '\n'.
> + res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> + mem_names[i]);
> +
> + slim_rproc->mem[i].cpu_addr = devm_ioremap_resource(dev, res);
> + if (IS_ERR(slim_rproc->mem[i].cpu_addr)) {
> + dev_err(&pdev->dev, "devm_ioremap_resource failed\n");
> + err = PTR_ERR(slim_rproc->mem[i].cpu_addr);
> + goto err;
> + }
> + slim_rproc->mem[i].bus_addr = res->start;
> + slim_rproc->mem[i].size = resource_size(res);
> + }
> +
> + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "slimcore");
Superfluous '\n'.
> + slim_rproc->slimcore = devm_ioremap_resource(dev, res);
> + if (IS_ERR(slim_rproc->slimcore)) {
> + dev_err(&pdev->dev,
> + "devm_ioremap_resource failed for slimcore\n");
Best not to quote function names. Instead write the description in
plain English; "failed to remap 'slimcore' IO", or similar.
> + err = PTR_ERR(slim_rproc->slimcore);
> + goto err;
> + }
> +
> + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "peripherals");
> +
Superfluous '\n'.
> + slim_rproc->peri = devm_ioremap_resource(dev, res);
> + if (IS_ERR(slim_rproc->peri)) {
> + dev_err(&pdev->dev, "devm_ioremap_resource failed for peri\n");
As above.
> + err = PTR_ERR(slim_rproc->peri);
> + goto err;
> + }
> +
> + err = slim_clk_get(slim_rproc, dev);
> + if (err)
> + goto err;
> +
> + /* Register as a remoteproc device */
> + err = rproc_add(rproc);
> + if (err) {
> + dev_err(dev, "registration of slim remoteproc failed\n");
> + goto err_clk;
> + }
> +
> + return slim_rproc;
> +
> +err_clk:
> + for (i = 0; i < ST_SLIM_MAX_CLK && slim_rproc->clks[i]; i++)
> + clk_put(slim_rproc->clks[i]);
> +err:
> + rproc_put(rproc);
> + return ERR_PTR(err);
> +}
> +EXPORT_SYMBOL(st_slim_rproc_alloc);
> +
> +/**
> + * st_slim_rproc_put() - put slim rproc resources
> + * @slim_rproc: Pointer to the st_slim_rproc struct
> + *
> + * Function for calling respective _put() functions on
Early line wrap
<--------|---------|---------|---------|---------|---------|---------|--------->
> + * slim_rproc resources.
> + *
Superfluous '\n'.
> + */
> +void st_slim_rproc_put(struct st_slim_rproc *slim_rproc)
> +{
> + int clk;
> +
> + if (!slim_rproc)
> + return;
> +
> + for (clk = 0; clk < ST_SLIM_MAX_CLK && slim_rproc->clks[clk]; clk++)
> + clk_put(slim_rproc->clks[clk]);
> +
> + rproc_del(slim_rproc->rproc);
> + rproc_put(slim_rproc->rproc);
> +}
> +EXPORT_SYMBOL(st_slim_rproc_put);
> +
> +MODULE_AUTHOR("Peter Griffin");
Email.
> +MODULE_DESCRIPTION("STMicroelectronics SLIM rproc driver");
Now it's "SLIM"? Make up your mind.
> +MODULE_LICENSE("GPL v2");
> diff --git a/include/linux/remoteproc/st_slim_rproc.h b/include/linux/remoteproc/st_slim_rproc.h
> new file mode 100644
> index 0000000..64a2c5b
> --- /dev/null
> +++ b/include/linux/remoteproc/st_slim_rproc.h
> @@ -0,0 +1,53 @@
> +/*
> + * st_slim_rproc.h
As above.
> + * Copyright (C) 2016 STMicroelectronics
> + * Author: Peter Griffin <peter.griffin@linaro.org>
> + * License terms: GNU General Public License (GPL), version 2
> + */
Same for the *.c header.
> +#ifndef _ST_SLIM_H
> +#define _ST_SLIM_H
Best to mention the subsystem too.
> +#define ST_SLIM_MEM_MAX 2
> +#define ST_SLIM_MAX_CLK 4
> +
> +enum {
> + ST_SLIM_DMEM,
> + ST_SLIM_IMEM,
> +};
> +
> +/**
> + * struct st_slim_mem - slim internal memory structure
> + * @cpu_addr: MPU virtual address of the memory region
> + * @bus_addr: Bus address used to access the memory region
> + * @size: Size of the memory region
> + */
> +struct st_slim_mem {
> + void __iomem *cpu_addr;
> + phys_addr_t bus_addr;
> + size_t size;
> +};
> +
> +/**
> + * struct st_slim_rproc - SLIM slim core
> + * @rproc: rproc handle
> + * @mem: slim memory information
> + * @slimcore: slim slimcore regs
> + * @peri: slim peripheral regs
> + * @clks: slim clocks
> + */
> +struct st_slim_rproc {
> + struct rproc *rproc;
> + struct st_slim_mem mem[ST_SLIM_MEM_MAX];
> + void __iomem *slimcore;
> + void __iomem *peri;
> +
> + /* st_slim_rproc private */
> + struct clk *clks[ST_SLIM_MAX_CLK];
> +};
> +
> +struct st_slim_rproc *st_slim_rproc_alloc(struct platform_device *pdev,
> + char *fw_name);
> +void st_slim_rproc_put(struct st_slim_rproc *slim_rproc);
> +
> +#endif
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* Re: [PATCH v2 2/2] vfio: add virtio pci quirk
From: Alex Williamson @ 2016-08-30 12:46 UTC (permalink / raw)
To: Michael S. Tsirkin
Cc: Feng Wu, kvm, qemu-devel, linux-kernel, Julia Lawall, Yongji Xie,
Paolo Bonzini, virtualization, Dan Carpenter
In-Reply-To: <20160830081834-mutt-send-email-mst@kernel.org>
On Tue, 30 Aug 2016 08:20:38 +0300
"Michael S. Tsirkin" <mst@redhat.com> wrote:
> On Mon, Aug 29, 2016 at 10:53:04PM -0600, Alex Williamson wrote:
> > On Mon, 29 Aug 2016 21:52:20 -0600
> > Alex Williamson <alex.williamson@redhat.com> wrote:
> >
> > > On Mon, 29 Aug 2016 21:23:25 -0600
> > > Alex Williamson <alex.williamson@redhat.com> wrote:
> > >
> > > > On Tue, 30 Aug 2016 05:27:17 +0300
> > > > "Michael S. Tsirkin" <mst@redhat.com> wrote:
> > > >
> > > > > Modern virtio pci devices can set VIRTIO_F_IOMMU_PLATFORM
> > > > > to signal they are safe to use with an IOMMU.
> > > > >
> > > > > Without this bit, exposing the device to userspace is unsafe, so probe
> > > > > and fail VFIO initialization unless noiommu is enabled.
> > > > >
> > > > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> > > > > ---
> > > > > drivers/vfio/pci/vfio_pci_private.h | 1 +
> > > > > drivers/vfio/pci/vfio_pci.c | 14 ++++
> > > > > drivers/vfio/pci/vfio_pci_virtio.c | 140 ++++++++++++++++++++++++++++++++++++
> > > > > drivers/vfio/pci/Makefile | 1 +
> > > > > 4 files changed, 156 insertions(+)
> > > > > create mode 100644 drivers/vfio/pci/vfio_pci_virtio.c
> > > > >
> > > > > diff --git a/drivers/vfio/pci/vfio_pci_private.h b/drivers/vfio/pci/vfio_pci_private.h
> > > > > index 2128de8..2bd5616 100644
> > > > > --- a/drivers/vfio/pci/vfio_pci_private.h
> > > > > +++ b/drivers/vfio/pci/vfio_pci_private.h
> > > > > @@ -139,4 +139,5 @@ static inline int vfio_pci_igd_init(struct vfio_pci_device *vdev)
> > > > > return -ENODEV;
> > > > > }
> > > > > #endif
> > > > > +extern int vfio_pci_virtio_quirk(struct vfio_pci_device *vdev, bool noiommu);
> > > > > #endif /* VFIO_PCI_PRIVATE_H */
> > > > > diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
> > > > > index d624a52..e93bf0c 100644
> > > > > --- a/drivers/vfio/pci/vfio_pci.c
> > > > > +++ b/drivers/vfio/pci/vfio_pci.c
> > > > > @@ -1236,6 +1236,20 @@ static int vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> > > > > return ret;
> > > > > }
> > > > >
> > > > > + if (pdev->vendor == PCI_VENDOR_ID_REDHAT_QUMRANET) {
> > > >
> > > > Perhaps a vfio_pci_is_virtio() like vga below? Let's test the device
> > > > ID range initially as well, this test raised a big red flag for me
> > > > whether all devices within this vendor ID were virtio.
> > > >
> > > > > + bool noiommu = vfio_is_noiommu_group_dev(&pdev->dev);
> > > >
> > > > I think you can use iommu_present() for this and avoid patch 1of2.
> > > > noiommu is mutually exclusive to an iommu being present. Seems like
> > > > all of this logic should be in the quirk itself, I'm not sure what it
> > > > buys to get the value here but wait until later to use it. Using
> > > > iommu_present() could also move this test much earlier in
> > > > vfio_pci_probe() making the exit path easier.
> > >
> > > Except then I'm reintroducing the bug fixed by 16ab8a5cbea4 since
> > > iommu_present() assumes an IOMMU API based device. I'll try to think if
> > > there's another way to avoid adding the is_noiommu function. Thanks,
> >
> > I think something like this would do it.
> >
> > --- a/drivers/vfio/pci/vfio_pci.c
> > +++ b/drivers/vfio/pci/vfio_pci.c
> > @@ -1214,6 +1214,22 @@ static int vfio_pci_probe(struct pci_dev *pdev, const str
> > if (pdev->hdr_type != PCI_HEADER_TYPE_NORMAL)
> > return -EINVAL;
> >
> > + /*
> > + * Filter out virtio devices that do not honor the iommu,
> > + * but only for real iommu groups.
> > + */
> > + if (vfio_pci_is_virtio(pdev)) {
> > + struct iommu_group *tmp = iommu_group_get(&pdev->dev);
> > +
> > + if (tmp) {
> > + iommu_group_put(tmp);
> > +
> > + ret = vfio_pci_virtio_quirk(pdev);
> > + if (ret)
> > + return ret;
> > + }
> > + }
> > +
> > group = vfio_iommu_group_get(&pdev->dev);
> > if (!group)
> > return -EINVAL;
> >
> > Thanks,
> > Alex
>
> Yes but I think this will also prevent binding
> a vfio-noiommu to this device.
>
> Arguably this is a separate bug as it's already impossible ...
> but now that we are disabling regular vfio the noiommu
> fallback becomes more important.
>
> Any hints on how to fix?
I don't follow, prior to noiommu, we'd simply call iommu_group_get() and
rely on the iommu group created by the iommu driver. Either there is
one and we allow binding to vfio-pci or there is not one and we would
fail. With noiommu, vfio_iommu_group_get() wraps that call in some
logic that potentially creates an iommu group if noiommu is enabled.
So if we use the real iommu_group_get() prior to that and a group
exists, we know we're not using noiommu and we can test the virtio
device. If the group doesn't exist here, noiommu plays out the same as
it would otherwise (depending on noiommu enabling), a virtio device can
be bound regardless of its capabilities and features. I think that's
what we want, right? Thanks,
Alex
> > > > > +
> > > > > + ret = vfio_pci_virtio_quirk(vdev, noiommu);
> > > > > + if (ret) {
> > > > > + dev_warn(&vdev->pdev->dev,
> > > > > + "Failed to setup Virtio for VFIO\n");
> > > > > + vfio_del_group_dev(&pdev->dev);
> > > > > + vfio_iommu_group_put(group, &pdev->dev);
> > > > > + kfree(vdev);
> > > > > + return ret;
> > > > > + }
> > > > > + }
> > > > > +
> > > > > if (vfio_pci_is_vga(pdev)) {
> > > > > vga_client_register(pdev, vdev, NULL, vfio_pci_set_vga_decode);
> > > > > vga_set_legacy_decoding(pdev,
> > > > > diff --git a/drivers/vfio/pci/vfio_pci_virtio.c b/drivers/vfio/pci/vfio_pci_virtio.c
> > > > > new file mode 100644
> > > > > index 0000000..e1ecffd
> > > > > --- /dev/null
> > > > > +++ b/drivers/vfio/pci/vfio_pci_virtio.c
> > > > > @@ -0,0 +1,140 @@
> > > > > +/*
> > > > > + * VFIO PCI Intel Graphics support
> > > > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > > > > + *
> > > > > + * Copyright (C) 2016 Red Hat, Inc. All rights reserved.
> > > > > + * Author: Alex Williamson <alex.williamson@redhat.com>
> > > >
> > > > Update.
> > > >
> > > > > + *
> > > > > + * This program is free software; you can redistribute it and/or modify
> > > > > + * it under the terms of the GNU General Public License version 2 as
> > > > > + * published by the Free Software Foundation.
> > > > > + *
> > > > > + * Register a device specific region through which to provide read-only
> > > > > + * access to the Intel IGD opregion. The register defining the opregion
> > > > > + * address is also virtualized to prevent user modification.
> > > > > + */
> > > > > +
> > > > > +#include <linux/io.h>
> > > > > +#include <linux/pci.h>
> > > > > +#include <linux/uaccess.h>
> > > >
> > > > Are io.h and uaccess.h needed?
> > > >
> > > > > +#include <linux/vfio.h>
> > > > > +#include <linux/virtio_pci.h>
> > > > > +#include <linux/virtio_config.h>
> > > > > +
> > > > > +#include "vfio_pci_private.h"
> > > > > +
> > > > > +/**
> > > > > + * virtio_pci_find_capability - walk capabilities to find device info.
> > > > > + * @dev: the pci device
> > > > > + * @cfg_type: the VIRTIO_PCI_CAP_* value we seek
> > > > > + *
> > > > > + * Returns offset of the capability, or 0.
> > > > > + */
> > > > > +static inline int virtio_pci_find_capability(struct pci_dev *dev, u8 cfg_type)
> > > >
> > > > Does inlining this really make sense?
> > > >
> > > > > +{
> > > > > + int pos;
> > > > > +
> > > > > + for (pos = pci_find_capability(dev, PCI_CAP_ID_VNDR);
> > > > > + pos > 0;
> > > > > + pos = pci_find_next_capability(dev, pos, PCI_CAP_ID_VNDR)) {
> > > > > + u8 type;
> > > > > + pci_read_config_byte(dev, pos + offsetof(struct virtio_pci_cap,
> > > > > + cfg_type),
> > > > > + &type);
> > > > > +
> > > > > + if (type != cfg_type)
> > > > > + continue;
> > > > > +
> > > > > + /* Ignore structures with reserved BAR values */
> > > > > + if (type != VIRTIO_PCI_CAP_PCI_CFG) {
> > > > > + u8 bar;
> > > > > +
> > > > > + pci_read_config_byte(dev, pos +
> > > > > + offsetof(struct virtio_pci_cap,
> > > > > + bar),
> > > > > + &bar);
> > > > > + if (bar > 0x5)
> > > >
> > > > s/0x5/PCI_STD_RESOURCE_END/
> > > >
> > > > > + continue;
> > > > > + }
> > > > > +
> > > > > + return pos;
> > > > > + }
> > > > > + return 0;
> > > > > +}
> > > > > +
> > > > > +
> > > > > +int vfio_pci_virtio_quirk(struct vfio_pci_device *vdev, bool noiommu)
> > > > > +{
> > > > > + struct pci_dev *dev = vdev->pdev;
> > > >
> > > > Please use *pdev for consistency with the rest of drivers/vfio/pci/*
> > > >
> > > > Also, is there any reason to pass the vfio_pci_device? There's nothing
> > > > vfio here otherwise and we could remove more #includes.
> > > >
> > > > > + int common, cfg;
> > > > > + u32 features;
> > > > > + u32 offset;
> > > > > + u8 bar;
> > > > > +
> > > > > + /* Without an IOMMU, we don't care */
> > > > > + if (noiommu)
> > > > > + return 0;
> > > > > +
> > > > > + /* Virtio only owns devices >= 0x1000 and <= 0x107f: leave the rest. */
> > > > > + if (dev->device < 0x1000 || dev->device > 0x107f)
> > > > > + return 0;
> > > >
> > > > Whitespace
> > > >
> > > > > +
> > > > > + /* Check whether device enforces the IOMMU correctly */
> > > > > +
> > > > > + /*
> > > > > + * All modern devices must have common and cfg capabilities. We use cfg
> > > > > + * capability for access so that we don't need to worry about resource
> > > > > + * availability. Slow but sure.
> > > > > + * Note that all vendor-specific fields we access are little-endian
> > > > > + * which matches what pci config accessors expect, so they do byteswap
> > > > > + * for us if appropriate.
> > > > > + */
> > > > > + common = virtio_pci_find_capability(dev, VIRTIO_PCI_CAP_COMMON_CFG);
> > > > > + cfg = virtio_pci_find_capability(dev, VIRTIO_PCI_CAP_PCI_CFG);
> > > > > + if (!cfg || !common) {
> > > > > + dev_warn(&dev->dev,
> > > > > + "Virtio device lacks common or pci cfg.\n");
> > > >
> > > > Whitespace
> > > >
> > > > > + return -ENODEV;
> > > > > + }
> > > > > +
> > > > > + pci_read_config_byte(dev, common + offsetof(struct virtio_pci_cap,
> > > > > + bar),
> > > > > + &bar);
> > > > > + pci_read_config_dword(dev, common + offsetof(struct virtio_pci_cap,
> > > > > + offset),
> > > > > + &offset);
> > > > > +
> > > > > + /* Program cfg capability for dword access into common cfg. */
> > > > > + pci_write_config_byte(dev, cfg + offsetof(struct virtio_pci_cfg_cap,
> > > > > + cap.bar),
> > > > > + bar);
> > > > > + pci_write_config_dword(dev, cfg + offsetof(struct virtio_pci_cfg_cap,
> > > > > + cap.length),
> > > > > + 0x4);
> > > > > +
> > > > > + /* Select features dword that has VIRTIO_F_IOMMU_PLATFORM. */
> > > > > + pci_write_config_dword(dev, cfg + offsetof(struct virtio_pci_cfg_cap,
> > > > > + cap.offset),
> > > > > + offset + offsetof(struct virtio_pci_common_cfg,
> > > > > + device_feature_select));
> > > > > + pci_write_config_dword(dev, cfg + offsetof(struct virtio_pci_cfg_cap,
> > > > > + pci_cfg_data),
> > > > > + VIRTIO_F_IOMMU_PLATFORM / 32);
> > > > > +
> > > > > + /* Get the features dword. */
> > > > > + pci_write_config_dword(dev, cfg + offsetof(struct virtio_pci_cfg_cap,
> > > > > + cap.offset),
> > > > > + offset + offsetof(struct virtio_pci_common_cfg,
> > > > > + device_feature));
> > > > > + pci_read_config_dword(dev, cfg + offsetof(struct virtio_pci_cfg_cap,
> > > > > + pci_cfg_data),
> > > > > + &features);
> > > > > +
> > > > > + /* Does this device obey the platform's IOMMU? If not it's an error. */
> > > > > + if (!(features & (0x1 << (VIRTIO_F_IOMMU_PLATFORM % 32)))) {
> > > > > + dev_warn(&dev->dev,
> > > > > + "Virtio device lacks VIRTIO_F_IOMMU_PLATFORM.\n");
> > > >
> > > > Whitespace
> > > >
> > > > > + return -ENODEV;
> > > > > + }
> > > > > +
> > > > > + return 0;
> > > > > +}
> > > > > diff --git a/drivers/vfio/pci/Makefile b/drivers/vfio/pci/Makefile
> > > > > index 76d8ec0..e9b20e7 100644
> > > > > --- a/drivers/vfio/pci/Makefile
> > > > > +++ b/drivers/vfio/pci/Makefile
> > > > > @@ -1,5 +1,6 @@
> > > > >
> > > > > vfio-pci-y := vfio_pci.o vfio_pci_intrs.o vfio_pci_rdwr.o vfio_pci_config.o
> > > > > +vfio-pci-y += vfio_pci_virtio.o
> > > > > vfio-pci-$(CONFIG_VFIO_PCI_IGD) += vfio_pci_igd.o
> > > > >
> > > > > obj-$(CONFIG_VFIO_PCI) += vfio-pci.o
> > > >
> > > > Thanks,
> > > > Alex
^ permalink raw reply
* Re: [PATCH v8 15/18] ARM: STi: DT: STiH407: Add uniperif reader dt nodes
From: Peter Griffin @ 2016-08-30 14:21 UTC (permalink / raw)
To: Lee Jones
Cc: devicetree, kernel, vinod.koul, Arnaud Pouliquen,
linux-remoteproc, patrice.chotard, dri-devel, linux-kernel,
airlied, dmaengine, dan.j.williams, bjorn.andersson,
virtualization, linux-arm-kernel
In-Reply-To: <20160830100148.GO1661@dell>
Hi Lee,
Thanks for reviewing and your very valuable feedback.
On Tue, 30 Aug 2016, Lee Jones wrote:
> On Fri, 26 Aug 2016, Peter Griffin wrote:
>
> > This patch adds the DT node for the uniperif reader
> > IP block found on STiH407 family silicon.
> >
> > Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
> > Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> > ---
> > arch/arm/boot/dts/stih407-family.dtsi | 26 ++++++++++++++++++++++++++
> > 1 file changed, 26 insertions(+)
> >
> > diff --git a/arch/arm/boot/dts/stih407-family.dtsi b/arch/arm/boot/dts/stih407-family.dtsi
> > index d263c96..bdddf2c 100644
> > --- a/arch/arm/boot/dts/stih407-family.dtsi
> > +++ b/arch/arm/boot/dts/stih407-family.dtsi
> > @@ -956,5 +956,31 @@
> > st,version = <5>;
> > st,mode = "SPDIF";
> > };
> > +
> > + sti_uni_reader0: sti-uni-reader@0 {
> > + compatible = "st,sti-uni-reader";
> > + status = "disabled";
>
> I find it's normally nicer to place the status of the node at the
> bottom, separated by a '\n'.
Ok I'll add a superflous '\n' in the next version.
> There isn't a functional difference
> admittedly, but it would be my preference, since it's not describing
> the device per se.
Will change to your preference in the next version.
>
> > + #sound-dai-cells = <0>;
> > + st,syscfg = <&syscfg_core>;
> > + reg = <0x8D83000 0x158>;
>
> We usually use lower-case for the address.
Will fix.
>
> Since this has a 'reg' property, the '0' in the node name does not
> look appropriate.
Will fix.
>
> > + interrupts = <GIC_SPI 87 IRQ_TYPE_NONE>;
> > + dmas = <&fdma0 5 0 1>;
> > + dma-names = "rx";
> > + dai-name = "Uni Reader #0 (PCM IN)";
>
> Oooo, not seen something like this before.
>
> If it does not already have one, it would require a DT Ack.
No idea, the driver got merged 1 year ago.
Arnaud did you get a DT ack when you merged this driver & binding?
>
> > + st,version = <3>;
>
> This will likely need a DT Ack too. We usually encode this sort of
> information in the compatible string.
See 05c1b4480e86a871b18030d6f3d532dc0ecdf38c
>
> > + };
> > +
> > + sti_uni_reader1: sti-uni-reader@1 {
> > + compatible = "st,sti-uni-reader";
> > + status = "disabled";
> > + #sound-dai-cells = <0>;
> > + st,syscfg = <&syscfg_core>;
> > + reg = <0x8D84000 0x158>;
> > + interrupts = <GIC_SPI 88 IRQ_TYPE_NONE>;
> > + dmas = <&fdma0 6 0 1>;
> > + dma-names = "rx";
> > + dai-name = "Uni Reader #1 (HDMI RX)";
> > + st,version = <3>;
> > + };
>
> All as above.
>
> > };
> > };
>
Regards,
Peter.
^ permalink raw reply
* [PATCH] virtio_console: Stop doing DMA on the stack
From: Andy Lutomirski @ 2016-08-30 15:04 UTC (permalink / raw)
To: x86, Amit Shah, virtualization
Cc: linux-kernel, Andy Lutomirski, Michael S. Tsirkin
virtio_console uses a small DMA buffer for control requests. Move
that buffer into heap memory.
Doing virtio DMA on the stack is normally okay on non-DMA-API virtio
systems (which is currently most of them), but it breaks completely
if the stack is virtually mapped.
Tested by typing both directions using picocom aimed at /dev/hvc0.
Signed-off-by: Andy Lutomirski <luto@kernel.org>
---
Hi all-
This is currently broken in tip:x86/asm. If you (Amit) like this patch,
would it make sense for Ingo to add it to -tip?
Thanks,
Andy
drivers/char/virtio_console.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c
index d2406fe25533..5da47e26a012 100644
--- a/drivers/char/virtio_console.c
+++ b/drivers/char/virtio_console.c
@@ -165,6 +165,12 @@ struct ports_device {
*/
struct virtqueue *c_ivq, *c_ovq;
+ /*
+ * A control packet buffer for guest->host requests, protected
+ * by c_ovq_lock.
+ */
+ struct virtio_console_control cpkt;
+
/* Array of per-port IO virtqueues */
struct virtqueue **in_vqs, **out_vqs;
@@ -560,28 +566,29 @@ static ssize_t __send_control_msg(struct ports_device *portdev, u32 port_id,
unsigned int event, unsigned int value)
{
struct scatterlist sg[1];
- struct virtio_console_control cpkt;
struct virtqueue *vq;
unsigned int len;
if (!use_multiport(portdev))
return 0;
- cpkt.id = cpu_to_virtio32(portdev->vdev, port_id);
- cpkt.event = cpu_to_virtio16(portdev->vdev, event);
- cpkt.value = cpu_to_virtio16(portdev->vdev, value);
-
vq = portdev->c_ovq;
- sg_init_one(sg, &cpkt, sizeof(cpkt));
-
spin_lock(&portdev->c_ovq_lock);
- if (virtqueue_add_outbuf(vq, sg, 1, &cpkt, GFP_ATOMIC) == 0) {
+
+ portdev->cpkt.id = cpu_to_virtio32(portdev->vdev, port_id);
+ portdev->cpkt.event = cpu_to_virtio16(portdev->vdev, event);
+ portdev->cpkt.value = cpu_to_virtio16(portdev->vdev, value);
+
+ sg_init_one(sg, &portdev->cpkt, sizeof(struct virtio_console_control));
+
+ if (virtqueue_add_outbuf(vq, sg, 1, &portdev->cpkt, GFP_ATOMIC) == 0) {
virtqueue_kick(vq);
while (!virtqueue_get_buf(vq, &len)
&& !virtqueue_is_broken(vq))
cpu_relax();
}
+
spin_unlock(&portdev->c_ovq_lock);
return 0;
}
--
2.7.4
^ permalink raw reply related
* Re: [PATCH v8 01/18] remoteproc: st_slim_rproc: add a slimcore rproc driver
From: Peter Griffin @ 2016-08-30 15:44 UTC (permalink / raw)
To: Lee Jones
Cc: devicetree, kernel, vinod.koul, linux-remoteproc, patrice.chotard,
dri-devel, linux-kernel, airlied, dmaengine, dan.j.williams,
bjorn.andersson, virtualization, linux-arm-kernel
In-Reply-To: <20160830123453.GG10121@dell>
Hi Lee,
Thanks for reviewing.
On Tue, 30 Aug 2016, Lee Jones wrote:
> On Fri, 26 Aug 2016, Peter Griffin wrote:
>
> > slim core is used as a basis for many IPs in the STi
> > chipsets such as fdma and demux. To avoid duplicating
> > the elf loading code in each device driver a slim
> > rproc driver has been created.
> >
> > This driver is designed to be used by other device drivers
> > such as fdma, or demux whose IP is based around a slim core.
> > The device driver can call slim_rproc_alloc() to allocate
> > a slim rproc and slim_rproc_put() when finished.
> >
> > This driver takes care of ioremapping the slim
> > registers (dmem, imem, slimcore, peripherals), whose offsets
> > and sizes can change between IP's. It also obtains and enables
> > any clocks used by the device. This approach avoids having
> > a double mapping of the registers as slim_rproc does not register
> > its own platform device. It also maps well to device tree
> > abstraction as it allows us to have one dt node for the whole
> > device.
> >
> > All of the generic rproc elf loading code can be reused, and
> > we provide start() stop() hooks to start and stop the slim
> > core once the firmware has been loaded. This has been tested
> > successfully with fdma driver.
>
> Nit. It would be good to use a constant line-wrap.
>
> 'M-x post-mode' will help with this.
Can you provide the magic which makes this happen for GIT commit messages?
>
> > Signed-off-by: Peter Griffin <peter.griffin@linaro.org>
> > ---
> > drivers/remoteproc/Kconfig | 8 +
> > drivers/remoteproc/Makefile | 1 +
> > drivers/remoteproc/st_slim_rproc.c | 364 +++++++++++++++++++++++++++++++
> > include/linux/remoteproc/st_slim_rproc.h | 53 +++++
> > 4 files changed, 426 insertions(+)
> > create mode 100644 drivers/remoteproc/st_slim_rproc.c
> > create mode 100644 include/linux/remoteproc/st_slim_rproc.h
> >
> > diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
> > index 1a8bf76a..06765e0 100644
> > --- a/drivers/remoteproc/Kconfig
> > +++ b/drivers/remoteproc/Kconfig
> > @@ -100,4 +100,12 @@ config ST_REMOTEPROC
> > processor framework.
> > This can be either built-in or a loadable module.
> >
> > +config ST_SLIM_REMOTEPROC
> > + tristate "ST Slim remoteproc support"
> > + select REMOTEPROC
> > + help
> > + Say y here to support firmware loading on IP based around
> > + the Slim core.
> > + If unsure say N.
> > +
> > endmenu
> > diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
> > index 92d3758..db1dae7 100644
> > --- a/drivers/remoteproc/Makefile
> > +++ b/drivers/remoteproc/Makefile
> > @@ -14,3 +14,4 @@ obj-$(CONFIG_DA8XX_REMOTEPROC) += da8xx_remoteproc.o
> > obj-$(CONFIG_QCOM_MDT_LOADER) += qcom_mdt_loader.o
> > obj-$(CONFIG_QCOM_Q6V5_PIL) += qcom_q6v5_pil.o
> > obj-$(CONFIG_ST_REMOTEPROC) += st_remoteproc.o
> > +obj-$(CONFIG_ST_SLIM_REMOTEPROC) += st_slim_rproc.o
> > diff --git a/drivers/remoteproc/st_slim_rproc.c b/drivers/remoteproc/st_slim_rproc.c
> > new file mode 100644
> > index 0000000..f4bf2d7
> > --- /dev/null
> > +++ b/drivers/remoteproc/st_slim_rproc.c
> > @@ -0,0 +1,364 @@
> > +/*
> > + * st_slim_rproc.c
>
> These serve no purpose and have a habit of becoming out-of-date.
> Please remove it and replace with a nice succinct description
> instead.
OK will fix.
>
> > + * Copyright (C) 2016 STMicroelectronics
>
> Nit: '\n' here.
Will fix.
>
> > + * Author: Peter Griffin <peter.griffin@linaro.org>
>
> Nit: '\n' here.
Will fix.
>
> > + * License terms: GNU General Public License (GPL), version 2
>
> Are you sure ST are okay with the shortened version of the GPL?
Do you mean the banner should be like this?
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
As I'm not aware of a shortened version of the GPV v2 license.
>
> > + */
> > +
> > +#include <linux/clk.h>
> > +#include <linux/err.h>
> > +#include <linux/kernel.h>
> > +#include <linux/module.h>
> > +#include <linux/of.h>
> > +#include <linux/of_device.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/remoteproc.h>
> > +#include <linux/remoteproc/st_slim_rproc.h>
> > +#include "remoteproc_internal.h"
> > +
> > +/* slimcore registers */
>
> What's it called? slimcore, slim core, ST Slim?
It is usually referred to as SLIM core, or SLIM CPU in the various functional
specifications.
>
> Please be consistent. Use the name from the datasheet.
OK. The datasheet isn't consistent either, so we will settle on SLIM core and
SLIM CPU.
>
> > +#define SLIM_ID_OFST 0x0
> > +#define SLIM_VER_OFST 0x4
> > +
> > +#define SLIM_EN_OFST 0x8
> > +#define SLIM_EN_RUN BIT(0)
> > +
> > +#define SLIM_CLK_GATE_OFST 0xC
> > +#define SLIM_CLK_GATE_DIS BIT(0)
> > +#define SLIM_CLK_GATE_RESET BIT(2)
> > +
> > +#define SLIM_SLIM_PC_OFST 0x20
> > +
> > +/* dmem registers */
> > +#define SLIM_REV_ID_OFST 0x0
> > +#define SLIM_REV_ID_MIN_MASK GENMASK(15, 8)
> > +#define SLIM_REV_ID_MIN(id) ((id & SLIM_REV_ID_MIN_MASK) >> 8)
> > +#define SLIM_REV_ID_MAJ_MASK GENMASK(23, 16)
> > +#define SLIM_REV_ID_MAJ(id) ((id & SLIM_REV_ID_MAJ_MASK) >> 16)
> > +
> > +
> > +/* peripherals registers */
> > +#define SLIM_STBUS_SYNC_OFST 0xF88
> > +#define SLIM_STBUS_SYNC_DIS BIT(0)
> > +
> > +#define SLIM_INT_SET_OFST 0xFD4
> > +#define SLIM_INT_CLR_OFST 0xFD8
> > +#define SLIM_INT_MASK_OFST 0xFDC
> > +
> > +#define SLIM_CMD_CLR_OFST 0xFC8
> > +#define SLIM_CMD_MASK_OFST 0xFCC
> > +
> > +static const char *mem_names[ST_SLIM_MEM_MAX] = {
> > + [ST_SLIM_DMEM] = "dmem",
> > + [ST_SLIM_IMEM] = "imem",
> > +};
> > +
> > +static int slim_clk_get(struct st_slim_rproc *slim_rproc, struct device *dev)
> > +{
> > + int clk, err;
> > +
> > + for (clk = 0; clk < ST_SLIM_MAX_CLK; clk++) {
> > + slim_rproc->clks[clk] = of_clk_get(dev->of_node, clk);
> > + if (IS_ERR(slim_rproc->clks[clk])) {
> > + err = PTR_ERR(slim_rproc->clks[clk]);
> > + if (err == -EPROBE_DEFER)
> > + goto err_put_clks;
> > + slim_rproc->clks[clk] = NULL;
> > + break;
> > + }
> > + }
> > +
> > + return 0;
> > +
> > +err_put_clks:
> > + while (--clk >= 0)
> > + clk_put(slim_rproc->clks[clk]);
> > +
> > + return err;
> > +}
> > +
> > +static void slim_clk_disable(struct st_slim_rproc *slim_rproc)
> > +{
> > + int clk;
> > +
> > + for (clk = 0; clk < ST_SLIM_MAX_CLK && slim_rproc->clks[clk]; clk++)
> > + clk_disable_unprepare(slim_rproc->clks[clk]);
> > +}
> > +
> > +static int slim_clk_enable(struct st_slim_rproc *slim_rproc)
> > +{
> > + int clk, ret;
> > +
> > + for (clk = 0; clk < ST_SLIM_MAX_CLK && slim_rproc->clks[clk]; clk++) {
> > + ret = clk_prepare_enable(slim_rproc->clks[clk]);
> > + if (ret)
> > + goto err_disable_clks;
> > + }
> > +
> > + return 0;
> > +
> > +err_disable_clks:
> > + while (--clk >= 0)
> > + clk_disable_unprepare(slim_rproc->clks[clk]);
> > +
> > + return ret;
> > +}
> > +
> > +/**
> > + * Remoteproc slim specific device handlers
> > + */
>
> I suggest not using kernel-doc format for this type of comment.
Will fix.
>
> > +static int slim_rproc_start(struct rproc *rproc)
> > +{
> > + struct device *dev = &rproc->dev;
> > + struct st_slim_rproc *slim_rproc = rproc->priv;
> > + unsigned long hw_id, hw_ver, fw_rev;
> > + u32 val;
> > + int ret;
> > +
> > + ret = slim_clk_enable(slim_rproc);
> > + if (ret) {
> > + dev_err(dev, "Failed to enable clocks\n");
> > + return ret;
> > + }
> > +
> > + /* disable CPU pipeline clock & reset cpu pipeline */
>
> Be consistent. Is it 'cpu' or 'CPU'. Personally I find using
> 'correct English' to be the most consistent way of formatting
> comments i.e. Capitals for names, acronyms and at the start of a
> sentence.
OK will update to CPU for both.
>
> > + val = SLIM_CLK_GATE_DIS | SLIM_CLK_GATE_RESET;
> > + writel(val, slim_rproc->slimcore + SLIM_CLK_GATE_OFST);
> > +
> > + /* disable SLIM core STBus sync */
> > + writel(SLIM_STBUS_SYNC_DIS, slim_rproc->peri + SLIM_STBUS_SYNC_OFST);
> > +
> > + /* enable cpu pipeline clock */
> > + writel(!SLIM_CLK_GATE_DIS,
> > + slim_rproc->slimcore + SLIM_CLK_GATE_OFST);
> > +
> > + /* clear int & cmd mailbox */
> > + writel(~0U, slim_rproc->peri + SLIM_INT_CLR_OFST);
> > + writel(~0U, slim_rproc->peri + SLIM_CMD_CLR_OFST);
> > +
> > + /* enable all channels cmd & int */
> > + writel(~0U, slim_rproc->peri + SLIM_INT_MASK_OFST);
> > + writel(~0U, slim_rproc->peri + SLIM_CMD_MASK_OFST);
> > +
> > + /* enable cpu */
> > + writel(SLIM_EN_RUN, slim_rproc->slimcore + SLIM_EN_OFST);
> > +
> > + hw_id = readl_relaxed(slim_rproc->slimcore + SLIM_ID_OFST);
> > + hw_ver = readl_relaxed(slim_rproc->slimcore + SLIM_VER_OFST);
> > +
> > + fw_rev = readl(slim_rproc->mem[ST_SLIM_DMEM].cpu_addr +
> > + SLIM_REV_ID_OFST);
> > +
> > + dev_info(dev, "fw rev:%ld.%ld on SLIM %ld.%ld\n",
> > + SLIM_REV_ID_MAJ(fw_rev), SLIM_REV_ID_MIN(fw_rev),
> > + hw_id, hw_ver);
> > +
> > + return 0;
> > +}
> > +
> > +static int slim_rproc_stop(struct rproc *rproc)
> > +{
> > + struct st_slim_rproc *slim_rproc = rproc->priv;
> > + u32 val;
> > +
> > + /* mask all (cmd & int) channels */
> > + writel(0UL, slim_rproc->peri + SLIM_INT_MASK_OFST);
> > + writel(0UL, slim_rproc->peri + SLIM_CMD_MASK_OFST);
> > +
> > + /* disable cpu pipeline clock */
> > + writel(SLIM_CLK_GATE_DIS, slim_rproc->slimcore + SLIM_CLK_GATE_OFST);
> > +
> > + writel(!SLIM_EN_RUN, slim_rproc->slimcore + SLIM_EN_OFST);
> > +
> > + val = readl(slim_rproc->slimcore + SLIM_EN_OFST);
> > + if (val & SLIM_EN_RUN)
> > + dev_warn(&rproc->dev, "Failed to disable SLIM");
> > +
> > + slim_clk_disable(slim_rproc);
> > +
> > + dev_dbg(&rproc->dev, "slim stopped\n");
> > +
> > + return 0;
> > +}
> > +
> > +static void *slim_rproc_da_to_va(struct rproc *rproc, u64 da, int len)
> > +{
> > + struct st_slim_rproc *slim_rproc = rproc->priv;
> > + void *va = NULL;
> > + int i;
> > +
> > + for (i = 0; i < ST_SLIM_MEM_MAX; i++) {
> > + if (da != slim_rproc->mem[i].bus_addr)
> > + continue;
> > +
> > + if (len <= slim_rproc->mem[i].size) {
> > + /* __force to make sparse happy with type conversion */
> > + va = (__force void *)slim_rproc->mem[i].cpu_addr;
> > + break;
> > + }
> > + }
> > +
> > + dev_dbg(&rproc->dev, "%s: da = 0x%llx len = 0x%x va = 0x%p\n",
> > + __func__, da, len, va);
>
> Non-consistent with other debug prints. I suggest dropping the
> _func_. It's a nice to have during initial debugging, but I don't
> usually find them useful upstream.
OK will fix.
>
> > + return va;
> > +}
> > +
> > +static struct rproc_ops slim_rproc_ops = {
> > + .start = slim_rproc_start,
> > + .stop = slim_rproc_stop,
> > + .da_to_va = slim_rproc_da_to_va,
> > +};
> > +
> > +/**
> > + * Firmware handler operations: sanity, boot address, load ...
> > + */
>
> Don't use kernel-doc for these.
Will fix.
>
> > +static struct resource_table empty_rsc_tbl = {
> > + .ver = 1,
> > + .num = 0,
> > +};
>
> This should go away soon.
>
> Be prepared to remove this once the code lands.
OK.
>
> > +static struct resource_table *slim_rproc_find_rsc_table(struct rproc *rproc,
> > + const struct firmware *fw,
> > + int *tablesz)
> > +{
> > + *tablesz = sizeof(empty_rsc_tbl);
> > + return &empty_rsc_tbl;
> > +}
> > +
> > +static struct rproc_fw_ops slim_rproc_fw_ops = {
> > + .find_rsc_table = slim_rproc_find_rsc_table,
> > +};
> > +
> > +/**
> > + * st_slim_rproc_alloc() - allocate and initialise slim rproc
> > + * @pdev: Pointer to the platform_device struct
> > + * @fw_name: Name of firmware for rproc to use
> > + *
> > + * Function for allocating and initialising a slim rproc for use by
> > + * device drivers whose IP is based around the slim slim core. It
>
> "slim slim"? Do you mean "really slim"? ;)
Will update to SLIM core.
>
> > + * obtains and enables any clocks required by the slim core and also
> > + * ioremaps the various IO.
> > + *
> > + * Returns st_slim_rproc pointer or PTR_ERR() on error.
> > + */
> > +
> > +struct st_slim_rproc *st_slim_rproc_alloc(struct platform_device *pdev,
> > + char *fw_name)
> > +{
> > + struct device *dev = &pdev->dev;
> > + struct st_slim_rproc *slim_rproc;
> > + struct device_node *np = dev->of_node;
> > + struct rproc *rproc;
> > + struct resource *res;
> > + int err, i;
> > + const struct rproc_fw_ops *elf_ops;
> > +
> > + if (WARN_ON(!np || !fw_name))
> > + return ERR_PTR(-EINVAL);
>
> !np should not happen, ever. You can remove the check.
OK, will fix.
>
> > + if (!of_device_is_compatible(np, "st,slim-rproc"))
> > + return ERR_PTR(-EINVAL);
> > +
> > + rproc = rproc_alloc(dev, np->name, &slim_rproc_ops,
> > + fw_name, sizeof(*slim_rproc));
> > + if (!rproc)
> > + return ERR_PTR(-ENOMEM);
> > +
> > + rproc->has_iommu = false;
> > +
> > + slim_rproc = rproc->priv;
> > + slim_rproc->rproc = rproc;
> > +
> > + elf_ops = rproc->fw_ops;
> > + /* Use some generic elf ops */
> > + slim_rproc_fw_ops.load = elf_ops->load;
> > + slim_rproc_fw_ops.sanity_check = elf_ops->sanity_check;
> > +
> > + rproc->fw_ops = &slim_rproc_fw_ops;
> > +
> > + /* get imem and dmem */
> > + for (i = 0; i < ARRAY_SIZE(mem_names); i++) {
> > +
>
> Superfluous '\n'.
Will fix.
>
> > + res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> > + mem_names[i]);
> > +
> > + slim_rproc->mem[i].cpu_addr = devm_ioremap_resource(dev, res);
> > + if (IS_ERR(slim_rproc->mem[i].cpu_addr)) {
> > + dev_err(&pdev->dev, "devm_ioremap_resource failed\n");
> > + err = PTR_ERR(slim_rproc->mem[i].cpu_addr);
> > + goto err;
> > + }
> > + slim_rproc->mem[i].bus_addr = res->start;
> > + slim_rproc->mem[i].size = resource_size(res);
> > + }
> > +
> > + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "slimcore");
>
> Superfluous '\n'.
Will fix.
>
> > + slim_rproc->slimcore = devm_ioremap_resource(dev, res);
> > + if (IS_ERR(slim_rproc->slimcore)) {
> > + dev_err(&pdev->dev,
> > + "devm_ioremap_resource failed for slimcore\n");
>
> Best not to quote function names. Instead write the description in
> plain English; "failed to remap 'slimcore' IO", or similar.
Will fix.
>
> > + err = PTR_ERR(slim_rproc->slimcore);
> > + goto err;
> > + }
> > +
> > + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "peripherals");
> > +
>
> Superfluous '\n'.
Will fix.
>
> > + slim_rproc->peri = devm_ioremap_resource(dev, res);
> > + if (IS_ERR(slim_rproc->peri)) {
> > + dev_err(&pdev->dev, "devm_ioremap_resource failed for peri\n");
>
> As above.
>
> > + err = PTR_ERR(slim_rproc->peri);
> > + goto err;
> > + }
> > +
> > + err = slim_clk_get(slim_rproc, dev);
> > + if (err)
> > + goto err;
> > +
> > + /* Register as a remoteproc device */
> > + err = rproc_add(rproc);
> > + if (err) {
> > + dev_err(dev, "registration of slim remoteproc failed\n");
> > + goto err_clk;
> > + }
> > +
> > + return slim_rproc;
> > +
> > +err_clk:
> > + for (i = 0; i < ST_SLIM_MAX_CLK && slim_rproc->clks[i]; i++)
> > + clk_put(slim_rproc->clks[i]);
> > +err:
> > + rproc_put(rproc);
> > + return ERR_PTR(err);
> > +}
> > +EXPORT_SYMBOL(st_slim_rproc_alloc);
> > +
> > +/**
> > + * st_slim_rproc_put() - put slim rproc resources
> > + * @slim_rproc: Pointer to the st_slim_rproc struct
> > + *
> > + * Function for calling respective _put() functions on
>
> Early line wrap
Will fix.
>
> <--------|---------|---------|---------|---------|---------|---------|--------->
>
> > + * slim_rproc resources.
> > + *
>
> Superfluous '\n'.
Will fix.
>
> > + */
> > +void st_slim_rproc_put(struct st_slim_rproc *slim_rproc)
> > +{
> > + int clk;
> > +
> > + if (!slim_rproc)
> > + return;
> > +
> > + for (clk = 0; clk < ST_SLIM_MAX_CLK && slim_rproc->clks[clk]; clk++)
> > + clk_put(slim_rproc->clks[clk]);
> > +
> > + rproc_del(slim_rproc->rproc);
> > + rproc_put(slim_rproc->rproc);
> > +}
> > +EXPORT_SYMBOL(st_slim_rproc_put);
> > +
> > +MODULE_AUTHOR("Peter Griffin");
>
> Email.
Will fix.
>
> > +MODULE_DESCRIPTION("STMicroelectronics SLIM rproc driver");
>
> Now it's "SLIM"? Make up your mind.
Will fix.
>
> > +MODULE_LICENSE("GPL v2");
> > diff --git a/include/linux/remoteproc/st_slim_rproc.h b/include/linux/remoteproc/st_slim_rproc.h
> > new file mode 100644
> > index 0000000..64a2c5b
> > --- /dev/null
> > +++ b/include/linux/remoteproc/st_slim_rproc.h
> > @@ -0,0 +1,53 @@
> > +/*
> > + * st_slim_rproc.h
>
> As above.
Will fix.
>
> > + * Copyright (C) 2016 STMicroelectronics
> > + * Author: Peter Griffin <peter.griffin@linaro.org>
> > + * License terms: GNU General Public License (GPL), version 2
> > + */
>
> Same for the *.c header.
Will fix.
>
> > +#ifndef _ST_SLIM_H
> > +#define _ST_SLIM_H
>
> Best to mention the subsystem too.
Will fix.
>
> > +#define ST_SLIM_MEM_MAX 2
> > +#define ST_SLIM_MAX_CLK 4
> > +
> > +enum {
> > + ST_SLIM_DMEM,
> > + ST_SLIM_IMEM,
> > +};
> > +
> > +/**
> > + * struct st_slim_mem - slim internal memory structure
> > + * @cpu_addr: MPU virtual address of the memory region
> > + * @bus_addr: Bus address used to access the memory region
> > + * @size: Size of the memory region
> > + */
> > +struct st_slim_mem {
> > + void __iomem *cpu_addr;
> > + phys_addr_t bus_addr;
> > + size_t size;
> > +};
> > +
> > +/**
> > + * struct st_slim_rproc - SLIM slim core
> > + * @rproc: rproc handle
> > + * @mem: slim memory information
> > + * @slimcore: slim slimcore regs
> > + * @peri: slim peripheral regs
> > + * @clks: slim clocks
> > + */
> > +struct st_slim_rproc {
> > + struct rproc *rproc;
> > + struct st_slim_mem mem[ST_SLIM_MEM_MAX];
> > + void __iomem *slimcore;
> > + void __iomem *peri;
> > +
> > + /* st_slim_rproc private */
> > + struct clk *clks[ST_SLIM_MAX_CLK];
> > +};
> > +
> > +struct st_slim_rproc *st_slim_rproc_alloc(struct platform_device *pdev,
> > + char *fw_name);
> > +void st_slim_rproc_put(struct st_slim_rproc *slim_rproc);
> > +
> > +#endif
>
regards,
Peter.
^ permalink raw reply
* Re: [PATCH v8 05/18] dmaengine: st_fdma: Add STMicroelectronics FDMA engine driver support
From: Vinod Koul @ 2016-08-30 16:30 UTC (permalink / raw)
To: Peter Griffin
Cc: devicetree, kernel, airlied, linux-remoteproc, virtualization,
patrice.chotard, dri-devel, linux-kernel, Ludovic Barre,
dmaengine, dan.j.williams, bjorn.andersson, lee.jones,
linux-arm-kernel
In-Reply-To: <1472223413-7254-6-git-send-email-peter.griffin@linaro.org>
On Fri, Aug 26, 2016 at 03:56:40PM +0100, Peter Griffin wrote:
> config STM32_DMA
> bool "STMicroelectronics STM32 DMA support"
> depends on ARCH_STM32
> @@ -567,7 +580,6 @@ config ZX_DMA
> help
> Support the DMA engine for ZTE ZX296702 platform devices.
>
> -
unrelated change?
> + fdev->chans = devm_kzalloc(&pdev->dev,
> + fdev->nr_channels
> + * sizeof(struct st_fdma_chan), GFP_KERNEL);
devm_kcalloc()
> + if (!fdev->chans)
> + return -ENOMEM;
> +
> + fdev->dev = &pdev->dev;
> + fdev->drvdata = drvdata;
> + platform_set_drvdata(pdev, fdev);
> +
> + fdev->irq = platform_get_irq(pdev, 0);
> + if (fdev->irq < 0) {
> + dev_err(&pdev->dev, "Failed to get irq resource\n");
> + return -EINVAL;
> + }
> +
> + ret = devm_request_irq(&pdev->dev, fdev->irq, st_fdma_irq_handler, 0,
> + dev_name(&pdev->dev), fdev);
> + if (ret) {
> + dev_err(&pdev->dev, "Failed to request irq (%d)\n", ret);
> + goto err;
> + }
> +
> + fdev->slim_rproc = st_slim_rproc_alloc(pdev, fdev->fw_name);
> + if (!fdev->slim_rproc) {
> + ret = PTR_ERR(fdev->slim_rproc);
> + dev_err(&pdev->dev, "slim_rproc_alloc failed (%d)\n", ret);
> + goto err;
> + }
> +
> + /* Initialise list of FDMA channels */
> + INIT_LIST_HEAD(&fdev->dma_device.channels);
> + for (i = 0; i < fdev->nr_channels; i++) {
> + struct st_fdma_chan *fchan = &fdev->chans[i];
> +
> + fchan->fdev = fdev;
> + fchan->vchan.desc_free = st_fdma_free_desc;
> + vchan_init(&fchan->vchan, &fdev->dma_device);
this initialized a tasklet
> +static int st_fdma_remove(struct platform_device *pdev)
> +{
> + struct st_fdma_dev *fdev = platform_get_drvdata(pdev);
> +
> + devm_free_irq(&pdev->dev, fdev->irq, fdev);
> + st_slim_rproc_put(fdev->slim_rproc);
> + of_dma_controller_free(pdev->dev.of_node);
> + dma_async_device_unregister(&fdev->dma_device);
and that vchan tasklet is not quisced here :(
> +MODULE_LICENSE("GPL v2");
> +MODULE_DESCRIPTION("STMicroelectronics FDMA engine driver");
> +MODULE_AUTHOR("Ludovic.barre <Ludovic.barre@st.com>");
> +MODULE_AUTHOR("Peter Griffin <peter.griffin@linaro.org>");
No MODULE_ALIAS?
--
~Vinod
^ permalink raw reply
* Re: [PATCH v8 01/18] remoteproc: st_slim_rproc: add a slimcore rproc driver
From: Bjorn Andersson @ 2016-08-30 16:54 UTC (permalink / raw)
To: Lee Jones
Cc: devicetree, kernel, vinod.koul, linux-remoteproc, patrice.chotard,
dri-devel, linux-kernel, Peter Griffin, airlied, dmaengine,
dan.j.williams, virtualization, linux-arm-kernel
In-Reply-To: <20160830123453.GG10121@dell>
On Tue 30 Aug 05:34 PDT 2016, Lee Jones wrote:
Thanks for your review Lee.
> On Fri, 26 Aug 2016, Peter Griffin wrote:
[..]
> > diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
> > index 1a8bf76a..06765e0 100644
> > --- a/drivers/remoteproc/Kconfig
> > +++ b/drivers/remoteproc/Kconfig
> > @@ -100,4 +100,12 @@ config ST_REMOTEPROC
> > processor framework.
> > This can be either built-in or a loadable module.
> >
> > +config ST_SLIM_REMOTEPROC
> > + tristate "ST Slim remoteproc support"
> > + select REMOTEPROC
> > + help
> > + Say y here to support firmware loading on IP based around
> > + the Slim core.
> > + If unsure say N.
Saw one more thing when browsing through...
As this piece of code doesn't do anything on its own and is going to be
selected by the "function driver" I don't think this should be
user-selectable.
Regards,
Bjorn
^ permalink raw reply
* RE: [PATCH v3 kernel 0/7] Extend virtio-balloon for fast (de)inflating & fast live migration
From: Li, Liang Z @ 2016-08-31 6:28 UTC (permalink / raw)
To: 'Michael S. Tsirkin'
Cc: 'virtio-dev@lists.oasis-open.org',
'kvm@vger.kernel.org',
'linux-kernel@vger.kernel.org', Hansen, Dave,
'qemu-devel@nongnu.org',
'virtualization@lists.linux-foundation.org',
'linux-mm@kvack.org', 'dgilbert@redhat.com'
In-Reply-To: <F2CBF3009FA73547804AE4C663CAB28E04220EDA@shsmsx102.ccr.corp.intel.com>
Hi Michael,
I know you are very busy. If you have time, could you help to take a look at this patch set?
Thanks!
Liang
> -----Original Message-----
> From: Li, Liang Z
> Sent: Thursday, August 18, 2016 9:06 AM
> To: Michael S. Tsirkin
> Cc: virtualization@lists.linux-foundation.org; linux-mm@kvack.org; virtio-
> dev@lists.oasis-open.org; kvm@vger.kernel.org; qemu-devel@nongnu.org;
> quintela@redhat.com; dgilbert@redhat.com; Hansen, Dave; linux-
> kernel@vger.kernel.org
> Subject: RE: [PATCH v3 kernel 0/7] Extend virtio-balloon for fast (de)inflating
> & fast live migration
>
> Hi Michael,
>
> Could you help to review this version when you have time?
>
> Thanks!
> Liang
>
> > -----Original Message-----
> > From: Li, Liang Z
> > Sent: Monday, August 08, 2016 2:35 PM
> > To: linux-kernel@vger.kernel.org
> > Cc: virtualization@lists.linux-foundation.org; linux-mm@kvack.org;
> > virtio- dev@lists.oasis-open.org; kvm@vger.kernel.org;
> > qemu-devel@nongnu.org; quintela@redhat.com; dgilbert@redhat.com;
> > Hansen, Dave; Li, Liang Z
> > Subject: [PATCH v3 kernel 0/7] Extend virtio-balloon for fast
> > (de)inflating & fast live migration
> >
> > This patch set contains two parts of changes to the virtio-balloon.
> >
> > One is the change for speeding up the inflating & deflating process,
> > the main idea of this optimization is to use bitmap to send the page
> > information to host instead of the PFNs, to reduce the overhead of
> > virtio data transmission, address translation and madvise(). This can
> > help to improve the performance by about 85%.
> >
> > Another change is for speeding up live migration. By skipping process
> > guest's free pages in the first round of data copy, to reduce needless
> > data processing, this can help to save quite a lot of CPU cycles and
> > network bandwidth. We put guest's free page information in bitmap and
> > send it to host with the virt queue of virtio-balloon. For an idle 8GB
> > guest, this can help to shorten the total live migration time from
> > 2Sec to about 500ms in the 10Gbps network environment.
> >
> > Dave Hansen suggested a new scheme to encode the data structure,
> > because of additional complexity, it's not implemented in v3.
> >
> > Changes from v2 to v3:
> > * Change the name of 'free page' to 'unused page'.
> > * Use the scatter & gather bitmap instead of a 1MB page bitmap.
> > * Fix overwriting the page bitmap after kicking.
> > * Some of MST's comments for v2.
> >
> > Changes from v1 to v2:
> > * Abandon the patch for dropping page cache.
> > * Put some structures to uapi head file.
> > * Use a new way to determine the page bitmap size.
> > * Use a unified way to send the free page information with the bitmap
> > * Address the issues referred in MST's comments
> >
> >
> > Liang Li (7):
> > virtio-balloon: rework deflate to add page to a list
> > virtio-balloon: define new feature bit and page bitmap head
> > mm: add a function to get the max pfn
> > virtio-balloon: speed up inflate/deflate process
> > mm: add the related functions to get unused page
> > virtio-balloon: define feature bit and head for misc virt queue
> > virtio-balloon: tell host vm's unused page info
> >
> > drivers/virtio/virtio_balloon.c | 390
> > ++++++++++++++++++++++++++++++++----
> > include/linux/mm.h | 3 +
> > include/uapi/linux/virtio_balloon.h | 41 ++++
> > mm/page_alloc.c | 94 +++++++++
> > 4 files changed, 485 insertions(+), 43 deletions(-)
> >
> > --
> > 1.8.3.1
^ permalink raw reply
* [RFC/PATCHSET 0/3] virtio: Implement virtio pstore device (v4)
From: Namhyung Kim @ 2016-08-31 8:07 UTC (permalink / raw)
To: virtio-dev, virtualization, kvm, qemu-devel
Cc: Tony Luck, Radim Krčmář, Kees Cook,
Michael S. Tsirkin, Anton Vorontsov, Will Deacon, LKML,
Steven Rostedt, Minchan Kim, Anthony Liguori, Colin Cross,
Paolo Bonzini, Ingo Molnar
Hello,
This is another iteration of the virtio-pstore work. I've addressed
all comments from Daniel Berrange on the qemu side.
* changes in v4)
- use qio_channel_file_new_path() (Daniel)
- rename to delete_old_pstore_file (Daniel)
- convert G_REMOVE_SOURCE to FALSE (Daniel)
* changes in v3)
- use QIOChannel API (Stefan, Daniel)
- add bound check for malcious guests (Daniel)
- drop support PSTORE_TYPE_CONSOLE for now
- update license to allow GPL v2 or later (Michael)
- limit number of pstore files on qemu
* changes in v2)
- update VIRTIO_ID_PSTORE to 22 (Cornelia, Stefan)
- make buffer size configurable (Cornelia)
- support PSTORE_TYPE_CONSOLE (Kees)
- use separate virtqueues for read and write
- support concurrent async write
- manage pstore (file) id in device side
- fix various mistakes in qemu device (Stefan)
It started from the fact that dumping ftrace buffer at kernel
oops/panic takes too much time. Although there's a way to reduce the
size of the original data, sometimes I want to have the information as
many as possible. Maybe kexec/kdump can solve this problem but it
consumes some portion of guest memory so I'd like to avoid it. And I
know the qemu + crashtool can dump and analyze the whole guest memory
including the ftrace buffer without wasting guest memory, but it adds
one more layer and has some limitation as an out-of-tree tool like not
being in sync with the kernel changes.
So I think it'd be great using the pstore interface to dump guest
kernel data on the host. One can read the data on the host directly
or on the guest (at the next boot) using pstore filesystem as usual.
While this patchset only implements dumping kernel log buffer, it can
be extended to have ftrace buffer and probably some more..
The patch 0001 implements virtio pstore driver. It has two virt queue
for (sync) read and (async) write, pstore buffer and io request and
response structure. The virtio_pstore_req struct is to give
information about the current pstore operation. The result will be
written to the virtio_pstore_res struct. For read operation it also
uses virtio_pstore_fileinfo struct.
The patch 0002 and 0003 implement virtio-pstore legacy PCI device on
qemu-kvm and kvmtool respectively. I referenced virtio-baloon and
virtio-rng implementations and I don't know whether kvmtool supports
modern virtio 1.0+ spec. Other transports might be supported later.
For example, using virtio-pstore on qemu looks like below:
$ qemu-system-x86_64 -enable-kvm -device virtio-pstore,directory=xxx
When guest kernel gets panic the log messages will be saved under the
xxx directory.
$ ls xxx
dmesg-1.enc.z dmesg-2.enc.z
As you can see the pstore subsystem compresses the log data using zlib
(now supports lzo and lz4 too). The data can be extracted with the
following command:
$ cat xxx/dmesg-1.enc.z | \
> python -c 'import sys, zlib; print(zlib.decompress(sys.stdin.read()))'
Oops#1 Part1
<5>[ 0.000000] Linux version 4.6.0kvm+ (namhyung@danjae) (gcc version 5.3.0 (GCC) ) #145 SMP Mon Jul 18 10:22:45 KST 2016
<6>[ 0.000000] Command line: root=/dev/vda console=ttyS0
<6>[ 0.000000] x86/fpu: Legacy x87 FPU detected.
<6>[ 0.000000] x86/fpu: Using 'eager' FPU context switches.
<6>[ 0.000000] e820: BIOS-provided physical RAM map:
<6>[ 0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
<6>[ 0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
<6>[ 0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
<6>[ 0.000000] BIOS-e820: [mem 0x0000000000100000-0x0000000007fddfff] usable
<6>[ 0.000000] BIOS-e820: [mem 0x0000000007fde000-0x0000000007ffffff] reserved
<6>[ 0.000000] BIOS-e820: [mem 0x00000000feffc000-0x00000000feffffff] reserved
<6>[ 0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
<6>[ 0.000000] NX (Execute Disable) protection: active
<6>[ 0.000000] SMBIOS 2.8 present.
<7>[ 0.000000] DMI: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.9.3-0-ge2fc41e-prebuilt.qemu-project.org 04/01/2014
...
Namhyung Kim (3):
virtio: Basic implementation of virtio pstore driver
qemu: Implement virtio-pstore device
kvmtool: Implement virtio-pstore device
drivers/virtio/Kconfig | 10 +
drivers/virtio/Makefile | 1 +
drivers/virtio/virtio_pstore.c | 417 +++++++++++++++++++++++++++++++++++++
include/uapi/linux/Kbuild | 1 +
include/uapi/linux/virtio_ids.h | 1 +
include/uapi/linux/virtio_pstore.h | 74 +++++++
6 files changed, 504 insertions(+)
create mode 100644 drivers/virtio/virtio_pstore.c
create mode 100644 include/uapi/linux/virtio_pstore.h
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Anthony Liguori <aliguori@amazon.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: kvm@vger.kernel.org
Cc: qemu-devel@nongnu.org
Cc: virtualization@lists.linux-foundation.org
Cc: virtio-dev@lists.oasis-open.org
Thanks,
Namhyung
--
2.9.3
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* [PATCH 1/3] virtio: Basic implementation of virtio pstore driver
From: Namhyung Kim @ 2016-08-31 8:08 UTC (permalink / raw)
To: virtio-dev, virtualization, kvm, qemu-devel
Cc: Tony Luck, Radim Krčmář, Kees Cook,
Michael S. Tsirkin, Anton Vorontsov, Will Deacon, LKML,
Steven Rostedt, Minchan Kim, Anthony Liguori, Colin Cross,
Paolo Bonzini, Ingo Molnar
In-Reply-To: <20160831080802.13408-1-namhyung@kernel.org>
The virtio pstore driver provides interface to the pstore subsystem so
that the guest kernel's log/dump message can be saved on the host
machine. Users can access the log file directly on the host, or on the
guest at the next boot using pstore filesystem. It currently deals with
kernel log (printk) buffer only, but we can extend it to have other
information (like ftrace dump) later.
It supports legacy PCI device using single order-2 page buffer. It uses
two virtqueues - one for (sync) read and another for (async) write.
Since it cannot wait for write finished, it supports up to 128
concurrent IO. The buffer size is configurable now.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Radim Krčmář <rkrcmar@redhat.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>
Cc: Anthony Liguori <aliguori@amazon.com>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Tony Luck <tony.luck@intel.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Minchan Kim <minchan@kernel.org>
Cc: Will Deacon <will.deacon@arm.com>
Cc: kvm@vger.kernel.org
Cc: qemu-devel@nongnu.org
Cc: virtualization@lists.linux-foundation.org
Cc: virtio-dev@lists.oasis-open.org
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
---
drivers/virtio/Kconfig | 10 +
drivers/virtio/Makefile | 1 +
drivers/virtio/virtio_pstore.c | 417 +++++++++++++++++++++++++++++++++++++
include/uapi/linux/Kbuild | 1 +
include/uapi/linux/virtio_ids.h | 1 +
include/uapi/linux/virtio_pstore.h | 74 +++++++
6 files changed, 504 insertions(+)
create mode 100644 drivers/virtio/virtio_pstore.c
create mode 100644 include/uapi/linux/virtio_pstore.h
diff --git a/drivers/virtio/Kconfig b/drivers/virtio/Kconfig
index 77590320d44c..8f0e6c796c12 100644
--- a/drivers/virtio/Kconfig
+++ b/drivers/virtio/Kconfig
@@ -58,6 +58,16 @@ config VIRTIO_INPUT
If unsure, say M.
+config VIRTIO_PSTORE
+ tristate "Virtio pstore driver"
+ depends on VIRTIO
+ depends on PSTORE
+ ---help---
+ This driver supports virtio pstore devices to save/restore
+ panic and oops messages on the host.
+
+ If unsure, say M.
+
config VIRTIO_MMIO
tristate "Platform bus driver for memory mapped virtio devices"
depends on HAS_IOMEM && HAS_DMA
diff --git a/drivers/virtio/Makefile b/drivers/virtio/Makefile
index 41e30e3dc842..bee68cb26d48 100644
--- a/drivers/virtio/Makefile
+++ b/drivers/virtio/Makefile
@@ -5,3 +5,4 @@ virtio_pci-y := virtio_pci_modern.o virtio_pci_common.o
virtio_pci-$(CONFIG_VIRTIO_PCI_LEGACY) += virtio_pci_legacy.o
obj-$(CONFIG_VIRTIO_BALLOON) += virtio_balloon.o
obj-$(CONFIG_VIRTIO_INPUT) += virtio_input.o
+obj-$(CONFIG_VIRTIO_PSTORE) += virtio_pstore.o
diff --git a/drivers/virtio/virtio_pstore.c b/drivers/virtio/virtio_pstore.c
new file mode 100644
index 000000000000..ec41f0d2f0b7
--- /dev/null
+++ b/drivers/virtio/virtio_pstore.c
@@ -0,0 +1,417 @@
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pstore.h>
+#include <linux/virtio.h>
+#include <linux/virtio_config.h>
+#include <uapi/linux/virtio_ids.h>
+#include <uapi/linux/virtio_pstore.h>
+
+#define VIRT_PSTORE_ORDER 2
+#define VIRT_PSTORE_BUFSIZE (4096 << VIRT_PSTORE_ORDER)
+#define VIRT_PSTORE_NR_REQ 128
+
+struct virtio_pstore {
+ struct virtio_device *vdev;
+ struct virtqueue *vq[2];
+ struct pstore_info pstore;
+ struct virtio_pstore_req req[VIRT_PSTORE_NR_REQ];
+ struct virtio_pstore_res res[VIRT_PSTORE_NR_REQ];
+ unsigned int req_id;
+
+ /* Waiting for host to ack */
+ wait_queue_head_t acked;
+ int failed;
+};
+
+#define TYPE_TABLE_ENTRY(_entry) \
+ { PSTORE_TYPE_##_entry, VIRTIO_PSTORE_TYPE_##_entry }
+
+struct type_table {
+ int pstore;
+ u16 virtio;
+} type_table[] = {
+ TYPE_TABLE_ENTRY(DMESG),
+};
+
+#undef TYPE_TABLE_ENTRY
+
+
+static u16 to_virtio_type(struct virtio_pstore *vps, enum pstore_type_id type)
+{
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(type_table); i++) {
+ if (type == type_table[i].pstore)
+ return cpu_to_virtio16(vps->vdev, type_table[i].virtio);
+ }
+
+ return cpu_to_virtio16(vps->vdev, VIRTIO_PSTORE_TYPE_UNKNOWN);
+}
+
+static enum pstore_type_id from_virtio_type(struct virtio_pstore *vps, u16 type)
+{
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(type_table); i++) {
+ if (virtio16_to_cpu(vps->vdev, type) == type_table[i].virtio)
+ return type_table[i].pstore;
+ }
+
+ return PSTORE_TYPE_UNKNOWN;
+}
+
+static void virtpstore_ack(struct virtqueue *vq)
+{
+ struct virtio_pstore *vps = vq->vdev->priv;
+
+ wake_up(&vps->acked);
+}
+
+static void virtpstore_check(struct virtqueue *vq)
+{
+ struct virtio_pstore *vps = vq->vdev->priv;
+ struct virtio_pstore_res *res;
+ unsigned int len;
+
+ res = virtqueue_get_buf(vq, &len);
+ if (res == NULL)
+ return;
+
+ if (virtio32_to_cpu(vq->vdev, res->ret) < 0)
+ vps->failed = 1;
+}
+
+static void virt_pstore_get_reqs(struct virtio_pstore *vps,
+ struct virtio_pstore_req **preq,
+ struct virtio_pstore_res **pres)
+{
+ unsigned int idx = vps->req_id++ % VIRT_PSTORE_NR_REQ;
+
+ *preq = &vps->req[idx];
+ *pres = &vps->res[idx];
+
+ memset(*preq, 0, sizeof(**preq));
+ memset(*pres, 0, sizeof(**pres));
+}
+
+static int virt_pstore_open(struct pstore_info *psi)
+{
+ struct virtio_pstore *vps = psi->data;
+ struct virtio_pstore_req *req;
+ struct virtio_pstore_res *res;
+ struct scatterlist sgo[1], sgi[1];
+ struct scatterlist *sgs[2] = { sgo, sgi };
+ unsigned int len;
+
+ virt_pstore_get_reqs(vps, &req, &res);
+
+ req->cmd = cpu_to_virtio16(vps->vdev, VIRTIO_PSTORE_CMD_OPEN);
+
+ sg_init_one(sgo, req, sizeof(*req));
+ sg_init_one(sgi, res, sizeof(*res));
+ virtqueue_add_sgs(vps->vq[0], sgs, 1, 1, vps, GFP_KERNEL);
+ virtqueue_kick(vps->vq[0]);
+
+ wait_event(vps->acked, virtqueue_get_buf(vps->vq[0], &len));
+ return virtio32_to_cpu(vps->vdev, res->ret);
+}
+
+static int virt_pstore_close(struct pstore_info *psi)
+{
+ struct virtio_pstore *vps = psi->data;
+ struct virtio_pstore_req *req = &vps->req[vps->req_id];
+ struct virtio_pstore_res *res = &vps->res[vps->req_id];
+ struct scatterlist sgo[1], sgi[1];
+ struct scatterlist *sgs[2] = { sgo, sgi };
+ unsigned int len;
+
+ virt_pstore_get_reqs(vps, &req, &res);
+
+ req->cmd = cpu_to_virtio16(vps->vdev, VIRTIO_PSTORE_CMD_CLOSE);
+
+ sg_init_one(sgo, req, sizeof(*req));
+ sg_init_one(sgi, res, sizeof(*res));
+ virtqueue_add_sgs(vps->vq[0], sgs, 1, 1, vps, GFP_KERNEL);
+ virtqueue_kick(vps->vq[0]);
+
+ wait_event(vps->acked, virtqueue_get_buf(vps->vq[0], &len));
+ return virtio32_to_cpu(vps->vdev, res->ret);
+}
+
+static ssize_t virt_pstore_read(u64 *id, enum pstore_type_id *type,
+ int *count, struct timespec *time,
+ char **buf, bool *compressed,
+ ssize_t *ecc_notice_size,
+ struct pstore_info *psi)
+{
+ struct virtio_pstore *vps = psi->data;
+ struct virtio_pstore_req *req;
+ struct virtio_pstore_res *res;
+ struct virtio_pstore_fileinfo info;
+ struct scatterlist sgo[1], sgi[3];
+ struct scatterlist *sgs[2] = { sgo, sgi };
+ unsigned int len;
+ unsigned int flags;
+ int ret;
+ void *bf;
+
+ virt_pstore_get_reqs(vps, &req, &res);
+
+ req->cmd = cpu_to_virtio16(vps->vdev, VIRTIO_PSTORE_CMD_READ);
+
+ sg_init_one(sgo, req, sizeof(*req));
+ sg_init_table(sgi, 3);
+ sg_set_buf(&sgi[0], res, sizeof(*res));
+ sg_set_buf(&sgi[1], &info, sizeof(info));
+ sg_set_buf(&sgi[2], psi->buf, psi->bufsize);
+ virtqueue_add_sgs(vps->vq[0], sgs, 1, 1, vps, GFP_KERNEL);
+ virtqueue_kick(vps->vq[0]);
+
+ wait_event(vps->acked, virtqueue_get_buf(vps->vq[0], &len));
+ if (len < sizeof(*res) + sizeof(info))
+ return -1;
+
+ ret = virtio32_to_cpu(vps->vdev, res->ret);
+ if (ret < 0)
+ return ret;
+
+ len = virtio32_to_cpu(vps->vdev, info.len);
+
+ bf = kmalloc(len, GFP_KERNEL);
+ if (bf == NULL)
+ return -ENOMEM;
+
+ *id = virtio64_to_cpu(vps->vdev, info.id);
+ *type = from_virtio_type(vps, info.type);
+ *count = virtio32_to_cpu(vps->vdev, info.count);
+
+ flags = virtio32_to_cpu(vps->vdev, info.flags);
+ *compressed = flags & VIRTIO_PSTORE_FL_COMPRESSED;
+
+ time->tv_sec = virtio64_to_cpu(vps->vdev, info.time_sec);
+ time->tv_nsec = virtio32_to_cpu(vps->vdev, info.time_nsec);
+
+ memcpy(bf, psi->buf, len);
+ *buf = bf;
+
+ return len;
+}
+
+static int notrace virt_pstore_write(enum pstore_type_id type,
+ enum kmsg_dump_reason reason,
+ u64 *id, unsigned int part, int count,
+ bool compressed, size_t size,
+ struct pstore_info *psi)
+{
+ struct virtio_pstore *vps = psi->data;
+ struct virtio_pstore_req *req;
+ struct virtio_pstore_res *res;
+ struct scatterlist sgo[2], sgi[1];
+ struct scatterlist *sgs[2] = { sgo, sgi };
+ unsigned int flags = compressed ? VIRTIO_PSTORE_FL_COMPRESSED : 0;
+
+ if (vps->failed)
+ return -1;
+
+ *id = vps->req_id;
+ virt_pstore_get_reqs(vps, &req, &res);
+
+ req->cmd = cpu_to_virtio16(vps->vdev, VIRTIO_PSTORE_CMD_WRITE);
+ req->type = to_virtio_type(vps, type);
+ req->flags = cpu_to_virtio32(vps->vdev, flags);
+
+ sg_init_table(sgo, 2);
+ sg_set_buf(&sgo[0], req, sizeof(*req));
+ sg_set_buf(&sgo[1], psi->buf, size);
+ sg_init_one(sgi, res, sizeof(*res));
+ virtqueue_add_sgs(vps->vq[1], sgs, 1, 1, vps, GFP_ATOMIC);
+ virtqueue_kick(vps->vq[1]);
+
+ return 0;
+}
+
+static int virt_pstore_erase(enum pstore_type_id type, u64 id, int count,
+ struct timespec time, struct pstore_info *psi)
+{
+ struct virtio_pstore *vps = psi->data;
+ struct virtio_pstore_req *req;
+ struct virtio_pstore_res *res;
+ struct scatterlist sgo[1], sgi[1];
+ struct scatterlist *sgs[2] = { sgo, sgi };
+ unsigned int len;
+
+ virt_pstore_get_reqs(vps, &req, &res);
+
+ req->cmd = cpu_to_virtio16(vps->vdev, VIRTIO_PSTORE_CMD_ERASE);
+ req->type = to_virtio_type(vps, type);
+ req->id = cpu_to_virtio64(vps->vdev, id);
+ req->count = cpu_to_virtio32(vps->vdev, count);
+
+ sg_init_one(sgo, req, sizeof(*req));
+ sg_init_one(sgi, res, sizeof(*res));
+ virtqueue_add_sgs(vps->vq[0], sgs, 1, 1, vps, GFP_KERNEL);
+ virtqueue_kick(vps->vq[0]);
+
+ wait_event(vps->acked, virtqueue_get_buf(vps->vq[0], &len));
+ return virtio32_to_cpu(vps->vdev, res->ret);
+}
+
+static int virt_pstore_init(struct virtio_pstore *vps)
+{
+ struct pstore_info *psinfo = &vps->pstore;
+ int err;
+
+ if (!psinfo->bufsize)
+ psinfo->bufsize = VIRT_PSTORE_BUFSIZE;
+
+ psinfo->buf = alloc_pages_exact(psinfo->bufsize, GFP_KERNEL);
+ if (!psinfo->buf) {
+ pr_err("cannot allocate pstore buffer\n");
+ return -ENOMEM;
+ }
+
+ psinfo->owner = THIS_MODULE;
+ psinfo->name = "virtio";
+ psinfo->open = virt_pstore_open;
+ psinfo->close = virt_pstore_close;
+ psinfo->read = virt_pstore_read;
+ psinfo->erase = virt_pstore_erase;
+ psinfo->write = virt_pstore_write;
+ psinfo->flags = PSTORE_FLAGS_FRAGILE;
+
+ psinfo->data = vps;
+ spin_lock_init(&psinfo->buf_lock);
+
+ err = pstore_register(psinfo);
+ if (err)
+ kfree(psinfo->buf);
+
+ return err;
+}
+
+static int virt_pstore_exit(struct virtio_pstore *vps)
+{
+ struct pstore_info *psinfo = &vps->pstore;
+
+ pstore_unregister(psinfo);
+
+ free_pages_exact(psinfo->buf, psinfo->bufsize);
+ psinfo->buf = NULL;
+ psinfo->bufsize = 0;
+
+ return 0;
+}
+
+static int virtpstore_init_vqs(struct virtio_pstore *vps)
+{
+ vq_callback_t *callbacks[] = { virtpstore_ack, virtpstore_check };
+ const char *names[] = { "pstore_read", "pstore_write" };
+
+ return vps->vdev->config->find_vqs(vps->vdev, 2, vps->vq,
+ callbacks, names);
+}
+
+static void virtpstore_init_config(struct virtio_pstore *vps)
+{
+ u32 bufsize;
+
+ virtio_cread(vps->vdev, struct virtio_pstore_config, bufsize, &bufsize);
+
+ vps->pstore.bufsize = PAGE_ALIGN(bufsize);
+}
+
+static void virtpstore_confirm_config(struct virtio_pstore *vps)
+{
+ u32 bufsize = vps->pstore.bufsize;
+
+ virtio_cwrite(vps->vdev, struct virtio_pstore_config, bufsize,
+ &bufsize);
+}
+
+static int virtpstore_probe(struct virtio_device *vdev)
+{
+ struct virtio_pstore *vps;
+ int err;
+
+ if (!vdev->config->get) {
+ dev_err(&vdev->dev, "driver init: config access disabled\n");
+ return -EINVAL;
+ }
+
+ vdev->priv = vps = kzalloc(sizeof(*vps), GFP_KERNEL);
+ if (!vps) {
+ err = -ENOMEM;
+ goto out;
+ }
+ vps->vdev = vdev;
+
+ err = virtpstore_init_vqs(vps);
+ if (err < 0)
+ goto out_free;
+
+ virtpstore_init_config(vps);
+
+ err = virt_pstore_init(vps);
+ if (err)
+ goto out_del_vq;
+
+ virtpstore_confirm_config(vps);
+
+ init_waitqueue_head(&vps->acked);
+
+ virtio_device_ready(vdev);
+
+ dev_info(&vdev->dev, "driver init: ok (bufsize = %luK, flags = %x)\n",
+ vps->pstore.bufsize >> 10, vps->pstore.flags);
+
+ return 0;
+
+out_del_vq:
+ vdev->config->del_vqs(vdev);
+out_free:
+ kfree(vps);
+out:
+ dev_err(&vdev->dev, "driver init: failed with %d\n", err);
+ return err;
+}
+
+static void virtpstore_remove(struct virtio_device *vdev)
+{
+ struct virtio_pstore *vps = vdev->priv;
+
+ virt_pstore_exit(vps);
+
+ /* Now we reset the device so we can clean up the queues. */
+ vdev->config->reset(vdev);
+
+ vdev->config->del_vqs(vdev);
+
+ kfree(vps);
+}
+
+static unsigned int features[] = {
+};
+
+static struct virtio_device_id id_table[] = {
+ { VIRTIO_ID_PSTORE, VIRTIO_DEV_ANY_ID },
+ { 0 },
+};
+
+static struct virtio_driver virtio_pstore_driver = {
+ .driver.name = KBUILD_MODNAME,
+ .driver.owner = THIS_MODULE,
+ .feature_table = features,
+ .feature_table_size = ARRAY_SIZE(features),
+ .id_table = id_table,
+ .probe = virtpstore_probe,
+ .remove = virtpstore_remove,
+};
+
+module_virtio_driver(virtio_pstore_driver);
+MODULE_DEVICE_TABLE(virtio, id_table);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Namhyung Kim <namhyung@kernel.org>");
+MODULE_DESCRIPTION("Virtio pstore driver");
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 6d4e92ccdc91..9bbb1554d8b2 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -449,6 +449,7 @@ header-y += virtio_ids.h
header-y += virtio_input.h
header-y += virtio_net.h
header-y += virtio_pci.h
+header-y += virtio_pstore.h
header-y += virtio_ring.h
header-y += virtio_rng.h
header-y += virtio_scsi.h
diff --git a/include/uapi/linux/virtio_ids.h b/include/uapi/linux/virtio_ids.h
index 77925f587b15..c72a9ab588c0 100644
--- a/include/uapi/linux/virtio_ids.h
+++ b/include/uapi/linux/virtio_ids.h
@@ -41,5 +41,6 @@
#define VIRTIO_ID_CAIF 12 /* Virtio caif */
#define VIRTIO_ID_GPU 16 /* virtio GPU */
#define VIRTIO_ID_INPUT 18 /* virtio input */
+#define VIRTIO_ID_PSTORE 22 /* virtio pstore */
#endif /* _LINUX_VIRTIO_IDS_H */
diff --git a/include/uapi/linux/virtio_pstore.h b/include/uapi/linux/virtio_pstore.h
new file mode 100644
index 000000000000..f4b0d204d8ae
--- /dev/null
+++ b/include/uapi/linux/virtio_pstore.h
@@ -0,0 +1,74 @@
+#ifndef _LINUX_VIRTIO_PSTORE_H
+#define _LINUX_VIRTIO_PSTORE_H
+/* This header is BSD licensed so anyone can use the definitions to implement
+ * compatible drivers/servers.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of IBM nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL IBM OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE. */
+#include <linux/types.h>
+#include <linux/virtio_types.h>
+
+#define VIRTIO_PSTORE_CMD_NULL 0
+#define VIRTIO_PSTORE_CMD_OPEN 1
+#define VIRTIO_PSTORE_CMD_READ 2
+#define VIRTIO_PSTORE_CMD_WRITE 3
+#define VIRTIO_PSTORE_CMD_ERASE 4
+#define VIRTIO_PSTORE_CMD_CLOSE 5
+
+#define VIRTIO_PSTORE_TYPE_UNKNOWN 0
+#define VIRTIO_PSTORE_TYPE_DMESG 1
+
+#define VIRTIO_PSTORE_FL_COMPRESSED 1
+
+struct virtio_pstore_req {
+ __virtio16 cmd;
+ __virtio16 type;
+ __virtio32 flags;
+ __virtio64 id;
+ __virtio32 count;
+ __virtio32 reserved;
+};
+
+struct virtio_pstore_res {
+ __virtio16 cmd;
+ __virtio16 type;
+ __virtio32 ret;
+};
+
+struct virtio_pstore_fileinfo {
+ __virtio64 id;
+ __virtio32 count;
+ __virtio16 type;
+ __virtio16 unused;
+ __virtio32 flags;
+ __virtio32 len;
+ __virtio64 time_sec;
+ __virtio32 time_nsec;
+ __virtio32 reserved;
+};
+
+struct virtio_pstore_config {
+ __virtio32 bufsize;
+};
+
+#endif /* _LINUX_VIRTIO_PSTORE_H */
--
2.9.3
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox