Why ARM CPU hot(un)plug is still unsupported?

2023-05-08 Thread Zongyuan Li
I’v noticed that there used to be a patch series working on it:

https://patchew.org/QEMU/20200613213629.21984-1-salil.me...@huawei.com/

It seems to be working, any reason on why it is not merged? Is there any 
difficulty
to implement cpu hot(un)plug in qemu-arm(especially for kvm case)? Hope I can
find something I can help.

Regards,
Zongyuan



How 'qdev_realize_and_unref' work?

2022-03-22 Thread Zongyuan Li
I recently read the following code in hw/openrisc/openrisc_sim.c:

>  if (num_cpus > 1) {
>DeviceState *splitter = qdev_new(TYPE_SPLIT_IRQ);
>qdev_prop_set_uint32(splitter, "num-lines", num_cpus);
>qdev_realize_and_unref(splitter, NULL, _fatal);
>for (i = 0; i < num_cpus; i++) {
>qdev_connect_gpio_out(splitter, i, get_cpu_irq(cpus, i, irq_pin));
>}
>serial_irq = qdev_get_gpio_in(splitter, 0);
>} else {
>serial_irq = get_cpu_irq(cpus, 0, irq_pin);
>}

'splitter' will be used after 'qdev_realize_and_unref', which will
drop the only reference it takes.
But since the memory will be freed, it seems illegal to use
'splitter'. Can anyone explain if I am missing something?

Thanks a lot,
Li