mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 02:03:56 -06:00
hw/intc/loongarch_extioi: Add kernel irqchip save and restore function
Add save and store funtction if kvm_irqchip_in_kernel() return true, it is to get and set ExtIOI irqchip state from KVM kernel. Reviewed-by: Song Gao <gaosong@loongson.cn> Signed-off-by: Bibo Mao <maobibo@loongson.cn> Message-ID: <20250606063033.2557365-3-maobibo@loongson.cn> Signed-off-by: Song Gao <gaosong@loongson.cn>
This commit is contained in:
parent
8bf8814ab1
commit
228c5413fb
3 changed files with 106 additions and 0 deletions
|
@ -393,11 +393,24 @@ static void loongarch_extioi_reset_hold(Object *obj, ResetType type)
|
|||
}
|
||||
}
|
||||
|
||||
static int vmstate_extioi_pre_save(void *opaque)
|
||||
{
|
||||
if (kvm_irqchip_in_kernel()) {
|
||||
return kvm_extioi_get(opaque);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vmstate_extioi_post_load(void *opaque, int version_id)
|
||||
{
|
||||
LoongArchExtIOICommonState *s = LOONGARCH_EXTIOI_COMMON(opaque);
|
||||
int i, start_irq;
|
||||
|
||||
if (kvm_irqchip_in_kernel()) {
|
||||
return kvm_extioi_put(opaque, version_id);
|
||||
}
|
||||
|
||||
for (i = 0; i < (EXTIOI_IRQS / 4); i++) {
|
||||
start_irq = i * 4;
|
||||
extioi_update_sw_coremap(s, start_irq, s->coremap[i], false);
|
||||
|
@ -423,6 +436,7 @@ static void loongarch_extioi_class_init(ObjectClass *klass, const void *data)
|
|||
&lec->parent_unrealize);
|
||||
resettable_class_set_parent_phases(rc, NULL, loongarch_extioi_reset_hold,
|
||||
NULL, &lec->parent_phases);
|
||||
lecc->pre_save = vmstate_extioi_pre_save;
|
||||
lecc->post_load = vmstate_extioi_post_load;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue