kconfig: Add PCIe devices to s390x machines
PATCH v4 1/1 kconfig: Add PCIe devices to s390x machines
It is useful to extend the number of available PCIe devices to KVM guests for passthrough scenarios and also to expose these models to a different (big endian) architecture. Introduce a new config PCIE_DEVICES to select models, Intel Ethernet adapters and one USB controller. These devices all support MSI-X which is a requirement on s390x as legacy INTx are not supported.
---
There could be a more general use of PCIE_DEVICES
v4: Introduce PCIE_DEVICES
v3: PCI -> PCI_EXPRESS
v2: select -> imply
configs/devices/s390x-softmmu/default.mak | 1 + hw/net/Kconfig | 4 ++-- hw/pci/Kconfig | 3 +++ hw/s390x/Kconfig | 3 ++- hw/usb/Kconfig | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-)
configs/devices/s390x-softmmu/default.mak +1 -0
@@ -7,6 +7,7 @@ #CONFIG_VFIO_CCW=n #CONFIG_VIRTIO_PCI=n #CONFIG_WDT_DIAG288=n +#CONFIG_PCIE_DEVICE=n # Boards: #
hw/net/Kconfig +2 -2
@@ -41,12 +41,12 @@ config E1000_PCI config E1000E_PCI_EXPRESS bool - default y if PCI_DEVICES + default y if PCI_DEVICES || PCIE_DEVICES depends on PCI_EXPRESS && MSI_NONBROKEN config IGB_PCI_EXPRESS bool - default y if PCI_DEVICES + default y if PCI_DEVICES || PCIE_DEVICES depends on PCI_EXPRESS && MSI_NONBROKEN config RTL8139_PCI
hw/pci/Kconfig +3 -0
@@ -8,6 +8,9 @@ config PCI_EXPRESS config PCI_DEVICES bool +config PCIE_DEVICES + bool + config MSI_NONBROKEN # selected by interrupt controllers that do not support MSI, # or support it and have a good implementation. See commit
hw/s390x/Kconfig +2 -1
@@ -5,7 +5,8 @@ config S390_CCW_VIRTIO imply VFIO_AP imply VFIO_CCW imply WDT_DIAG288 - select PCI + imply PCIE_DEVICES + select PCI_EXPRESS select S390_FLIC select S390_FLIC_KVM if KVM select SCLPCONSOLE
hw/usb/Kconfig +1 -1
@@ -36,7 +36,7 @@ config USB_XHCI config USB_XHCI_PCI bool - default y if PCI_DEVICES + default y if PCI_DEVICES || PCIE_DEVICES depends on PCI select USB_XHCI
Signature · 1 line
2.41.0
Hi Cédric,
Quoted 43 lines · Cédric Le Goater
It is useful to extend the number of available PCIe devices to KVM guests for passthrough scenarios and also to expose these models to a different (big endian) architecture. Introduce a new config
PCIE_DEVICESto select models, Intel Ethernet adapters and one USB controller. These devices all support MSI-X which is a requirement on s390x as legacy INTx are not supported.Cc Matthew Rosato <[email protected]>Cc Paolo Bonzini <[email protected]>Cc Thomas Huth <[email protected]>Signed-off-by Cédric Le Goater <[email protected]>---
There could be a more general use of
PCIE_DEVICESv4: Introduce
PCIE_DEVICES
v3: PCI ->PCI_EXPRESS
v2: select -> implyconfigs/devices/s390x-softmmu/default.mak | 1 + hw/net/Kconfig | 4 ++-- hw/pci/Kconfig | 3 +++ hw/s390x/Kconfig | 3 ++- hw/usb/Kconfig | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-)configs/devices/s390x-softmmu/default.mak +1
-0@@ -7,6 +7,7 @@ #CONFIG_VFIO_CCW=n #CONFIG_VIRTIO_PCI=n #CONFIG_WDT_DIAG288=n +#CONFIG_PCIE_DEVICE=n # Boards: #hw/net/Kconfig +0
-0
hw/net/Kconfig config E1000_PCI · line 44
Quoted 5 lines
hw/net/Kconfig +1
-1@@ -41,12 +41,12 @@ config E1000_PCI config E1000E_PCI_EXPRESS bool - default y if PCI_DEVICES + default y if PCI_DEVICES || PCIE_DEVICES
There seems to be a pre-existing bug, shouldn't this be
default y if PCIE_DEVICES
?
(Cc'ing maintainers)
hw/net/Kconfig config E1000_PCI · line 49
Quoted 6 lines
hw/net/Kconfig +1
-1depends on PCI_EXPRESS && MSI_NONBROKEN config IGB_PCI_EXPRESS bool - default y if PCI_DEVICES + default y if PCI_DEVICES || PCIE_DEVICES
Similarly:
default y if PCIE_DEVICES
Quoted 22 lines
hw/net/Kconfig +0
-0depends on PCI_EXPRESS && MSI_NONBROKEN config RTL8139_PCIhw/pci/Kconfig +3
-0@@ -8,6 +8,9 @@ config PCI_EXPRESS config PCI_DEVICES bool +config PCIE_DEVICES + bool + config MSI_NONBROKEN # selected by interrupt controllers that do not support MSI, # or support it and have a good implementation. See commithw/s390x/Kconfig +0
-0
hw/s390x/Kconfig config S390_CCW_VIRTIO · line 9
Quoted 6 lines
hw/s390x/Kconfig +2
-1@@ -5,7 +5,8 @@ config S390_CCW_VIRTIO imply VFIO_AP imply VFIO_CCW imply WDT_DIAG288 - select PCI + imply PCIE_DEVICES + select PCI_EXPRESS
I'm confused, TYPE_S390_PCI_HOST_BRIDGE exposes a PCI bus... At a minimum you'd need:
-- >8 --
static const TypeInfo s390_pcihost_info = {
.name = TYPE_S390_PCI_HOST_BRIDGE, - .parent = TYPE_PCI_HOST_BRIDGE, + .parent = TYPE_PCIE_HOST_BRIDGE,
.instance_size = sizeof(S390pciState),
.class_init = s390_pcihost_class_init,
.interfaces = (InterfaceInfo[]) {
---
Actually I can see:
if (s390_pci_msix_init(pbdev) && !pbdev->interp) {
error_setg(errp, "MSI-X support is mandatory "
"in the S390 architecture");
return;
}So this must be PCIe, not legacy PCI, right?
hw/usb/Kconfig config USB_XHCI · line 39
Quoted 10 lines
hw/usb/Kconfig +1
-1@@ -36,7 +36,7 @@ config USB_XHCI config USB_XHCI_PCI bool - default y if PCI_DEVICES + default y if PCI_DEVICES || PCIE_DEVICES
TYPE_XHCI_PCI inherits TYPE_PCI_DEVICE and implements INTERFACE_PCIE_DEVICE, so this is OK.
Quoted 3 lines
hw/usb/Kconfig +0
-0depends on PCI select USB_XHCI
Quoted 27 lines
Quoted 11 lines
hw/s390x/Kconfig +0
-0@@ -5,7 +5,8 @@ config S390_CCW_VIRTIOimply
VFIO_AP
implyVFIO_CCW
implyWDT_DIAG288
- select PCI
+ implyPCIE_DEVICES
+ selectPCI_EXPRESSI'm confused,
TYPE_S390_PCI_HOST_BRIDGEexposes a PCI bus... At a minimum you'd need:-- >8 --
static const TypeInfos390_pcihost_info= {
.name =TYPE_S390_PCI_HOST_BRIDGE,
- .parent =TYPE_PCI_HOST_BRIDGE,
+ .parent =TYPE_PCIE_HOST_BRIDGE,
.instance_size = sizeof(S390pciState),
.class_init =s390_pcihost_class_init,
.interfaces = (InterfaceInfo[]) {
---Actually I can see:
Quoted 7 lines
if (
s390_pci_msix_init(pbdev)&& !pbdev->interp) {error_setg(errp, "MSI-X support is mandatory " "in the S390 architecture"); return;
}So this must be PCIe, not legacy PCI, right?
It seems difficult to change now without breaking migration compatibility.
C.
Quoted 51 lines · Philippe Mathieu-Daudé
Hi Cédric,
Quoted 41 lines · Cédric Le Goater
It is useful to extend the number of available PCIe devices to KVM guests for passthrough scenarios and also to expose these models to a different (big endian) architecture. Introduce a new config
PCIE_DEVICESto select models, Intel Ethernet adapters and one USB controller. These devices all support MSI-X which is a requirement on s390x as legacy INTx are not supported.Cc Matthew Rosato <[email protected]>Cc Paolo Bonzini <[email protected]>Cc Thomas Huth <[email protected]>Signed-off-by Cédric Le Goater <[email protected]>---
There could be a more general use of
PCIE_DEVICESv4: Introduce
PCIE_DEVICES
v3: PCI ->PCI_EXPRESS
v2: select -> imply configs/devices/s390x-softmmu/default.mak | 1 + hw/net/Kconfig | 4 ++-- hw/pci/Kconfig | 3 +++ hw/s390x/Kconfig | 3 ++- hw/usb/Kconfig | 2 +-5 files changed, 9 insertions(+), 4 deletions(-)configs/devices/s390x-softmmu/default.mak +1
-0@@ -7,6 +7,7 @@ #CONFIG_VFIO_CCW=n #CONFIG_VIRTIO_PCI=n #CONFIG_WDT_DIAG288=n +#CONFIG_PCIE_DEVICE=n # Boards: #hw/net/Kconfig +0
-0@@ -41,12 +41,12 @@ config E1000_PCIQuoted 4 lines
config
E1000E_PCI_EXPRESS
bool
- default y ifPCI_DEVICES
+ default y ifPCI_DEVICES||PCIE_DEVICESThere seems to be a pre-existing bug, shouldn't this be
Quoted 3 lines
default y if
PCIE_DEVICES?
I think you should leave this as is and instead add a config selected only when legacy PCI is available and make all legacy PCI devices depend on the config. This will prevent from selecting legacy PCI devices for s390x machines no matter if it's selected due to PCI_DEVICES or selected manually by the user (by mistake).
Quoted 79 lines
(Cc'ing maintainers)
Quoted 5 lines
depends on
PCI_EXPRESS&&MSI_NONBROKEN
configIGB_PCI_EXPRESS
bool
- default y ifPCI_DEVICES
+ default y ifPCI_DEVICES||PCIE_DEVICESSimilarly:
default y if
PCIE_DEVICESQuoted 20 lines
depends on
PCI_EXPRESS&&MSI_NONBROKEN
configRTL8139_PCIhw/pci/Kconfig +0
-0@@ -8,6 +8,9 @@ config PCI_EXPRESSconfig
PCI_DEVICES
boolhw/pci/Kconfig +3
-0+config PCIE_DEVICES + bool +config
MSI_NONBROKEN# selected by interrupt controllers that do not support MSI, # or support it and have a good implementation. See commithw/s390x/Kconfig +0
-0@@ -5,7 +5,8 @@ config S390_CCW_VIRTIOQuoted 6 lines
imply
VFIO_AP
implyVFIO_CCW
implyWDT_DIAG288
- select PCI
+ implyPCIE_DEVICES
+ selectPCI_EXPRESSI'm confused,
TYPE_S390_PCI_HOST_BRIDGEexposes a PCI bus... At a minimum you'd need:-- >8 --
static const TypeInfos390_pcihost_info= {
.name =TYPE_S390_PCI_HOST_BRIDGE,
- .parent =TYPE_PCI_HOST_BRIDGE,
+ .parent =TYPE_PCIE_HOST_BRIDGE,
.instance_size = sizeof(S390pciState),
.class_init =s390_pcihost_class_init,
.interfaces = (InterfaceInfo[]) {
---Actually I can see:
if (
s390_pci_msix_init(pbdev)&& !pbdev->interp) {error_setg(errp, "MSI-X support is mandatory " "in the S390 architecture"); return;
}So this must be PCIe, not legacy PCI, right?
Quoted 9 lines
hw/usb/Kconfig +0
-0@@ -36,7 +36,7 @@ config USB_XHCIconfig
USB_XHCI_PCI
bool
- default y ifPCI_DEVICES
+ default y ifPCI_DEVICES||PCIE_DEVICES
TYPE_XHCI_PCIinheritsTYPE_PCI_DEVICEand implementsINTERFACE_PCIE_DEVICE, so this is OK.Quoted 2 lines
depends on PCI
selectUSB_XHCI
configs/devices/s390x-softmmu/default.mak line 10
Quoted 9 lines
configs/devices/s390x-softmmu/default.mak +1
-0@@ -7,6 +7,7 @@ #CONFIG_VFIO_CCW=n #CONFIG_VIRTIO_PCI=n #CONFIG_WDT_DIAG288=n +#CONFIG_PCIE_DEVICE=n
Should be CONFIG_PCIE_DEVICES; fixed and queued, thanks.
Paolo
Quoted 11 lines · Paolo Bonzini
configs/devices/s390x-softmmu/default.mak line 10
Quoted 9 lines
configs/devices/s390x-softmmu/default.mak +1
-0@@ -7,6 +7,7 @@ #CONFIG_VFIO_CCW=n #CONFIG_VIRTIO_PCI=n #CONFIG_WDT_DIAG288=n +#CONFIG_PCIE_DEVICE=nShould be
CONFIG_PCIE_DEVICES; fixed and queued, thanks.
I think the patch is fine for now, but in the long run, I think we should make sure to mark PCIe-only devices only with PCIE_DEVICES, as Philippe suggested. So PCIe devices will then also not show up any more on targets that only provide a plain PCI bus (like hppa, I guess?).
Thomas
Quoted 4 lines · Thomas Huth
I think the patch is fine for now, but in the long run, I think we should make sure to mark PCIe-only devices only with
PCIE_DEVICES, as Philippe suggested. So PCIe devices will then also not show up any more on targets that only provide a plain PCI bus (like hppa, I guess?).
Or even "-M pc", I think.
Paolo