ibm,architecture-vec-5 is supposed to encode all option vector 5 bits negotiated between platform/guest. Currently we hardcode this property in the boot-time device tree to advertise a single negotiated capability, "Form 1" NUMA Affinity, regardless of whether or not CAS has been invoked or that capability has actually been negotiated.
Improve this by generating ibm,architecture-vec-5 based on the full set of option vector 5 capabilities negotiated via CAS. Signed-off-by: Michael Roth <mdr...@linux.vnet.ibm.com> --- hw/ppc/spapr.c | 22 +++++++++++++++++----- include/hw/ppc/spapr_ovec.h | 1 + 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 460c7a8..3b2a459 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -285,7 +285,6 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base, GString *qemu_hypertas = g_string_sized_new(256); uint32_t refpoints[] = {cpu_to_be32(0x4), cpu_to_be32(0x4)}; uint32_t interrupt_server_ranges_prop[] = {0, cpu_to_be32(max_cpus)}; - unsigned char vec5[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x80}; char *buf; add_str(hypertas, "hcall-pft"); @@ -351,9 +350,6 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base, /* /chosen */ _FDT((fdt_begin_node(fdt, "chosen"))); - /* Set Form1_affinity */ - _FDT((fdt_property(fdt, "ibm,architecture-vec-5", vec5, sizeof(vec5)))); - _FDT((fdt_property_string(fdt, "bootargs", kernel_cmdline))); _FDT((fdt_property(fdt, "linux,initrd-start", &start_prop, sizeof(start_prop)))); @@ -858,14 +854,28 @@ static int spapr_populate_cas_updates(sPAPRMachineState *spapr, void *fdt, sPAPROptionVector *ov5_updates) { sPAPRMachineClass *smc = SPAPR_MACHINE_GET_CLASS(spapr); - int ret = 0; + int ret = 0, offset; /* Generate ibm,dynamic-reconfiguration-memory node if required */ if (spapr_ovec_test(ov5_updates, OV5_DRCONF_MEMORY)) { g_assert(smc->dr_lmb_enabled); ret = spapr_populate_drconf_memory(spapr, fdt); + if (ret) { + goto out; + } } + offset = fdt_path_offset(fdt, "/chosen"); + if (offset < 0) { + offset = fdt_add_subnode(fdt, 0, "chosen"); + if (offset < 0) { + return offset; + } + } + ret = spapr_ovec_populate_dt(fdt, offset, spapr->ov5_cas, + "ibm,architecture-vec-5"); + +out: return ret; } @@ -1804,6 +1814,8 @@ static void ppc_spapr_init(MachineState *machine) spapr_validate_node_memory(machine, &error_fatal); } + spapr_ovec_set(spapr->ov5, OV5_FORM1_AFFINITY); + /* init CPUs */ if (machine->cpu_model == NULL) { machine->cpu_model = kvm_enabled() ? "host" : smc->tcg_default_cpu; diff --git a/include/hw/ppc/spapr_ovec.h b/include/hw/ppc/spapr_ovec.h index 09afd59..47fa04c 100644 --- a/include/hw/ppc/spapr_ovec.h +++ b/include/hw/ppc/spapr_ovec.h @@ -44,6 +44,7 @@ typedef struct sPAPROptionVector sPAPROptionVector; /* option vector 5 */ #define OV5_DRCONF_MEMORY OV_BIT(2, 2) +#define OV5_FORM1_AFFINITY OV_BIT(5, 0) /* interfaces */ sPAPROptionVector *spapr_ovec_new(void); -- 1.9.1