On Mon, 18 May 2020 16:44:17 -0500
Reza Arbab <address@hidden> wrote:
@@ -944,8 +946,9 @@ static void spapr_dt_rtas(SpaprMachineState *spapr, void
*fdt)
qemu_hypertas->str, qemu_hypertas->len));
g_string_free(qemu_hypertas, TRUE);
+ nr_refpoints = MIN(smc->nr_assoc_refpoints, ARRAY_SIZE(refpoints));
Having the machine requesting more reference points than available
would clearly be a bug. I'd rather add an assert() than silently
clipping to the size of refpoints[].
_FDT(fdt_setprop(fdt, rtas, "ibm,associativity-reference-points",
- refpoints, sizeof(refpoints)));
+ refpoints, nr_refpoints * sizeof(uint32_t)));
Size can be expressed without yet another explicit reference to the
uint32_t type:
nr_refpoints * sizeof(refpoints[0])
@@ -4541,6 +4544,7 @@ static void spapr_machine_class_init(ObjectClass *oc,
void *data)
smc->linux_pci_probe = true;
smc->smp_threads_vsmt = true;
smc->nr_xirqs = SPAPR_NR_XIRQS;
+ smc->nr_assoc_refpoints = 2;
When adding a new setting for the default machine type, we usually
take care of older machine types at the same time, ie. folding this
patch into the next one. Both patches are simple enough that it should
be okay and this would avoid this line to be touched again.