From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39940) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bytgE-0001PJ-Cb for qemu-devel@nongnu.org; Tue, 25 Oct 2016 00:49:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bytgB-0006IP-62 for qemu-devel@nongnu.org; Tue, 25 Oct 2016 00:49:42 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52431 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1bytgB-0006IH-1N for qemu-devel@nongnu.org; Tue, 25 Oct 2016 00:49:39 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9P4me5q143015 for ; Tue, 25 Oct 2016 00:49:38 -0400 Received: from e33.co.us.ibm.com (e33.co.us.ibm.com [32.97.110.151]) by mx0a-001b2d01.pphosted.com with ESMTP id 269smhq1rr-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 25 Oct 2016 00:49:38 -0400 Received: from localhost by e33.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 24 Oct 2016 22:49:37 -0600 From: Michael Roth Date: Mon, 24 Oct 2016 23:47:30 -0500 In-Reply-To: <1477370856-8940-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1477370856-8940-1-git-send-email-mdroth@linux.vnet.ibm.com> Message-Id: <1477370856-8940-5-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 04/10] spapr: improve ibm, architecture-vec-5 property handling List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: nfont@linux.vnet.ibm.com, david@gibson.dropbear.id.au, qemu-ppc@nongnu.org, jallen@linux.vnet.ibm.com, bharata@linux.vnet.ibm.com 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 --- hw/ppc/spapr.c | 23 +++++++++++++++++------ include/hw/ppc/spapr_ovec.h | 1 + 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 3b64580..828072a 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -659,14 +659,28 @@ static int spapr_dt_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; } @@ -792,14 +806,9 @@ static void spapr_dt_chosen(sPAPRMachineState *spapr, void *fdt) char *stdout_path = spapr_vio_stdout_path(spapr->vio_bus); size_t cb = 0; char *bootlist = get_boot_devices_list(&cb, true); - unsigned char vec5[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x80}; _FDT(chosen = fdt_add_subnode(fdt, 0, "chosen")); - /* Set Form1_affinity */ - _FDT(fdt_setprop(fdt, chosen, "ibm,architecture-vec-5", - vec5, sizeof(vec5))); - _FDT(fdt_setprop_string(fdt, chosen, "bootargs", machine->kernel_cmdline)); _FDT(fdt_setprop_cell(fdt, chosen, "linux,initrd-start", spapr->initrd_base)); @@ -1778,6 +1787,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