On 2/9/25 04:27, Bibo Mao wrote:
On 2025/9/1 下午6:51, Philippe Mathieu-Daudé wrote:
Hi Bibo,
On 1/9/25 10:19, Bibo Mao wrote:
With generic cpu reset interface, pc register is entry of FLASH for
UEFI BIOS. However with direct kernel booting requirement, there is
a little different, pc register of primary cpu is entry address of ELF
file.
At the same time with requirement of cpu hotplug, hot-added CPU should
register reset interface for this cpu object. Now reset callback is
not registered for hot-added CPU.
With this patch reset callback for CPU is register when CPU instance
is created, and reset interface is added for virt-machine board. In
reset interface of virt-machine, reset for direct kernel booting
requirement is called.
Signed-off-by: Bibo Mao <maob...@loongson.cn>
---
v1 ... v2:
1. Add qemu_unregister_reset() in function
loongarch_cpu_unrealizefn(),
remove reset callback if vCPU is unrealized.
---
Signed-off-by: Bibo Mao <maob...@loongson.cn>
---
hw/loongarch/boot.c | 9 +--------
hw/loongarch/virt.c | 14 ++++++++++++++
include/hw/loongarch/boot.h | 1 +
target/loongarch/cpu.c | 11 +++++++++++
4 files changed, 27 insertions(+), 8 deletions(-)
static void loongarch_cpu_realizefn(DeviceState *dev, Error **errp)
{
CPUState *cs = CPU(dev);
@@ -668,6 +675,9 @@ static void loongarch_cpu_realizefn(DeviceState
*dev, Error **errp)
qemu_init_vcpu(cs);
cpu_reset(cs);
Devices shouldn't call their DeviceReset handler manually, as it is
always called after DeviceRealize.
>> ok, will remove this.
This is a legacy pattern we want to eventually clean. Maybe we still
need this one at this point. See for reference this series:
https://lore.kernel.org/qemu-devel/20231128170008.57ddb...@imammedo.users.ipa.redhat.com/