From: Jared Rossi <[email protected]> Enabling a PCI function that is already configured will result in an error. Simply check if the device has already been enabled, and if so, return without doing anything further; otherwise, enable it as usual.
Also, because enable_pci_function() prints its own message, let's remove the duplicate message emitted during the virtio PCI setup steps. Reviewed-by: Zhuoying Cai <[email protected]> Reviewed-by: Eric Farman <[email protected]> Signed-off-by: Jared Rossi <[email protected]> --- pc-bios/s390-ccw/clp.c | 4 ++++ pc-bios/s390-ccw/virtio-pci.c | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pc-bios/s390-ccw/clp.c b/pc-bios/s390-ccw/clp.c index ca9565d8de..7917f13345 100644 --- a/pc-bios/s390-ccw/clp.c +++ b/pc-bios/s390-ccw/clp.c @@ -82,6 +82,10 @@ int enable_pci_function(uint32_t *fhandle) { ClpReqRspSetPci rrb; + if (*fhandle & CLP_FHLIST_MASK_CONFIG) { + return 0; /* already enabled */ + } + rrb.request.hdr.len = sizeof(ClpReqSetPci); rrb.request.hdr.cmd = 0x05; rrb.request.fh = *fhandle; diff --git a/pc-bios/s390-ccw/virtio-pci.c b/pc-bios/s390-ccw/virtio-pci.c index f501252c81..231ab6e04d 100644 --- a/pc-bios/s390-ccw/virtio-pci.c +++ b/pc-bios/s390-ccw/virtio-pci.c @@ -452,7 +452,6 @@ int virtio_pci_setup_device(void) VDev *vdev = virtio_get_device(); if (enable_pci_function(&vdev->pci_fh)) { - puts("Failed to enable PCI function"); return -ENODEV; } -- 2.54.0
