diff options
author | Cornelia Huck <cohuck@redhat.com> | 2017-07-06 17:13:14 +0200 |
---|---|---|
committer | Cornelia Huck <cohuck@redhat.com> | 2017-08-30 18:23:25 +0200 |
commit | 80b7a265362c870f95fb5ca1f7e7a02c0fa0db3e (patch) | |
tree | 854932d6cc1e81fea496caae0224d09935cac791 /hw/s390x/s390-pci-bus.c | |
parent | d32bd032d8fde41281aae34c16a4aa97e9acfeac (diff) |
s390x/sclp: properly guard pci-specific functions
If we do not provide zpci, pci reconfiguration via sclp is not available
either. I/O adapter configuration, however, should always be present.
Rename the values that refer to I/O adapter configuration (instead of only
pci) to make things clearer.
Move length checking of the sccb for I/O adapter configuration into the
common sclp code (out of the pci code). This also fixes an issue that
the pci code would refer to a field in the sccb before checking whether
it was actually long enough.
Check for the adapter type in the sccb and return unrecognized adapter
type if the guest tries to issue I/O adapter configure/deconfigure for
a type other than pci or for pci if the zpci facility is not provided.
Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.vnet.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'hw/s390x/s390-pci-bus.c')
-rw-r--r-- | hw/s390x/s390-pci-bus.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c index c57f6ebae0..0a31a4ae88 100644 --- a/hw/s390x/s390-pci-bus.c +++ b/hw/s390x/s390-pci-bus.c @@ -122,16 +122,11 @@ S390PCIBusDevice *s390_pci_find_dev_by_fid(S390pciState *s, uint32_t fid) void s390_pci_sclp_configure(SCCB *sccb) { - PciCfgSccb *psccb = (PciCfgSccb *)sccb; + IoaCfgSccb *psccb = (IoaCfgSccb *)sccb; S390PCIBusDevice *pbdev = s390_pci_find_dev_by_fid(s390_get_phb(), be32_to_cpu(psccb->aid)); uint16_t rc; - if (be16_to_cpu(sccb->h.length) < 16) { - rc = SCLP_RC_INSUFFICIENT_SCCB_LENGTH; - goto out; - } - if (!pbdev) { DPRINTF("sclp config no dev found\n"); rc = SCLP_RC_ADAPTER_ID_NOT_RECOGNIZED; @@ -155,16 +150,11 @@ out: void s390_pci_sclp_deconfigure(SCCB *sccb) { - PciCfgSccb *psccb = (PciCfgSccb *)sccb; + IoaCfgSccb *psccb = (IoaCfgSccb *)sccb; S390PCIBusDevice *pbdev = s390_pci_find_dev_by_fid(s390_get_phb(), be32_to_cpu(psccb->aid)); uint16_t rc; - if (be16_to_cpu(sccb->h.length) < 16) { - rc = SCLP_RC_INSUFFICIENT_SCCB_LENGTH; - goto out; - } - if (!pbdev) { DPRINTF("sclp deconfig no dev found\n"); rc = SCLP_RC_ADAPTER_ID_NOT_RECOGNIZED; |