mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
target-arm: Use the kernel's idea of MPIDR if we're using KVM
When we're using KVM, the kernel's internal idea of the MPIDR affinity fields must match the values we tell it for the guest vcpu cluster configuration in the device tree. Since at the moment the kernel doesn't support letting userspace tell it the correct affinity fields to use, we must read the kernel's view and reflect that back in the device tree. Signed-off-by: Shlomo Pongratz <shlomo.pongratz@huawei.com> Signed-off-by: Pavel Fedin <p.fedin@samsung.com> Message-id: 02f601d0a1e6$90c7d630$b2578290$@samsung.com [PMM: Use a local #define rather than a global variable for the TCG ARM_CPUS_PER_CLUSTER setting. Tweak a comment. Update the commit message.] Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
parent
8f4d260e70
commit
eb5e1d3c85
7 changed files with 64 additions and 9 deletions
|
@ -153,10 +153,14 @@ bool kvm_arm_reg_syncs_via_cpreg_list(uint64_t regidx)
|
|||
}
|
||||
}
|
||||
|
||||
#define ARM_MPIDR_HWID_BITMASK 0xFFFFFF
|
||||
#define ARM_CPU_ID_MPIDR 0, 0, 0, 5
|
||||
|
||||
int kvm_arch_init_vcpu(CPUState *cs)
|
||||
{
|
||||
int ret;
|
||||
uint64_t v;
|
||||
uint32_t mpidr;
|
||||
struct kvm_one_reg r;
|
||||
ARMCPU *cpu = ARM_CPU(cs);
|
||||
|
||||
|
@ -193,6 +197,17 @@ int kvm_arch_init_vcpu(CPUState *cs)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* When KVM is in use, PSCI is emulated in-kernel and not by qemu.
|
||||
* Currently KVM has its own idea about MPIDR assignment, so we
|
||||
* override our defaults with what we get from KVM.
|
||||
*/
|
||||
ret = kvm_get_one_reg(cs, ARM_CP15_REG32(ARM_CPU_ID_MPIDR), &mpidr);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
cpu->mp_affinity = mpidr & ARM_MPIDR_HWID_BITMASK;
|
||||
|
||||
return kvm_arm_init_cpreg_list(cpu);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue