diff options
| author | Andre Przywara <andre.przywara@arm.com> | 2014-06-02 09:37:13 -0400 |
|---|---|---|
| committer | Christoffer Dall <christoffer.dall@linaro.org> | 2015-01-20 12:25:17 -0500 |
| commit | 4429fc64b90368e9bc93f933ea8b011d8db3a2f2 (patch) | |
| tree | a7cb2e3dbebe4c2d6dc7a17e648a04b1c82090b9 /arch/arm/include/asm | |
| parent | 7276030a082c9c33150e5900a80e26c6e3189b16 (diff) | |
arm/arm64: KVM: rework MPIDR assignment and add accessors
The virtual MPIDR registers (containing topology information) for the
guest are currently mapped linearily to the vcpu_id. Improve this
mapping for arm64 by using three levels to not artificially limit the
number of vCPUs.
To help this, change and rename the kvm_vcpu_get_mpidr() function to
mask off the non-affinity bits in the MPIDR register.
Also add an accessor to later allow easier access to a vCPU with a
given MPIDR. Use this new accessor in the PSCI emulation.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Christoffer Dall <christoffer.dall@linaro.org>
Reviewed-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
Diffstat (limited to 'arch/arm/include/asm')
| -rw-r--r-- | arch/arm/include/asm/kvm_emulate.h | 5 | ||||
| -rw-r--r-- | arch/arm/include/asm/kvm_host.h | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/arch/arm/include/asm/kvm_emulate.h b/arch/arm/include/asm/kvm_emulate.h index 66ce17655bb9..c52861577567 100644 --- a/arch/arm/include/asm/kvm_emulate.h +++ b/arch/arm/include/asm/kvm_emulate.h | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | #include <asm/kvm_asm.h> | 23 | #include <asm/kvm_asm.h> |
| 24 | #include <asm/kvm_mmio.h> | 24 | #include <asm/kvm_mmio.h> |
| 25 | #include <asm/kvm_arm.h> | 25 | #include <asm/kvm_arm.h> |
| 26 | #include <asm/cputype.h> | ||
| 26 | 27 | ||
| 27 | unsigned long *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num); | 28 | unsigned long *vcpu_reg(struct kvm_vcpu *vcpu, u8 reg_num); |
| 28 | unsigned long *vcpu_spsr(struct kvm_vcpu *vcpu); | 29 | unsigned long *vcpu_spsr(struct kvm_vcpu *vcpu); |
| @@ -167,9 +168,9 @@ static inline u32 kvm_vcpu_hvc_get_imm(struct kvm_vcpu *vcpu) | |||
| 167 | return kvm_vcpu_get_hsr(vcpu) & HSR_HVC_IMM_MASK; | 168 | return kvm_vcpu_get_hsr(vcpu) & HSR_HVC_IMM_MASK; |
| 168 | } | 169 | } |
| 169 | 170 | ||
| 170 | static inline unsigned long kvm_vcpu_get_mpidr(struct kvm_vcpu *vcpu) | 171 | static inline unsigned long kvm_vcpu_get_mpidr_aff(struct kvm_vcpu *vcpu) |
| 171 | { | 172 | { |
| 172 | return vcpu->arch.cp15[c0_MPIDR]; | 173 | return vcpu->arch.cp15[c0_MPIDR] & MPIDR_HWID_BITMASK; |
| 173 | } | 174 | } |
| 174 | 175 | ||
| 175 | static inline void kvm_vcpu_set_be(struct kvm_vcpu *vcpu) | 176 | static inline void kvm_vcpu_set_be(struct kvm_vcpu *vcpu) |
diff --git a/arch/arm/include/asm/kvm_host.h b/arch/arm/include/asm/kvm_host.h index 7d07eb85c0b0..2fa51740edc2 100644 --- a/arch/arm/include/asm/kvm_host.h +++ b/arch/arm/include/asm/kvm_host.h | |||
| @@ -236,6 +236,8 @@ int kvm_perf_teardown(void); | |||
| 236 | 236 | ||
| 237 | void kvm_mmu_wp_memory_region(struct kvm *kvm, int slot); | 237 | void kvm_mmu_wp_memory_region(struct kvm *kvm, int slot); |
| 238 | 238 | ||
| 239 | struct kvm_vcpu *kvm_mpidr_to_vcpu(struct kvm *kvm, unsigned long mpidr); | ||
| 240 | |||
| 239 | static inline void kvm_arch_hardware_disable(void) {} | 241 | static inline void kvm_arch_hardware_disable(void) {} |
| 240 | static inline void kvm_arch_hardware_unsetup(void) {} | 242 | static inline void kvm_arch_hardware_unsetup(void) {} |
| 241 | static inline void kvm_arch_sync_events(struct kvm *kvm) {} | 243 | static inline void kvm_arch_sync_events(struct kvm *kvm) {} |
