On 8/18/26 4:53 PM, Zhuoying Cai wrote:
Enable network booting via virtio-net-pci by implementing PCI transport
support for virtio-net.
This patch also adds endianness handling for virtio PCI ring operations in
little-endian to ensure correct behavior on s390x.
Signed-off-by: Zhuoying Cai <[email protected]>
---
pc-bios/s390-ccw/main.c | 1 +
pc-bios/s390-ccw/virtio-net.c | 37 +++++++++++++++++++++++-------
pc-bios/s390-ccw/virtio-pci.c | 43 +++++++++++++++++++++++++++++++++++
pc-bios/s390-ccw/virtio-pci.h | 2 ++
4 files changed, 75 insertions(+), 8 deletions(-)
...
+static bool find_pci_net_dev(void)
+{
+ if (!virtio_is_supported(virtio_get_device())) {
+ return false;
+ }
+
+ if (virtio_get_device_type() != VIRTIO_ID_NET) {
+ return false;
+ }
+
+ return true;
+}
+
+bool virtio_pci_net_setup(void)
+{
+ bool found = false;
+
+ if (have_iplb || store_iplb(&iplb)) {
+ IPL_assert(iplb.pbt == S390_IPL_TYPE_PCI, "IPL_TYPE_PCI expected");
+ found = find_pci_net_dev();
Just return find_pci_net_dev() here, and false below.
That eliminates the found variable entirely.
+ }
+
+ return found;
+}
diff --git a/pc-bios/s390-ccw/virtio-pci.h b/pc-bios/s390-ccw/virtio-pci.h
index 33b683bd92..2c3136fd05 100644
--- a/pc-bios/s390-ccw/virtio-pci.h
+++ b/pc-bios/s390-ccw/virtio-pci.h
@@ -70,6 +70,8 @@ long virtio_pci_notify(VRing *vr);
bool virtio_pci_is_supported(VDev *vdev);
int virtio_pci_setup(VDev *vdev);
int virtio_pci_setup_device(void);
+bool virtio_pci_is_supported(VDev *vdev);
Accidental copy and paste here? You added
virtio_pci_is_supported() but it exists above :)
+bool virtio_pci_net_setup(void);
int vpci_read_flex(uint64_t offset, uint8_t pcias, void *buf, int len);
int vpci_read_bswap64(uint64_t offset, uint8_t pcias, uint64_t *buf);
With both of those fixed:
Reviewed-by: Jason J. Herne <[email protected]>