mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
spapr: introduce SpaprMachineState::numa_assoc_array
The next step to centralize all NUMA/associativity handling in the spapr machine is to create a 'one stop place' for all things ibm,associativity. This patch introduces numa_assoc_array, a 2 dimensional array that will store all ibm,associativity arrays of all NUMA nodes. This array is initialized in a new spapr_numa_associativity_init() function, called in spapr_machine_init(). It is being initialized with the same values used in other ibm,associativity properties around spapr files (i.e. all zeros, last value is node_id). The idea is to remove all hardcoded definitions and FDT writes of ibm,associativity arrays, doing instead a call to the new helper spapr_numa_write_associativity_dt() helper, that will be able to write the DT with the correct values. We'll start small, handling the trivial cases first. The remaining instances of ibm,associativity will be handled next. Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com> Message-Id: <20200903220639.563090-2-danielhb413@gmail.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
6ee1d62e6a
commit
f1aa45fffe
7 changed files with 73 additions and 33 deletions
|
@ -15,6 +15,36 @@
|
|||
#include "hw/ppc/spapr_numa.h"
|
||||
#include "hw/ppc/fdt.h"
|
||||
|
||||
|
||||
void spapr_numa_associativity_init(SpaprMachineState *spapr,
|
||||
MachineState *machine)
|
||||
{
|
||||
int nb_numa_nodes = machine->numa_state->num_nodes;
|
||||
int i;
|
||||
|
||||
/*
|
||||
* For all associativity arrays: first position is the size,
|
||||
* position MAX_DISTANCE_REF_POINTS is always the numa_id,
|
||||
* represented by the index 'i'.
|
||||
*
|
||||
* This will break on sparse NUMA setups, when/if QEMU starts
|
||||
* to support it, because there will be no more guarantee that
|
||||
* 'i' will be a valid node_id set by the user.
|
||||
*/
|
||||
for (i = 0; i < nb_numa_nodes; i++) {
|
||||
spapr->numa_assoc_array[i][0] = cpu_to_be32(MAX_DISTANCE_REF_POINTS);
|
||||
spapr->numa_assoc_array[i][MAX_DISTANCE_REF_POINTS] = cpu_to_be32(i);
|
||||
}
|
||||
}
|
||||
|
||||
void spapr_numa_write_associativity_dt(SpaprMachineState *spapr, void *fdt,
|
||||
int offset, int nodeid)
|
||||
{
|
||||
_FDT((fdt_setprop(fdt, offset, "ibm,associativity",
|
||||
spapr->numa_assoc_array[nodeid],
|
||||
sizeof(spapr->numa_assoc_array[nodeid]))));
|
||||
}
|
||||
|
||||
/*
|
||||
* Helper that writes ibm,associativity-reference-points and
|
||||
* max-associativity-domains in the RTAS pointed by @rtas
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue