From patchwork Thu Sep 8 19:40:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1675803 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=o8unxzl3; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MNqHt599lz1ynD for ; Fri, 9 Sep 2022 05:41:30 +1000 (AEST) Received: from localhost ([::1]:38600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWNOy-0004MN-Dz for incoming@patchwork.ozlabs.org; Thu, 08 Sep 2022 15:41:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNOO-0004Hx-5W; Thu, 08 Sep 2022 15:40:52 -0400 Received: from mail-ot1-x32d.google.com ([2607:f8b0:4864:20::32d]:44559) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWNOM-0007BA-EU; Thu, 08 Sep 2022 15:40:51 -0400 Received: by mail-ot1-x32d.google.com with SMTP id t11-20020a05683014cb00b0063734a2a786so13001973otq.11; Thu, 08 Sep 2022 12:40:49 -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=HovcpPksbyRH4MetLfjOHLX26QOG2cA8NngwzZBGLTg=; b=o8unxzl36NDzNTN6PCA6whfSPbdTD1zMYiOe0Zqn27z2Oke0Wu322i5IDympBwsd+X IUKtq/bdiujbW0k4n/3rKhxdkUdDmkYgzuLAEqJzAnNH4UP5LvDi7c8mTSuuXBqMYjhZ KskDjkSAP99v5ZTA7SJqpCocXvQ3oE9UtHMNWNZXahtdOB2mGD3j0xnh2Rb7hg+NNt/J 2mq3usyUBig6PzDZ+srxX/nyd8F5yXxdB2BoS0JcF1ysJ72rXSAVLT9X4LBTmizRXh9W lM2ruQ2F4NkCvlINYXTDaauPMfL+vYOAdY3VNrrM0xvI2svt47rQuq8R4yMsc4hOnWbH v1Qw== 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=HovcpPksbyRH4MetLfjOHLX26QOG2cA8NngwzZBGLTg=; b=ha/iek1fpqkT9IqLlf6GyZBOTxFSNnI9Y/ziPZzn9P8UdYHoz4k+ixpaTbjUtsU3qh Z8xF9tm6AdTt9dSR4Nw4ofJo/6D75HsIkbzGame6z4K5qXN4M9xsfLHYwbrFflP2mhGL 4uOV4zesYM1kRiUSZMiKReH70b/AYG20DPYq55FR8srigul2ZPY5kmvfhegATWCDdOz3 JZRGVOwMSlAVJT6EamfiDkOB1oHcQK4SVT3W+TiVpXDUm8fUpAWTa7l3FYCBNDMqZ0vL s7Hfmr4I8y0y+gwrqHCsP+2gAPNaKU3dUI/oN1xepmy+73WfG3JP0wQML6DxsrLsffWM copQ== X-Gm-Message-State: ACgBeo3jweqGfSE9sTB1+ZVjj7fIpfbJWYX6YOJkN4TAw7m5Oee6aC8s /lIuJ8QpeHf7DwCSQpsiuDQu4l3xUPbIXw== X-Google-Smtp-Source: AA6agR7TEAj11wplDp4SRrXfqJdnMZ95t1jCV5bqLtkL2bEbIy8XViGikaS0XntAWe0T5q7pC3mv+g== X-Received: by 2002:a05:6830:43a0:b0:638:f637:e2c3 with SMTP id s32-20020a05683043a000b00638f637e2c3mr3954644otv.379.1662666048643; Thu, 08 Sep 2022 12:40:48 -0700 (PDT) Received: from balboa.ibmuc.com (200-207-147-180.dsl.telesp.net.br. [200.207.147.180]) by smtp.gmail.com with ESMTPSA id 3-20020aca0703000000b0033ad6ea8d11sm2839849oih.47.2022.09.08.12.40.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 12:40:48 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, clg@kaod.org, Daniel Henrique Barboza , Peter Maydell , qemu-arm@nongnu.org Subject: [PATCH v7 01/14] hw/arm: do not free machine->fdt in arm_load_dtb() Date: Thu, 8 Sep 2022 16:40:27 -0300 Message-Id: <20220908194040.518400-2-danielhb413@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220908194040.518400-1-danielhb413@gmail.com> References: <20220908194040.518400-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32d; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x32d.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" At this moment, arm_load_dtb() can free machine->fdt when binfo->dtb_filename is NULL. If there's no 'dtb_filename', 'fdt' will be retrieved by binfo->get_dtb(). If get_dtb() returns machine->fdt, as is the case of machvirt_dtb() from hw/arm/virt.c, fdt now has a pointer to machine->fdt. And, in that case, the existing g_free(fdt) at the end of arm_load_dtb() will make machine->fdt point to an invalid memory region. This is not an issue right now because there's no code that access machine->fdt after arm_load_dtb(), but we're going to add a QMP/HMP FDT command that will rely on machine->fdt being valid. Instead of freeing 'fdt' at the end of arm_load_dtb(), assign it to machine->fdt. This will allow the FDT of ARM machines that relies on arm_load_dtb() to be accessed later on. Since all ARM machines allocates the FDT only once, we don't need to worry about leaking the existing FDT during a machine reset (which is something that other machines have to look after, e.g. the ppc64 pSeries machine). Cc: Peter Maydell Cc: qemu-arm@nongnu.org Signed-off-by: Daniel Henrique Barboza --- hw/arm/boot.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index ada2717f76..60bbfba37f 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -684,7 +684,8 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo, */ rom_add_blob_fixed_as("dtb", fdt, size, addr, as); - g_free(fdt); + /* Set ms->fdt for 'dumpdtb' QMP/HMP command */ + ms->fdt = fdt; return size; From patchwork Thu Sep 8 19:40:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1675807 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=mRBWZOXs; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MNqLY4wC9z1ynD for ; Fri, 9 Sep 2022 05:43:49 +1000 (AEST) Received: from localhost ([::1]:36360 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWNRD-0001bK-IR for incoming@patchwork.ozlabs.org; Thu, 08 Sep 2022 15:43:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNOQ-0004Nr-OV; Thu, 08 Sep 2022 15:40:54 -0400 Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]:36695) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWNOP-0007BU-7E; Thu, 08 Sep 2022 15:40:54 -0400 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-127ba06d03fso23619623fac.3; Thu, 08 Sep 2022 12:40:52 -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=cjAKqoCsh4ucsmwOdsaJfx2iBShktx1X0R5EseCjguM=; b=mRBWZOXszv3PJiTPz8GzErhrqs4Dxe/RzCa+JPBp4NubiFz1f+GvgGSOtpYUy1Nga7 L2ZBQ2r+6cYI//5bqvOypkbZWXf5r9zhyCMhjbBCJ8u+fv786svc/ehCX5LpH3ka8jqN 7UMuswzSzcQGqTo26oHQGEBDHDc1bPhlv+zYNCJ6q9xsqijF35FFImX/IPZtPgHNEcxp o97BcNcInSrEIYfdcO86J3L9dHktbYry/KO2DM//LZZAqaS3H1EtChm70VNx/IsNPlRu 2YXL5h/UNgdI9U/SKb5jzDuD9MmuTM2fL8C9jpw00eNNgWIrSaX47MOBYNE8W0CJBHr7 hdng== 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=cjAKqoCsh4ucsmwOdsaJfx2iBShktx1X0R5EseCjguM=; b=UgvvxVchJWl6dmeQYxmIGxDaRVPOnqAiEpAvsuQfwpK8Df6Z7XIEy1ZjwloKZKdSPd DA1kRfu8EJ8yJaXVIlyYhL8w4FQBO12QuGIfGXnYYn1b76NdU1BUqhvYTpMZtUcviy1p 1YVgnJLqYQPwUbdROpFpfJ/D5DEV7AxIAHkeDGd5BLgFKteZ/zq6h/S+CpY9Vk06zSlN uvFaN2qstvssGUUIZTsSlNBCuD5ptUmY+JX2IiXfHU+W1wY8rYBZvei2CN3AfSNSwwCL MP5jvj4nZx0Ap3Wh2EmvuiCZX8jRTjrpiRgZBhOxx1Xn6CaWTJMTnJY7u+JN/pHIr2u/ q1nQ== X-Gm-Message-State: ACgBeo3KyP3NQ/jlkduWedY6ObPMB4e73rBxOpeCsYErvd1UY7Mt70PF LxS3TKMe67oHEuVTyA6qtyUyVPIyq//Lzw== X-Google-Smtp-Source: AA6agR6FzHoXlDeS73YNoU0u0L9XEYM50cU+/s/e++V7pHNL3VLYSyLAUswSBBpkeCN1iN868DKrpA== X-Received: by 2002:a05:6870:a188:b0:126:444d:743d with SMTP id a8-20020a056870a18800b00126444d743dmr2696054oaf.111.1662666051256; Thu, 08 Sep 2022 12:40:51 -0700 (PDT) Received: from balboa.ibmuc.com (200-207-147-180.dsl.telesp.net.br. [200.207.147.180]) by smtp.gmail.com with ESMTPSA id 3-20020aca0703000000b0033ad6ea8d11sm2839849oih.47.2022.09.08.12.40.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 12:40:50 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, clg@kaod.org, Daniel Henrique Barboza , "Edgar E . Iglesias" Subject: [PATCH v7 02/14] hw/microblaze: set machine->fdt in microblaze_load_dtb() Date: Thu, 8 Sep 2022 16:40:28 -0300 Message-Id: <20220908194040.518400-3-danielhb413@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220908194040.518400-1-danielhb413@gmail.com> References: <20220908194040.518400-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::33; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x33.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will enable support for 'dumpdtb' QMP/HMP command for all microblaze machines that uses microblaze_load_dtb(). Cc: Edgar E. Iglesias Signed-off-by: Daniel Henrique Barboza --- hw/microblaze/boot.c | 8 +++++++- hw/microblaze/meson.build | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hw/microblaze/boot.c b/hw/microblaze/boot.c index 8b92a9801a..c8eff7b6fc 100644 --- a/hw/microblaze/boot.c +++ b/hw/microblaze/boot.c @@ -39,6 +39,8 @@ #include "boot.h" +#include + static struct { void (*machine_cpu_reset)(MicroBlazeCPU *); @@ -72,6 +74,7 @@ static int microblaze_load_dtb(hwaddr addr, const char *kernel_cmdline, const char *dtb_filename) { + MachineState *machine = MACHINE(qdev_get_machine()); int fdt_size; void *fdt = NULL; int r; @@ -100,7 +103,10 @@ static int microblaze_load_dtb(hwaddr addr, } cpu_physical_memory_write(addr, fdt, fdt_size); - g_free(fdt); + + /* Set machine->fdt for 'dumpdtb' QMP/HMP command */ + machine->fdt = fdt; + return fdt_size; } diff --git a/hw/microblaze/meson.build b/hw/microblaze/meson.build index bb9e4eb8f4..a38a397872 100644 --- a/hw/microblaze/meson.build +++ b/hw/microblaze/meson.build @@ -1,5 +1,5 @@ microblaze_ss = ss.source_set() -microblaze_ss.add(files('boot.c')) +microblaze_ss.add(files('boot.c'), fdt) microblaze_ss.add(when: 'CONFIG_PETALOGIX_S3ADSP1800', if_true: files('petalogix_s3adsp1800_mmu.c')) microblaze_ss.add(when: 'CONFIG_PETALOGIX_ML605', if_true: files('petalogix_ml605_mmu.c')) microblaze_ss.add(when: 'CONFIG_XLNX_ZYNQMP_PMU', if_true: files('xlnx-zynqmp-pmu.c')) From patchwork Thu Sep 8 19:40:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1675805 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Y/gV47VR; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MNqK70Whcz1ynD for ; Fri, 9 Sep 2022 05:42:35 +1000 (AEST) Received: from localhost ([::1]:60420 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWNPz-0006fd-VD for incoming@patchwork.ozlabs.org; Thu, 08 Sep 2022 15:42:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNOU-0004Xv-BO; Thu, 08 Sep 2022 15:40:58 -0400 Received: from mail-oa1-x2c.google.com ([2001:4860:4864:20::2c]:44639) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWNOS-0007Bj-O3; Thu, 08 Sep 2022 15:40:58 -0400 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-11eab59db71so47096641fac.11; Thu, 08 Sep 2022 12:40:56 -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=YOFZ9NdiFBAa9F2Aq+WCsRHWWt7d567/X2aplHJ6aKE=; b=Y/gV47VR42Nc3ZoUGaU+cBzeyOgc5HzjALdFBWdaaJbJ21+j09e6OZ/MPavxTzkyMz 8sgHt1lQ6jp6JX5Oin7p6C9cjVy74JgPdCFkpvaWXDbpWEIyXEQtEp6scc/Pmw0IHWFq IiWTGb67vGd3tMbqlgTWRvGAcwC+vhytoabATkGRY82rtQWpTKjm+4pWcqhzZKBWpK8c Cx5O2Hn73unp3zm5CoXh5sG7ILLY/BWy4A508WuxgXFhwUYc13V0QULjwxI+/zueIKKv AdPEtFAIOgykLUzIejvPi4FDPKMhC2HoEX/bUpxDzMItpkRYSJbWwe6bFmh5HvP3ddFy uqJQ== 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=YOFZ9NdiFBAa9F2Aq+WCsRHWWt7d567/X2aplHJ6aKE=; b=AuV3FLdfN6dt6C1FV0MXPzy4eipI0Z4zF2iSiCLdBAuCzhwWfZgLVy/EQpbatSG60S FpIvonra6oMlVm+TjrhhWLhB+6ih3ysr70SLzs1vg2t8bx71acQELTlMwXN7V/ukUnJe qyV5b1mT50Y3ObJ0OyZwnMutwGE6un/lGPCS6n42F3dAtci5FOQBy7MPuH4za4Rxtlcp TCdTA8ppeC3Oda07SEDStQYwlSS/9CGrWrwwBdTwEpOSKdBSNBte1apanwSB02r8QrFT mHU/ab8S2+hoSf+QlLFGraBnJ1SdAhxEiZeuPZuh3OVLieJZ09mVCS8dmM8Nr9wBTW56 Uvxg== X-Gm-Message-State: ACgBeo0PXfSLZlUzISHBh9dZroXa26xLBJsav6e9cfX90WoMd95bZEEn +K1rFmX9sS2x7yXxYh8odmffDdsLDwDn7A== X-Google-Smtp-Source: AA6agR5ZkMpAjmDC260tBAD8KUYaXe55JLHwneuNOpcDbBeMchpx5bA/ALgWSQ28tQXsuhSqqoVIPg== X-Received: by 2002:a05:6870:9729:b0:127:529c:a04 with SMTP id n41-20020a056870972900b00127529c0a04mr2775408oaq.250.1662666053924; Thu, 08 Sep 2022 12:40:53 -0700 (PDT) Received: from balboa.ibmuc.com (200-207-147-180.dsl.telesp.net.br. [200.207.147.180]) by smtp.gmail.com with ESMTPSA id 3-20020aca0703000000b0033ad6ea8d11sm2839849oih.47.2022.09.08.12.40.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 12:40:53 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, clg@kaod.org, Daniel Henrique Barboza , Chris Wulff , Marek Vasut Subject: [PATCH v7 03/14] hw/nios2: set machine->fdt in nios2_load_dtb() Date: Thu, 8 Sep 2022 16:40:29 -0300 Message-Id: <20220908194040.518400-4-danielhb413@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220908194040.518400-1-danielhb413@gmail.com> References: <20220908194040.518400-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2c; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x2c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will enable support for 'dumpdtb' QMP/HMP command for all nios2 machines that uses nios2_load_dtb(). Cc: Chris Wulff Cc: Marek Vasut 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 @@ #include "boot.h" +#include + #define NIOS2_MAGIC 0x534f494e static struct nios2_boot_info { @@ -81,6 +83,7 @@ static uint64_t translate_kernel_address(void *opaque, uint64_t addr) static int nios2_load_dtb(struct nios2_boot_info bi, const uint32_t ramsize, const char *kernel_cmdline, const char *dtb_filename) { + MachineState *machine = MACHINE(qdev_get_machine()); int fdt_size; void *fdt = NULL; int r; @@ -113,7 +116,10 @@ static int nios2_load_dtb(struct nios2_boot_info bi, const uint32_t ramsize, } cpu_physical_memory_write(bi.fdt, fdt, fdt_size); - g_free(fdt); + + /* Set machine->fdt for 'dumpdtb' QMP/HMP command */ + machine->fdt = fdt; + return fdt_size; } 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 = 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_nommu.c')) From patchwork Thu Sep 8 19:40:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1675809 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Sp52kS5c; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MNqMx4txJz1ynD for ; Fri, 9 Sep 2022 05:45:01 +1000 (AEST) Received: from localhost ([::1]:47756 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWNSN-0003uU-Hq for incoming@patchwork.ozlabs.org; Thu, 08 Sep 2022 15:44:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34672) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNOV-0004b4-67; Thu, 08 Sep 2022 15:40:59 -0400 Received: from mail-ot1-x334.google.com ([2607:f8b0:4864:20::334]:36787) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWNOT-0007Bv-MW; Thu, 08 Sep 2022 15:40:58 -0400 Received: by mail-ot1-x334.google.com with SMTP id 6-20020a9d0106000000b0063963134d04so13043623otu.3; Thu, 08 Sep 2022 12:40:57 -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=mGG3U2Luf4I4urQShsm1RjBsPx5YCf60/nn93DboxwM=; b=Sp52kS5cCBWsjDRCbYGLfZTCvJjDfSex5naJaO9XnG6/fVfucmvsWIxkuUVmyWG9vt WSRbSTiPNEq5SLXuY02JxujO623J8E1YOa571P4zqvVm9MSQb9TCDB+F6XbKLrBm9xlD l40obpo+KaLmWwfgfVbLjhbvCiMSiLmWqxQYd4iA8eQ/wUWW7cloJC/ziaQpHmNxxjLJ WbpLjf05rZOs8n743G59EloDUmymGGRdD4FCmS9Rjdqob9aXBmzeARWKdRs04tKhks20 SukGtg7aEnDQ6wKrklzxSVeq9jLHVNzxJl6oEPmBaELRJCJeP1QRjzpgw0e3YTtDHQvC 1OIg== 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=mGG3U2Luf4I4urQShsm1RjBsPx5YCf60/nn93DboxwM=; b=sUo+PvK0uIMUHjejUnjh84xbDQgxE0F5R8ukY0Umu+dU8jLFpn7OmHJT7tX48Dfphm XO2tvZi0clexeIYM7QD0OsgREveCK5xhTPzwbLFyxl/PjzyHU+ww8s7FnKQ1JiTdv6nA LIGXYsvpvcqoEMSN4IHkII/B8vno1eBfAnnNa/5uX6sNy1tYO9LKlpE/rNcUnbp6drmA 1X85CJcJCJ5qZYDpls8qxLVq4N/mSvobai7S1L5WQTn5TgGDpJrU/lBH1sxUhdai+XyW QHLy4r/9ICwSWD+3uLGcTaPGtDxtGk40RQSLbK7O3IclpSudeuXbjiqIuWd2sy/1GcSN GUdQ== X-Gm-Message-State: ACgBeo0YRflsK8cBQ0kki8OIkIsZMEFfHtsoDcgpXLiZppfcr2De0zOW i4N+FzasTtLJnc4q5twglqVPNwl8WSUsqQ== X-Google-Smtp-Source: AA6agR6F8lElzXdKfA56F1b8kpGvqjVXE7IuEdVr5kHp2O9gMvyXbxLNfWxY3LnNneneh5T+jTPhxA== X-Received: by 2002:a05:6830:631c:b0:638:c121:463a with SMTP id cg28-20020a056830631c00b00638c121463amr3951803otb.39.1662666055990; Thu, 08 Sep 2022 12:40:55 -0700 (PDT) Received: from balboa.ibmuc.com (200-207-147-180.dsl.telesp.net.br. [200.207.147.180]) by smtp.gmail.com with ESMTPSA id 3-20020aca0703000000b0033ad6ea8d11sm2839849oih.47.2022.09.08.12.40.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 12:40:55 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, clg@kaod.org, Daniel Henrique Barboza Subject: [PATCH v7 04/14] hw/ppc: set machine->fdt in ppce500_load_device_tree() Date: Thu, 8 Sep 2022 16:40:30 -0300 Message-Id: <20220908194040.518400-5-danielhb413@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220908194040.518400-1-danielhb413@gmail.com> References: <20220908194040.518400-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::334; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x334.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will enable support for 'dumpdtb' QMP/HMP command for the e500 machine. Cc: Cédric Le Goater Signed-off-by: Daniel Henrique Barboza --- hw/ppc/e500.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/hw/ppc/e500.c b/hw/ppc/e500.c index 32495d0123..ea5f947824 100644 --- a/hw/ppc/e500.c +++ b/hw/ppc/e500.c @@ -47,6 +47,8 @@ #include "hw/i2c/i2c.h" #include "hw/irq.h" +#include + #define EPAPR_MAGIC (0x45504150) #define DTC_LOAD_PAD 0x1800000 #define DTC_PAD_MASK 0xFFFFF @@ -600,7 +602,16 @@ done: cpu_physical_memory_write(addr, fdt, fdt_size); } ret = fdt_size; - g_free(fdt); + + /* + * Update the machine->fdt pointer to enable support for the + * 'dumpdtb' QMP/HMP command. + * + * The FDT is re-created during reset, so free machine->fdt + * to avoid leaking the old FDT. + */ + g_free(machine->fdt); + machine->fdt = fdt; out: g_free(pci_map); From patchwork Thu Sep 8 19:40:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1675814 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=n99P++y4; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MNqRD2LMXz1yj1 for ; Fri, 9 Sep 2022 05:47:52 +1000 (AEST) Received: from localhost ([::1]:57848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWNV8-00087i-5R for incoming@patchwork.ozlabs.org; Thu, 08 Sep 2022 15:47:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34674) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNOY-0004ke-JC; Thu, 08 Sep 2022 15:41:02 -0400 Received: from mail-ot1-x331.google.com ([2607:f8b0:4864:20::331]:40644) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWNOV-0007C9-Rc; Thu, 08 Sep 2022 15:41:02 -0400 Received: by mail-ot1-x331.google.com with SMTP id z22-20020a056830129600b0063711f456ceso13022128otp.7; Thu, 08 Sep 2022 12:40:59 -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=bVHNw7cB4ISER7GtCuYaKaI3lp2SzMEJltQRB/+3XB4=; b=n99P++y4H7ipy0AL3RVp4y1iEHHprjxzGbotxzQO36veJpmTCAj3ZvX0huJ5eXAd8w NvCrHdhFQ3nakX+6SwIIfkMV4Pnk/7Cw83XOak0t5vVS0Bz7w8b3/gM6ZKqjXX7vDqiL 8Rc8Qsd5PrOiXTB3kwcsMc2hQ3sqOaOjL3bcKD1RSY2sdWPN4ahmuvaoVFbxffoOvnfD 7hqh9nX5I6exiLhNEOiRa7nCnTKGODIufVGWsJ75UMeQDsvFMf9QE2GNL3oCDdIAbwuO Kmvpdd6xZbXtyagqEwzmUhvNEgFN2/pwPWEFqhWzaVLSAX4QFvJHSydrmSbtfQYtw/7j lMrw== 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=bVHNw7cB4ISER7GtCuYaKaI3lp2SzMEJltQRB/+3XB4=; b=27S5GzwELWYetrCh7aX+Efyoa9Dr1mxiKtzA2yXOK2yQQUztyM8/KqLQxL8QN8DPHj KJh1rr+LnFF29fSR6WRzF2qF20aYSi+n5rjQopZV/XnBkDiO7VfwC0NcL//EOIz5ONBG GFVHlzUnEeGZh02mmAD/ZHPFzsDPdepg1mXwJ5HMtmS4dZlVh1Wa7j7NzyLc3kNYPGnj z6hMyGa+XPPFUwmnwLAQd6qDqLcNDqsMi4mT60zaDF//VEIwPsYo3NEtNPS8CgMvL/vE oRaqYAE+hxpAXbzdmxhNs4x/rmZDoGAZHbUSsceWuVH3ANH0uwmzgnIuZgOM/PUj7DIj ll5g== X-Gm-Message-State: ACgBeo3tqjwlQPCNNY2mSYEAWMrWgdaUxD4gCqr2WkyWasp/utTxs+32 NLtau2I6445kAhO5KZVa+0XNPehrjEq4QA== X-Google-Smtp-Source: AA6agR62M3acqqrfIUQfO52hRrU9NbOH9Tk8L9jNxgxqvJjW9vJB+FGd1Lx4hahQcD1zkJUicMaT9w== X-Received: by 2002:a05:6830:1bd5:b0:647:28e0:1585 with SMTP id v21-20020a0568301bd500b0064728e01585mr3980583ota.195.1662666058214; Thu, 08 Sep 2022 12:40:58 -0700 (PDT) Received: from balboa.ibmuc.com (200-207-147-180.dsl.telesp.net.br. [200.207.147.180]) by smtp.gmail.com with ESMTPSA id 3-20020aca0703000000b0033ad6ea8d11sm2839849oih.47.2022.09.08.12.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 12:40:57 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, clg@kaod.org, Daniel Henrique Barboza Subject: [PATCH v7 05/14] hw/ppc: set machine->fdt in bamboo_load_device_tree() Date: Thu, 8 Sep 2022 16:40:31 -0300 Message-Id: <20220908194040.518400-6-danielhb413@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220908194040.518400-1-danielhb413@gmail.com> References: <20220908194040.518400-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::331; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x331.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will enable support for 'dumpdtb' QMP/HMP command for the bamboo machine. Setting machine->fdt requires a MachineState pointer to be used inside bamboo_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. Cc: Cédric Le Goater Signed-off-by: Daniel Henrique Barboza Reviewed-by: BALATON Zoltan --- hw/ppc/ppc440_bamboo.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/hw/ppc/ppc440_bamboo.c b/hw/ppc/ppc440_bamboo.c index ea945a1c99..9cc58fccf9 100644 --- a/hw/ppc/ppc440_bamboo.c +++ b/hw/ppc/ppc440_bamboo.c @@ -34,6 +34,8 @@ #include "hw/qdev-properties.h" #include "qapi/error.h" +#include + #define BINARY_DEVICE_TREE_FILE "bamboo.dtb" /* from u-boot */ @@ -56,14 +58,13 @@ static const ram_addr_t ppc440ep_sdram_bank_sizes[] = { static hwaddr entry; -static int bamboo_load_device_tree(hwaddr addr, - uint32_t ramsize, - hwaddr initrd_base, - hwaddr initrd_size, - const char *kernel_cmdline) +static int bamboo_load_device_tree(MachineState *machine, + hwaddr addr, + hwaddr initrd_base, + hwaddr initrd_size) { int ret = -1; - uint32_t mem_reg_property[] = { 0, 0, cpu_to_be32(ramsize) }; + uint32_t mem_reg_property[] = { 0, 0, cpu_to_be32(machine->ram_size) }; char *filename; int fdt_size; void *fdt; @@ -98,7 +99,7 @@ static int bamboo_load_device_tree(hwaddr addr, fprintf(stderr, "couldn't set /chosen/linux,initrd-end\n"); } ret = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", - kernel_cmdline); + machine->kernel_cmdline); if (ret < 0) { fprintf(stderr, "couldn't set /chosen/bootargs\n"); } @@ -119,7 +120,10 @@ static int bamboo_load_device_tree(hwaddr addr, tb_freq); rom_add_blob_fixed(BINARY_DEVICE_TREE_FILE, fdt, fdt_size, addr); - g_free(fdt); + + /* Set ms->fdt for 'dumpdtb' QMP/HMP command */ + machine->fdt = fdt; + return 0; } @@ -163,7 +167,6 @@ static void main_cpu_reset(void *opaque) static void bamboo_init(MachineState *machine) { const char *kernel_filename = machine->kernel_filename; - const char *kernel_cmdline = machine->kernel_cmdline; const char *initrd_filename = machine->initrd_filename; unsigned int pci_irq_nrs[4] = { 28, 27, 26, 25 }; MemoryRegion *address_space_mem = get_system_memory(); @@ -289,8 +292,8 @@ static void bamboo_init(MachineState *machine) /* If we're loading a kernel directly, we must load the device tree too. */ if (kernel_filename) { - if (bamboo_load_device_tree(FDT_ADDR, machine->ram_size, RAMDISK_ADDR, - initrd_size, kernel_cmdline) < 0) { + if (bamboo_load_device_tree(machine, FDT_ADDR, + RAMDISK_ADDR, initrd_size) < 0) { error_report("couldn't load device tree"); exit(1); } From patchwork Thu Sep 8 19:40:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1675817 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=Dgap6oz6; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MNqW95zg2z1yhR for ; Fri, 9 Sep 2022 05:51:16 +1000 (AEST) Received: from localhost ([::1]:37266 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWNYO-00024J-2A for incoming@patchwork.ozlabs.org; Thu, 08 Sep 2022 15:51:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNOa-0004pQ-67; Thu, 08 Sep 2022 15:41:04 -0400 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]:41572) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWNOY-0007CS-JP; Thu, 08 Sep 2022 15:41:03 -0400 Received: by mail-ot1-x32a.google.com with SMTP id t8-20020a9d5908000000b0063b41908168so13024095oth.8; Thu, 08 Sep 2022 12:41:01 -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=x+yzFneJkuBjx/cE5luVruTYbhLKWulRKwv297h+toI=; b=Dgap6oz6dJ+zwVtBwI9BHTp57NelNY6JCto3y9WPYil2dCCRKzomWDeoKHdOO1z+mX zQ7HLmGoQs6fDN0VU33kfX4pKdbnq0VuHKcPdbw7g46wDWh1pmxSChIJLbdGMlYNTVFN HhxWyt3fBS0WguNDPhpgeW5sxucwPx1SXgGG8LKnkudbWilRsnpdYNGVuCq1DBknWGRh s2uKXtKWTwhxwt8a/Xl1NB0KQVkf66HyE+KcleQmZnf+84FY2C8kOmi25mLBL6gHhNnl 4tDqMuYMFxSAdj3m0Nw8tyMEBajhhp4AlFN+nGp4dST7OeLcL2s7zgxFQb7ytFGOuCPW GAFw== 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=x+yzFneJkuBjx/cE5luVruTYbhLKWulRKwv297h+toI=; b=1fR55QAjVtVxqk8yVHkAXuKIiqlDZx+4t52W7xPazUFQxnQ9Av6IvfD9paoWO89lFk G6q1UEKDeT/KQJCc8lF0OXfSR2VAaKq6ruAHWVcz/8WDuFWOlNUV23obK29pUxGCL5ub IFGJVa2rRNVDn3rSRJ4AyZMnonXt+J7swGWmAbFyoAFvVwu3duDbqT7i+kYbWNbBsrfx crOt9H1j2TAGMs6oE7S1WXNCSjNyYkt7+cLM5At2POAgpKN1DajEL8EdWA4YkOQYscKd eiL6IilEaK9LSk7ewM/De/6rNdgx2pfO/xjLS/BbSY7K42lPF89vgKJ1CbL3MSUblz6P I1hA== X-Gm-Message-State: ACgBeo0UrfXWCN0jD+JOQCs3J6If2m24cQ6xVupkp681LOh6MwmANV/V Q0Qa2kPKecXxjw+poCiYBL0z59G9ZTNeQw== X-Google-Smtp-Source: AA6agR5N8rUdYG7MV2SaGAwhuE1RRbz7hlNEZbpYbR9WWwktXEMgmCDmb011DBPDH8OHkGMX/rNTWQ== X-Received: by 2002:a05:6830:d81:b0:616:c424:6f22 with SMTP id bv1-20020a0568300d8100b00616c4246f22mr4067323otb.77.1662666060991; Thu, 08 Sep 2022 12:41:00 -0700 (PDT) Received: from balboa.ibmuc.com (200-207-147-180.dsl.telesp.net.br. [200.207.147.180]) by smtp.gmail.com with ESMTPSA id 3-20020aca0703000000b0033ad6ea8d11sm2839849oih.47.2022.09.08.12.40.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 12:41:00 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, clg@kaod.org, Daniel Henrique Barboza , BALATON Zoltan Subject: [PATCH v7 06/14] hw/ppc: set machine->fdt in sam460ex_load_device_tree() Date: Thu, 8 Sep 2022 16:40:32 -0300 Message-Id: <20220908194040.518400-7-danielhb413@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220908194040.518400-1-danielhb413@gmail.com> References: <20220908194040.518400-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32a; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x32a.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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. Cc: BALATON Zoltan Reviewed-by: BALATON Zoltan 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; } -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[] = { 0, 0, cpu_to_be32(ramsize) }; + uint32_t mem_reg_property[] = { 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)); - qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", kernel_cmdline); + qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", + machine->kernel_cmdline); /* Copy data from the host device tree into the guest. Since the guest can * directly access the timebase without host involvement, we must expose @@ -208,7 +208,9 @@ static int sam460ex_load_device_tree(hwaddr addr, EBC_FREQ); 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 = fdt; return fdt_size; } @@ -496,9 +498,8 @@ static void sam460ex_init(MachineState *machine) if (machine->kernel_filename) { int dt_size; - dt_size = sam460ex_load_device_tree(FDT_ADDR, machine->ram_size, - RAMDISK_ADDR, initrd_size, - machine->kernel_cmdline); + dt_size = sam460ex_load_device_tree(machine, FDT_ADDR, + RAMDISK_ADDR, initrd_size); boot_info->dt_base = FDT_ADDR; boot_info->dt_size = dt_size; From patchwork Thu Sep 8 19:40:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1675808 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=glsmiAAd; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MNqLb5RqHz1ynD for ; Fri, 9 Sep 2022 05:43:51 +1000 (AEST) Received: from localhost ([::1]:36362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWNRF-0001j8-KQ for incoming@patchwork.ozlabs.org; Thu, 08 Sep 2022 15:43:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34034) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNOd-0004zr-0v; Thu, 08 Sep 2022 15:41:07 -0400 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]:41576) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWNOa-0007Ct-U6; Thu, 08 Sep 2022 15:41:06 -0400 Received: by mail-ot1-x32e.google.com with SMTP id t8-20020a9d5908000000b0063b41908168so13024154oth.8; Thu, 08 Sep 2022 12:41:04 -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=IJGxDWIooTZeySostCt3cNZ9hfpj8NMfdT8RBIxinxI=; b=glsmiAAdYuBrOYNV8cfhD1EB+tqItuMT4ZRGJPE43Vyq6LpbbZhDL41eGgUbsoJmny cuZGWrogbnSDtVicxS2oHlzW65Ym1IehvhEjv1UueP4E5u8QuTUH1KriH1J64zAZ8+5T FPFwSRoPIRyBWgzwlZnxKiaWdurJBdixYwY6lO43FMMMNTk9myebc0mBo77cCEmOuf6t 9imhivSY2lL+xpELJQI+TpQloGaGSssikQQVAZnqROOz8GS+e+hkpIIm1kVQe+685Aub H/XOpk5ZzgmliHbShnC6HUp8ooHPZ9sNRZRmfXfdHVgAwnHmlB6nGvGQ4/iu+FKaDCkk 3b2Q== 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=IJGxDWIooTZeySostCt3cNZ9hfpj8NMfdT8RBIxinxI=; b=j8RFA2xFKA1zJ7q1OV3KsG3OTR1Fjyx3DWs93gHVkt+E5/dx+RrPnLFnJS9f18qczx TJ6S1jn00WsnkSmLm0e4nirZjz6ofpx0nYWJGISeX53hONPQAs5oTAQ0zckHmDfbGAib GC0I1sVYahI8/h5VOoFt4d6rWQXPJdCFv8IbKGli+TIGuV+f0+Zx0y7O6/pTUX4wbu3t NBva50iMm38AWasRJv5IR5eJZF1Zs8b1mamGv/5QOIz5RSWgrSeLPV9XDgzlsXNTq3yH MIPF617lRB7wkFKvNBnLsK0FDY9qmXny9bfQSOhQi7JkGHLskM379Vg48vB/Qv5yTxu6 lTMQ== X-Gm-Message-State: ACgBeo0OhUqZQ9e9KWsWGmwAksPNAdQBjzZuxpv7CS9idFV5SGLA8Bte 6paYeS2DAtD0YNSnOUXT7Pw5Z+uTxUSVbQ== X-Google-Smtp-Source: AA6agR6DeltvMlxZMTGhCmiCJ6VFTr7MTHE9AS67dV3sX7Fxt/PSS4x+Kx+vDds8to2f4L4tqGGOGA== X-Received: by 2002:a05:6830:18c4:b0:636:ee33:158e with SMTP id v4-20020a05683018c400b00636ee33158emr4045445ote.239.1662666063350; Thu, 08 Sep 2022 12:41:03 -0700 (PDT) Received: from balboa.ibmuc.com (200-207-147-180.dsl.telesp.net.br. [200.207.147.180]) by smtp.gmail.com with ESMTPSA id 3-20020aca0703000000b0033ad6ea8d11sm2839849oih.47.2022.09.08.12.41.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 12:41:02 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, clg@kaod.org, Daniel Henrique Barboza , "Edgar E . Iglesias" Subject: [PATCH v7 07/14] hw/ppc: set machine->fdt in xilinx_load_device_tree() Date: Thu, 8 Sep 2022 16:40:33 -0300 Message-Id: <20220908194040.518400-8-danielhb413@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220908194040.518400-1-danielhb413@gmail.com> References: <20220908194040.518400-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32e; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x32e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will enable support for 'dumpdtb' QMP/HMP command for the virtex_ml507 machine. Setting machine->fdt requires a MachineState pointer to be used inside xilinx_load_device_tree(). Let's change the function to receive this pointer from the caller. kernel_cmdline' can be retrieved directly from the 'machine' pointer. 'ramsize' wasn't being used so can be removed. Cc: Edgar E. Iglesias Signed-off-by: Daniel Henrique Barboza Reviewed-by: BALATON Zoltan --- hw/ppc/virtex_ml507.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/hw/ppc/virtex_ml507.c b/hw/ppc/virtex_ml507.c index 493ea0c19f..13cace229b 100644 --- a/hw/ppc/virtex_ml507.c +++ b/hw/ppc/virtex_ml507.c @@ -45,6 +45,8 @@ #include "hw/qdev-properties.h" #include "ppc405.h" +#include + #define EPAPR_MAGIC (0x45504150) #define FLASH_SIZE (16 * MiB) @@ -144,11 +146,10 @@ static void main_cpu_reset(void *opaque) } #define BINARY_DEVICE_TREE_FILE "virtex-ml507.dtb" -static int xilinx_load_device_tree(hwaddr addr, - uint32_t ramsize, - hwaddr initrd_base, - hwaddr initrd_size, - const char *kernel_cmdline) +static int xilinx_load_device_tree(MachineState *machine, + hwaddr addr, + hwaddr initrd_base, + hwaddr initrd_size) { char *path; int fdt_size; @@ -190,18 +191,21 @@ static int xilinx_load_device_tree(hwaddr addr, error_report("couldn't set /chosen/linux,initrd-end"); } - r = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", kernel_cmdline); + r = qemu_fdt_setprop_string(fdt, "/chosen", "bootargs", + machine->kernel_cmdline); if (r < 0) fprintf(stderr, "couldn't set /chosen/bootargs\n"); cpu_physical_memory_write(addr, fdt, fdt_size); - g_free(fdt); + + /* Set machine->fdt for 'dumpdtb' QMP/HMP command */ + machine->fdt = fdt; + return fdt_size; } static void virtex_init(MachineState *machine) { const char *kernel_filename = machine->kernel_filename; - const char *kernel_cmdline = machine->kernel_cmdline; hwaddr initrd_base = 0; int initrd_size = 0; MemoryRegion *address_space_mem = get_system_memory(); @@ -294,9 +298,8 @@ static void virtex_init(MachineState *machine) boot_info.fdt = high + (8192 * 2); boot_info.fdt &= ~8191; - xilinx_load_device_tree(boot_info.fdt, machine->ram_size, - initrd_base, initrd_size, - kernel_cmdline); + xilinx_load_device_tree(machine, boot_info.fdt, + initrd_base, initrd_size); } env->load_info = &boot_info; } From patchwork Thu Sep 8 19:40:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1675821 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=TZUfa1yA; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MNqZC2b7jz1yhR for ; Fri, 9 Sep 2022 05:53:55 +1000 (AEST) Received: from localhost ([::1]:36608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWNaz-0006HB-5n for incoming@patchwork.ozlabs.org; Thu, 08 Sep 2022 15:53:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNOf-00057V-1y; Thu, 08 Sep 2022 15:41:09 -0400 Received: from mail-oa1-x36.google.com ([2001:4860:4864:20::36]:38863) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWNOd-0007DG-Hs; Thu, 08 Sep 2022 15:41:08 -0400 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-1278624b7c4so28966249fac.5; Thu, 08 Sep 2022 12:41:06 -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=hBI/7RO7Fr1a9pi8i5aU6Jr0VxpF0f01rU6VBZnellI=; b=TZUfa1yA8mGD9gNHIH6Obzh2Tz5G3k4P4q/K+BzV8IhYsA6zvDOY5Pd/OvON7p+616 Cn10+78eSvbKAKDuxpBEZnjeqDlxUI2cV1R2wuapCT3e263L7aNmJppBuyhcUYG1mIv9 adjUqyOPbxZwvhf9IvV5fvBV6c7hBECxYe8ryuMLOg/tLxpA54YyAZFcRXqMIjwaq2IM tkeBipmMfyZZgpj0466DN5iGqmqC9DQVZRpYYdDuoY+S5m+VhsidvTliBwM5NuF62n+6 fdTS+zltZ6W55dVr27wZuXUfVVZvF8g1hRMOqGi/lobbUb9ThKxM3bkhzzMEceRrl3+g ALXA== 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=hBI/7RO7Fr1a9pi8i5aU6Jr0VxpF0f01rU6VBZnellI=; b=4XbEseIuUsgVeka0L7KaFm74hNTjIUdob5GHNJVdnHt7E1AK5wRAraQdg2kRvkA78q mrbTeCJiwFR233i1PGLoF0YXh93sW6HP2lBTFsdqJvnZ9h4193+dAXsWhGMzBitIRR3l erpGifkb5C3yMfizQ6Z415bQbZYsgHRnCgRmRD3XjTvTBsR0p2qBFidF824UJ/5nhh9W dlP4tR0oT1qNW7DUqWkcOfK9z9HjJCG91aBmTywhzFXdGyK3teERV1mGpgrWwCNAsOXZ 236aFZwyIRAsRuzrvwymJSq/QM0wsZwCaHlK/lKQzK3eDf34DMH/LhQucBJLadJjN5Rn FE4Q== X-Gm-Message-State: ACgBeo3BwrwX4P+j3WMkvaGAQ61brmLYUHk66qrrmcgTxZhJYas2cSdk oCGnTVuB9klVFhpAWe3LX6OApXt1sEuuZw== X-Google-Smtp-Source: AA6agR7yNOjg5jnHvyIliPHaU0K53lqPW3T55i8lRLGG5mJvKandYsg/KO+Mma3dxcWcRSJL3K20VQ== X-Received: by 2002:a05:6870:701f:b0:127:8afc:e62c with SMTP id u31-20020a056870701f00b001278afce62cmr2780842oae.234.1662666065843; Thu, 08 Sep 2022 12:41:05 -0700 (PDT) Received: from balboa.ibmuc.com (200-207-147-180.dsl.telesp.net.br. [200.207.147.180]) by smtp.gmail.com with ESMTPSA id 3-20020aca0703000000b0033ad6ea8d11sm2839849oih.47.2022.09.08.12.41.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 12:41:05 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, clg@kaod.org, Daniel Henrique Barboza , BALATON Zoltan Subject: [PATCH v7 08/14] hw/ppc: set machine->fdt in pegasos2_machine_reset() Date: Thu, 8 Sep 2022 16:40:34 -0300 Message-Id: <20220908194040.518400-9-danielhb413@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220908194040.518400-1-danielhb413@gmail.com> References: <20220908194040.518400-1-danielhb413@gmail.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" We'll introduce a QMP/HMP command that requires machine->fdt to be set properly. Cc: BALATON Zoltan Cc: qemu-ppc@nongnu.org Signed-off-by: Daniel Henrique Barboza Reviewed-by: BALATON Zoltan --- hw/ppc/pegasos2.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/ppc/pegasos2.c b/hw/ppc/pegasos2.c index 61f4263953..ecf682b148 100644 --- a/hw/ppc/pegasos2.c +++ b/hw/ppc/pegasos2.c @@ -331,6 +331,10 @@ static void pegasos2_machine_reset(MachineState *machine) vof_build_dt(fdt, pm->vof); vof_client_open_store(fdt, pm->vof, "/chosen", "stdout", "/failsafe"); + + /* Set machine->fdt for 'dumpdtb' QMP/HMP command */ + machine->fdt = fdt; + pm->cpu->vhyp = PPC_VIRTUAL_HYPERVISOR(machine); } From patchwork Thu Sep 8 19:40:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1675806 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=dV1xQhJw; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MNqKf26fqz1ynD for ; Fri, 9 Sep 2022 05:43:02 +1000 (AEST) Received: from localhost ([::1]:48866 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWNQS-00083p-3w for incoming@patchwork.ozlabs.org; Thu, 08 Sep 2022 15:43:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNOh-0005Ed-Fd; Thu, 08 Sep 2022 15:41:11 -0400 Received: from mail-oa1-x2c.google.com ([2001:4860:4864:20::2c]:43550) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWNOf-0007Da-U3; Thu, 08 Sep 2022 15:41:11 -0400 Received: by mail-oa1-x2c.google.com with SMTP id 586e51a60fabf-1279948d93dso27359589fac.10; Thu, 08 Sep 2022 12:41:09 -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=Ec2Lo/5G8PihGWfWUwrMlKjdFfVtvxfpeHSd7ZKavpg=; b=dV1xQhJw/qmlnrP4gf9qXl3e0vT/+D0P2ivBi3XxguanA21TddkZIKugCEZgJdkXou mm9THCSa13Oq3fgUT8uqR66T1qKKOJSNO8bN1QUTJEEzEDElGWbH3MucdP7+zshuO1h/ FnDDMj/NzP/S0ggYSF0bRlt+Ee9Dvaru5x7P4kZIYqVHocCoyIfqbha8pZ66sJQ5WFmr I0rfdQtS3ZQCCSWU0rPyuTYn50WzsHq7Il/bkwxZdcgNXTMcb2ZXa57MlmN6al4bnGN6 WFxbcd0WKrI6M4R8sndVIo2CgcZt8nGsrBtPkNvL2tRDVRgtuipQYanIODETYENUijL8 Nb1A== 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=Ec2Lo/5G8PihGWfWUwrMlKjdFfVtvxfpeHSd7ZKavpg=; b=yV1e1x9zkMqQ/PCOuuvI14ZOH4/fR9nmgC56FNIJHv+ByC8bNqmngSXxvDLD2lRLmk xipY/px1DJL0VdQGA/ZWfznaRPmJRsi21BmXjuizJwzHbLTVvmUUXZLH9N3D0Ih40Ztw 8lesrjwmZBeBMAFdUcI1mM0i0fIMgPexnBzDcZ8TYrbfcpdoSIufNoTjbrDhbSF2Nia6 hvjIQkfI3tR19jMTwv3pd223HprY/o2VXGW0ZwtnS9ALANsJ/6gjDeaH76d3sm4UZvvy /mxScThox9nS6pfHFBRGttWrRjCgv5oOmr/AprQerf/ARWIfkKq8JfS3AH/QhNga2Ksz vgvQ== X-Gm-Message-State: ACgBeo3aut/e53J2yPIpl4MfxeZkFveIykNH2csDaJ1ZrTujvvZyndkx ++g5QuvaOHLgT9ZFtW+78CiCAd/sHSW6iw== X-Google-Smtp-Source: AA6agR4bp1wZpmFcgE3q0z6F3HCRcU3Nrj/vBFdM0kQmAo3g367K60Higvr66PsWOtX65rDaKT/uUA== X-Received: by 2002:a05:6870:8a09:b0:126:7a92:1b0b with SMTP id p9-20020a0568708a0900b001267a921b0bmr2814258oaq.152.1662666068421; Thu, 08 Sep 2022 12:41:08 -0700 (PDT) Received: from balboa.ibmuc.com (200-207-147-180.dsl.telesp.net.br. [200.207.147.180]) by smtp.gmail.com with ESMTPSA id 3-20020aca0703000000b0033ad6ea8d11sm2839849oih.47.2022.09.08.12.41.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 12:41:07 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, clg@kaod.org, Daniel Henrique Barboza , Frederic Barrat Subject: [PATCH v7 09/14] hw/ppc: set machine->fdt in pnv_reset() Date: Thu, 8 Sep 2022 16:40:35 -0300 Message-Id: <20220908194040.518400-10-danielhb413@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220908194040.518400-1-danielhb413@gmail.com> References: <20220908194040.518400-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2c; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x2c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will enable support for the 'dumpdtb' QMP/HMP command for all powernv machines. Reviewed-by: Cédric Le Goater Reviewed-by: Frederic Barrat Signed-off-by: Daniel Henrique Barboza --- hw/ppc/pnv.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/ppc/pnv.c b/hw/ppc/pnv.c index 354aa289d1..6a20c4811f 100644 --- a/hw/ppc/pnv.c +++ b/hw/ppc/pnv.c @@ -678,7 +678,13 @@ static void pnv_reset(MachineState *machine) qemu_fdt_dumpdtb(fdt, fdt_totalsize(fdt)); cpu_physical_memory_write(PNV_FDT_ADDR, fdt, fdt_totalsize(fdt)); - g_free(fdt); + /* + * Set machine->fdt for 'dumpdtb' QMP/HMP command. Free + * the existing machine->fdt to avoid leaking it during + * a reset. + */ + g_free(machine->fdt); + machine->fdt = fdt; } static ISABus *pnv_chip_power8_isa_create(PnvChip *chip, Error **errp) From patchwork Thu Sep 8 19:40:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1675825 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=anIhY5rO; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MNqdz51xcz1ynD for ; Fri, 9 Sep 2022 05:57:10 +1000 (AEST) Received: from localhost ([::1]:58856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWNe6-0002uc-SO for incoming@patchwork.ozlabs.org; Thu, 08 Sep 2022 15:57:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34040) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNOl-0005Rh-J1; Thu, 08 Sep 2022 15:41:15 -0400 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]:42610) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWNOj-0007Dz-SU; Thu, 08 Sep 2022 15:41:15 -0400 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-127d10b4f19so21411104fac.9; Thu, 08 Sep 2022 12:41:13 -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=gdxoRd7OeTBWEhsO7aIWLhTwjTOt7R/kxNuYrJctnJw=; b=anIhY5rOf+t3cAMMEhM+5R7tldN0abyDAQZV85R17WEP3hhhza+jdkVl72mrT3OlwU Y/dm0gFaoHeLflHf4jUHWLAMqsazGi/Nc2kuRJfA4YBSFd6FxC1HtXaD34ouM9o9/cIG 9njAC2o2B9ZwrZFCuwdcdmWuoPstA+jTgZLr8QCIMi7ZaV0o3OlGWNF/L3AobF6XcYVo w1Y8OAWzdwxJFDxmLX5xUXXsZsfjGSk4LmCUXiyNU74M7YSWGwRaPENOWnDxIEfz06ds ZExAASJzh7dCU2bY/YRKmQgoGQKdLWp4XnicZ/lh/GQX1sPFhBI3E4E9BWLSIYS2GmQu wKFw== 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=gdxoRd7OeTBWEhsO7aIWLhTwjTOt7R/kxNuYrJctnJw=; b=ljhejY8dROyBgKPJz0OxlKmNvERdvQBORngWP7lWNGskT7eS0F4qbsys+9y7J9UmgD oUj/6FA1i0W8W/ivhMN546ZhX9W6CmsQQXkvzYp4dwO7RHURk9KAGEpGdYPsbaZnsMuc 8wWYeU0lOu5dwIa609UhHm7TdoAoyoLYNpdi8uQOMtTLXEFv0tKdx8tZ/VoVssIkf/zO jCU+2iv15vTPHMXqJ0ghumh9Q+t9FylbI471wDGwAtwl4Uw8k1aDvp4WpY/yIq0z1rhm N1bJDUcmkV+XJgHjIH8XkqNAyERKiuSaWQG+3j8QmLM8CsO7mK5r+haeIgI5ePTdPFCc bGfg== X-Gm-Message-State: ACgBeo04ZYVPJ/2Teq7WKeOXYf1YVpF9mNQa9ISLCDIS0zZqV4l+icnc NAL48r2LwKafFnSSprB3cJiQz6tuCvpF7Q== X-Google-Smtp-Source: AA6agR4Nc37wS+zgfnxKy6XIMW7MQAUuAQrB3Ckrbfs1SVFmDDroyBqhq/LGU2EI4Yjz2AaemxnhUw== X-Received: by 2002:a05:6870:3450:b0:11e:b695:c13f with SMTP id i16-20020a056870345000b0011eb695c13fmr2945149oah.130.1662666071126; Thu, 08 Sep 2022 12:41:11 -0700 (PDT) Received: from balboa.ibmuc.com (200-207-147-180.dsl.telesp.net.br. [200.207.147.180]) by smtp.gmail.com with ESMTPSA id 3-20020aca0703000000b0033ad6ea8d11sm2839849oih.47.2022.09.08.12.41.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 12:41:10 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, clg@kaod.org, Daniel Henrique Barboza , David Gibson Subject: [PATCH v7 10/14] hw/ppc: set machine->fdt in spapr machine Date: Thu, 8 Sep 2022 16:40:36 -0300 Message-Id: <20220908194040.518400-11-danielhb413@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220908194040.518400-1-danielhb413@gmail.com> References: <20220908194040.518400-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::2e; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x2e.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The pSeries machine never bothered with the common machine->fdt attribute. We do all the FDT related work using spapr->fdt_blob. We're going to introduce a QMP/HMP command to dump the FDT, which will rely on setting machine->fdt properly to work across all machine archs/types. Let's set machine->fdt in two places where we manipulate the FDT: spapr_machine_reset() and CAS. There are other places where the FDT is manipulated in the pSeries machines, most notably the hotplug/unplug path. For now we'll acknowledge that we won't have the most accurate representation of the FDT, depending on the current machine state, when using this QMP/HMP fdt command. Making the internal FDT representation always match the actual FDT representation that the guest is using is a problem for another day. spapr->fdt_blob is left untouched for now. To replace it with machine->fdt, since we're migrating spapr->fdt_blob, we would need to migrate machine->fdt as well. This is something that we would like to to do keep our code simpler but it's also a work we'll leave for later. Reviewed-by: David Gibson Signed-off-by: Daniel Henrique Barboza --- hw/ppc/spapr.c | 3 +++ hw/ppc/spapr_hcall.c | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index fb790b61e4..170bbfd199 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -1713,6 +1713,9 @@ static void spapr_machine_reset(MachineState *machine) spapr->fdt_initial_size = spapr->fdt_size; spapr->fdt_blob = fdt; + /* Set machine->fdt for 'dumpdtb' QMP/HMP command */ + machine->fdt = fdt; + /* Set up the entry state */ first_ppc_cpu->env.gpr[5] = 0; diff --git a/hw/ppc/spapr_hcall.c b/hw/ppc/spapr_hcall.c index a8d4a6bcf0..891206e893 100644 --- a/hw/ppc/spapr_hcall.c +++ b/hw/ppc/spapr_hcall.c @@ -1256,6 +1256,14 @@ target_ulong do_client_architecture_support(PowerPCCPU *cpu, spapr->fdt_initial_size = spapr->fdt_size; spapr->fdt_blob = fdt; + /* + * Set the machine->fdt pointer again since we just freed + * it above (by freeing spapr->fdt_blob). We set this + * pointer to enable support for the 'dumpdtb' QMP/HMP + * command. + */ + MACHINE(spapr)->fdt = fdt; + return H_SUCCESS; } From patchwork Thu Sep 8 19:40:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1675810 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=AX4S6/xl; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MNqPD5SSdz1yj1 for ; Fri, 9 Sep 2022 05:46:07 +1000 (AEST) Received: from localhost ([::1]:47080 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWNTP-0005HQ-UN for incoming@patchwork.ozlabs.org; Thu, 08 Sep 2022 15:46:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNOn-0005Vp-2K; Thu, 08 Sep 2022 15:41:17 -0400 Received: from mail-oa1-x36.google.com ([2001:4860:4864:20::36]:38863) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWNOl-0007DG-BT; Thu, 08 Sep 2022 15:41:16 -0400 Received: by mail-oa1-x36.google.com with SMTP id 586e51a60fabf-1278624b7c4so28967130fac.5; Thu, 08 Sep 2022 12:41: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=knGOKFS2756lg9un0i8XENNl/xbiU4W5WHHiAwpLrxk=; b=AX4S6/xlYLC+J9EW2gdT28IxrQYPRBzw3sTEw8cCG6xDIcRHRueISMkuw8QSArK1q3 jtHwNLqN07w7PfsJd+8MDNfM4fjuOOkON9zaeIXakLiofPdNnS55up9h4ZBjJliqQ31q vG0yX6kHROtgxMPQZ9jBN9rYHK9SRIDhDCRtpC670UWfctrROOtAt1sZm8CcZsJceS+u LgWUmRcPM0wzLMNeXVVkLcDNFAIG8UpV9oQgiVIuI3V22sqtZYhG/j+fWghZOojJyGN/ D7CGZoX+AUbEm7uwssKQk0nTS5D2Tixx7+GU/0Tn84TOqEKkAS95SbqJJUwr2CwuGFUh BzXw== 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=knGOKFS2756lg9un0i8XENNl/xbiU4W5WHHiAwpLrxk=; b=ul6hQEUdKWPWaNcczp7xKvaBFkiZcVAlSl8lo2bSrzIgEzLL7ZRfwL4OG/jF0wr3hw rPEeWNp6H2Uun7KPUxK7v8pcn+MDKzKrqjBPv3i6W6NH0+C7/HvmWXXq0O0LgcrWy2ni QExHfyHPotQZ8T4IIgalWcBz5jRHQm5FEftjTFPrW1wxDOH5ii/aD9I+rlSkL4JsfV1c iKJfvigO2uoiYNEsoGN/1lpgCpZrAv48uUtQRQoedbMYtHs39DNZOYLVe6aKQvI9meEG K9m1XcP2qz0HfRBJkG7oDRQ2RizmHe9CeEsd+n4jOYtJP4BM3eDBAF+XGHOKJFGKcLBv MhzA== X-Gm-Message-State: ACgBeo3ODZG/BUC+KA321n9zopR13tC+b4XqLDiJF1a92/nRLn/NQaLD /LNNMd5oXXsUOOVBSlad+PtduGDeUWyaaQ== X-Google-Smtp-Source: AA6agR5pFoVlo8BD/b2buGykXcrgupFfFhj40rggGk0amWnFcw4/1TNACTRUkLYQaSR6k5m9PaTpJw== X-Received: by 2002:a05:6870:538e:b0:112:49fd:6753 with SMTP id h14-20020a056870538e00b0011249fd6753mr2933064oan.62.1662666074107; Thu, 08 Sep 2022 12:41:14 -0700 (PDT) Received: from balboa.ibmuc.com (200-207-147-180.dsl.telesp.net.br. [200.207.147.180]) by smtp.gmail.com with ESMTPSA id 3-20020aca0703000000b0033ad6ea8d11sm2839849oih.47.2022.09.08.12.41.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 12:41:13 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, clg@kaod.org, Daniel Henrique Barboza , Alistair Francis , Bin Meng , Palmer Dabbelt , Alistair Francis Subject: [PATCH v7 11/14] hw/riscv: set machine->fdt in sifive_u_machine_init() Date: Thu, 8 Sep 2022 16:40:37 -0300 Message-Id: <20220908194040.518400-12-danielhb413@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220908194040.518400-1-danielhb413@gmail.com> References: <20220908194040.518400-1-danielhb413@gmail.com> MIME-Version: 1.0 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: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will enable support for 'dumpdtb' QMP/HMP command for the sifive_u machine. Cc: Alistair Francis Cc: Bin Meng Cc: Palmer Dabbelt Reviewed-by: Alistair Francis Signed-off-by: Daniel Henrique Barboza --- hw/riscv/sifive_u.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c index e4c814a3ea..b139824aab 100644 --- a/hw/riscv/sifive_u.c +++ b/hw/riscv/sifive_u.c @@ -634,6 +634,9 @@ static void sifive_u_machine_init(MachineState *machine) start_addr_hi32 = (uint64_t)start_addr >> 32; } + /* Set machine->fdt for 'dumpdtb' QMP/HMP command */ + machine->fdt = s->fdt; + /* reset vector */ uint32_t reset_vec[12] = { s->msel, /* MSEL pin state */ From patchwork Thu Sep 8 19:40:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1675816 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=B3LO9U1U; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MNqSz3Cfjz1yj1 for ; Fri, 9 Sep 2022 05:49:23 +1000 (AEST) Received: from localhost ([::1]:51706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWNWb-0000Nf-8d for incoming@patchwork.ozlabs.org; Thu, 08 Sep 2022 15:49:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44786) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNOq-0005hN-QR; Thu, 08 Sep 2022 15:41:21 -0400 Received: from mail-oa1-x35.google.com ([2001:4860:4864:20::35]:37525) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWNOp-0007Ej-5F; Thu, 08 Sep 2022 15:41:20 -0400 Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-127f5411b9cso15831622fac.4; Thu, 08 Sep 2022 12:41:17 -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=DW1rSBh0neqmDcZLST7TOdBTISrO3R2UrJPNhSW5CJY=; b=B3LO9U1UR/kqjdy82M9NlFIsSSILuR3tR3gVuOhrj9vXp++7eK/bPDyskG4cSbNJqJ t2uebMzjBwS2DdT7WLPpSllwuvE57wVFfvvSL4NZrkCtstMFrQ6mHQa+Cmak+m+2LKhQ SBjoq3zjGRHhJQoEU8irkX+GwuuLUi8dk3c/pcqVg6xMEBnzPGmR9UxaN85lioRqO9dj jBXdGUvNIDuTiu9Bm6dgBqkx4rJpiZxCUP6OAB7eXOfdJ/0x98CoLwlpxVFSgokDTSH1 80hU4PK4A3lKA2bbdrJ+0/FeYXtLZrsDEPiZikKteDdNSMZC7BwOuZ907HARUg2a+n0g wqRQ== 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=DW1rSBh0neqmDcZLST7TOdBTISrO3R2UrJPNhSW5CJY=; b=wxrAn7K31ZZz9u+kzevfJo7eagce3QGYm5CWwVMskXNlm/Tc/pgoAn1NJVxs69aZdO oHbWL4VE2qc5BatYBoBXa6CxhhFriTcqMeb2d6WtmyYmQ1FRSVKK+2DXhzpgVCc5GZ6B iR5bmqX/7C2zus4QQngg/o9B96af1Zeh9ZJ26WYZwzjSJqTTjNgjWNeHQOX1Jaxp2Hic xCvEZl+4fknDjjrpJ0icNV+lUmmkGrAkb8PbE2yhNDjcRudr+pApu9fcUxLrkv/Pue/t ewMms+HUzX1DL3lM7UtjVe5v8cG9CgYZrA0aO3zZQHkUkfVq9eZoMo3oN1+X1kCfx42B /eJQ== X-Gm-Message-State: ACgBeo0o9h2gWh2bUZiLcc/xz6m19nofDjKGRnXSDUo41+2R5nkJansy AYevPjrvOG4JUd5ohQe0JFQqtU6M5YbJJQ== X-Google-Smtp-Source: AA6agR4/R0EpeybHtMAjh6KkJzUTl9UwJDtol5C9W3GIz03jsUR9SyiXHWe4wlZAn1q15K1haJY1Ew== X-Received: by 2002:a05:6870:7394:b0:126:6f7b:15a2 with SMTP id z20-20020a056870739400b001266f7b15a2mr2707288oam.227.1662666076999; Thu, 08 Sep 2022 12:41:16 -0700 (PDT) Received: from balboa.ibmuc.com (200-207-147-180.dsl.telesp.net.br. [200.207.147.180]) by smtp.gmail.com with ESMTPSA id 3-20020aca0703000000b0033ad6ea8d11sm2839849oih.47.2022.09.08.12.41.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 12:41:16 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, clg@kaod.org, Daniel Henrique Barboza , Palmer Dabbelt , Alistair Francis , Bin Meng Subject: [PATCH v7 12/14] hw/riscv: set machine->fdt in spike_board_init() Date: Thu, 8 Sep 2022 16:40:38 -0300 Message-Id: <20220908194040.518400-13-danielhb413@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220908194040.518400-1-danielhb413@gmail.com> References: <20220908194040.518400-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::35; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x35.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will enable support for the 'dumpdtb' QMP/HMP command for the spike machine. Cc: Palmer Dabbelt Cc: Alistair Francis Cc: Bin Meng Reviewed-by: Alistair Francis Signed-off-by: Daniel Henrique Barboza --- hw/riscv/spike.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c index 5ba34543c8..1e1d752c00 100644 --- a/hw/riscv/spike.c +++ b/hw/riscv/spike.c @@ -40,6 +40,8 @@ #include "sysemu/device_tree.h" #include "sysemu/sysemu.h" +#include + static const MemMapEntry spike_memmap[] = { [SPIKE_MROM] = { 0x1000, 0xf000 }, [SPIKE_HTIF] = { 0x1000000, 0x1000 }, @@ -304,6 +306,10 @@ static void spike_board_init(MachineState *machine) /* Compute the fdt load address in dram */ fdt_load_addr = riscv_load_fdt(memmap[SPIKE_DRAM].base, machine->ram_size, s->fdt); + + /* Set machine->fdt for 'dumpdtb' QMP/HMP command */ + machine->fdt = s->fdt; + /* load the reset vector */ riscv_setup_rom_reset_vec(machine, &s->soc[0], memmap[SPIKE_DRAM].base, memmap[SPIKE_MROM].base, From patchwork Thu Sep 8 19:40:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1675818 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=kDrN744w; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MNqWk1t0Wz1yhR for ; Fri, 9 Sep 2022 05:51:46 +1000 (AEST) Received: from localhost ([::1]:58142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWNYu-0002nh-4n for incoming@patchwork.ozlabs.org; Thu, 08 Sep 2022 15:51:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNOt-0005ky-Uh; Thu, 08 Sep 2022 15:41:23 -0400 Received: from mail-ot1-x32c.google.com ([2607:f8b0:4864:20::32c]:43560) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWNOr-0007Ey-88; Thu, 08 Sep 2022 15:41:22 -0400 Received: by mail-ot1-x32c.google.com with SMTP id 92-20020a9d0be5000000b0063946111607so13019782oth.10; Thu, 08 Sep 2022 12:41: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=16WddNSZhqtrCV5F9Z1jI9UMmcItES0z/obJPMI510U=; b=kDrN744wwjwBN4bezDzjhVVAxakuq3L+cgsyy5u7UGuodZlRqcB3vZt5h8H+zD1H29 keAhytwqvRTuK4aTJR1ZItYbOwc3dhePyujhXeLcPyniGM90dTOTttQ/fx3q1V+2sxc+ k0LuEfUh1AItOtyjFbjUvsg8VoaapQVG4TZVS+ABaw52KZLlr30gav2iNl+Rz+bMprj1 kQelbDAon1agMg5JeF1Xgy2oI+J22U0VQ+UZS1pEQeTeirvCQiDOy96grO6uxBMgH24z gPkZfAtk6zRaYTzauEp9KFa8d5V4pC6fiw3dADOpLVJ4IKhsyZ01WMrxwUKEeCkUmzMT dozg== 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=16WddNSZhqtrCV5F9Z1jI9UMmcItES0z/obJPMI510U=; b=vLDI+W/8GAuA2glXsOw5f+3Avg0kR0YUjFHEhVyOy7GTSheffdVdESzdt8CmRkWAW7 fQaTDBYwr3q/SY/DNBl8vjSL5rRbjoB4fRieQyjm8VUTcWBWTu5lBtIxxLPQmq0lpZL0 ggd0pwrFeolPShOyrMvybICvd3eiPLr0AT+gShEFvdBrc39whoQ1GL4YwvbWPXbx+Do2 tRmC8R3NcNa9e1EBwDz/xE+7WkddtPJGjn3QJYvzCevH9gUu+13PofsA8+5dapBzEgdR NEEeGIvrfV60/c9lzINzbriFmFrsWXdt+N6D6nog516rfgdyHENjkQe5fYchNJqhJfIu zWQA== X-Gm-Message-State: ACgBeo3WOPx0Y5eJDFc3jGXmEYdGGeVlUG/rWaAc7WcEdf0TWRWpf8Va 7JTDchHKko6pFr3MJLuhY87+A3/3YmWObg== X-Google-Smtp-Source: AA6agR4OsG+HQrgvXeyo5wreCx90XUNeLqOwhjXQnm9B3Sc9pJo+izED8H+s5zx8SktdHZkJOVXW8A== X-Received: by 2002:a05:6830:25c4:b0:637:2a66:1dfd with SMTP id d4-20020a05683025c400b006372a661dfdmr3945043otu.383.1662666079294; Thu, 08 Sep 2022 12:41:19 -0700 (PDT) Received: from balboa.ibmuc.com (200-207-147-180.dsl.telesp.net.br. [200.207.147.180]) by smtp.gmail.com with ESMTPSA id 3-20020aca0703000000b0033ad6ea8d11sm2839849oih.47.2022.09.08.12.41.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 12:41:18 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, clg@kaod.org, Daniel Henrique Barboza Subject: [PATCH v7 13/14] hw/xtensa: set machine->fdt in xtfpga_init() Date: Thu, 8 Sep 2022 16:40:39 -0300 Message-Id: <20220908194040.518400-14-danielhb413@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220908194040.518400-1-danielhb413@gmail.com> References: <20220908194040.518400-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::32c; envelope-from=danielhb413@gmail.com; helo=mail-ot1-x32c.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" This will enable support for the 'dumpdtb' QMP/HMP command for all xtensa machines that uses a FDT. Signed-off-by: Daniel Henrique Barboza --- hw/xtensa/meson.build | 2 +- hw/xtensa/xtfpga.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/xtensa/meson.build b/hw/xtensa/meson.build index 1d5835df4b..ebba51cc74 100644 --- a/hw/xtensa/meson.build +++ b/hw/xtensa/meson.build @@ -6,6 +6,6 @@ xtensa_ss.add(files( )) xtensa_ss.add(when: 'CONFIG_XTENSA_SIM', if_true: files('sim.c')) xtensa_ss.add(when: 'CONFIG_XTENSA_VIRT', if_true: files('virt.c')) -xtensa_ss.add(when: 'CONFIG_XTENSA_XTFPGA', if_true: files('xtfpga.c')) +xtensa_ss.add(when: 'CONFIG_XTENSA_XTFPGA', if_true: [files('xtfpga.c'), fdt]) hw_arch += {'xtensa': xtensa_ss} diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index 2a5556a35f..867427c3d9 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -50,6 +50,8 @@ #include "hw/xtensa/mx_pic.h" #include "migration/vmstate.h" +#include + typedef struct XtfpgaFlashDesc { hwaddr base; size_t size; @@ -377,7 +379,9 @@ static void xtfpga_init(const XtfpgaBoardDesc *board, MachineState *machine) cur_tagptr = put_tag(cur_tagptr, BP_TAG_FDT, sizeof(dtb_addr), &dtb_addr); cur_lowmem = QEMU_ALIGN_UP(cur_lowmem + fdt_size, 4 * KiB); - g_free(fdt); + + /* Set machine->fdt for 'dumpdtb' QMP/HMP command */ + machine->fdt = fdt; } #else if (dtb_filename) { From patchwork Thu Sep 8 19:40:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Henrique Barboza X-Patchwork-Id: 1675824 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=SdGR7UEw; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MNqc313bMz1ynD for ; Fri, 9 Sep 2022 05:55:31 +1000 (AEST) Received: from localhost ([::1]:42022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWNcW-0000fx-VG for incoming@patchwork.ozlabs.org; Thu, 08 Sep 2022 15:55:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWNOw-0005vZ-IY; Thu, 08 Sep 2022 15:41:26 -0400 Received: from mail-oa1-x32.google.com ([2001:4860:4864:20::32]:39706) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oWNOu-0007FL-MT; Thu, 08 Sep 2022 15:41:26 -0400 Received: by mail-oa1-x32.google.com with SMTP id 586e51a60fabf-11e9a7135easo47172871fac.6; Thu, 08 Sep 2022 12:41:23 -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=YXFNdSMPQKzSn1qm43GndbjG2aj9DxDqDqivIw7D6Fg=; b=SdGR7UEw4Ol9f7kftvlV2htLMZGJL5PZc4HyfKLlLU9TkMjH7NpkcmH8zdvISVqaXZ VfAhxiORuK2cVyN7oe05e/35MiwjBLtqMh+dvp97ylf3ygxrCYlIqmb8s5Jftx5xSw5c Ct1KrPgem9bB1L8KkjMRL3Al0iwPq00TvfI4LlFJCFu56I5zkqxPq9aB6ivrH3ufT4mb 83/v+M3TDa+GvbyjdJcF1OPGSB1WMDY/mQ7uRqLUuS91nm1mbC0LK0VPkGsNEdhAZCkm yQBTbhDfsSaVNf1VvyeAuBTzWMAwmUZVo5xy0vXSpMYYD4aIsd1vg1b4wezjVXQGM8MW /uXw== 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=YXFNdSMPQKzSn1qm43GndbjG2aj9DxDqDqivIw7D6Fg=; b=XLZ4s7ppDLDTspdpvesdzlMkeTLXFyUiMF8jKGgW/44cQYmYwfPRVI6dhxg982aFag litUrMtWlNn2RObIPflBOr2IjRsMrg116QuLachyE/0iNCchFrrLd+uh0ZimXca4AghA +dw9qA4dyAlt/WjIB4blwDvReq5THnpi6fwoEFZdpP4qx/3Cxk6R+ekWEyBoEVuUFED2 8808mDGR0U6BlfrzmtJ9SbictOnI9Vum9xpwnIB2JrpgML3FoKp+1n6Tg2jkAvh+jegi ByyeCUJFjfsjybpmgTXKQDmgZV8ysBqsA+fPwGhIFTo9vRr4hawS4BiLV4qK+K+7an8w WzPA== X-Gm-Message-State: ACgBeo0XtX9jZsVZwfEh0heZMaIUaDxO2SUpR48NFT4FFRCu5z2iaYJ6 4Ex2KXgAHelMYtUh4ZS8GunpS9dS1CN+ng== X-Google-Smtp-Source: AA6agR4rhpUTLVx4HuZwyZso5km7+s3XeWOB+X+yj3IlorIh4TiGLWPjzQOoadWap56eI51R5oW9pw== X-Received: by 2002:a05:6808:190f:b0:343:ba2:7d4d with SMTP id bf15-20020a056808190f00b003430ba27d4dmr2072518oib.227.1662666082264; Thu, 08 Sep 2022 12:41:22 -0700 (PDT) Received: from balboa.ibmuc.com (200-207-147-180.dsl.telesp.net.br. [200.207.147.180]) by smtp.gmail.com with ESMTPSA id 3-20020aca0703000000b0033ad6ea8d11sm2839849oih.47.2022.09.08.12.41.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Sep 2022 12:41:21 -0700 (PDT) From: Daniel Henrique Barboza To: qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, clg@kaod.org, Daniel Henrique Barboza , "Dr . David Alan Gilbert" , Markus Armbruster , Alistair Francis , David Gibson Subject: [PATCH v7 14/14] qmp/hmp, device_tree.c: introduce dumpdtb Date: Thu, 8 Sep 2022 16:40:40 -0300 Message-Id: <20220908194040.518400-15-danielhb413@gmail.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220908194040.518400-1-danielhb413@gmail.com> References: <20220908194040.518400-1-danielhb413@gmail.com> MIME-Version: 1.0 Received-SPF: pass client-ip=2001:4860:4864:20::32; envelope-from=danielhb413@gmail.com; helo=mail-oa1-x32.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, T_SCC_BODY_TEXT_LINE=-0.01 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" To save the FDT blob we have the '-machine dumpdtb=' property. With this property set, the machine saves the FDT in and exit. The created file can then be converted to plain text dts format using 'dtc'. There's nothing particularly sophisticated into saving the FDT that can't be done with the machine at any state, as long as the machine has a valid FDT to be saved. The 'dumpdtb' command receives a 'filename' paramenter and, if a valid FDT is available, it'll save it in a file 'filename'. In short, this is a '-machine dumpdtb' that can be fired on demand via QMP/HMP. A valid FDT consists of a FDT that was created using libfdt being retrieved via 'current_machine->fdt' in device_tree.c. This condition is met by most FDT users in QEMU. This command will always be executed in-band (i.e. holding BQL), avoiding potential race conditions with machines that might change the FDT during runtime (e.g. PowerPC 'pseries' machine). Cc: Dr. David Alan Gilbert Cc: Markus Armbruster Cc: Alistair Francis Cc: David Gibson Acked-by: Dr. David Alan Gilbert Signed-off-by: Daniel Henrique Barboza Reviewed-by: Markus Armbruster --- hmp-commands.hx | 15 +++++++++++++++ include/sysemu/device_tree.h | 1 + monitor/misc.c | 1 + qapi/machine.json | 18 ++++++++++++++++++ softmmu/device_tree.c | 31 +++++++++++++++++++++++++++++++ 5 files changed, 66 insertions(+) diff --git a/hmp-commands.hx b/hmp-commands.hx index 182e639d14..753669a2eb 100644 --- a/hmp-commands.hx +++ b/hmp-commands.hx @@ -1800,3 +1800,18 @@ ERST "\n\t\t\t\t\t limit on a specified virtual cpu", .cmd = hmp_cancel_vcpu_dirty_limit, }, + +#if defined(CONFIG_FDT) + { + .name = "dumpdtb", + .args_type = "filename:F", + .params = "filename", + .help = "save the FDT in the 'filename' file to be decoded using dtc", + .cmd = hmp_dumpdtb, + }, + +SRST +``dumpdtb`` *filename* + Save the FDT in the 'filename' file to be decoded using dtc. +ERST +#endif diff --git a/include/sysemu/device_tree.h b/include/sysemu/device_tree.h index ef060a9759..e7c5441f56 100644 --- a/include/sysemu/device_tree.h +++ b/include/sysemu/device_tree.h @@ -136,6 +136,7 @@ int qemu_fdt_add_path(void *fdt, const char *path); } while (0) void qemu_fdt_dumpdtb(void *fdt, int size); +void hmp_dumpdtb(Monitor *mon, const QDict *qdict); /** * qemu_fdt_setprop_sized_cells_from_array: diff --git a/monitor/misc.c b/monitor/misc.c index 3d2312ba8d..e7dd63030b 100644 --- a/monitor/misc.c +++ b/monitor/misc.c @@ -49,6 +49,7 @@ #include "sysemu/blockdev.h" #include "sysemu/sysemu.h" #include "sysemu/tpm.h" +#include "sysemu/device_tree.h" #include "qapi/qmp/qdict.h" #include "qapi/qmp/qerror.h" #include "qapi/qmp/qstring.h" diff --git a/qapi/machine.json b/qapi/machine.json index abb2f48808..9f0c8c8374 100644 --- a/qapi/machine.json +++ b/qapi/machine.json @@ -1664,3 +1664,21 @@ '*size': 'size', '*max-size': 'size', '*slots': 'uint64' } } + +## +# @dumpdtb: +# +# Save the FDT in dtb format. +# +# @filename: name of the FDT file to be created +# +# Since: 7.2 +# +# Example: +# {"execute": "dumpdtb"} +# "arguments": { "filename": "fdt.dtb" } } +# +## +{ 'command': 'dumpdtb', + 'data': { 'filename': 'str' }, + 'if': 'CONFIG_FDT' } diff --git a/softmmu/device_tree.c b/softmmu/device_tree.c index 6ca3fad285..7031dcf89d 100644 --- a/softmmu/device_tree.c +++ b/softmmu/device_tree.c @@ -26,6 +26,9 @@ #include "hw/loader.h" #include "hw/boards.h" #include "qemu/config-file.h" +#include "qapi/qapi-commands-machine.h" +#include "qapi/qmp/qdict.h" +#include "monitor/hmp.h" #include @@ -643,3 +646,31 @@ out: g_free(propcells); return ret; } + +void qmp_dumpdtb(const char *filename, Error **errp) +{ + g_autoptr(GError) err = NULL; + int size; + + if (!current_machine->fdt) { + error_setg(errp, "This machine doesn't have a FDT"); + return; + } + + size = fdt_totalsize(current_machine->fdt); + + if (!g_file_set_contents(filename, current_machine->fdt, size, &err)) { + error_setg(errp, "Error saving FDT to file %s: %s", + filename, err->message); + } +} + +void hmp_dumpdtb(Monitor *mon, const QDict *qdict) +{ + const char *filename = qdict_get_str(qdict, "filename"); + Error *local_err = NULL; + + qmp_dumpdtb(filename, &local_err); + + hmp_handle_error(mon, local_err); +}