aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoffer Dall <christoffer.dall@linaro.org>2015-03-11 09:21:31 -0400
committerChristoffer Dall <christoffer.dall@linaro.org>2015-03-12 10:15:27 -0400
commit662d9715840aef44dcb573b0f9fab9e8319c868a (patch)
tree8c2800bd7b58972618fa820a57b03cdfca01d1c9
parent69ff5c619cb350f43fbab2a491b4b66de7e96959 (diff)
arm/arm64: KVM: Kill CONFIG_KVM_ARM_{VGIC,TIMER}
We can definitely decide at run-time whether to use the GIC and timers or not, and the extra code and data structures that we allocate space for is really negligable with this config option, so I don't think it's worth the extra complexity of always having to define stub static inlines. The !CONFIG_KVM_ARM_VGIC/TIMER case is pretty much an untested code path anyway, so we're better off just getting rid of it. Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
-rw-r--r--arch/arm/kernel/asm-offsets.c4
-rw-r--r--arch/arm/kvm/Kconfig29
-rw-r--r--arch/arm/kvm/Makefile8
-rw-r--r--arch/arm/kvm/arm.c6
-rw-r--r--arch/arm/kvm/guest.c18
-rw-r--r--arch/arm/kvm/interrupts_head.S8
-rw-r--r--arch/arm64/kvm/Kconfig17
-rw-r--r--arch/arm64/kvm/Makefile16
-rw-r--r--include/kvm/arm_arch_timer.h31
-rw-r--r--include/kvm/arm_vgic.h85
10 files changed, 20 insertions, 202 deletions
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index 2d2d6087b9b1..488eaac56028 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -190,7 +190,6 @@ int main(void)
190 DEFINE(VCPU_HxFAR, offsetof(struct kvm_vcpu, arch.fault.hxfar)); 190 DEFINE(VCPU_HxFAR, offsetof(struct kvm_vcpu, arch.fault.hxfar));
191 DEFINE(VCPU_HPFAR, offsetof(struct kvm_vcpu, arch.fault.hpfar)); 191 DEFINE(VCPU_HPFAR, offsetof(struct kvm_vcpu, arch.fault.hpfar));
192 DEFINE(VCPU_HYP_PC, offsetof(struct kvm_vcpu, arch.fault.hyp_pc)); 192 DEFINE(VCPU_HYP_PC, offsetof(struct kvm_vcpu, arch.fault.hyp_pc));
193#ifdef CONFIG_KVM_ARM_VGIC
194 DEFINE(VCPU_VGIC_CPU, offsetof(struct kvm_vcpu, arch.vgic_cpu)); 193 DEFINE(VCPU_VGIC_CPU, offsetof(struct kvm_vcpu, arch.vgic_cpu));
195 DEFINE(VGIC_V2_CPU_HCR, offsetof(struct vgic_cpu, vgic_v2.vgic_hcr)); 194 DEFINE(VGIC_V2_CPU_HCR, offsetof(struct vgic_cpu, vgic_v2.vgic_hcr));
196 DEFINE(VGIC_V2_CPU_VMCR, offsetof(struct vgic_cpu, vgic_v2.vgic_vmcr)); 195 DEFINE(VGIC_V2_CPU_VMCR, offsetof(struct vgic_cpu, vgic_v2.vgic_vmcr));
@@ -200,14 +199,11 @@ int main(void)
200 DEFINE(VGIC_V2_CPU_APR, offsetof(struct vgic_cpu, vgic_v2.vgic_apr)); 199 DEFINE(VGIC_V2_CPU_APR, offsetof(struct vgic_cpu, vgic_v2.vgic_apr));
201 DEFINE(VGIC_V2_CPU_LR, offsetof(struct vgic_cpu, vgic_v2.vgic_lr)); 200 DEFINE(VGIC_V2_CPU_LR, offsetof(struct vgic_cpu, vgic_v2.vgic_lr));
202 DEFINE(VGIC_CPU_NR_LR, offsetof(struct vgic_cpu, nr_lr)); 201 DEFINE(VGIC_CPU_NR_LR, offsetof(struct vgic_cpu, nr_lr));
203#ifdef CONFIG_KVM_ARM_TIMER
204 DEFINE(VCPU_TIMER_CNTV_CTL, offsetof(struct kvm_vcpu, arch.timer_cpu.cntv_ctl)); 202 DEFINE(VCPU_TIMER_CNTV_CTL, offsetof(struct kvm_vcpu, arch.timer_cpu.cntv_ctl));
205 DEFINE(VCPU_TIMER_CNTV_CVAL, offsetof(struct kvm_vcpu, arch.timer_cpu.cntv_cval)); 203 DEFINE(VCPU_TIMER_CNTV_CVAL, offsetof(struct kvm_vcpu, arch.timer_cpu.cntv_cval));
206 DEFINE(KVM_TIMER_CNTVOFF, offsetof(struct kvm, arch.timer.cntvoff)); 204 DEFINE(KVM_TIMER_CNTVOFF, offsetof(struct kvm, arch.timer.cntvoff));
207 DEFINE(KVM_TIMER_ENABLED, offsetof(struct kvm, arch.timer.enabled)); 205 DEFINE(KVM_TIMER_ENABLED, offsetof(struct kvm, arch.timer.enabled));
208#endif
209 DEFINE(KVM_VGIC_VCTRL, offsetof(struct kvm, arch.vgic.vctrl_base)); 206 DEFINE(KVM_VGIC_VCTRL, offsetof(struct kvm, arch.vgic.vctrl_base));
210#endif
211 DEFINE(KVM_VTTBR, offsetof(struct kvm, arch.vttbr)); 207 DEFINE(KVM_VTTBR, offsetof(struct kvm, arch.vttbr));
212#endif 208#endif
213 return 0; 209 return 0;
diff --git a/arch/arm/kvm/Kconfig b/arch/arm/kvm/Kconfig
index 338ace78ed18..7b6347bbb413 100644
--- a/arch/arm/kvm/Kconfig
+++ b/arch/arm/kvm/Kconfig
@@ -18,6 +18,7 @@ if VIRTUALIZATION
18 18
19config KVM 19config KVM
20 bool "Kernel-based Virtual Machine (KVM) support" 20 bool "Kernel-based Virtual Machine (KVM) support"
21 depends on MMU && OF
21 select PREEMPT_NOTIFIERS 22 select PREEMPT_NOTIFIERS
22 select ANON_INODES 23 select ANON_INODES
23 select HAVE_KVM_CPU_RELAX_INTERCEPT 24 select HAVE_KVM_CPU_RELAX_INTERCEPT
@@ -26,10 +27,11 @@ config KVM
26 select KVM_ARM_HOST 27 select KVM_ARM_HOST
27 select KVM_GENERIC_DIRTYLOG_READ_PROTECT 28 select KVM_GENERIC_DIRTYLOG_READ_PROTECT
28 select SRCU 29 select SRCU
29 depends on ARM_VIRT_EXT && ARM_LPAE 30 select MMU_NOTIFIER
31 select HAVE_KVM_IRQCHIP
32 depends on ARM_VIRT_EXT && ARM_LPAE && ARM_ARCH_TIMER
30 ---help--- 33 ---help---
31 Support hosting virtualized guest machines. You will also 34 Support hosting virtualized guest machines.
32 need to select one or more of the processor modules below.
33 35
34 This module provides access to the hardware capabilities through 36 This module provides access to the hardware capabilities through
35 a character device node named /dev/kvm. 37 a character device node named /dev/kvm.
@@ -37,10 +39,7 @@ config KVM
37 If unsure, say N. 39 If unsure, say N.
38 40
39config KVM_ARM_HOST 41config KVM_ARM_HOST
40 bool "KVM host support for ARM cpus." 42 bool
41 depends on KVM
42 depends on MMU
43 select MMU_NOTIFIER
44 ---help--- 43 ---help---
45 Provides host support for ARM processors. 44 Provides host support for ARM processors.
46 45
@@ -55,20 +54,4 @@ config KVM_ARM_MAX_VCPUS
55 large, so only choose a reasonable number that you expect to 54 large, so only choose a reasonable number that you expect to
56 actually use. 55 actually use.
57 56
58config KVM_ARM_VGIC
59 bool "KVM support for Virtual GIC"
60 depends on KVM_ARM_HOST && OF
61 select HAVE_KVM_IRQCHIP
62 default y
63 ---help---
64 Adds support for a hardware assisted, in-kernel GIC emulation.
65
66config KVM_ARM_TIMER
67 bool "KVM support for Architected Timers"
68 depends on KVM_ARM_VGIC && ARM_ARCH_TIMER
69 select HAVE_KVM_IRQCHIP
70 default y
71 ---help---
72 Adds support for the Architected Timers in virtual machines
73
74endif # VIRTUALIZATION 57endif # VIRTUALIZATION
diff --git a/arch/arm/kvm/Makefile b/arch/arm/kvm/Makefile
index 443b8bea43e9..60be7be4c824 100644
--- a/arch/arm/kvm/Makefile
+++ b/arch/arm/kvm/Makefile
@@ -20,7 +20,7 @@ kvm-arm-y = $(KVM)/kvm_main.o $(KVM)/coalesced_mmio.o
20obj-y += kvm-arm.o init.o interrupts.o 20obj-y += kvm-arm.o init.o interrupts.o
21obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o 21obj-y += arm.o handle_exit.o guest.o mmu.o emulate.o reset.o
22obj-y += coproc.o coproc_a15.o coproc_a7.o mmio.o psci.o perf.o 22obj-y += coproc.o coproc_a15.o coproc_a7.o mmio.o psci.o perf.o
23obj-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic.o 23obj-y += $(KVM)/arm/vgic.o
24obj-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic-v2.o 24obj-y += $(KVM)/arm/vgic-v2.o
25obj-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic-v2-emul.o 25obj-y += $(KVM)/arm/vgic-v2-emul.o
26obj-$(CONFIG_KVM_ARM_TIMER) += $(KVM)/arm/arch_timer.o 26obj-y += $(KVM)/arm/arch_timer.o
diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c
index e0e9434e4869..37b46c504534 100644
--- a/arch/arm/kvm/arm.c
+++ b/arch/arm/kvm/arm.c
@@ -170,9 +170,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext)
170{ 170{
171 int r; 171 int r;
172 switch (ext) { 172 switch (ext) {
173#ifdef CONFIG_KVM_ARM_VGIC
174 case KVM_CAP_IRQCHIP: 173 case KVM_CAP_IRQCHIP:
175#endif
176 case KVM_CAP_DEVICE_CTRL: 174 case KVM_CAP_DEVICE_CTRL:
177 case KVM_CAP_USER_MEMORY: 175 case KVM_CAP_USER_MEMORY:
178 case KVM_CAP_SYNC_MMU: 176 case KVM_CAP_SYNC_MMU:
@@ -829,8 +827,6 @@ static int kvm_vm_ioctl_set_device_addr(struct kvm *kvm,
829 827
830 switch (dev_id) { 828 switch (dev_id) {
831 case KVM_ARM_DEVICE_VGIC_V2: 829 case KVM_ARM_DEVICE_VGIC_V2:
832 if (!IS_ENABLED(CONFIG_KVM_ARM_VGIC))
833 return -ENXIO;
834 return kvm_vgic_addr(kvm, type, &dev_addr->addr, true); 830 return kvm_vgic_addr(kvm, type, &dev_addr->addr, true);
835 default: 831 default:
836 return -ENODEV; 832 return -ENODEV;
@@ -845,8 +841,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
845 841
846 switch (ioctl) { 842 switch (ioctl) {
847 case KVM_CREATE_IRQCHIP: { 843 case KVM_CREATE_IRQCHIP: {
848 if (!IS_ENABLED(CONFIG_KVM_ARM_VGIC))
849 return -ENXIO;
850 return kvm_vgic_create(kvm, KVM_DEV_TYPE_ARM_VGIC_V2); 844 return kvm_vgic_create(kvm, KVM_DEV_TYPE_ARM_VGIC_V2);
851 } 845 }
852 case KVM_ARM_SET_DEVICE_ADDR: { 846 case KVM_ARM_SET_DEVICE_ADDR: {
diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c
index 384bab67c462..d503fbb787d3 100644
--- a/arch/arm/kvm/guest.c
+++ b/arch/arm/kvm/guest.c
@@ -109,22 +109,6 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
109 return -EINVAL; 109 return -EINVAL;
110} 110}
111 111
112#ifndef CONFIG_KVM_ARM_TIMER
113
114#define NUM_TIMER_REGS 0
115
116static int copy_timer_indices(struct kvm_vcpu *vcpu, u64 __user *uindices)
117{
118 return 0;
119}
120
121static bool is_timer_reg(u64 index)
122{
123 return false;
124}
125
126#else
127
128#define NUM_TIMER_REGS 3 112#define NUM_TIMER_REGS 3
129 113
130static bool is_timer_reg(u64 index) 114static bool is_timer_reg(u64 index)
@@ -152,8 +136,6 @@ static int copy_timer_indices(struct kvm_vcpu *vcpu, u64 __user *uindices)
152 return 0; 136 return 0;
153} 137}
154 138
155#endif
156
157static int set_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) 139static int set_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg)
158{ 140{
159 void __user *uaddr = (void __user *)(long)reg->addr; 141 void __user *uaddr = (void __user *)(long)reg->addr;
diff --git a/arch/arm/kvm/interrupts_head.S b/arch/arm/kvm/interrupts_head.S
index 14d488388480..35e4a3a0c476 100644
--- a/arch/arm/kvm/interrupts_head.S
+++ b/arch/arm/kvm/interrupts_head.S
@@ -402,7 +402,6 @@ vcpu .req r0 @ vcpu pointer always in r0
402 * Assumes vcpu pointer in vcpu reg 402 * Assumes vcpu pointer in vcpu reg
403 */ 403 */
404.macro save_vgic_state 404.macro save_vgic_state
405#ifdef CONFIG_KVM_ARM_VGIC
406 /* Get VGIC VCTRL base into r2 */ 405 /* Get VGIC VCTRL base into r2 */
407 ldr r2, [vcpu, #VCPU_KVM] 406 ldr r2, [vcpu, #VCPU_KVM]
408 ldr r2, [r2, #KVM_VGIC_VCTRL] 407 ldr r2, [r2, #KVM_VGIC_VCTRL]
@@ -460,7 +459,6 @@ ARM_BE8(rev r6, r6 )
460 subs r4, r4, #1 459 subs r4, r4, #1
461 bne 1b 460 bne 1b
4622: 4612:
463#endif
464.endm 462.endm
465 463
466/* 464/*
@@ -469,7 +467,6 @@ ARM_BE8(rev r6, r6 )
469 * Assumes vcpu pointer in vcpu reg 467 * Assumes vcpu pointer in vcpu reg
470 */ 468 */
471.macro restore_vgic_state 469.macro restore_vgic_state
472#ifdef CONFIG_KVM_ARM_VGIC
473 /* Get VGIC VCTRL base into r2 */ 470 /* Get VGIC VCTRL base into r2 */
474 ldr r2, [vcpu, #VCPU_KVM] 471 ldr r2, [vcpu, #VCPU_KVM]
475 ldr r2, [r2, #KVM_VGIC_VCTRL] 472 ldr r2, [r2, #KVM_VGIC_VCTRL]
@@ -501,7 +498,6 @@ ARM_BE8(rev r6, r6 )
501 subs r4, r4, #1 498 subs r4, r4, #1
502 bne 1b 499 bne 1b
5032: 5002:
504#endif
505.endm 501.endm
506 502
507#define CNTHCTL_PL1PCTEN (1 << 0) 503#define CNTHCTL_PL1PCTEN (1 << 0)
@@ -515,7 +511,6 @@ ARM_BE8(rev r6, r6 )
515 * Clobbers r2-r5 511 * Clobbers r2-r5
516 */ 512 */
517.macro save_timer_state 513.macro save_timer_state
518#ifdef CONFIG_KVM_ARM_TIMER
519 ldr r4, [vcpu, #VCPU_KVM] 514 ldr r4, [vcpu, #VCPU_KVM]
520 ldr r2, [r4, #KVM_TIMER_ENABLED] 515 ldr r2, [r4, #KVM_TIMER_ENABLED]
521 cmp r2, #0 516 cmp r2, #0
@@ -537,7 +532,6 @@ ARM_BE8(rev r6, r6 )
537 mcrr p15, 4, r2, r2, c14 @ CNTVOFF 532 mcrr p15, 4, r2, r2, c14 @ CNTVOFF
538 533
5391: 5341:
540#endif
541 @ Allow physical timer/counter access for the host 535 @ Allow physical timer/counter access for the host
542 mrc p15, 4, r2, c14, c1, 0 @ CNTHCTL 536 mrc p15, 4, r2, c14, c1, 0 @ CNTHCTL
543 orr r2, r2, #(CNTHCTL_PL1PCEN | CNTHCTL_PL1PCTEN) 537 orr r2, r2, #(CNTHCTL_PL1PCEN | CNTHCTL_PL1PCTEN)
@@ -559,7 +553,6 @@ ARM_BE8(rev r6, r6 )
559 bic r2, r2, #CNTHCTL_PL1PCEN 553 bic r2, r2, #CNTHCTL_PL1PCEN
560 mcr p15, 4, r2, c14, c1, 0 @ CNTHCTL 554 mcr p15, 4, r2, c14, c1, 0 @ CNTHCTL
561 555
562#ifdef CONFIG_KVM_ARM_TIMER
563 ldr r4, [vcpu, #VCPU_KVM] 556 ldr r4, [vcpu, #VCPU_KVM]
564 ldr r2, [r4, #KVM_TIMER_ENABLED] 557 ldr r2, [r4, #KVM_TIMER_ENABLED]
565 cmp r2, #0 558 cmp r2, #0
@@ -579,7 +572,6 @@ ARM_BE8(rev r6, r6 )
579 and r2, r2, #3 572 and r2, r2, #3
580 mcr p15, 0, r2, c14, c3, 1 @ CNTV_CTL 573 mcr p15, 0, r2, c14, c3, 1 @ CNTV_CTL
5811: 5741:
582#endif
583.endm 575.endm
584 576
585.equ vmentry, 0 577.equ vmentry, 0
diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig
index f5590c81d95f..ee43750104fc 100644
--- a/arch/arm64/kvm/Kconfig
+++ b/arch/arm64/kvm/Kconfig
@@ -18,6 +18,7 @@ if VIRTUALIZATION
18 18
19config KVM 19config KVM
20 bool "Kernel-based Virtual Machine (KVM) support" 20 bool "Kernel-based Virtual Machine (KVM) support"
21 depends on OF
21 select MMU_NOTIFIER 22 select MMU_NOTIFIER
22 select PREEMPT_NOTIFIERS 23 select PREEMPT_NOTIFIERS
23 select ANON_INODES 24 select ANON_INODES
@@ -25,8 +26,7 @@ config KVM
25 select HAVE_KVM_ARCH_TLB_FLUSH_ALL 26 select HAVE_KVM_ARCH_TLB_FLUSH_ALL
26 select KVM_MMIO 27 select KVM_MMIO
27 select KVM_ARM_HOST 28 select KVM_ARM_HOST
28 select KVM_ARM_VGIC 29 select HAVE_KVM_IRQCHIP
29 select KVM_ARM_TIMER
30 select KVM_GENERIC_DIRTYLOG_READ_PROTECT 30 select KVM_GENERIC_DIRTYLOG_READ_PROTECT
31 select SRCU 31 select SRCU
32 ---help--- 32 ---help---
@@ -50,17 +50,4 @@ config KVM_ARM_MAX_VCPUS
50 large, so only choose a reasonable number that you expect to 50 large, so only choose a reasonable number that you expect to
51 actually use. 51 actually use.
52 52
53config KVM_ARM_VGIC
54 bool
55 depends on KVM_ARM_HOST && OF
56 select HAVE_KVM_IRQCHIP
57 ---help---
58 Adds support for a hardware assisted, in-kernel GIC emulation.
59
60config KVM_ARM_TIMER
61 bool
62 depends on KVM_ARM_VGIC
63 ---help---
64 Adds support for the Architected Timers in virtual machines.
65
66endif # VIRTUALIZATION 53endif # VIRTUALIZATION
diff --git a/arch/arm64/kvm/Makefile b/arch/arm64/kvm/Makefile
index 4e6e09ee4033..c92b26abc691 100644
--- a/arch/arm64/kvm/Makefile
+++ b/arch/arm64/kvm/Makefile
@@ -19,11 +19,11 @@ kvm-$(CONFIG_KVM_ARM_HOST) += emulate.o inject_fault.o regmap.o
19kvm-$(CONFIG_KVM_ARM_HOST) += hyp.o hyp-init.o handle_exit.o 19kvm-$(CONFIG_KVM_ARM_HOST) += hyp.o hyp-init.o handle_exit.o
20kvm-$(CONFIG_KVM_ARM_HOST) += guest.o reset.o sys_regs.o sys_regs_generic_v8.o 20kvm-$(CONFIG_KVM_ARM_HOST) += guest.o reset.o sys_regs.o sys_regs_generic_v8.o
21 21
22kvm-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic.o 22kvm-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/vgic.o
23kvm-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic-v2.o 23kvm-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/vgic-v2.o
24kvm-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic-v2-emul.o 24kvm-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/vgic-v2-emul.o
25kvm-$(CONFIG_KVM_ARM_VGIC) += vgic-v2-switch.o 25kvm-$(CONFIG_KVM_ARM_HOST) += vgic-v2-switch.o
26kvm-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic-v3.o 26kvm-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/vgic-v3.o
27kvm-$(CONFIG_KVM_ARM_VGIC) += $(KVM)/arm/vgic-v3-emul.o 27kvm-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/vgic-v3-emul.o
28kvm-$(CONFIG_KVM_ARM_VGIC) += vgic-v3-switch.o 28kvm-$(CONFIG_KVM_ARM_HOST) += vgic-v3-switch.o
29kvm-$(CONFIG_KVM_ARM_TIMER) += $(KVM)/arm/arch_timer.o 29kvm-$(CONFIG_KVM_ARM_HOST) += $(KVM)/arm/arch_timer.o
diff --git a/include/kvm/arm_arch_timer.h b/include/kvm/arm_arch_timer.h
index b3f45a578344..a74e4c2bf188 100644
--- a/include/kvm/arm_arch_timer.h
+++ b/include/kvm/arm_arch_timer.h
@@ -24,17 +24,14 @@
24#include <linux/workqueue.h> 24#include <linux/workqueue.h>
25 25
26struct arch_timer_kvm { 26struct arch_timer_kvm {
27#ifdef CONFIG_KVM_ARM_TIMER
28 /* Is the timer enabled */ 27 /* Is the timer enabled */
29 bool enabled; 28 bool enabled;
30 29
31 /* Virtual offset */ 30 /* Virtual offset */
32 cycle_t cntvoff; 31 cycle_t cntvoff;
33#endif
34}; 32};
35 33
36struct arch_timer_cpu { 34struct arch_timer_cpu {
37#ifdef CONFIG_KVM_ARM_TIMER
38 /* Registers: control register, timer value */ 35 /* Registers: control register, timer value */
39 u32 cntv_ctl; /* Saved/restored */ 36 u32 cntv_ctl; /* Saved/restored */
40 cycle_t cntv_cval; /* Saved/restored */ 37 cycle_t cntv_cval; /* Saved/restored */
@@ -55,10 +52,8 @@ struct arch_timer_cpu {
55 52
56 /* Timer IRQ */ 53 /* Timer IRQ */
57 const struct kvm_irq_level *irq; 54 const struct kvm_irq_level *irq;
58#endif
59}; 55};
60 56
61#ifdef CONFIG_KVM_ARM_TIMER
62int kvm_timer_hyp_init(void); 57int kvm_timer_hyp_init(void);
63void kvm_timer_enable(struct kvm *kvm); 58void kvm_timer_enable(struct kvm *kvm);
64void kvm_timer_init(struct kvm *kvm); 59void kvm_timer_init(struct kvm *kvm);
@@ -72,30 +67,4 @@ void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu);
72u64 kvm_arm_timer_get_reg(struct kvm_vcpu *, u64 regid); 67u64 kvm_arm_timer_get_reg(struct kvm_vcpu *, u64 regid);
73int kvm_arm_timer_set_reg(struct kvm_vcpu *, u64 regid, u64 value); 68int kvm_arm_timer_set_reg(struct kvm_vcpu *, u64 regid, u64 value);
74 69
75#else
76static inline int kvm_timer_hyp_init(void)
77{
78 return 0;
79};
80
81static inline void kvm_timer_enable(struct kvm *kvm) {}
82static inline void kvm_timer_init(struct kvm *kvm) {}
83static inline void kvm_timer_vcpu_reset(struct kvm_vcpu *vcpu,
84 const struct kvm_irq_level *irq) {}
85static inline void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu) {}
86static inline void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu) {}
87static inline void kvm_timer_sync_hwstate(struct kvm_vcpu *vcpu) {}
88static inline void kvm_timer_vcpu_terminate(struct kvm_vcpu *vcpu) {}
89
90static inline int kvm_arm_timer_set_reg(struct kvm_vcpu *vcpu, u64 regid, u64 value)
91{
92 return 0;
93}
94
95static inline u64 kvm_arm_timer_get_reg(struct kvm_vcpu *vcpu, u64 regid)
96{
97 return 0;
98}
99#endif
100
101#endif 70#endif
diff --git a/include/kvm/arm_vgic.h b/include/kvm/arm_vgic.h
index 7c55dd5dd2c9..b81630b1da85 100644
--- a/include/kvm/arm_vgic.h
+++ b/include/kvm/arm_vgic.h
@@ -148,7 +148,6 @@ struct vgic_vm_ops {
148}; 148};
149 149
150struct vgic_dist { 150struct vgic_dist {
151#ifdef CONFIG_KVM_ARM_VGIC
152 spinlock_t lock; 151 spinlock_t lock;
153 bool in_kernel; 152 bool in_kernel;
154 bool ready; 153 bool ready;
@@ -237,7 +236,6 @@ struct vgic_dist {
237 unsigned long *irq_pending_on_cpu; 236 unsigned long *irq_pending_on_cpu;
238 237
239 struct vgic_vm_ops vm_ops; 238 struct vgic_vm_ops vm_ops;
240#endif
241}; 239};
242 240
243struct vgic_v2_cpu_if { 241struct vgic_v2_cpu_if {
@@ -265,7 +263,6 @@ struct vgic_v3_cpu_if {
265}; 263};
266 264
267struct vgic_cpu { 265struct vgic_cpu {
268#ifdef CONFIG_KVM_ARM_VGIC
269 /* per IRQ to LR mapping */ 266 /* per IRQ to LR mapping */
270 u8 *vgic_irq_lr_map; 267 u8 *vgic_irq_lr_map;
271 268
@@ -284,7 +281,6 @@ struct vgic_cpu {
284 struct vgic_v2_cpu_if vgic_v2; 281 struct vgic_v2_cpu_if vgic_v2;
285 struct vgic_v3_cpu_if vgic_v3; 282 struct vgic_v3_cpu_if vgic_v3;
286 }; 283 };
287#endif
288}; 284};
289 285
290#define LR_EMPTY 0xff 286#define LR_EMPTY 0xff
@@ -297,7 +293,6 @@ struct kvm_vcpu;
297struct kvm_run; 293struct kvm_run;
298struct kvm_exit_mmio; 294struct kvm_exit_mmio;
299 295
300#ifdef CONFIG_KVM_ARM_VGIC
301int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write); 296int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write);
302int kvm_vgic_hyp_init(void); 297int kvm_vgic_hyp_init(void);
303int kvm_vgic_map_resources(struct kvm *kvm); 298int kvm_vgic_map_resources(struct kvm *kvm);
@@ -334,84 +329,4 @@ static inline int vgic_v3_probe(struct device_node *vgic_node,
334} 329}
335#endif 330#endif
336 331
337#else
338static inline int kvm_vgic_hyp_init(void)
339{
340 return 0;
341}
342
343static inline int kvm_vgic_set_addr(struct kvm *kvm, unsigned long type, u64 addr)
344{
345 return 0;
346}
347
348static inline int kvm_vgic_addr(struct kvm *kvm, unsigned long type, u64 *addr, bool write)
349{
350 return -ENXIO;
351}
352
353static inline int kvm_vgic_map_resources(struct kvm *kvm)
354{
355 return 0;
356}
357
358static inline int kvm_vgic_create(struct kvm *kvm, u32 type)
359{
360 return 0;
361}
362
363static inline void kvm_vgic_destroy(struct kvm *kvm)
364{
365}
366
367static inline void kvm_vgic_vcpu_destroy(struct kvm_vcpu *vcpu)
368{
369}
370
371static inline int kvm_vgic_vcpu_init(struct kvm_vcpu *vcpu)
372{
373 return 0;
374}
375
376static inline void kvm_vgic_flush_hwstate(struct kvm_vcpu *vcpu) {}
377static inline void kvm_vgic_sync_hwstate(struct kvm_vcpu *vcpu) {}
378
379static inline int kvm_vgic_inject_irq(struct kvm *kvm, int cpuid,
380 unsigned int irq_num, bool level)
381{
382 return 0;
383}
384
385static inline int kvm_vgic_vcpu_pending_irq(struct kvm_vcpu *vcpu)
386{
387 return 0;
388}
389
390static inline bool vgic_handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *run,
391 struct kvm_exit_mmio *mmio)
392{
393 return false;
394}
395
396static inline int irqchip_in_kernel(struct kvm *kvm)
397{
398 return 0;
399}
400
401static inline bool vgic_initialized(struct kvm *kvm)
402{
403 return true;
404}
405
406static inline bool vgic_ready(struct kvm *kvm)
407{
408 return true;
409}
410
411static inline int kvm_vgic_get_max_vcpus(void)
412{
413 return KVM_MAX_VCPUS;
414}
415#endif
416
417#endif 332#endif