mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
migration: Fix migration failure when aia is configured as aplic-imsic
Address an error in migration when aia is configured as 'aplic-imsic' in riscv kvm vm by adding riscv_aplic_state_needed() and riscv_imsic_state_needed() to determine whether the corresponding sates are needed. Previously, the fields in the vmsds of 'riscv_aplic' and 'riscv_imsic' can only be initialized under certain special conditions in commit95a97b3fd2
. However, the corresponding ses of these vmsds are inserted into the savevm_state.handlers unconditionally. This led to migration failure characterized by uninitialized fields when save vm state: qemu-system-riscv64: ../migration/vmstate.c:433: vmstate_save_state_v: Assertion 'first_elem || !n_elems || !size' failed. Fixes:95a97b3fd2
("target/riscv: update APLIC and IMSIC to support KVM AIA") Signed-off-by: Xuemei Liu <liu.xuemei1@zte.com.cn> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Message-ID: <20250616150034827wuHs_ffe3Qm8cqFXT7HeW@zte.com.cn> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
parent
b5092b3db2
commit
bc2200134c
2 changed files with 18 additions and 4 deletions
|
@ -962,10 +962,18 @@ static const Property riscv_aplic_properties[] = {
|
|||
DEFINE_PROP_BOOL("mmode", RISCVAPLICState, mmode, 0),
|
||||
};
|
||||
|
||||
static bool riscv_aplic_state_needed(void *opaque)
|
||||
{
|
||||
RISCVAPLICState *aplic = opaque;
|
||||
|
||||
return riscv_use_emulated_aplic(aplic->msimode);
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_riscv_aplic = {
|
||||
.name = "riscv_aplic",
|
||||
.version_id = 2,
|
||||
.minimum_version_id = 2,
|
||||
.version_id = 3,
|
||||
.minimum_version_id = 3,
|
||||
.needed = riscv_aplic_state_needed,
|
||||
.fields = (const VMStateField[]) {
|
||||
VMSTATE_UINT32(domaincfg, RISCVAPLICState),
|
||||
VMSTATE_UINT32(mmsicfgaddr, RISCVAPLICState),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue