mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 01:33:56 -06:00
hw/intc/loongarch_ipi: Add kernel irqchip realize function
Function kvm_ipi_realize() is added if kvm_irqchip_in_kernel() return true. It is to create and initialize IPI device in kernel mode. Reviewed-by: Song Gao <gaosong@loongson.cn> Signed-off-by: Bibo Mao <maobibo@loongson.cn> Message-ID: <20250606063033.2557365-4-maobibo@loongson.cn> Signed-off-by: Song Gao <gaosong@loongson.cn>
This commit is contained in:
parent
228c5413fb
commit
412f655566
5 changed files with 42 additions and 0 deletions
27
hw/intc/loongarch_ipi_kvm.c
Normal file
27
hw/intc/loongarch_ipi_kvm.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
* LoongArch IPI interrupt KVM support
|
||||
*
|
||||
* Copyright (C) 2025 Loongson Technology Corporation Limited
|
||||
*/
|
||||
|
||||
#include "qemu/osdep.h"
|
||||
#include "qapi/error.h"
|
||||
#include "hw/intc/loongarch_ipi.h"
|
||||
#include "system/kvm.h"
|
||||
#include "target/loongarch/cpu.h"
|
||||
|
||||
void kvm_ipi_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
LoongarchIPIState *lis = LOONGARCH_IPI(dev);
|
||||
int ret;
|
||||
|
||||
ret = kvm_create_device(kvm_state, KVM_DEV_TYPE_LOONGARCH_IPI, false);
|
||||
if (ret < 0) {
|
||||
fprintf(stderr, "IPI KVM_CREATE_DEVICE failed: %s\n",
|
||||
strerror(-ret));
|
||||
abort();
|
||||
}
|
||||
|
||||
lis->dev_fd = ret;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue