diff mbox series

hw/phb4: Avoid wait for PERST when running on QEMU

Message ID 20241110140932.410939-1-npiggin@gmail.com
State New
Headers show
Series hw/phb4: Avoid wait for PERST when running on QEMU | expand

Commit Message

Nicholas Piggin Nov. 10, 2024, 2:09 p.m. UTC
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@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 mbox series

Patch

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));
 		}