On 9/22/26 11:35 AM, Joshua Daley wrote: > FYI, now that Jared's virtio-scsi-pci boot series is merged, this patch does > not apply. >
Thanks for the heads-up! I’ll update the patch accordingly in the next version. > On 9/14/2026 3:34 PM, Zhuoying Cai wrote: >> Enable network booting via virtio-net-pci by implementing PCI transport >> support for virtio-net. >> >> This patch also extends endianness handling for virtio PCI ring operations in >> little-endian to ensure correct behavior on s390x. >> >> Signed-off-by: Zhuoying Cai <[email protected]> >> Reviewed-by: Jared Rossi <[email protected]> >> --- >> pc-bios/s390-ccw/main.c | 1 + >> pc-bios/s390-ccw/netmain.c | 9 +++++++- >> pc-bios/s390-ccw/virtio-net.c | 41 ++++++++++++++++++++++++++++------- >> pc-bios/s390-ccw/virtio-pci.c | 20 +++++++++++++++++ >> 4 files changed, 62 insertions(+), 9 deletions(-) >> >> diff --git a/pc-bios/s390-ccw/main.c b/pc-bios/s390-ccw/main.c >> index 8fc1cbf653..28cab3b411 100644 >> --- a/pc-bios/s390-ccw/main.c >> +++ b/pc-bios/s390-ccw/main.c >> @@ -332,6 +332,7 @@ static void ipl_pci_device(void) >> } >> >> switch (vdev->dev_type) { >> + case VIRTIO_ID_NET: >> case VIRTIO_ID_BLOCK: >> if (virtio_setup() == 0) { >> zipl_load(); /* only return on error */ > case VIRTIO_ID_SCSI has been added here > > ..snip... > >> diff --git a/pc-bios/s390-ccw/virtio-pci.c b/pc-bios/s390-ccw/virtio-pci.c >> index f501252c81..fd794bad8f 100644 >> --- a/pc-bios/s390-ccw/virtio-pci.c >> +++ b/pc-bios/s390-ccw/virtio-pci.c >> @@ -52,6 +52,10 @@ void virtio_pci_id2type(VDev *vdev, uint16_t device_id) >> case 0x1001: >> vdev->dev_type = VIRTIO_ID_BLOCK; >> break; >> + case 0x1041: >> + case 0x1000: >> + vdev->dev_type = VIRTIO_ID_NET; >> + break; >> default: >> vdev->dev_type = 0; >> } > some new cases were added here also > >> @@ -199,6 +203,17 @@ static int virtio_pci_get_blk_config(void) >> return rc; >> } >> >> +static int virtio_pci_get_net_config(void) >> +{ >> + VirtioNetConfig *cfg = &virtio_get_device()->config.net; >> + >> + /* >> + * Byte-swapping is not needed as only the MAC address (byte array) >> + * is used here. Byte-swap if other fields are added. >> + */ >> + return vpci_read_flex(d_cap.off, d_cap.bar, cfg, >> sizeof(VirtioNetConfig)); >> +} >> + >> static int virtio_pci_negotiate(void) >> { >> int i, rc; >> @@ -330,6 +345,7 @@ bool virtio_pci_is_supported(VDev *vdev) >> if (vdev->vendor_id == PCI_VENDOR_VIRTIO) { >> switch (vdev->dev_type) { >> case VIRTIO_ID_BLOCK: >> + case VIRTIO_ID_NET: >> return true; >> default: >> return false; > here also > >> @@ -384,6 +400,10 @@ int virtio_pci_setup(VDev *vdev) >> vdev->cmd_vr_idx = 0; >> virtio_pci_get_blk_config(); >> break; >> + case VIRTIO_ID_NET: >> + vdev->nr_vqs = 2; >> + virtio_pci_get_net_config(); >> + break; >> default: >> puts("Unsupported virtio device"); >> return -ENODEV; > here also
