mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -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
|
@ -72,6 +72,21 @@ bool arm_is_psci_call(ARMCPU *cpu, int excp_type)
|
|||
}
|
||||
}
|
||||
|
||||
static CPUState *get_cpu_by_id(uint64_t id)
|
||||
{
|
||||
CPUState *cpu;
|
||||
|
||||
CPU_FOREACH(cpu) {
|
||||
ARMCPU *armcpu = ARM_CPU(cpu);
|
||||
|
||||
if (armcpu->mp_affinity == id) {
|
||||
return cpu;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void arm_handle_psci_call(ARMCPU *cpu)
|
||||
{
|
||||
/*
|
||||
|
@ -121,7 +136,7 @@ void arm_handle_psci_call(ARMCPU *cpu)
|
|||
|
||||
switch (param[2]) {
|
||||
case 0:
|
||||
target_cpu_state = qemu_get_cpu(mpidr & 0xff);
|
||||
target_cpu_state = get_cpu_by_id(mpidr);
|
||||
if (!target_cpu_state) {
|
||||
ret = QEMU_PSCI_RET_INVALID_PARAMS;
|
||||
break;
|
||||
|
@ -153,7 +168,7 @@ void arm_handle_psci_call(ARMCPU *cpu)
|
|||
context_id = param[3];
|
||||
|
||||
/* change to the cpu we are powering up */
|
||||
target_cpu_state = qemu_get_cpu(mpidr & 0xff);
|
||||
target_cpu_state = get_cpu_by_id(mpidr);
|
||||
if (!target_cpu_state) {
|
||||
ret = QEMU_PSCI_RET_INVALID_PARAMS;
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue