On Tue, Dec 14, 2021 at 09:53:12PM +0000, Annie Li wrote: > After the PCIe device is hot-plugged, the device's power state is > initialized as ON. However, the device isn't powered on yet, i.e. > the PCI_EXP_SYSCTL_PCC bit isn't set to PCI_EXP_SLTCTL_PWR_ON. > Later on, its power state will set back to OFF due to the non > PCI_EXP_SLTCTL_PWR_ON state. The device is invisible until > PCI_EXP_SLTCTL_PWR_ON is set. > > This may be appropriate for general PCIe hot-plug cases. However, > if the device is hot-plugged when the VM is in VM_STATE_PRELAUNCH > state, especially the system disk device, the firmware will fail > to find the system disk. As a result, the guest fails to boot.
Maybe we should just not set DeviceState->hotplugged = true for devices added in VM_STATE_PRELAUNCH? It's not actual hotplug (i.e. device added while the system is running) after all ... There are lots of places checking DeviceState->hotplugged, and I suspect we have similar issues elsewhere. take care, Gerd