From nobody Mon Feb 9 07:23:13 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; 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; dmarc=pass(p=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1664218791; cv=none; d=zohomail.com; s=zohoarc; b=im/sVdLNs9/3/eUwbySCeIN6M+W2tM9iXnx7zCIX9vXydHL3H00+f01IUy3Jx+OaFyBmudxc8FxFmtu3PyCbCM6XHYAA42QGaj5MA0HD4PBr+XRERyhEe+g4wneEvq+MceHZlQBK7NIdBvbmflCQF7VrQUuY4VTKANP4lA6IQ1g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664218791; h=Content-Type: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=yf6ffLPC8i9eGCLE6mj5B79jg8nmXu5Z8K8DzV7zV2I=; b=cUzdJI6xzekY80V+M/AJheMsZNXotY7Xm1U7y/NvMsyJlpnEQ9s+QeBrW1W4LjOJMZbkTR0yZSJ2kkiDEGqtd+QAaQuSdVNFVuDW1QXkzXFgQmaL3hwsDoTutLqOqgExaerxqGMJNnEq6u1Fd0/O0KjrJGo3G+6A/PezSnO2n50= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1664218791142213.35948759729308; Mon, 26 Sep 2022 11:59:51 -0700 (PDT) Received: from localhost ([::1]:38472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1octKW-0005yG-R3 for importer@patchew.org; Mon, 26 Sep 2022 14:59:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocs4j-0008DC-6k for qemu-devel@nongnu.org; Mon, 26 Sep 2022 13:39:30 -0400 Received: from mail-oa1-x36.google.com ([2001:4860:4864:20::36]:33680) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ocs4h-00027p-Kp for qemu-devel@nongnu.org; Mon, 26 Sep 2022 13:39:24 -0400 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-1274ec87ad5so10247841fac.0 for ; Mon, 26 Sep 2022 10:39:21 -0700 (PDT) Received: from balboa.COMFAST (189-68-154-15.dsl.telesp.net.br. [189.68.154.15]) by smtp.gmail.com with ESMTPSA id m12-20020a0568301e6c00b0061c9ab1032dsm7947165otr.18.2022.09.26.10.39.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 10:39:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=yf6ffLPC8i9eGCLE6mj5B79jg8nmXu5Z8K8DzV7zV2I=; b=O5puEa5Mcf2Kl8IpuaRjpKdHlUVhVu0YrsA627Eyd8mn1of7+qfJMlxPnAftcHbNli e/uaqj9p9cDqPhHWtT0lX/91QjybFrOUb5mxnCcLU0muF3iYImEXhtnnpjCJq1NW1uZj KaAm35e8KYY29VDpdANuC1ohvSyWecIwTLns6otn8R1HhfMhZZeFQzDKIqyje4y07rWY jrd9bJudnZLi/eoWYxSektITIoZstbsVRGrgi5I433hsxRTMO/28XPZFYomvrN48reQV Hhzk5hQklQ06TB5oBOUog1h13aMG5+knat8E9R6orOuffuuPVMAQeUzo9pv9kH+S/elb SKYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=yf6ffLPC8i9eGCLE6mj5B79jg8nmXu5Z8K8DzV7zV2I=; b=GTr53IvC7pglP5LaoFLspONgYy2cVZaDqz9YvntbviRtu7cc/9joLsNBVnp6zHCcAI jZ2BgCwr31B3uKyd1EQaZDPbsB+mxWpABrQMlfiHpU16z2XemMBV3HSRlnu63ODjx1Vm ZfJWKhdB5sNL1bHww3bljDEbjp4EdRFjaj0DigTNCXV88L+9K39qh1z/FncV7uZNJFq+ Awu76fWaMEE85EeDYj46oj0OpkPltcfjDuuyPGwoNq+a9/3kqg2hyIw+BcUgLLVt+RDF MqRmkCt4oy4koqnAYLOa8xonL3p0d8SEqJWYWITJJewAsgHysc/wRgujxsrZDwcvqned J4/A== X-Gm-Message-State: ACrzQf2pYj89vsOXfjvB2V6ZDHaQLJHVbAjvr8iMRHKdyKkAmIeIU/bH jW/HGg99UKfDl0U1lPyfs/FDIpXFHgo= X-Google-Smtp-Source: AMsMyM7TM0CbWAeIcLM2yle8TJx6AL3FiGOTzoK7xt8VhKSXlBjGh921/rZXH0gxc4DNP1i8F1SBSQ== X-Received: by 2002:a05:6870:2382:b0:12d:4848:fbcc with SMTP id e2-20020a056870238200b0012d4848fbccmr12908415oap.111.1664213960449; Mon, 26 Sep 2022 10:39:20 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , BALATON Zoltan , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v8 09/16] hw/ppc: set machine->fdt in sam460ex_load_device_tree() Date: Mon, 26 Sep 2022 14:38:48 -0300 Message-Id: <20220926173855.1159396-10-danielhb413@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926173855.1159396-1-danielhb413@gmail.com> References: <20220926173855.1159396-1-danielhb413@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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; Received-SPF: pass client-ip=2001:4860:4864:20::36; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x36.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1664218793341100001 This will enable support for 'dumpdtb' QMP/HMP command for the sam460ex machine. Setting machine->fdt requires a MachineState pointer to be used inside sam460ex_load_device_tree(). Let's change the function to receive this pointer from the caller. 'ramsize' and 'kernel_cmdline' can be retrieved directly from the 'machine' pointer. Reviewed-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Daniel Henrique Barboza --- hw/ppc/sam460ex.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/hw/ppc/sam460ex.c b/hw/ppc/sam460ex.c index 850bb3b817..5d09d3c6ab 100644 --- a/hw/ppc/sam460ex.c +++ b/hw/ppc/sam460ex.c @@ -131,13 +131,12 @@ static int sam460ex_load_uboot(void) return 0; } =20 -static int sam460ex_load_device_tree(hwaddr addr, - uint32_t ramsize, +static int sam460ex_load_device_tree(MachineState *machine, + hwaddr addr, hwaddr initrd_base, - hwaddr initrd_size, - const char *kernel_cmdline) + hwaddr initrd_size) { - uint32_t mem_reg_property[] =3D { 0, 0, cpu_to_be32(ramsize) }; + uint32_t mem_reg_property[] =3D { 0, 0, cpu_to_be32(machine->ram_size)= }; char *filename; int fdt_size; void *fdt; @@ -171,7 +170,8 @@ static int sam460ex_load_device_tree(hwaddr addr, qemu_fdt_setprop_cell(fdt, "/chosen", "linux,initrd-end", (initrd_base + initrd_size)); =20 - qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", kernel_cmdline); + qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", + machine->kernel_cmdline); =20 /* Copy data from the host device tree into the guest. Since the guest= can * directly access the timebase without host involvement, we must expo= se @@ -208,7 +208,9 @@ static int sam460ex_load_device_tree(hwaddr addr, EBC_FREQ); =20 rom_add_blob_fixed(BINARY_DEVICE_TREE_FILE, fdt, fdt_size, addr); - g_free(fdt); + + /* Set machine->fdt for 'dumpdtb' QMP/HMP command */ + machine->fdt =3D fdt; =20 return fdt_size; } @@ -496,9 +498,8 @@ static void sam460ex_init(MachineState *machine) if (machine->kernel_filename) { int dt_size; =20 - dt_size =3D sam460ex_load_device_tree(FDT_ADDR, machine->ram_size, - RAMDISK_ADDR, initrd_size, - machine->kernel_cmdline); + dt_size =3D sam460ex_load_device_tree(machine, FDT_ADDR, + RAMDISK_ADDR, initrd_size); =20 boot_info->dt_base =3D FDT_ADDR; boot_info->dt_size =3D dt_size; --=20 2.37.3