xemu/include/hw/ppc
Greg Kurz 648edb6475 spapr: move VCPU calculation to core machine code
The VCPU ids are currently computed and assigned to each individual
CPU threads in spapr_cpu_core_realize(). But the numbering logic
of VCPU ids is actually a machine-level concept, and many places
in hw/ppc/spapr.c also have to compute VCPU ids out of CPU indexes.

The current formula used in spapr_cpu_core_realize() is:

    vcpu_id = (cc->core_id * spapr->vsmt / smp_threads) + i

where:

    cc->core_id is a multiple of smp_threads
    cpu_index = cc->core_id + i
    0 <= i < smp_threads

So we have:

    cpu_index % smp_threads == i
    cc->core_id / smp_threads == cpu_index / smp_threads

hence:

    vcpu_id =
        (cpu_index / smp_threads) * spapr->vsmt + cpu_index % smp_threads;

This formula was used before VSMT at the time VCPU ids where computed
at the target emulation level. It has the advantage of being useable
to derive a VPCU id out of a CPU index only. It is fitted for all the
places where the machine code has to compute a VCPU id.

This patch introduces an accessor to set the VCPU id in a PowerPCCPU object
using the above formula. It is a first step to consolidate all the VCPU id
logic in a single place.

Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2018-02-16 12:14:26 +11:00
..
fdt.h Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
mac_dbdma.h mac_dbdma: remove DBDMA_init() function 2017-09-27 13:05:41 +10:00
openpic.h ppc: Fix OpenPIC model 2017-09-27 13:05:41 +10:00
pnv_core.h ppc: pnv: drop PnvChipClass::cpu_model field 2017-10-17 10:34:01 +11:00
pnv_lpc.h pnv: Fix build failures on some host platforms 2017-05-11 09:45:15 +10:00
pnv_occ.h pnv: Fix build failures on some host platforms 2017-05-11 09:45:15 +10:00
pnv_psi.h ppc/pnv: Remove unused XICSState reference 2017-07-17 15:07:05 +10:00
pnv_xscom.h ppc/pnv: fix PnvChip redefinition in <hw/ppc/pnv_xscom.h> 2018-01-27 17:25:27 +11:00
pnv.h ppc/pnv: fix XSCOM core addressing on POWER9 2018-01-17 09:35:24 +11:00
ppc4xx.h ppc4xx: Make MAL emulation more generic 2017-09-08 09:30:55 +10:00
ppc_e500.h intc/openpic: Build openpic only once 2013-07-09 21:33:02 +02:00
ppc.h ppc: spapr: replace ppc_cpu_parse_features() with cpu_parse_cpu_model() 2017-10-17 10:34:00 +11:00
spapr_cpu_core.h spapr_cpu_core: instantiate CPUs separately 2017-12-15 09:49:23 +11:00
spapr_drc.h hw/ppc: CAS reset on early device hotplug 2017-09-08 09:30:54 +10:00
spapr_ovec.h ppc/xive: fix OV5_XIVE_EXPLOIT bits 2017-09-15 10:29:48 +10:00
spapr_rtas.h tests: add RTAS command in the protocol 2016-09-23 10:29:40 +10:00
spapr_vio.h spapr: introduce a spapr_qirq() helper 2017-12-15 09:49:24 +11:00
spapr.h spapr: move VCPU calculation to core machine code 2018-02-16 12:14:26 +11:00
xics.h spapr: introduce a spapr_qirq() helper 2017-12-15 09:49:24 +11:00