mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
hw/arm/virt: extract mp-affinity calculation in separate function
Signed-off-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <1493816238-33120-3-git-send-email-imammedo@redhat.com> Reviewed-by: Andrew Jones <drjones@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
parent
63baf8bf01
commit
46de5913b6
3 changed files with 37 additions and 20 deletions
|
@ -458,6 +458,13 @@ static void arm_disas_set_info(CPUState *cpu, disassemble_info *info)
|
|||
}
|
||||
}
|
||||
|
||||
uint64_t arm_cpu_mp_affinity(int idx, uint8_t clustersz)
|
||||
{
|
||||
uint32_t Aff1 = idx / clustersz;
|
||||
uint32_t Aff0 = idx % clustersz;
|
||||
return (Aff1 << ARM_AFF1_SHIFT) | Aff0;
|
||||
}
|
||||
|
||||
static void arm_cpu_initfn(Object *obj)
|
||||
{
|
||||
CPUState *cs = CPU(obj);
|
||||
|
@ -709,9 +716,8 @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
|
|||
* so these bits always RAZ.
|
||||
*/
|
||||
if (cpu->mp_affinity == ARM64_AFFINITY_INVALID) {
|
||||
uint32_t Aff1 = cs->cpu_index / ARM_DEFAULT_CPUS_PER_CLUSTER;
|
||||
uint32_t Aff0 = cs->cpu_index % ARM_DEFAULT_CPUS_PER_CLUSTER;
|
||||
cpu->mp_affinity = (Aff1 << ARM_AFF1_SHIFT) | Aff0;
|
||||
cpu->mp_affinity = arm_cpu_mp_affinity(cs->cpu_index,
|
||||
ARM_DEFAULT_CPUS_PER_CLUSTER);
|
||||
}
|
||||
|
||||
if (cpu->reset_hivecs) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue