xref: /qemu/target/riscv/kvm/kvm-cpu.c (revision 91654e613bf67863f27854a7c8e292a273b50a40)
1 /*
2  * RISC-V implementation of KVM hooks
3  *
4  * Copyright (c) 2020 Huawei Technologies Co., Ltd
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms and conditions of the GNU General Public License,
8  * version 2 or later, as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along with
16  * this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #include "qemu/osdep.h"
20 #include <sys/ioctl.h>
21 
22 #include <linux/kvm.h>
23 
24 #include "qemu-common.h"
25 #include "qemu/timer.h"
26 #include "qemu/error-report.h"
27 #include "qemu/main-loop.h"
28 #include "sysemu/sysemu.h"
29 #include "sysemu/kvm.h"
30 #include "sysemu/kvm_int.h"
31 #include "cpu.h"
32 #include "trace.h"
33 #include "hw/pci/pci.h"
34 #include "exec/memattrs.h"
35 #include "exec/address-spaces.h"
36 #include "hw/boards.h"
37 #include "hw/irq.h"
38 #include "qemu/log.h"
39 #include "hw/loader.h"
40 
41 const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
42     KVM_CAP_LAST_INFO
43 };
44 
45 int kvm_arch_get_registers(CPUState *cs)
46 {
47     return 0;
48 }
49 
50 int kvm_arch_put_registers(CPUState *cs, int level)
51 {
52     return 0;
53 }
54 
55 int kvm_arch_release_virq_post(int virq)
56 {
57     return 0;
58 }
59 
60 int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route,
61                              uint64_t address, uint32_t data, PCIDevice *dev)
62 {
63     return 0;
64 }
65 
66 int kvm_arch_destroy_vcpu(CPUState *cs)
67 {
68     return 0;
69 }
70 
71 unsigned long kvm_arch_vcpu_id(CPUState *cpu)
72 {
73     return cpu->cpu_index;
74 }
75 
76 void kvm_arch_init_irq_routing(KVMState *s)
77 {
78 }
79 
80 int kvm_arch_init_vcpu(CPUState *cs)
81 {
82     return 0;
83 }
84 
85 int kvm_arch_msi_data_to_gsi(uint32_t data)
86 {
87     abort();
88 }
89 
90 int kvm_arch_add_msi_route_post(struct kvm_irq_routing_entry *route,
91                                 int vector, PCIDevice *dev)
92 {
93     return 0;
94 }
95 
96 int kvm_arch_init(MachineState *ms, KVMState *s)
97 {
98     return 0;
99 }
100 
101 int kvm_arch_irqchip_create(KVMState *s)
102 {
103     return 0;
104 }
105 
106 int kvm_arch_process_async_events(CPUState *cs)
107 {
108     return 0;
109 }
110 
111 void kvm_arch_pre_run(CPUState *cs, struct kvm_run *run)
112 {
113 }
114 
115 MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run)
116 {
117     return MEMTXATTRS_UNSPECIFIED;
118 }
119 
120 bool kvm_arch_stop_on_emulation_error(CPUState *cs)
121 {
122     return true;
123 }
124 
125 int kvm_arch_handle_exit(CPUState *cs, struct kvm_run *run)
126 {
127     return 0;
128 }
129 
130 bool kvm_arch_cpu_check_are_resettable(void)
131 {
132     return true;
133 }
134