From nobody Thu Oct 2 03:25:45 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1584441249; cv=none; d=zohomail.com; s=zohoarc; b=JRazLxdQh6W0ABZ1QvTPOtXiOR3SZPO65/r4Glv+GDdugldw6/lMVo2bfxrxuvxiMNczWJ+Z5rEpy9voC+dh7CoZC3++41t3MqyxhWSCFj0Cwj7GmV5qLCyk2mZoyZcYWxD84MBExylI50Uij80b2CPtOQIbl0R1RaHG97a/eFE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584441249; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YLTHEiyYBrpwsnDEFh1Zpm5ev7vDUS4zX4NvBatuid4=; b=CdR24mNJOgFL7bxxxPsexb6jHPUAanc3dGUAu2U5GTRbddfKQylxmkYuwmYdGjGldWOq+USVvnxFkT1/x9z+Q6O21R4L0LByTA0KONxpaQwMIryGxrYTc4RuvQGx30YYWt/QLqYgLr3k8jmhh1Ypp6yCnpXI/PY67KuhElKFSaA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1584441249139566.0577249399344; Tue, 17 Mar 2020 03:34:09 -0700 (PDT) Received: from localhost ([::1]:56188 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jE9Xz-0001ht-OP for importer@patchew.org; Tue, 17 Mar 2020 06:34:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46540) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jE96T-0002K8-Tv for qemu-devel@nongnu.org; Tue, 17 Mar 2020 06:05:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jE96S-0008A1-0w for qemu-devel@nongnu.org; Tue, 17 Mar 2020 06:05:41 -0400 Received: from bilbo.ozlabs.org ([2401:3900:2:1::2]:47397 helo=ozlabs.org) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jE96R-0005aq-Kq; Tue, 17 Mar 2020 06:05:39 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 48hTL05lgtz9sTQ; Tue, 17 Mar 2020 21:04:40 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1584439480; bh=KT5ze/+yN+LYC+I7poQ2KhjH7DVbMMJtLwam/nRyiCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QqAN9nmD9i2Ily7p6eYGvvr65Aq/cr/YQbXfpcrPSV+6Q03Leze3rHbqD5rkUWZZw I1y4FwDtPVZcL9wi7F/l5shL4owHr4J8P7rcv6egf+4szAaBsNfB7sp8Qox+K89k37 MGln+mvvjtrVXX2W3hZXLETW7YwjlhreI076b5eY= From: David Gibson To: peter.maydell@linaro.org Subject: [PULL 35/45] spapr: Move creation of ibm,architecture-vec-5 property Date: Tue, 17 Mar 2020 21:04:13 +1100 Message-Id: <20200317100423.622643-36-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200317100423.622643-1-david@gibson.dropbear.id.au> References: <20200317100423.622643-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lvivier@redhat.com, aik@ozlabs.ru, mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, clg@kaod.org, David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" This is currently called from spapr_dt_cas_updates() which is a hang over from when we created this only as a diff to the DT at CAS time. Now that we fully rebuild the DT at CAS time, just create it along with the rest of the properties in /chosen. Signed-off-by: David Gibson Reviewed-by: Greg Kurz --- hw/ppc/spapr.c | 144 ++++++++++++++++++++++--------------------------- 1 file changed, 65 insertions(+), 79 deletions(-) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index 5e938833f3..aff8c87fad 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -889,22 +889,6 @@ static int spapr_rng_populate_dt(void *fdt) return ret ? -1 : 0; } =20 -static int spapr_dt_cas_updates(SpaprMachineState *spapr, void *fdt, - SpaprOptionVector *ov5_updates) -{ - int offset; - - offset =3D fdt_path_offset(fdt, "/chosen"); - if (offset < 0) { - offset =3D fdt_add_subnode(fdt, 0, "chosen"); - if (offset < 0) { - return offset; - } - } - return spapr_ovec_populate_dt(fdt, offset, spapr->ov5_cas, - "ibm,architecture-vec-5"); -} - static void spapr_dt_rtas(SpaprMachineState *spapr, void *fdt) { MachineState *ms =3D MACHINE(spapr); @@ -1043,81 +1027,92 @@ static void spapr_dt_ov5_platform_support(SpaprMach= ineState *spapr, void *fdt, val, sizeof(val))); } =20 -static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt) +static void spapr_dt_chosen(SpaprMachineState *spapr, void *fdt, bool rese= t) { MachineState *machine =3D MACHINE(spapr); SpaprMachineClass *smc =3D SPAPR_MACHINE_GET_CLASS(machine); int chosen; - const char *boot_device =3D machine->boot_order; - char *stdout_path =3D spapr_vio_stdout_path(spapr->vio_bus); - size_t cb =3D 0; - char *bootlist =3D get_boot_devices_list(&cb); =20 _FDT(chosen =3D fdt_add_subnode(fdt, 0, "chosen")); =20 - if (machine->kernel_cmdline && machine->kernel_cmdline[0]) { - _FDT(fdt_setprop_string(fdt, chosen, "bootargs", - machine->kernel_cmdline)); - } - if (spapr->initrd_size) { - _FDT(fdt_setprop_cell(fdt, chosen, "linux,initrd-start", - spapr->initrd_base)); - _FDT(fdt_setprop_cell(fdt, chosen, "linux,initrd-end", - spapr->initrd_base + spapr->initrd_size)); - } + if (reset) { + const char *boot_device =3D machine->boot_order; + char *stdout_path =3D spapr_vio_stdout_path(spapr->vio_bus); + size_t cb =3D 0; + char *bootlist =3D get_boot_devices_list(&cb); + + if (machine->kernel_cmdline && machine->kernel_cmdline[0]) { + _FDT(fdt_setprop_string(fdt, chosen, "bootargs", + machine->kernel_cmdline)); + } =20 - if (spapr->kernel_size) { - uint64_t kprop[2] =3D { cpu_to_be64(spapr->kernel_addr), - cpu_to_be64(spapr->kernel_size) }; + if (spapr->initrd_size) { + _FDT(fdt_setprop_cell(fdt, chosen, "linux,initrd-start", + spapr->initrd_base)); + _FDT(fdt_setprop_cell(fdt, chosen, "linux,initrd-end", + spapr->initrd_base + spapr->initrd_size)= ); + } + + if (spapr->kernel_size) { + uint64_t kprop[2] =3D { cpu_to_be64(spapr->kernel_addr), + cpu_to_be64(spapr->kernel_size) }; =20 - _FDT(fdt_setprop(fdt, chosen, "qemu,boot-kernel", + _FDT(fdt_setprop(fdt, chosen, "qemu,boot-kernel", &kprop, sizeof(kprop))); - if (spapr->kernel_le) { - _FDT(fdt_setprop(fdt, chosen, "qemu,boot-kernel-le", NULL, 0)); + if (spapr->kernel_le) { + _FDT(fdt_setprop(fdt, chosen, "qemu,boot-kernel-le", NULL,= 0)); + } } - } - if (boot_menu) { - _FDT((fdt_setprop_cell(fdt, chosen, "qemu,boot-menu", boot_menu))); - } - _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-width", graphic_width= )); - _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-height", graphic_heig= ht)); - _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-depth", graphic_depth= )); + if (boot_menu) { + _FDT((fdt_setprop_cell(fdt, chosen, "qemu,boot-menu", boot_men= u))); + } + _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-width", graphic_w= idth)); + _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-height", graphic_= height)); + _FDT(fdt_setprop_cell(fdt, chosen, "qemu,graphic-depth", graphic_d= epth)); =20 - if (cb && bootlist) { - int i; + if (cb && bootlist) { + int i; =20 - for (i =3D 0; i < cb; i++) { - if (bootlist[i] =3D=3D '\n') { - bootlist[i] =3D ' '; + for (i =3D 0; i < cb; i++) { + if (bootlist[i] =3D=3D '\n') { + bootlist[i] =3D ' '; + } } + _FDT(fdt_setprop_string(fdt, chosen, "qemu,boot-list", bootlis= t)); } - _FDT(fdt_setprop_string(fdt, chosen, "qemu,boot-list", bootlist)); - } =20 - if (boot_device && strlen(boot_device)) { - _FDT(fdt_setprop_string(fdt, chosen, "qemu,boot-device", boot_devi= ce)); - } + if (boot_device && strlen(boot_device)) { + _FDT(fdt_setprop_string(fdt, chosen, "qemu,boot-device", boot_= device)); + } + + if (!spapr->has_graphics && stdout_path) { + /* + * "linux,stdout-path" and "stdout" properties are + * deprecated by linux kernel. New platforms should only + * use the "stdout-path" property. Set the new property + * and continue using older property to remain compatible + * with the existing firmware. + */ + _FDT(fdt_setprop_string(fdt, chosen, "linux,stdout-path", stdo= ut_path)); + _FDT(fdt_setprop_string(fdt, chosen, "stdout-path", stdout_pat= h)); + } =20 - if (!spapr->has_graphics && stdout_path) { /* - * "linux,stdout-path" and "stdout" properties are deprecated by l= inux - * kernel. New platforms should only use the "stdout-path" propert= y. Set - * the new property and continue using older property to remain - * compatible with the existing firmware. + * We can deal with BAR reallocation just fine, advertise it + * to the guest */ - _FDT(fdt_setprop_string(fdt, chosen, "linux,stdout-path", stdout_p= ath)); - _FDT(fdt_setprop_string(fdt, chosen, "stdout-path", stdout_path)); - } + if (smc->linux_pci_probe) { + _FDT(fdt_setprop_cell(fdt, chosen, "linux,pci-probe-only", 0)); + } =20 - /* We can deal with BAR reallocation just fine, advertise it to the gu= est */ - if (smc->linux_pci_probe) { - _FDT(fdt_setprop_cell(fdt, chosen, "linux,pci-probe-only", 0)); - } + spapr_dt_ov5_platform_support(spapr, fdt, chosen); =20 - spapr_dt_ov5_platform_support(spapr, fdt, chosen); + g_free(stdout_path); + g_free(bootlist); + } =20 - g_free(stdout_path); - g_free(bootlist); + _FDT(spapr_ovec_populate_dt(fdt, chosen, spapr->ov5_cas, + "ibm,architecture-vec-5")); } =20 static void spapr_dt_hypervisor(SpaprMachineState *spapr, void *fdt) @@ -1243,9 +1238,7 @@ void *spapr_build_fdt(SpaprMachineState *spapr, bool = reset, size_t space) spapr_dt_rtas(spapr, fdt); =20 /* /chosen */ - if (reset) { - spapr_dt_chosen(spapr, fdt); - } + spapr_dt_chosen(spapr, fdt, reset); =20 /* /hypervisor */ if (kvm_enabled()) { @@ -1264,13 +1257,6 @@ void *spapr_build_fdt(SpaprMachineState *spapr, bool= reset, size_t space) } } =20 - /* ibm,client-architecture-support updates */ - ret =3D spapr_dt_cas_updates(spapr, fdt, spapr->ov5_cas); - if (ret < 0) { - error_report("couldn't setup CAS properties fdt"); - exit(1); - } - if (smc->dr_phb_enabled) { ret =3D spapr_dt_drc(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_PHB); if (ret < 0) { --=20 2.24.1