mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 09:43:56 -06:00
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>
This commit is contained in:
parent
d32bd032d8
commit
80b7a26536
4 changed files with 48 additions and 29 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue