mirror of https://github.com/xemu-project/xemu.git
s390x/pci: refactor s390_pci_find_dev_by_fh
Because this function is called very frequently, we should use a more effective way to find the zpci device. So we use the FH's index to get the device directly. Signed-off-by: Yi Min Zhao <zyimin@linux.vnet.ibm.com> Reviewed-by: Pierre Morel <pmorel@linux.vnet.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
This commit is contained in:
parent
c188e30315
commit
06a96dae11
|
@ -198,20 +198,13 @@ S390PCIBusDevice *s390_pci_find_dev_by_idx(uint32_t idx)
|
||||||
|
|
||||||
S390PCIBusDevice *s390_pci_find_dev_by_fh(uint32_t fh)
|
S390PCIBusDevice *s390_pci_find_dev_by_fh(uint32_t fh)
|
||||||
{
|
{
|
||||||
S390PCIBusDevice *pbdev;
|
|
||||||
int i;
|
|
||||||
S390pciState *s = s390_get_phb();
|
S390pciState *s = s390_get_phb();
|
||||||
|
S390PCIBusDevice *pbdev;
|
||||||
|
|
||||||
if (!fh) {
|
pbdev = &s->pbdev[fh & FH_MASK_INDEX];
|
||||||
return NULL;
|
if (pbdev->fh != 0 && pbdev->fh == fh) {
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < PCI_SLOT_MAX; i++) {
|
|
||||||
pbdev = &s->pbdev[i];
|
|
||||||
if (pbdev->fh == fh) {
|
|
||||||
return pbdev;
|
return pbdev;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue