We can't properly handle hotplug of a device as long the guest kernel isn't fully booted. We detect this at CAS and potentially trigger a CAS reboot to complete the hotplug sequence.
The same goes actually with hot unplug but we currently don't detect it. Doing device_del before CAS hence seems to be ignored: when the guest is booted, it still sees the _unplugged_ device in the DT and configures it. But if some other hotplug event happens later, then the unplug request is finally processed by the guest and the device goes away. This doesn't seem to cause any crash but it is still very confusing. Detect device unplug at CAS and request a CAS reboot. Hopefully, when SLOF will know how to handle device addition and deletion in its DT according to the FDT provided by QEMU at CAS, we'll be able to address this differently (ie, coldplugging the new devices and removing the ones with a pending unplug request). Signed-off-by: Greg Kurz <gr...@kaod.org> --- hw/ppc/spapr_hcall.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index 7a33d79bbae9..84690cc2c1ce 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1659,7 +1659,7 @@ static bool spapr_hotplugged_dev_before_cas(void) if (!drc->dev) { continue; } - if (!spapr_drc_device_ready(drc)) { + if (spapr_drc_unplug_requested(drc) || !spapr_drc_device_ready(drc)) { return true; } }