This series gets raspi4b's PCIe root complex and GENET Ethernet
controller working end to end: the PCIe link comes up and devices on
it enumerate, and GENET passes real network traffic (DHCP, SSH, bulk
downloads) under both older (Debian 11, 5.15) and newer (Debian 13,
6.18) guest kernels. Most of the GENET code is Sergey Kambalin's
2024 series (patchwork series 829638), carried forward with his
authorship and Signed-off-by kept.
v3: thanks to Peter for the review (and for running it under UBSan),
and to Philippe.
- Fix the UB Peter found by running "make check-functional" under
clang's UBSan: bcm2838_genet_rdma() built the per-packet status
block by casting the (misaligned) RX buffer to a C struct. It now
fills the status block in with stl_le_p(), which is also correct
on big-endian hosts. The functional tests now run clean under
--enable-ubsan.
- Fold the three bugfix patches that were in v2 (PHY autonegotiation
restart, RX checksum reporting, TX ring activation check) into the
patches that introduce the code they fix: the MDIO patch, the TX
path patch and the RX path patch respectively. The series goes
from 19 patches to 16. Philippe's Reviewed-by on the old "fix TX
ring activation check" patch is not carried over, since that
change now lives inside the TX path patch.
- While in bcm2838_genet_rdma() I also found that the RX descriptor
index and the DMA write length come from guest-programmed
registers and were not checked against the size of the descriptor
array / our packet buffer. Add those checks (in the RX path
patch).
- Rebased on current master (7e8d3c7fc4).
This conflicts trivially (three files: raspi4b.c and
bcm2838_peripherals.[ch]) with the RNG200/thermal sensor series
("[PATCH v2 0/5] hw/arm/raspi4b: RNG200 and thermal sensor"), which is
posted separately. Whichever lands second, I will rebase.
Tested: checkpatch.pl reports no errors; the series builds on current
master and tests/functional/aarch64/test_raspi4.py passes, including
under clang --enable-ubsan; and unmodified Raspberry Pi OS Bullseye
and Trixie based images boot under raspi4b with a working network
(DHCP, ping, 2MB downloads) and SSH.
Marcelo Manzo (7):
hw/arm/bcm2838_pcie: add BCM2838 PCIe Root Complex
hw/arm/bcm2838_pcie: add BCM2838 PCIe host
hw/arm/bcm2838: enable BCM2838 PCIe host bridge
hw/net/bcm2838_genet: add GENET stub device
hw/arm/bcm2838: enable BCM2838 GENET controller
docs/system/arm/raspi: move PCIe/GENET from missing to implemented
tests/functional/aarch64: add raspi4b GENET networking test
Sergey Kambalin (9):
hw/net/bcm2838_genet: add GENET register structs, part 1/4
hw/net/bcm2838_genet: add GENET register structs, part 2/4
hw/net/bcm2838_genet: add GENET register structs, part 3/4
hw/net/bcm2838_genet: add GENET register structs, part 4/4
hw/net/bcm2838_genet: add GENET register access macros
hw/net/bcm2838_genet: implement GENET register ops
hw/net/bcm2838_genet: implement GENET MDIO
hw/net/bcm2838_genet: implement GENET TX path
hw/net/bcm2838_genet: implement GENET RX path
docs/system/arm/raspi.rst | 6 +-
hw/arm/bcm2838.c | 15 +
hw/arm/bcm2838_pcie.c | 308 ++++++
hw/arm/bcm2838_peripherals.c | 46 +
hw/arm/meson.build | 4 +-
hw/arm/raspi4b.c | 2 -
hw/arm/trace-events | 4 +
hw/net/bcm2838_genet.c | 1136 +++++++++++++++++++++++
hw/net/meson.build | 2 +
hw/net/trace-events | 16 +
include/hw/arm/bcm2838_pcie.h | 75 ++
include/hw/arm/bcm2838_peripherals.h | 7 +
include/hw/net/bcm2838_genet.h | 428 +++++++++
tests/functional/aarch64/test_raspi4.py | 30 +
14 files changed, 2074 insertions(+), 5 deletions(-)
create mode 100644 hw/arm/bcm2838_pcie.c
create mode 100644 hw/net/bcm2838_genet.c
create mode 100644 include/hw/arm/bcm2838_pcie.h
create mode 100644 include/hw/net/bcm2838_genet.h
--
2.55.0