[Skiboot] [PATCH] hw/phb4: Avoid wait for PERST when running on QEMU

Nicholas Piggin npiggin at gmail.com
Mon Nov 11 01:09:31 AEDT 2024


Waiting for PCI reset is the most costly component of a QEMU boot,
mostly due to 1s delay between PERST deassert and device config
space access. These PCI hardware delays are not required with QEMU,
so skip them on that platform.

On a single-CPU QEMU powernv10 machine where PCI probing is not well
parallelised, this reduces skiboot boot time from 6.3s to 0.4s. This is
important for testing and CI.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
This replaces "core/pci: Avoid wait for hardware running on QEMU" I
just incorrectly sent in a series of bugfixes. That one was too
aggressive, it seems QEMU does have some async components to PCI
init that needs to wait a little. This gets most of the benefit.

Thanks,
Nick
---

 hw/phb4.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/hw/phb4.c b/hw/phb4.c
index b1fa08fe1..5292a923b 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -2959,6 +2959,10 @@ static int64_t phb4_poll_link(struct pci_slot *slot)
 			PHBDBG(p, "LINK: Link is up\n");
 			phb4_prepare_link_change(slot, true);
 			pci_slot_set_state(slot, PHB4_SLOT_LINK_STABLE);
+			if (chip_quirk(QUIRK_QEMU)) {
+				/* QEMU doesn't need to wait */
+				return OPAL_SUCCESS;
+			}
 			return pci_slot_set_sm_timeout(slot, secs_to_tb(1));
 		}
 
-- 
2.45.2



More information about the Skiboot mailing list