home_node_associativity reply now uses the associativity values for tcpu->node_id provided by numa_assoc_array.
This will avoid further changes in this code when numa_assoc_array changes values, but it won't be enough to prevent further changes if (falar aqui q se mudar o tamanho do array tem q mexer nessa funcao tambem, falar q a macro associativity() deixa a automacao de tudo mto unreadable) Signed-off-by: Daniel Henrique Barboza <danielhb...@gmail.com> --- hw/ppc/spapr_hcall.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index c1d01228c6..2ec30efdcb 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1878,9 +1878,13 @@ static target_ulong h_home_node_associativity(PowerPCCPU *cpu, target_ulong opcode, target_ulong *args) { + SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr); target_ulong flags = args[0]; target_ulong procno = args[1]; PowerPCCPU *tcpu; + uint32_t assoc_domain1; + uint32_t assoc_domain2; + uint32_t assoc_domain3; int idx; /* only support procno from H_REGISTER_VPA */ @@ -1893,13 +1897,21 @@ static target_ulong h_home_node_associativity(PowerPCCPU *cpu, return H_P2; } + /* + * Index 0 is the ibm,associativity size of the node, + * which isn't relevant here. + */ + assoc_domain1 = smc->numa_assoc_array[tcpu->node_id][1]; + assoc_domain2 = smc->numa_assoc_array[tcpu->node_id][2]; + assoc_domain3 = smc->numa_assoc_array[tcpu->node_id][3]; + /* sequence is the same as in the "ibm,associativity" property */ idx = 0; #define ASSOCIATIVITY(a, b) (((uint64_t)(a) << 32) | \ ((uint64_t)(b) & 0xffffffff)) - args[idx++] = ASSOCIATIVITY(0, 0); - args[idx++] = ASSOCIATIVITY(0, tcpu->node_id); + args[idx++] = ASSOCIATIVITY(assoc_domain1, assoc_domain2); + args[idx++] = ASSOCIATIVITY(assoc_domain3, tcpu->node_id); args[idx++] = ASSOCIATIVITY(procno, -1); for ( ; idx < 6; idx++) { args[idx] = -1; -- 2.26.2