summary refs log tree commit diff stats
path: root/hw/intc/loongarch_ipi_kvm.c
blob: 51e9c7ed1e0c144630ac6188e5506066c88702b4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;
}