Skip to contentSkip to conversation

kconfig: Add PCIe devices to s390x machines

PATCH Superseded Cédric Le Goater 3 participants 6 messages Jul 4, 2023 – Jul 5, 2023

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 kconfig: Add PCIe devices to s390x machines

It is useful to extend the number of available PCI devices to KVM guests for passthrough scenarios and also to expose these models to a different (big endian) architecture. Include models for Intel Ethernet adapters and one USB controller, which all support MSI-X. Devices only supporting INTx won't work on s390x.

---

Tested under KVM as a machine device, under KVM nested as a passthrough device

 hw/s390x/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)
hw/s390x/Kconfig +4 -0
index 5e7d8a2bae8b..7a82c58cdf6e 100644
@@ -10,3 +10,7 @@ config S390_CCW_VIRTIO
     select SCLPCONSOLE
     select VIRTIO_CCW
     select MSI_NONBROKEN
+    imply PCI_EXPRESS
+    imply E1000E_PCI_EXPRESS
+    imply IGB_PCI_EXPRESS
+    imply USB_XHCI_PCI
Signature · 1 line
2.41.0
#1 lore raw
Quoted 20 lines · Cédric Le Goater

It is useful to extend the number of available PCI devices to KVM guests for passthrough scenarios and also to expose these models to a different (big endian) architecture. Include models for Intel Ethernet adapters and one USB controller, which all support MSI-X. Devices only supporting INTx won't work on s390x.

---

Tested under KVM as a machine device, under KVM nested as a passthrough device

  hw/s390x/Kconfig | 4 ++++
  1 file changed, 4 insertions(+)
hw/s390x/Kconfig +0 -0
index 5e7d8a2bae8b..7a82c58cdf6e 100644

hw/s390x/Kconfig config S390_CCW_VIRTIO · line 13

Quoted 4 lines
hw/s390x/Kconfig +1 -0
@@ -10,3 +10,7 @@ config S390_CCW_VIRTIO
      select SCLPCONSOLE
      select VIRTIO_CCW
      select MSI_NONBROKEN
+    imply PCI_EXPRESS

No, PCIe is a bus, which is implemented in s390-pci-bus.c; S390_CCW_VIRTIO exposes this bus, so we Kconfig SELECT it.

hw/s390x/Kconfig config S390_CCW_VIRTIO · line 16

Quoted 3 lines
hw/s390x/Kconfig +3 -0
+    imply E1000E_PCI_EXPRESS
+    imply IGB_PCI_EXPRESS
+    imply USB_XHCI_PCI

These are devices you can plug on a PCIe bus, so Kconfig IMPLY is correct.

#2 lore raw
Quoted 29 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Cédric Le Goater

It is useful to extend the number of available PCI devices to KVM guests for passthrough scenarios and also to expose these models to a different (big endian) architecture. Include models for Intel Ethernet adapters and one USB controller, which all support MSI-X. Devices only supporting INTx won't work on s390x.

---

  Tested under KVM as a machine device, under KVM nested as a passthrough device

  hw/s390x/Kconfig | 4 ++++

  1 file changed, 4 insertions(+)
hw/s390x/Kconfig +0 -0
index 5e7d8a2bae8b..7a82c58cdf6e 100644
@@ -10,3 +10,7 @@ config S390_CCW_VIRTIO
Quoted 4 lines

      select SCLPCONSOLE
      select VIRTIO_CCW
      select MSI_NONBROKEN
+    imply PCI_EXPRESS

No, PCIe is a bus, which is implemented in s390-pci-bus.c; S390_CCW_VIRTIO exposes this bus, so we Kconfig SELECT it.

Quoted 6 lines
Quoted 3 lines

+    imply E1000E_PCI_EXPRESS
+    imply IGB_PCI_EXPRESS
+    imply USB_XHCI_PCI

These are devices you can plug on a PCIe bus, so Kconfig IMPLY is correct.

If I understand correctly, this should be ?

@@ -5,8 +5,11 @@ config S390_CCW_VIRTIO
imply VFIO_AP
imply VFIO_CCW
imply WDT_DIAG288
- select PCI
+ select PCI_EXPRESS
select S390_FLIC
select SCLPCONSOLE
select VIRTIO_CCW
select MSI_NONBROKEN

+    imply E1000E_PCI_EXPRESS
+    imply IGB_PCI_EXPRESS
+    imply USB_XHCI_PCI
#3 lore raw
Quoted 42 lines · Cédric Le Goater
Quoted 29 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Cédric Le Goater

It is useful to extend the number of available PCI devices to KVM guests for passthrough scenarios and also to expose these models to a different (big endian) architecture. Include models for Intel Ethernet adapters and one USB controller, which all support MSI-X. Devices only supporting INTx won't work on s390x.

---

  Tested under KVM as a machine device, under KVM nested as a passthrough device

  hw/s390x/Kconfig | 4 ++++

  1 file changed, 4 insertions(+)
hw/s390x/Kconfig +0 -0
index 5e7d8a2bae8b..7a82c58cdf6e 100644
@@ -10,3 +10,7 @@ config S390_CCW_VIRTIO
Quoted 4 lines

      select SCLPCONSOLE
      select VIRTIO_CCW
      select MSI_NONBROKEN
+    imply PCI_EXPRESS

No, PCIe is a bus, which is implemented in s390-pci-bus.c; S390_CCW_VIRTIO exposes this bus, so we Kconfig SELECT it.

Quoted 6 lines
Quoted 3 lines

+    imply E1000E_PCI_EXPRESS
+    imply IGB_PCI_EXPRESS
+    imply USB_XHCI_PCI

These are devices you can plug on a PCIe bus, so Kconfig IMPLY is correct.

If I understand correctly, this should be ?

hw/s390x/Kconfig +0 -0
@@ -5,8 +5,11 @@ config S390_CCW_VIRTIO
      imply VFIO_AP
      imply VFIO_CCW

hw/s390x/Kconfig config S390_CCW_VIRTIO · line 15

Quoted 10 lines
hw/s390x/Kconfig +4 -1
      imply WDT_DIAG288
-    select PCI
+    select PCI_EXPRESS
      select S390_FLIC
      select SCLPCONSOLE
      select VIRTIO_CCW
      select MSI_NONBROKEN
+    imply E1000E_PCI_EXPRESS
+    imply IGB_PCI_EXPRESS
+    imply USB_XHCI_PCI

This is how I'd write this patch. Note I have zero knowledge of zPCI.

#4 lore raw
Quoted 40 lines · Philippe Mathieu-Daudé
Quoted 39 lines · Cédric Le Goater
Quoted 29 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Cédric Le Goater

It is useful to extend the number of available PCI devices to KVM guests for passthrough scenarios and also to expose these models to a different (big endian) architecture. Include models for Intel Ethernet adapters and one USB controller, which all support MSI-X. Devices only supporting INTx won't work on s390x.

---

  Tested under KVM as a machine device, under KVM nested as a passthrough device

  hw/s390x/Kconfig | 4 ++++

  1 file changed, 4 insertions(+)
hw/s390x/Kconfig +0 -0
index 5e7d8a2bae8b..7a82c58cdf6e 100644
@@ -10,3 +10,7 @@ config S390_CCW_VIRTIO
Quoted 4 lines

      select SCLPCONSOLE
      select VIRTIO_CCW
      select MSI_NONBROKEN
+    imply PCI_EXPRESS

No, PCIe is a bus, which is implemented in s390-pci-bus.c; S390_CCW_VIRTIO exposes this bus, so we Kconfig SELECT it.

Quoted 6 lines
Quoted 3 lines

+    imply E1000E_PCI_EXPRESS
+    imply IGB_PCI_EXPRESS
+    imply USB_XHCI_PCI

These are devices you can plug on a PCIe bus, so Kconfig IMPLY is correct.

If I understand correctly, this should be ?

Quoted 16 lines
Quoted 5 lines
(quoted diff) +0 -0
@@ -5,8 +5,11 @@ config S390_CCW_VIRTIO

      imply VFIO_AP
      imply VFIO_CCW
      imply WDT_DIAG288
-    select PCI

Quoted 8 lines

+    select PCI_EXPRESS
      select S390_FLIC
      select SCLPCONSOLE
      select VIRTIO_CCW
      select MSI_NONBROKEN
+    imply E1000E_PCI_EXPRESS
+    imply IGB_PCI_EXPRESS
+    imply USB_XHCI_PCI

This is how I'd write this patch. Note I have zero knowledge of zPCI.

Indeed, our s390x PCI emulation is lacking in some places (e.g. missing legacy interrupts as Thomas indicated in a prior thread) so we want to be selective about what we enable.

I have no strong objection to adding them as long as you've tested them.

Based on the above comments, will there be a v3? I don't have the imply'd devices readily available for test but I did do some passthrough and virtio sanity-testing with s390x hardware to make sure this changes doesn't regress anything there. I used the diff just above (select PCI_EXPRESS + imply*3)

Thanks,
Matt

#5 lore raw
Quoted 58 lines · Matthew Rosato
Quoted 40 lines · Philippe Mathieu-Daudé
Quoted 39 lines · Cédric Le Goater
Quoted 29 lines · Philippe Mathieu-Daudé
Quoted 20 lines · Cédric Le Goater

It is useful to extend the number of available PCI devices to KVM guests for passthrough scenarios and also to expose these models to a different (big endian) architecture. Include models for Intel Ethernet adapters and one USB controller, which all support MSI-X. Devices only supporting INTx won't work on s390x.

---

  Tested under KVM as a machine device, under KVM nested as a passthrough device

   hw/s390x/Kconfig | 4 ++++
   1 file changed, 4 insertions(+)
hw/s390x/Kconfig +0 -0
index 5e7d8a2bae8b..7a82c58cdf6e 100644

hw/s390x/Kconfig config S390_CCW_VIRTIO · line 13

Quoted 4 lines
hw/s390x/Kconfig +1 -0
@@ -10,3 +10,7 @@ config S390_CCW_VIRTIO
       select SCLPCONSOLE
       select VIRTIO_CCW
       select MSI_NONBROKEN
+    imply PCI_EXPRESS

No, PCIe is a bus, which is implemented in s390-pci-bus.c; S390_CCW_VIRTIO exposes this bus, so we Kconfig SELECT it.

Quoted 6 lines

hw/s390x/Kconfig config S390_CCW_VIRTIO · line 16

Quoted 3 lines
hw/s390x/Kconfig +3 -0
+    imply E1000E_PCI_EXPRESS
+    imply IGB_PCI_EXPRESS
+    imply USB_XHCI_PCI

These are devices you can plug on a PCIe bus, so Kconfig IMPLY is correct.

If I understand correctly, this should be ?

Quoted 16 lines

hw/s390x/Kconfig config S390_CCW_VIRTIO · line 15

Quoted 13 lines
hw/s390x/Kconfig +4 -1
@@ -5,8 +5,11 @@ config S390_CCW_VIRTIO
       imply VFIO_AP
       imply VFIO_CCW
       imply WDT_DIAG288
-    select PCI
+    select PCI_EXPRESS
       select S390_FLIC
       select SCLPCONSOLE
       select VIRTIO_CCW
       select MSI_NONBROKEN
+    imply E1000E_PCI_EXPRESS
+    imply IGB_PCI_EXPRESS
+    imply USB_XHCI_PCI

This is how I'd write this patch. Note I have zero knowledge of zPCI.

Quoted 5 lines

Indeed, our s390x PCI emulation is lacking in some places (e.g. missing legacy interrupts as Thomas indicated in a prior thread) so we want to be selective about what we enable.

I have no strong objection to adding them as long as you've tested them.

Based on the above comments, will there be a v3? I don't have the imply'd devices readily available for test but I did do some passthrough and virtio sanity-testing with s390x hardware to make sure this changes doesn't regress anything there. I used the diff just above (select PCI_EXPRESS + imply*3)

Good. The VM I use for tests has the following PCI devices :

0001:00:00.0 Ethernet controller: Mellanox Technologies MT27710 Family [ConnectX-4 Lx Virtual Function] 0002:00:00.0 Non-VGA unclassified device: IBM Internal Shared Memory (ISM) virtual PCI device 0003:00:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection 0004:00:00.0 Ethernet controller: Intel Corporation 82576 Gigabit Network Connection (rev 01)

The first two devices are passthrough devices from the LPAR. Then in the nested, I simply pass one of the last two devices, emulated in QEMU. Both kernels have the Intel net drivers to check connectivity with the LPAR. These are not shipped by default.

Sending a v3.

Thanks,

C.