diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2012-10-15 15:09:45 +0400 |
---|---|---|
committer | Christoffer Dall <cdall@cs.columbia.edu> | 2013-03-07 03:48:44 +0400 |
commit | 728d577d357c9caf83f75d0a38f318f343999cc2 (patch) | |
tree | 1b2fa2fcc4960b3a673476e6ead79461c9a210b4 /arch/arm/kvm/guest.c | |
parent | b4034bde5f168f2383a54b4573e1e440dbc169cf (diff) | |
download | linux-728d577d357c9caf83f75d0a38f318f343999cc2.tar.xz |
ARM: KVM: move kvm_target_cpu to guest.c
guest.c already contains some target-specific checks. Let's move
kvm_target_cpu() over there so arm.c is mostly target agnostic.
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'arch/arm/kvm/guest.c')
-rw-r--r-- | arch/arm/kvm/guest.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c index 2339d9609d36..152d03612181 100644 --- a/arch/arm/kvm/guest.c +++ b/arch/arm/kvm/guest.c @@ -22,6 +22,7 @@ #include <linux/module.h> #include <linux/vmalloc.h> #include <linux/fs.h> +#include <asm/cputype.h> #include <asm/uaccess.h> #include <asm/kvm.h> #include <asm/kvm_asm.h> @@ -180,6 +181,22 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, return -EINVAL; } +int __attribute_const__ kvm_target_cpu(void) +{ + unsigned long implementor = read_cpuid_implementor(); + unsigned long part_number = read_cpuid_part_number(); + + if (implementor != ARM_CPU_IMP_ARM) + return -EINVAL; + + switch (part_number) { + case ARM_CPU_PART_CORTEX_A15: + return KVM_ARM_TARGET_CORTEX_A15; + default: + return -EINVAL; + } +} + int kvm_vcpu_set_target(struct kvm_vcpu *vcpu, const struct kvm_vcpu_init *init) { |