diff options
author | Anup Patel <anup.patel@linaro.org> | 2013-11-14 10:20:08 -0500 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2013-12-28 05:28:50 -0500 |
commit | e28100bd8ed9e37b7cd4578140a1e7f95bd40835 (patch) | |
tree | 0f08697c384129e26eb2db125ff2c1a1383fbd1f /arch/arm64 | |
parent | da7814700a0c408bead58ce4714b7625ffbaade1 (diff) |
arm64: KVM: Support X-Gene guest VCPU on APM X-Gene host
This patch allows us to have X-Gene guest VCPU when using KVM arm64
on APM X-Gene host.
We add KVM_ARM_TARGET_XGENE_POTENZA for X-Gene Potenza compatible
guest VCPU and we return KVM_ARM_TARGET_XGENE_POTENZA in kvm_target_cpu()
when running on X-Gene host with Potenza core.
[maz: sanitized the commit log]
Signed-off-by: Anup Patel <anup.patel@linaro.org>
Signed-off-by: Pranavkumar Sawargaonkar <pranavkumar@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'arch/arm64')
-rw-r--r-- | arch/arm64/include/uapi/asm/kvm.h | 3 | ||||
-rw-r--r-- | arch/arm64/kvm/guest.c | 32 | ||||
-rw-r--r-- | arch/arm64/kvm/sys_regs_generic_v8.c | 3 |
3 files changed, 24 insertions, 14 deletions
diff --git a/arch/arm64/include/uapi/asm/kvm.h b/arch/arm64/include/uapi/asm/kvm.h index 5031f4263937..d9f026bc1a27 100644 --- a/arch/arm64/include/uapi/asm/kvm.h +++ b/arch/arm64/include/uapi/asm/kvm.h | |||
@@ -55,8 +55,9 @@ struct kvm_regs { | |||
55 | #define KVM_ARM_TARGET_AEM_V8 0 | 55 | #define KVM_ARM_TARGET_AEM_V8 0 |
56 | #define KVM_ARM_TARGET_FOUNDATION_V8 1 | 56 | #define KVM_ARM_TARGET_FOUNDATION_V8 1 |
57 | #define KVM_ARM_TARGET_CORTEX_A57 2 | 57 | #define KVM_ARM_TARGET_CORTEX_A57 2 |
58 | #define KVM_ARM_TARGET_XGENE_POTENZA 3 | ||
58 | 59 | ||
59 | #define KVM_ARM_NUM_TARGETS 3 | 60 | #define KVM_ARM_NUM_TARGETS 4 |
60 | 61 | ||
61 | /* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */ | 62 | /* KVM_ARM_SET_DEVICE_ADDR ioctl id encoding */ |
62 | #define KVM_ARM_DEVICE_TYPE_SHIFT 0 | 63 | #define KVM_ARM_DEVICE_TYPE_SHIFT 0 |
diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 3f0731e53274..08745578d54d 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c | |||
@@ -207,20 +207,26 @@ int __attribute_const__ kvm_target_cpu(void) | |||
207 | unsigned long implementor = read_cpuid_implementor(); | 207 | unsigned long implementor = read_cpuid_implementor(); |
208 | unsigned long part_number = read_cpuid_part_number(); | 208 | unsigned long part_number = read_cpuid_part_number(); |
209 | 209 | ||
210 | if (implementor != ARM_CPU_IMP_ARM) | 210 | switch (implementor) { |
211 | return -EINVAL; | 211 | case ARM_CPU_IMP_ARM: |
212 | switch (part_number) { | ||
213 | case ARM_CPU_PART_AEM_V8: | ||
214 | return KVM_ARM_TARGET_AEM_V8; | ||
215 | case ARM_CPU_PART_FOUNDATION: | ||
216 | return KVM_ARM_TARGET_FOUNDATION_V8; | ||
217 | case ARM_CPU_PART_CORTEX_A57: | ||
218 | return KVM_ARM_TARGET_CORTEX_A57; | ||
219 | }; | ||
220 | break; | ||
221 | case ARM_CPU_IMP_APM: | ||
222 | switch (part_number) { | ||
223 | case APM_CPU_PART_POTENZA: | ||
224 | return KVM_ARM_TARGET_XGENE_POTENZA; | ||
225 | }; | ||
226 | break; | ||
227 | }; | ||
212 | 228 | ||
213 | switch (part_number) { | 229 | return -EINVAL; |
214 | case ARM_CPU_PART_AEM_V8: | ||
215 | return KVM_ARM_TARGET_AEM_V8; | ||
216 | case ARM_CPU_PART_FOUNDATION: | ||
217 | return KVM_ARM_TARGET_FOUNDATION_V8; | ||
218 | case ARM_CPU_PART_CORTEX_A57: | ||
219 | /* Currently handled by the generic backend */ | ||
220 | return KVM_ARM_TARGET_CORTEX_A57; | ||
221 | default: | ||
222 | return -EINVAL; | ||
223 | } | ||
224 | } | 230 | } |
225 | 231 | ||
226 | int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, | 232 | int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, |
diff --git a/arch/arm64/kvm/sys_regs_generic_v8.c b/arch/arm64/kvm/sys_regs_generic_v8.c index 4268ab9356b1..8fe6f76b0edc 100644 --- a/arch/arm64/kvm/sys_regs_generic_v8.c +++ b/arch/arm64/kvm/sys_regs_generic_v8.c | |||
@@ -90,6 +90,9 @@ static int __init sys_reg_genericv8_init(void) | |||
90 | &genericv8_target_table); | 90 | &genericv8_target_table); |
91 | kvm_register_target_sys_reg_table(KVM_ARM_TARGET_CORTEX_A57, | 91 | kvm_register_target_sys_reg_table(KVM_ARM_TARGET_CORTEX_A57, |
92 | &genericv8_target_table); | 92 | &genericv8_target_table); |
93 | kvm_register_target_sys_reg_table(KVM_ARM_TARGET_XGENE_POTENZA, | ||
94 | &genericv8_target_table); | ||
95 | |||
93 | return 0; | 96 | return 0; |
94 | } | 97 | } |
95 | late_initcall(sys_reg_genericv8_init); | 98 | late_initcall(sys_reg_genericv8_init); |