[PATCH 0/5] hw/arm/raspi4b: RNG200 and thermal sensor

Marcelo Manzo posted 5 patches 1 day, 8 hours ago
Failed in applying to current master (apply log)
hw/arm/bcm2838.c                        |   4 +
hw/arm/bcm2838_peripherals.c            |  28 ++
hw/arm/raspi4b.c                        |  19 --
hw/misc/bcm2838_rng200.c                | 406 ++++++++++++++++++++++++
hw/misc/bcm2838_thermal.c               |  98 ++++++
hw/misc/meson.build                     |   2 +
hw/misc/trace-events                    |  10 +
include/hw/arm/bcm2838_peripherals.h    |   4 +
include/hw/misc/bcm2838_rng200.h        |  42 +++
include/hw/misc/bcm2838_thermal.h       |  23 ++
tests/functional/aarch64/test_raspi4.py |  32 ++
11 files changed, 649 insertions(+), 19 deletions(-)
create mode 100644 hw/misc/bcm2838_rng200.c
create mode 100644 hw/misc/bcm2838_thermal.c
create mode 100644 include/hw/misc/bcm2838_rng200.h
create mode 100644 include/hw/misc/bcm2838_thermal.h
[PATCH 0/5] hw/arm/raspi4b: RNG200 and thermal sensor
Posted by Marcelo Manzo 1 day, 8 hours ago
This is a follow-up to the "hw/arm/raspi4b: working PCIe and GENET
(real networking)" series I sent earlier [1], carrying forward two
more patches from the same stalled Sergey Kambalin series (patchwork
series 829638, [2]): the RNG200 hardware random number generator and
the dummy thermal sensor for BCM2711/raspi4b. These are the last two
devices raspi4b's DTB was masking out (the mask array,
nodes_to_remove[] in raspi4_modify_dtb(), is fully empty after this
series and goes away with it -- GENET, PCIe, RNG200, and the thermal
sensor were the only four entries it ever had).

Same porting approach as the previous series: patches 1 and 3 are
Kambalin's original code carried forward with his authorship and
Signed-off-by kept, adapted only for API drift since 2024 (headers
moved under hw/core/, class_init()'s const void *data, the
Resettable phases API, Property[] losing its
DEFINE_PROP_END_OF_LIST() sentinel, and fifo8_pop_buf() gaining a
caller-supplied destination buffer -- adapted
bcm2838_rng200_read_fifo_data() to the new copying API this code
originally used the now-legacy fifo8_pop_bufptr() form of). No
functional changes. Patches 2 and 4 wire the devices into the SoC.
Patch 5 adds a functional test.

Unlike the GENET/PCIe series, there were no real bugs to find here --
these are much smaller, mostly self-contained register models (the
RNG has a FIFO and a ptimer for periodic entropy generation, but no
DMA/checksum/link-state machinery to get subtly wrong), and testing
confirmed them working on the first pass: the guest probes both
("iproc-rng200 fe104000.rng: hwrng registered" and a working
thermal_zone reporting the expected fixed 25C), /dev/hwrng yields
real random bytes, and the new functional test
(test_arm_raspi4_rng_thermal) checks exactly that.

checkpatch.pl is clean (0 errors) across the series; note it also
caught two real issues in Kambalin's original code while I had it
open for the API-drift adaptation -- an old-style license-boilerplate
header instead of SPDX-License-Identifier in bcm2838_rng200.{c,h}
and bcm2838_thermal.h, and one brace-placement/whitespace nit -- both
fixed in the same patches.
tests/functional/aarch64/test_raspi4.py's other three tests
(including the GENET one from the previous series) still pass.

[1] https://patchwork.kernel.org/project/qemu-devel/cover/20260725004219.66222-1-marcelomanzo@gmail.com/
[2] https://patchwork.kernel.org/project/qemu-devel/cover/20240226000259.2752893-1-sergey.kambalin@auriga.com/

Marcelo Manzo (3):
  hw/arm/bcm2838: enable BCM2838 RNG200
  hw/arm/bcm2838: enable BCM2838 thermal sensor
  tests/functional/aarch64: add raspi4b RNG200/thermal test

Sergey Kambalin (2):
  hw/misc/bcm2838_rng200: add BCM2838 RNG200
  hw/misc/bcm2838_thermal: add BCM2838 thermal sensor

 hw/arm/bcm2838.c                        |   4 +
 hw/arm/bcm2838_peripherals.c            |  28 ++
 hw/arm/raspi4b.c                        |  19 --
 hw/misc/bcm2838_rng200.c                | 406 ++++++++++++++++++++++++
 hw/misc/bcm2838_thermal.c               |  98 ++++++
 hw/misc/meson.build                     |   2 +
 hw/misc/trace-events                    |  10 +
 include/hw/arm/bcm2838_peripherals.h    |   4 +
 include/hw/misc/bcm2838_rng200.h        |  42 +++
 include/hw/misc/bcm2838_thermal.h       |  23 ++
 tests/functional/aarch64/test_raspi4.py |  32 ++
 11 files changed, 649 insertions(+), 19 deletions(-)
 create mode 100644 hw/misc/bcm2838_rng200.c
 create mode 100644 hw/misc/bcm2838_thermal.c
 create mode 100644 include/hw/misc/bcm2838_rng200.h
 create mode 100644 include/hw/misc/bcm2838_thermal.h

-- 
2.47.1