diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2012-12-12 13:52:05 -0500 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2013-06-12 11:40:32 -0400 |
commit | dcd2e40c1e1cce302498d16d095b0f8a30326f74 (patch) | |
tree | 4cfe34f1c08aa77a4ba14e0c4d38b3c8b044e79c /arch/arm64/include | |
parent | 003300de6c3e51934fb52eb2677f6f4fb4996cbd (diff) |
arm64: KVM: PSCI implementation
Wire the PSCI backend into the exit handling code.
Reviewed-by: Christopher Covington <cov@codeaurora.org>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'arch/arm64/include')
-rw-r--r-- | arch/arm64/include/asm/kvm_host.h | 2 | ||||
-rw-r--r-- | arch/arm64/include/asm/kvm_psci.h | 23 | ||||
-rw-r--r-- | arch/arm64/include/uapi/asm/kvm.h | 16 |
3 files changed, 40 insertions, 1 deletions
diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h index 2500eb6a4d2a..2fdeb326c3ee 100644 --- a/arch/arm64/include/asm/kvm_host.h +++ b/arch/arm64/include/asm/kvm_host.h | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <kvm/arm_vgic.h> | 34 | #include <kvm/arm_vgic.h> |
35 | #include <kvm/arm_arch_timer.h> | 35 | #include <kvm/arm_arch_timer.h> |
36 | 36 | ||
37 | #define KVM_VCPU_MAX_FEATURES 0 | 37 | #define KVM_VCPU_MAX_FEATURES 1 |
38 | 38 | ||
39 | /* We don't currently support large pages. */ | 39 | /* We don't currently support large pages. */ |
40 | #define KVM_HPAGE_GFN_SHIFT(x) 0 | 40 | #define KVM_HPAGE_GFN_SHIFT(x) 0 |
diff --git a/arch/arm64/include/asm/kvm_psci.h b/arch/arm64/include/asm/kvm_psci.h new file mode 100644 index 000000000000..e301a4816355 --- /dev/null +++ b/arch/arm64/include/asm/kvm_psci.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2012,2013 - ARM Ltd | ||
3 | * Author: Marc Zyngier <marc.zyngier@arm.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License version 2 as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | ||
17 | |||
18 | #ifndef __ARM64_KVM_PSCI_H__ | ||
19 | #define __ARM64_KVM_PSCI_H__ | ||
20 | |||
21 | bool kvm_psci_call(struct kvm_vcpu *vcpu); | ||
22 | |||
23 | #endif /* __ARM64_KVM_PSCI_H__ */ | ||
diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index ebac919dc0ca..fb60f9037057 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h | |||
@@ -69,6 +69,8 @@ struct kvm_regs { | |||
69 | #define KVM_VGIC_V2_DIST_SIZE 0x1000 | 69 | #define KVM_VGIC_V2_DIST_SIZE 0x1000 |
70 | #define KVM_VGIC_V2_CPU_SIZE 0x2000 | 70 | #define KVM_VGIC_V2_CPU_SIZE 0x2000 |
71 | 71 | ||
72 | #define KVM_ARM_VCPU_POWER_OFF 0 /* CPU is started in OFF state */ | ||
73 | |||
72 | struct kvm_vcpu_init { | 74 | struct kvm_vcpu_init { |
73 | __u32 target; | 75 | __u32 target; |
74 | __u32 features[7]; | 76 | __u32 features[7]; |
@@ -141,6 +143,20 @@ struct kvm_arch_memory_slot { | |||
141 | /* Highest supported SPI, from VGIC_NR_IRQS */ | 143 | /* Highest supported SPI, from VGIC_NR_IRQS */ |
142 | #define KVM_ARM_IRQ_GIC_MAX 127 | 144 | #define KVM_ARM_IRQ_GIC_MAX 127 |
143 | 145 | ||
146 | /* PSCI interface */ | ||
147 | #define KVM_PSCI_FN_BASE 0x95c1ba5e | ||
148 | #define KVM_PSCI_FN(n) (KVM_PSCI_FN_BASE + (n)) | ||
149 | |||
150 | #define KVM_PSCI_FN_CPU_SUSPEND KVM_PSCI_FN(0) | ||
151 | #define KVM_PSCI_FN_CPU_OFF KVM_PSCI_FN(1) | ||
152 | #define KVM_PSCI_FN_CPU_ON KVM_PSCI_FN(2) | ||
153 | #define KVM_PSCI_FN_MIGRATE KVM_PSCI_FN(3) | ||
154 | |||
155 | #define KVM_PSCI_RET_SUCCESS 0 | ||
156 | #define KVM_PSCI_RET_NI ((unsigned long)-1) | ||
157 | #define KVM_PSCI_RET_INVAL ((unsigned long)-2) | ||
158 | #define KVM_PSCI_RET_DENIED ((unsigned long)-3) | ||
159 | |||
144 | #endif | 160 | #endif |
145 | 161 | ||
146 | #endif /* __ARM_KVM_H__ */ | 162 | #endif /* __ARM_KVM_H__ */ |