1 /* 2 * QEMU PowerPC pSeries Logical Partition NUMA associativity handling 3 * 4 * Copyright IBM Corp. 2020 5 * 6 * Authors: 7 * Daniel Henrique Barboza <danielhb413@gmail.com> 8 * 9 * This work is licensed under the terms of the GNU GPL, version 2 or later. 10 * See the COPYING file in the top-level directory. 11 */ 12 13 #include "qemu/osdep.h" 14 #include "qemu-common.h" 15 #include "hw/ppc/spapr_numa.h" 16 #include "hw/ppc/fdt.h" 17 18 /* 19 * Helper that writes ibm,associativity-reference-points and 20 * max-associativity-domains in the RTAS pointed by @rtas 21 * in the DT @fdt. 22 */ 23 void spapr_numa_write_rtas_dt(SpaprMachineState *spapr, void *fdt, int rtas) 24 { 25 SpaprMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr); 26 uint32_t refpoints[] = { 27 cpu_to_be32(0x4), 28 cpu_to_be32(0x4), 29 cpu_to_be32(0x2), 30 }; 31 uint32_t nr_refpoints = ARRAY_SIZE(refpoints); 32 uint32_t maxdomain = cpu_to_be32(spapr->gpu_numa_id > 1 ? 1 : 0); 33 uint32_t maxdomains[] = { 34 cpu_to_be32(4), 35 maxdomain, 36 maxdomain, 37 maxdomain, 38 cpu_to_be32(spapr->gpu_numa_id), 39 }; 40 41 if (smc->pre_5_1_assoc_refpoints) { 42 nr_refpoints = 2; 43 } 44 45 _FDT(fdt_setprop(fdt, rtas, "ibm,associativity-reference-points", 46 refpoints, nr_refpoints * sizeof(refpoints[0]))); 47 48 _FDT(fdt_setprop(fdt, rtas, "ibm,max-associativity-domains", 49 maxdomains, sizeof(maxdomains))); 50 } 51