From nobody Mon Feb 9 06:00:52 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=1664218481; cv=none; d=zohomail.com; s=zohoarc; b=NlKKwqftnxxi0pQSfN3nm/LIUTSbMxtxV6OEOs5+TabHFm+92R30wyBlz425OGCtJEQjdTekAs6O6RPPiQfD0feQN/rP+h72nfrJ/aNVdD+RESG6KlP2IBM69P4rpaJLjtDK9LI/OWVBbyYVudmzmJnzfT4BdR7fFautyEslF/I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664218481; 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=K9uaPJUsmwLieYaVUDJt066hUKn1XieJwGJCGkDP1Bg=; b=dqJM8xYVlr+oooni2xR/+vE9/J6YUlMqI3v/SGNlAlnRLO7d1/QBnqW7i8g6lWu3HpG4ptj+0pWl1/o5jKRl1DttHty6yrgLO+RTPOzT9/bdx+2raR8+UQNe4sSXZwVvBO6pxjCudaDzY3FZ2DhneMJhUlizL5jOvOx2vQebAl8= 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 1664218481203747.2168940035914; Mon, 26 Sep 2022 11:54:41 -0700 (PDT) Received: from localhost ([::1]:56340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1octFX-0008QS-QG for importer@patchew.org; Mon, 26 Sep 2022 14:54:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44356) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocs4b-0008Bp-P2 for qemu-devel@nongnu.org; Mon, 26 Sep 2022 13:39:19 -0400 Received: from mail-ot1-x336.google.com ([2607:f8b0:4864:20::336]:41607) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ocs4a-00026u-2F for qemu-devel@nongnu.org; Mon, 26 Sep 2022 13:39:17 -0400 Received: by mail-ot1-x336.google.com with SMTP id e24-20020a05683013d800b0065be336b8feso4903845otq.8 for ; Mon, 26 Sep 2022 10:39:15 -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.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Sep 2022 10:39:14 -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=K9uaPJUsmwLieYaVUDJt066hUKn1XieJwGJCGkDP1Bg=; b=cwjOLVljwPWnw6d1AEWl33lqbugoGPl1HWQ7WgLVLruWrJzLBXL2f3r2c42lKpWcUe SHJ0hNsc8kQ+tIBl++k2RixQXuEVO+hWua90k2UGrkhjA1dl/3EWo7WjLYGxRJptHynu 6EQSbeotFEB3L/Y47kJeDtxUJX596sBQoQbnHVpr4hbgoJxhZD83wjx2xzd5+8L8CchT xTgu1+/76JqTBHN+SvxJkzhVMQ2siGA6d7MxJ0T1ocwAbBrbmPhFlcRnnKB7UznPcCn/ lVFdds+hGaSfT4jJQc7ypd2pvAZEE+uqkllw0YEjnueR2cVr4Xi97D9J1rl8Bn8FawMM ZHwQ== 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=K9uaPJUsmwLieYaVUDJt066hUKn1XieJwGJCGkDP1Bg=; b=B7gj0FmFo8eh9AMh3Z/8WRfVoUq22yHmqiwBpMLmOumEx34UqeDig3jcmoJIrrPb6N YDQfKp6Iq/khMS02FzUU7lMtq9DG4T0t+/9ENAkBp6+KtdhaJYvlZvOEpZ/GU2Y0x4WN YeDA0tu06iXMBNEDVcGD5YkG+1WtD09MvFSnF3qOQCXTJQX5g6V/yWVk2c7Dzov88QCF vju0+sBEV8XJV+2LL5JjPgcMiC4xRtKQ3HSyt/CbU42hFTjr9dXplHMl5v5F9FNLrWwk kVrcai7qZCs9w1ynrO+d4PGe9ruZUfJbgfJZArPLzUbAUUwDpYe5ZArP65OyqUlftroW oFZg== X-Gm-Message-State: ACrzQf2jNzfPgAXbm5Lf3JUPhdFhANSid3ld9tmxSaoKInDpUaWp6yqt MGUd+9eEBe93zShjJEbmyd4QHRb3Szk= X-Google-Smtp-Source: AMsMyM5Ska+D0PYoUE4s4kU+bkfNJsybzEcoZtzrDy1g2PIkOgAZFoH/53eSmK3NvkYzD5+5THLfmQ== X-Received: by 2002:a9d:7d16:0:b0:656:578:24ae with SMTP id v22-20020a9d7d16000000b00656057824aemr10431181otn.152.1664213954444; Mon, 26 Sep 2022 10:39:14 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: Daniel Henrique Barboza , Chris Wulff , Marek Vasut , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v8 06/16] hw/nios2: set machine->fdt in nios2_load_dtb() Date: Mon, 26 Sep 2022 14:38:45 -0300 Message-Id: <20220926173855.1159396-7-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=2607:f8b0:4864:20::336; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x336.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: 1664218482942100001 This will enable support for 'dumpdtb' QMP/HMP command for all nios2 machines that uses nios2_load_dtb(). Cc: Chris Wulff Cc: Marek Vasut Reviewed-by: Philippe Mathieu-Daud=C3=A9 Signed-off-by: Daniel Henrique Barboza --- hw/nios2/boot.c | 8 +++++++- hw/nios2/meson.build | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/nios2/boot.c b/hw/nios2/boot.c index 21cbffff47..b30a7b1efb 100644 --- a/hw/nios2/boot.c +++ b/hw/nios2/boot.c @@ -43,6 +43,8 @@ =20 #include "boot.h" =20 +#include + #define NIOS2_MAGIC 0x534f494e =20 static struct nios2_boot_info { @@ -81,6 +83,7 @@ static uint64_t translate_kernel_address(void *opaque, ui= nt64_t addr) static int nios2_load_dtb(struct nios2_boot_info bi, const uint32_t ramsiz= e, const char *kernel_cmdline, const char *dtb_file= name) { + MachineState *machine =3D MACHINE(qdev_get_machine()); int fdt_size; void *fdt =3D NULL; int r; @@ -113,7 +116,10 @@ static int nios2_load_dtb(struct nios2_boot_info bi, c= onst uint32_t ramsize, } =20 cpu_physical_memory_write(bi.fdt, fdt, fdt_size); - g_free(fdt); + + /* Set machine->fdt for 'dumpdtb' QMP/HMP command */ + machine->fdt =3D fdt; + return fdt_size; } =20 diff --git a/hw/nios2/meson.build b/hw/nios2/meson.build index 6c58e8082b..22277bd6c5 100644 --- a/hw/nios2/meson.build +++ b/hw/nios2/meson.build @@ -1,5 +1,5 @@ nios2_ss =3D ss.source_set() -nios2_ss.add(files('boot.c')) +nios2_ss.add(files('boot.c'), fdt) nios2_ss.add(when: 'CONFIG_NIOS2_10M50', if_true: files('10m50_devboard.c'= )) nios2_ss.add(when: 'CONFIG_NIOS2_GENERIC_NOMMU', if_true: files('generic_n= ommu.c')) =20 --=20 2.37.3