xref: /openbmc/qemu/target/loongarch/kvm/kvm.c (revision 537ba9da)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * QEMU LoongArch KVM
4  *
5  * Copyright (c) 2023 Loongson Technology Corporation Limited
6  */
7 
8 #include "qemu/osdep.h"
9 #include <sys/ioctl.h>
10 #include <linux/kvm.h>
11 
12 #include "qemu/timer.h"
13 #include "qemu/error-report.h"
14 #include "qemu/main-loop.h"
15 #include "sysemu/sysemu.h"
16 #include "sysemu/kvm.h"
17 #include "sysemu/kvm_int.h"
18 #include "hw/pci/pci.h"
19 #include "exec/memattrs.h"
20 #include "exec/address-spaces.h"
21 #include "hw/boards.h"
22 #include "hw/irq.h"
23 #include "qemu/log.h"
24 #include "hw/loader.h"
25 #include "migration/migration.h"
26 #include "sysemu/runstate.h"
27 #include "cpu-csr.h"
28 #include "kvm_loongarch.h"
29 
30 static bool cap_has_mp_state;
31 const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
32     KVM_CAP_LAST_INFO
33 };
34 
35 int kvm_arch_get_registers(CPUState *cs)
36 {
37     return 0;
38 }
39 int kvm_arch_put_registers(CPUState *cs, int level)
40 {
41     return 0;
42 }
43 
44 int kvm_arch_init_vcpu(CPUState *cs)
45 {
46     return 0;
47 }
48 
49 int kvm_arch_destroy_vcpu(CPUState *cs)
50 {
51     return 0;
52 }
53 
54 unsigned long kvm_arch_vcpu_id(CPUState *cs)
55 {
56     return cs->cpu_index;
57 }
58 
59 int kvm_arch_release_virq_post(int virq)
60 {
61     return 0;
62 }
63 
64 int kvm_arch_msi_data_to_gsi(uint32_t data)
65 {
66     abort();
67 }
68 
69 int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
70                              uint64_t address, uint32_t data, PCIDevice *dev)
71 {
72     return 0;
73 }
74 
75 int kvm_arch_add_msi_route_post(struct kvm_irq_routing_entry *route,
76                                 int vector, PCIDevice *dev)
77 {
78     return 0;
79 }
80 
81 void kvm_arch_init_irq_routing(KVMState *s)
82 {
83 }
84 
85 int kvm_arch_get_default_type(MachineState *ms)
86 {
87     return 0;
88 }
89 
90 int kvm_arch_init(MachineState *ms, KVMState *s)
91 {
92     return 0;
93 }
94 
95 int kvm_arch_irqchip_create(KVMState *s)
96 {
97     return 0;
98 }
99 
100 void kvm_arch_pre_run(CPUState *cs, struct kvm_run *run)
101 {
102 }
103 
104 MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run)
105 {
106     return MEMTXATTRS_UNSPECIFIED;
107 }
108 
109 int kvm_arch_process_async_events(CPUState *cs)
110 {
111     return cs->halted;
112 }
113 
114 bool kvm_arch_stop_on_emulation_error(CPUState *cs)
115 {
116     return true;
117 }
118 
119 bool kvm_arch_cpu_check_are_resettable(void)
120 {
121     return true;
122 }
123 
124 int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
125 {
126     return 0;
127 }
128 
129 void kvm_arch_accel_class_init(ObjectClass *oc)
130 {
131 }
132