linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: fvp: Add virtio-rng support
@ 2022-04-21 14:35 Diego Sueiro
  2022-04-25 13:28 ` Sudeep Holla
  2022-04-26 13:24 ` Andre Przywara
  0 siblings, 2 replies; 3+ messages in thread
From: Diego Sueiro @ 2022-04-21 14:35 UTC (permalink / raw)
  To: devicetree, linux-arm-kernel, linux-kernel
  Cc: liviu.dudau, sudeep.holla, lorenzo.pieralisi, robh+dt,
	krzysztof.kozlowski+dt, nd, diego.sueiro

The virtio-rng is available from FVP_Base_RevC-2xAEMvA version 11.17, so add
the devicetree node to support it.

Signed-off-by: Diego Sueiro <diego.sueiro@arm.com>
---
 arch/arm64/boot/dts/arm/fvp-base-revc.dts            | 3 ++-
 arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi | 7 +++++++
 arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi     | 2 +-
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/arm/fvp-base-revc.dts b/arch/arm64/boot/dts/arm/fvp-base-revc.dts
index 269b649934b5..a496e39e6204 100644
--- a/arch/arm64/boot/dts/arm/fvp-base-revc.dts
+++ b/arch/arm64/boot/dts/arm/fvp-base-revc.dts
@@ -241,6 +241,7 @@ bus@8000000 {
 				<0 0 41 &gic 0 0 GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>,
 				<0 0 42 &gic 0 0 GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>,
 				<0 0 43 &gic 0 0 GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>,
-				<0 0 44 &gic 0 0 GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
+				<0 0 44 &gic 0 0 GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>,
+				<0 0 46 &gic 0 0 GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
 	};
 };
diff --git a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi
index 33182d9e5826..1b6326514c97 100644
--- a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi
+++ b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi
@@ -21,6 +21,13 @@ virtio-net@150000 {
 					reg = <0x150000 0x200>;
 					interrupts = <44>;
 				};
+
+				virtio-rng@200000 {
+					compatible = "virtio,mmio";
+					reg = <0x200000 0x200>;
+					interrupts = <46>;
+					status = "disabled";
+				};
 			};
 		};
 	};
diff --git a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi
index 5f6cab668aa0..a999e7f52d8b 100644
--- a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi
+++ b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi
@@ -110,7 +110,7 @@ iofpga-bus@300000000 {
 				compatible = "simple-bus";
 				#address-cells = <1>;
 				#size-cells = <1>;
-				ranges = <0 3 0 0x200000>;
+				ranges = <0 3 0 0x210000>;
 
 				v2m_sysreg: sysreg@10000 {
 					compatible = "arm,vexpress-sysreg";
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64: dts: fvp: Add virtio-rng support
  2022-04-21 14:35 [PATCH] arm64: dts: fvp: Add virtio-rng support Diego Sueiro
@ 2022-04-25 13:28 ` Sudeep Holla
  2022-04-26 13:24 ` Andre Przywara
  1 sibling, 0 replies; 3+ messages in thread
From: Sudeep Holla @ 2022-04-25 13:28 UTC (permalink / raw)
  To: linux-kernel, Diego Sueiro, devicetree, linux-arm-kernel
  Cc: Sudeep Holla, krzysztof.kozlowski+dt, lorenzo.pieralisi, robh+dt,
	nd, liviu.dudau

On Thu, 21 Apr 2022 15:35:21 +0100, Diego Sueiro wrote:
> The virtio-rng is available from FVP_Base_RevC-2xAEMvA version 11.17, so add
> the devicetree node to support it.
> 
> 

Applied to sudeep.holla/linux (for-next/juno), thanks!

[1/1] arm64: dts: fvp: Add virtio-rng support
      https://git.kernel.org/sudeep.holla/c/5393158f00

--
Regards,
Sudeep


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64: dts: fvp: Add virtio-rng support
  2022-04-21 14:35 [PATCH] arm64: dts: fvp: Add virtio-rng support Diego Sueiro
  2022-04-25 13:28 ` Sudeep Holla
@ 2022-04-26 13:24 ` Andre Przywara
  1 sibling, 0 replies; 3+ messages in thread
From: Andre Przywara @ 2022-04-26 13:24 UTC (permalink / raw)
  To: Diego Sueiro, Laurent Vivier
  Cc: linux-arm-kernel, linux-kernel, liviu.dudau, sudeep.holla,
	lorenzo.pieralisi, robh+dt, krzysztof.kozlowski+dt, Matt Mackall,
	Herbert Xu, linux-crypto, Michael S. Tsirkin

On Thu, 21 Apr 2022 15:35:21 +0100
Diego Sueiro <diego.sueiro@arm.com> wrote:

Hi,

> The virtio-rng is available from FVP_Base_RevC-2xAEMvA version 11.17, so add
> the devicetree node to support it.

The change looks good, although it probably deserves to mention the reason
for keeping it "disabled" by default (older FVP versions not having the
device, so they throw an SError on probe).

But when testing it, I discovered that there is some problem with later
kernels. It works fine up to v5.15, but breaks later on. I bisected it
down to:

=============
commit 9a4b612d675b03f7fc9fa1957ca399c8223f3954
Author: Laurent Vivier <lvivier@redhat.com>
Date:   Thu Oct 28 12:11:11 2021 +0200
    
    hwrng: virtio - always add a pending request

    If we ensure we have already some data available by enqueuing
    again the buffer once data are exhausted, we can return what we
    have without waiting for the device answer.
=============

The effect is that any access to /dev/hwrng hangs, it looks like it's
waiting for an interrupt to fire (core goes to WFI). The process reading
the char dev can be Ctrl-C'ed, but there will be no output, and the
interrupt counter in /proc/interrupts does not increase.
It works fine with any kernel under QEMU, but definitely breaks the FVP
usage (reverting that patch makes it work again on mainline).

I didn't have a closer look yet (and have limited knowledge about the
internals of virtio and virtio-rng in particular), but was wondering if
someone could give a hint at what could be the issue or the direction to
debug that?

Cheers,
Andre

> Signed-off-by: Diego Sueiro <diego.sueiro@arm.com>
> ---
>  arch/arm64/boot/dts/arm/fvp-base-revc.dts            | 3 ++-
>  arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi | 7 +++++++
>  arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi     | 2 +-
>  3 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/boot/dts/arm/fvp-base-revc.dts b/arch/arm64/boot/dts/arm/fvp-base-revc.dts
> index 269b649934b5..a496e39e6204 100644
> --- a/arch/arm64/boot/dts/arm/fvp-base-revc.dts
> +++ b/arch/arm64/boot/dts/arm/fvp-base-revc.dts
> @@ -241,6 +241,7 @@ bus@8000000 {
>  				<0 0 41 &gic 0 0 GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>,
>  				<0 0 42 &gic 0 0 GIC_SPI 42 IRQ_TYPE_LEVEL_HIGH>,
>  				<0 0 43 &gic 0 0 GIC_SPI 43 IRQ_TYPE_LEVEL_HIGH>,
> -				<0 0 44 &gic 0 0 GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>;
> +				<0 0 44 &gic 0 0 GIC_SPI 44 IRQ_TYPE_LEVEL_HIGH>,
> +				<0 0 46 &gic 0 0 GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
>  	};
>  };
> diff --git a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi
> index 33182d9e5826..1b6326514c97 100644
> --- a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi
> +++ b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard-rs2.dtsi
> @@ -21,6 +21,13 @@ virtio-net@150000 {
>  					reg = <0x150000 0x200>;
>  					interrupts = <44>;
>  				};
> +
> +				virtio-rng@200000 {
> +					compatible = "virtio,mmio";
> +					reg = <0x200000 0x200>;
> +					interrupts = <46>;
> +					status = "disabled";
> +				};
>  			};
>  		};
>  	};
> diff --git a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi
> index 5f6cab668aa0..a999e7f52d8b 100644
> --- a/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi
> +++ b/arch/arm64/boot/dts/arm/rtsm_ve-motherboard.dtsi
> @@ -110,7 +110,7 @@ iofpga-bus@300000000 {
>  				compatible = "simple-bus";
>  				#address-cells = <1>;
>  				#size-cells = <1>;
> -				ranges = <0 3 0 0x200000>;
> +				ranges = <0 3 0 0x210000>;
>  
>  				v2m_sysreg: sysreg@10000 {
>  					compatible = "arm,vexpress-sysreg";


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-26 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 14:35 [PATCH] arm64: dts: fvp: Add virtio-rng support Diego Sueiro
2022-04-25 13:28 ` Sudeep Holla
2022-04-26 13:24 ` Andre Przywara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).