163 lines
3.5 KiB
Diff
163 lines
3.5 KiB
Diff
|
|
From 623a99084843f47723cb799d4bcef8e1359d59ad Mon Sep 17 00:00:00 2001
|
||
|
|
From: Tianrui Zhao <zhaotianrui@loongson.cn>
|
||
|
|
Date: Fri, 5 Jan 2024 15:57:57 +0800
|
||
|
|
Subject: [PATCH] target/loongarch: Define some kvm_arch interfaces
|
||
|
|
|
||
|
|
Define some functions in target/loongarch/kvm/kvm.c,
|
||
|
|
such as kvm_arch_put_registers, kvm_arch_get_registers
|
||
|
|
and kvm_arch_handle_exit, etc. which are needed by
|
||
|
|
kvm/kvm-all.c. Now the most functions has no content
|
||
|
|
and they will be implemented in the next patches.
|
||
|
|
|
||
|
|
Signed-off-by: Tianrui Zhao <zhaotianrui@loongson.cn>
|
||
|
|
Signed-off-by: xianglai li <lixianglai@loongson.cn>
|
||
|
|
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
|
||
|
|
Reviewed-by: Song Gao <gaosong@loongson.cn>
|
||
|
|
Message-Id: <20240105075804.1228596-3-zhaotianrui@loongson.cn>
|
||
|
|
Signed-off-by: Song Gao <gaosong@loongson.cn>
|
||
|
|
---
|
||
|
|
target/loongarch/kvm/kvm.c | 131 +++++++++++++++++++++++++++++++++++++
|
||
|
|
1 file changed, 131 insertions(+)
|
||
|
|
create mode 100644 target/loongarch/kvm/kvm.c
|
||
|
|
|
||
|
|
diff --git a/target/loongarch/kvm/kvm.c b/target/loongarch/kvm/kvm.c
|
||
|
|
new file mode 100644
|
||
|
|
index 0000000000..0d67322fd9
|
||
|
|
--- /dev/null
|
||
|
|
+++ b/target/loongarch/kvm/kvm.c
|
||
|
|
@@ -0,0 +1,131 @@
|
||
|
|
+/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||
|
|
+/*
|
||
|
|
+ * QEMU LoongArch KVM
|
||
|
|
+ *
|
||
|
|
+ * Copyright (c) 2023 Loongson Technology Corporation Limited
|
||
|
|
+ */
|
||
|
|
+
|
||
|
|
+#include "qemu/osdep.h"
|
||
|
|
+#include <sys/ioctl.h>
|
||
|
|
+#include <linux/kvm.h>
|
||
|
|
+
|
||
|
|
+#include "qemu/timer.h"
|
||
|
|
+#include "qemu/error-report.h"
|
||
|
|
+#include "qemu/main-loop.h"
|
||
|
|
+#include "sysemu/sysemu.h"
|
||
|
|
+#include "sysemu/kvm.h"
|
||
|
|
+#include "sysemu/kvm_int.h"
|
||
|
|
+#include "hw/pci/pci.h"
|
||
|
|
+#include "exec/memattrs.h"
|
||
|
|
+#include "exec/address-spaces.h"
|
||
|
|
+#include "hw/boards.h"
|
||
|
|
+#include "hw/irq.h"
|
||
|
|
+#include "qemu/log.h"
|
||
|
|
+#include "hw/loader.h"
|
||
|
|
+#include "migration/migration.h"
|
||
|
|
+#include "sysemu/runstate.h"
|
||
|
|
+#include "cpu-csr.h"
|
||
|
|
+#include "kvm_loongarch.h"
|
||
|
|
+
|
||
|
|
+static bool cap_has_mp_state;
|
||
|
|
+const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
|
||
|
|
+ KVM_CAP_LAST_INFO
|
||
|
|
+};
|
||
|
|
+
|
||
|
|
+int kvm_arch_get_registers(CPUState *cs)
|
||
|
|
+{
|
||
|
|
+ return 0;
|
||
|
|
+}
|
||
|
|
+int kvm_arch_put_registers(CPUState *cs, int level)
|
||
|
|
+{
|
||
|
|
+ return 0;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+int kvm_arch_init_vcpu(CPUState *cs)
|
||
|
|
+{
|
||
|
|
+ return 0;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+int kvm_arch_destroy_vcpu(CPUState *cs)
|
||
|
|
+{
|
||
|
|
+ return 0;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+unsigned long kvm_arch_vcpu_id(CPUState *cs)
|
||
|
|
+{
|
||
|
|
+ return cs->cpu_index;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+int kvm_arch_release_virq_post(int virq)
|
||
|
|
+{
|
||
|
|
+ return 0;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+int kvm_arch_msi_data_to_gsi(uint32_t data)
|
||
|
|
+{
|
||
|
|
+ abort();
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
|
||
|
|
+ uint64_t address, uint32_t data, PCIDevice *dev)
|
||
|
|
+{
|
||
|
|
+ return 0;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+int kvm_arch_add_msi_route_post(struct kvm_irq_routing_entry *route,
|
||
|
|
+ int vector, PCIDevice *dev)
|
||
|
|
+{
|
||
|
|
+ return 0;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+void kvm_arch_init_irq_routing(KVMState *s)
|
||
|
|
+{
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+int kvm_arch_get_default_type(MachineState *ms)
|
||
|
|
+{
|
||
|
|
+ return 0;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+int kvm_arch_init(MachineState *ms, KVMState *s)
|
||
|
|
+{
|
||
|
|
+ return 0;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+int kvm_arch_irqchip_create(KVMState *s)
|
||
|
|
+{
|
||
|
|
+ return 0;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+void kvm_arch_pre_run(CPUState *cs, struct kvm_run *run)
|
||
|
|
+{
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run)
|
||
|
|
+{
|
||
|
|
+ return MEMTXATTRS_UNSPECIFIED;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+int kvm_arch_process_async_events(CPUState *cs)
|
||
|
|
+{
|
||
|
|
+ return cs->halted;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+bool kvm_arch_stop_on_emulation_error(CPUState *cs)
|
||
|
|
+{
|
||
|
|
+ return true;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+bool kvm_arch_cpu_check_are_resettable(void)
|
||
|
|
+{
|
||
|
|
+ return true;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
|
||
|
|
+{
|
||
|
|
+ return 0;
|
||
|
|
+}
|
||
|
|
+
|
||
|
|
+void kvm_arch_accel_class_init(ObjectClass *oc)
|
||
|
|
+{
|
||
|
|
+}
|
||
|
|
--
|
||
|
|
2.27.0
|
||
|
|
|