From patchwork Mon Jan 15 04:34:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13519302 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D856DC3DA79 for ; Mon, 15 Jan 2024 04:35:53 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPEgi-0002Ga-0K; Sun, 14 Jan 2024 23:35:04 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rPEgg-0002FH-54; Sun, 14 Jan 2024 23:35:02 -0500 Received: from mx0b-0064b401.pphosted.com ([205.220.178.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rPEge-00031f-1Y; Sun, 14 Jan 2024 23:35:01 -0500 Received: from pps.filterd (m0250811.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40F4O3Gf003990; Mon, 15 Jan 2024 04:34:53 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=6+KeztvLgQtSzYS/TQvIYfNGAPEQQaGKKtQ45xpVw98=; b= qfQeocVW7O2t3fxMO1J2tgOpp4mHXzFiBxSyd9baOOcM5TDMmGFY8dU9kI1T1vrw iwG9NjPa23Hc+6zDWhdnBOfJLjl7Ka3EoMIfJ/ZQq42e2m4n79+XQP77KQC9Gui0 oSaMD2pxdB8pMLu4ACgXDGR0EcuXcqbcYpWsRWBguhs0ma8ChxHscSZGeA3FsUc3 mow6yn6DHsjcsHi2J3bQSvGdYoJ/v/4h9IDbZd3jhBJG75yEJn4bWnx1htSm8VnQ 1ExgXoFc/fYhRJAxbZF0Mze3fj8niJ3ltophOkQ4aH+yHCt20+Og6LJSRi8jiGc+ 9z5Sy7E/rGCb6IZqvG5eOw== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3vkfqx9mya-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 15 Jan 2024 04:34:53 +0000 (GMT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QVplWGu36+6xKWKJYLghFRT59bbwwDpyjVoxl7J9xYlZ3sroFJeQiQkQuyYxIcuOEeSFiCFGDcprb4VvxNVwKiQo8O6SrjRsbTwlvb+b+DtJbzk9zkzUHi6dzMZqLrscLwt6ieb6YahVLdRe32cw303tosc9FDyHYsZGxr4EJRX4FsUYhIaLFJO8O/AbnrMVvAO4ega3jhMVKKGiq4j1oALAE9QHpWyX/1SOd5mP1pVNdTMmHvcm+BkeMd5jNLnaB65nf8VpmyPOR31lJnQ+UjKYQkKQ0zyfJpaqDVLFQW1VXRtz2ANsuplJpzAR2ximDIZoNPTW1uACHGDtBrC6Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=6+KeztvLgQtSzYS/TQvIYfNGAPEQQaGKKtQ45xpVw98=; b=GixiOd4OhSZdT7lOA66YRKBH8LOya40kS6PPxGGGGbBoYqjDTiJxfntqwReNzvO4I+yRnhNF4QhDPden81MOPJMDUnQSyZ1ma0Ohtl+NywbJQquJpNBEQqZF1yx/e4TQR2bdhlR7Td0NE+AqHlJHlPZGNOHOGv0zt5FvwnV+ISgqR2mqpwBzKrlQUkorJM+DJU2l+BYHxA9j7MvRB7mc6PKQkOM61Ec8KK7SAKvmMqc4R4Uitv0mXV7dMG9wanMU8rXO9lJcngd7MM11TqDuiLkgrFjgR0LARkwdMjV4u33it6sEUgN8GVaMrjHfAC75r00qmkvb8wmq3d5kb7PRnA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by CY8PR11MB6891.namprd11.prod.outlook.com (2603:10b6:930:5c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.19; Mon, 15 Jan 2024 04:34:51 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::4a3a:f09e:3c5d:318c]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::4a3a:f09e:3c5d:318c%6]) with mapi id 15.20.7181.026; Mon, 15 Jan 2024 04:34:51 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Alistair Francis , "Edgar E. Iglesias" , Leif Lindholm , Marcin Juszkiewicz , Peter Maydell , Radoslaw Biernacki , qemu-arm@nongnu.org Subject: [PATCH 1/3] hw/arm: Refactor struct arm_boot_info::get_dtb() Date: Mon, 15 Jan 2024 12:34:28 +0800 Message-Id: <20240115043431.3900922-2-bin.meng@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240115043431.3900922-1-bin.meng@windriver.com> References: <20240115043431.3900922-1-bin.meng@windriver.com> X-ClientProxiedBy: TY2PR04CA0009.apcprd04.prod.outlook.com (2603:1096:404:f6::21) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|CY8PR11MB6891:EE_ X-MS-Office365-Filtering-Correlation-Id: 1bed8eaf-ad42-4548-b810-08dc1583503a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uFwS8/SSjA624Yr7sVxgvdaxbjpeq7iTXNYJhSbFU9ofDlfy6uYfLP1IF0tDrzFAzr01IBTDfV2s6GXKXIRIGUFLtGbKUfjvhy4SYEeKWUI5zbLqkP/a+DCMLXwqG3Yu7bxE3mlsK+2XEJ0daBJW7JzzKCF8aZcaDnFEHydwIR/GnmMoclu344wLankQxfPebxHWdwsz5gpR1ICSAjuYol7UP6M07/WMeuJLImBoTYNyh6t995QHlPbaw36XWsinFvd99vl7Icr8Z1dEl4K1EXPLvmlvnCIAjkj/SRqr8BSUC185KaVjyaq9xxGcu77WDKDUpgAihiG8U61yps1m1ZffbWulRdRrN7S1GI7NrWfxv6/3btNWIIs5MrUB+uE/xDIO3HER9ukp9EGQzr0oh6UnPhHLrjqIcIsV7GDg9yvPCSkJMkAPNwiJSiu+cQleWio14louKSRI95u4om+GsySKWaMg5bAJv6Y9PSbtt2baOay4PiQUxbGSQN+f6oo1d1dPDFH/qtifqgbzSRMYuwNH9rGoTqjy+3UC05+2aWlANeWITZYi6xZZ4+K6Xe3cSDHrrEwYf5LEZprxQeDOFPbISliUsQcgEFnDZP1qoL9gyyjlmkXBp2NuomdxHDOX X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(39840400004)(396003)(136003)(346002)(230922051799003)(1800799012)(64100799003)(186009)(451199024)(66476007)(66946007)(66556008)(6916009)(44832011)(36756003)(8936002)(8676002)(316002)(54906003)(38100700002)(6512007)(4326008)(6486002)(38350700005)(2906002)(5660300002)(83380400001)(41300700001)(86362001)(478600001)(26005)(2616005)(1076003)(52116002)(6506007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: t6qSI9DP94f4Zxw3Qieuc+z3xRAhZG+zHYIsTUxSYCy9gj7HXyqu2ZT5lMAdtPpP7B5aK4ivXpCGrSj0lmT4XHFrJ7R9ukF7vHRNSMpTWyjvLuRuuDznUHtfacZ5YAcoQmHVyYleUf4xJQHuFZCDxOAG4eA0OMQJOYrWnAnO/YzvNVXKK09jOVI/NE2sL7DB+JuJoDsKaYlIBqJ0+JPNiT9xkbm3hjHux46+QbXJy/W/d0fdrgDIoSdHkuHLZhP9SXuaEYMbsWXerDg5OTY59DeJBIjK2hOE4UxTZbQwDGcXUXkIrmr3+PilFo/7NH3MjbsjRepxkfOHmKuGDpOQdPGBVyi1DSsSPkn6+NAOItoRsDeY8IxgOZLQflVksIDcTHqYIzKeox2xi/uThAfq0MAg37bUU1ANF8XCO0xGQWOevFHk/Cxzf0K9jbRJnCflFR9vjWLr3Ycsbdv0yb4m/kYcTda+SkCFoBJ98vJrsaAn/ArBB3KOBRf8MYnRgDVRaj2BRg6kYHXDg/Ml35J0YJnwHXwAVQCdT8vu2pik7scks7ecQCJ1r3pXJGx8gt1Goe2Bt0CXwXhgxiL+Ct2rleoQ2VVQR1PJeUN8EArNBPUtZ6K3U9G1+WLFqExPSKkw6hvtGJj0II6aTgHi5oyQyCZFixaHD4H+s1T+KxbWBrnNtwyZji/TTYJ6aLtT+bI7hLeozRZRPtK7IJ0AnzWr9AtGbSd1dnN18j24/lyuD0zZtzabkVjohhGzXSfXrUhfNr0LnGSSyR5nt0O25elGZauzhFkUbEs5hKi5PimBmRvG7GGssLk301hWqTFai9nHixPmXnFF+Ii2Bo2+PzhTSUrijbvIvtFuWCHzersPeMwoaRA7GaBwEqq+x+2h0ku7/TPVdcMzW4274LJuJD6Mw8JbSYeJeqdJuR+PybEqmQPjTfLZLWylBp+iaYieVf9cuXObAr/7dFQZYU+6QsLlqHEtZPyzQVu4YBqsAdLLtzzy93lxCSaepsoG7VW/iP8UWjK5iv0FWlI7MtKGigAM7y3iWLws5Ip2Wjy4u/AQMqLmAoGmwaB4/SsfXRLhsdRRQzlK+zxag2wojawvCUA7rKIuv5nYy/+stv2GQau0wfmr9h7l0bydFNkcN7C4Pns0a4YKsBEJo7YKFGG7GqkfY50+CDR1c/B2SwPtQPLsUAP0UIcpMNPfXNaoYi1T9m4A/O1EaDLISF2+AUqTxKN592UQQM/KaHI3EU62dqMeyM2Eop38yuKb3hdRWPWvedNp0kzNIsjJLPLyH/uZrKsfu+mSmdmpkboa43qPEk5HJBu0PwWyRZmWAz8uwKOzd8YCUC42u7CEQTUzEe0LoGIzRy/r35Ah2nzL5MivCdgjGWxO757aiOU766CeNt9+U+humoauscqD+yURicGYenlS+ZmsdPgUFoLKd0mLIVkJLbY8AOn+7s6n9y1JmiaADb6ZjmjNNQDF6wlX+kOfIvLCYpIWS3TdcmVsjU3KBQSpc3cOkIkBV9D/ZQTZ90s61Dmw/AQYUVbhw+hA6cElDcBnOFfwAy1oKmPSiQ1jLOBVPOukCs9s5d/DnkChIacA/YJU X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1bed8eaf-ad42-4548-b810-08dc1583503a X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2024 04:34:51.2760 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: tpcbbfwjVkS9558W20TJo9ddmPBRaNHrKpdK/5VyomMN8l63Jnv5ZhOuooqRyNPzm+xl1aumo/jzWspoCFwHJg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR11MB6891 X-Proofpoint-GUID: anqETuVdNi-dYw8jpuOS_ljp3Kq9meKX X-Proofpoint-ORIG-GUID: anqETuVdNi-dYw8jpuOS_ljp3Kq9meKX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_25,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 spamscore=0 lowpriorityscore=0 phishscore=0 malwarescore=0 mlxlogscore=740 clxscore=1015 bulkscore=0 mlxscore=0 suspectscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401150033 Received-SPF: pass client-ip=205.220.178.238; envelope-from=prvs=1744ec9a4b=bin.meng@windriver.com; helo=mx0b-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org At present we expect struct arm_boot_info::get_dtb() to return the device tree pointer as well as the device tree size. However, this is not necessary as we can get the device tree size via the device tree header directly. Change get_dtb() signature to drop the *size argument, and get the size by ourselves. Signed-off-by: Bin Meng Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Alistair Francis --- include/hw/arm/boot.h | 8 ++++---- hw/arm/boot.c | 3 ++- hw/arm/sbsa-ref.c | 3 +-- hw/arm/virt.c | 4 +--- hw/arm/xlnx-versal-virt.c | 4 +--- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/include/hw/arm/boot.h b/include/hw/arm/boot.h index 80c492d742..37fd1b520e 100644 --- a/include/hw/arm/boot.h +++ b/include/hw/arm/boot.h @@ -82,11 +82,11 @@ struct arm_boot_info { const struct arm_boot_info *info); /* if a board is able to create a dtb without a dtb file then it * sets get_dtb. This will only be used if no dtb file is provided - * by the user. On success, sets *size to the length of the created - * dtb, and returns a pointer to it. (The caller must free this memory - * with g_free() when it has finished with it.) On failure, returns NULL. + * by the user. On success, returns a pointer to it. (The caller must + * free this memory with g_free() when it has finished with it.) + * On failure, returns NULL. */ - void *(*get_dtb)(const struct arm_boot_info *info, int *size); + void *(*get_dtb)(const struct arm_boot_info *info); /* if a board needs to be able to modify a device tree provided by * the user it should implement this hook. */ diff --git a/hw/arm/boot.c b/hw/arm/boot.c index 84ea6a807a..ff1173299f 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -538,11 +538,12 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo, } g_free(filename); } else { - fdt = binfo->get_dtb(binfo, &size); + fdt = binfo->get_dtb(binfo); if (!fdt) { fprintf(stderr, "Board was unable to create a dtb blob\n"); goto fail; } + size = fdt_totalsize(fdt); } if (addr_limit > addr && size > (addr_limit - addr)) { diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c index 477dca0637..c5023871a7 100644 --- a/hw/arm/sbsa-ref.c +++ b/hw/arm/sbsa-ref.c @@ -681,12 +681,11 @@ static void create_pcie(SBSAMachineState *sms) create_smmu(sms, pci->bus); } -static void *sbsa_ref_dtb(const struct arm_boot_info *binfo, int *fdt_size) +static void *sbsa_ref_dtb(const struct arm_boot_info *binfo) { const SBSAMachineState *board = container_of(binfo, SBSAMachineState, bootinfo); - *fdt_size = board->fdt_size; return board->fdt; } diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 2793121cb4..1996fffa99 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -1577,14 +1577,12 @@ static void create_secure_ram(VirtMachineState *vms, g_free(nodename); } -static void *machvirt_dtb(const struct arm_boot_info *binfo, int *fdt_size) +static void *machvirt_dtb(const struct arm_boot_info *binfo) { const VirtMachineState *board = container_of(binfo, VirtMachineState, bootinfo); MachineState *ms = MACHINE(board); - - *fdt_size = board->fdt_size; return ms->fdt; } diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c index 537118224f..1e043c813e 100644 --- a/hw/arm/xlnx-versal-virt.c +++ b/hw/arm/xlnx-versal-virt.c @@ -551,12 +551,10 @@ static void versal_virt_modify_dtb(const struct arm_boot_info *binfo, fdt_add_memory_nodes(s, fdt, binfo->ram_size); } -static void *versal_virt_get_dtb(const struct arm_boot_info *binfo, - int *fdt_size) +static void *versal_virt_get_dtb(const struct arm_boot_info *binfo) { const VersalVirt *board = container_of(binfo, VersalVirt, binfo); - *fdt_size = board->fdt_size; return board->fdt; } From patchwork Mon Jan 15 04:34:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 13519301 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A04CAC3DA79 for ; Mon, 15 Jan 2024 04:35:50 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rPEgh-0002Fl-AX; Sun, 14 Jan 2024 23:35:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rPEgf-0002Ex-SC; Sun, 14 Jan 2024 23:35:01 -0500 Received: from mx0a-0064b401.pphosted.com ([205.220.166.238]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rPEgd-00031d-Mp; Sun, 14 Jan 2024 23:35:01 -0500 Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40F3uicm001931; Sun, 14 Jan 2024 20:34:54 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=windriver.com; h=from:to:cc:subject:date:message-id:in-reply-to:references :content-transfer-encoding:content-type:mime-version; s= PPS06212021; bh=/OEbbsO5755uJNTmelN4zLikb8E9MCrDj4Je6MuJ2HU=; b= n9fj3AdYPdVMVn4XR02tFPYvBAR4Yl+QFk4p/hjP05jvv7BS/S5O2Q67RDtU+38I RWSKNafGnybwbV4tID6rGBGo9px+kbxmN2RPGnU1uVYilEPvcT/wkMinlW+R3iKR iDI6es2o9k90VkTa3J07guaEByi8ARxeOKXeFxSBj0MGwCwGoNL7EePCYZ/O09/o q2NbHfupQJu5nJqe9Zz8gWjfKsyrFkfQslqEFuei8EDTgvjO2uaWB2Slz2xMCPfD msamlTBtStIw60YdIpdWnKjLn8fV+BjrvdojEdYHrrwtqpij0lcwr5IQvXt6fOC5 QGXaIxc6b5lGlOJGzwioeA== Received: from nam10-mw2-obe.outbound.protection.outlook.com (mail-mw2nam10lp2101.outbound.protection.outlook.com [104.47.55.101]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 3vkpp41cyg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 14 Jan 2024 20:34:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RiyzbU5jM8i7AtK/4QokINWBcz99XoLY/rLwBYGfdSNTE66a8DGYwGCn17s2W634GO72Pg48inWJ2ySCd+DdlhGM1AaeTAkZ+WLgf0oiY+QaT1FJ1uo5KcKpVJ/qsESvGrHMNqmMySYNcN9d9wg3echtwEnMmA3FFA8JucEfCLfP3QadkO9moqOLtcvrWr1TBRT4S/zsAPYr+hzLiDt5yuLbrakTnIJaW6yElvH6mLE4jEe9CRHzlIJcE9HqbiEoiUoAvZSLCfo1kIlCK3bL4Bkz8ErPyXKJwzoX2gBjARXQe9e79DU9yI1SmswHRr0dYx8SxUViGM7eQHh9DqqPQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/OEbbsO5755uJNTmelN4zLikb8E9MCrDj4Je6MuJ2HU=; b=VUbd5dwyCdtFrTnY/SmoPYuZl+TjcIWBBp0JJdXaLYxUx1frPsd0bwo1yIkdyjZMRS+48jKTr5IH0tMw2RJQeB8goZb9abvfhRtVNMZ1ZN3Jv4l4GOW67DngRwFNAIK6C8kJcWUQNRR3AUglbqnEPf0IiZu22pp0h3T1XxaV3NSzhyRC7FNqKe3miKb85uyW2Rvh398uVUfcy/ceitM2Dl32UuLezHPdJGZtsv0TCz0jP9CVGP00fzM5M1b9+gmo8ApieltKkeaoBXrdI53gJrpOA1rd8v7NvdLBC5wyQiiIZ2MiR1E8snqRndmSaeDYOO+d0fvw2Ga7YZ7mT17wHA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=windriver.com; dmarc=pass action=none header.from=windriver.com; dkim=pass header.d=windriver.com; arc=none Received: from DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) by CY8PR11MB6891.namprd11.prod.outlook.com (2603:10b6:930:5c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.19; Mon, 15 Jan 2024 04:34:53 +0000 Received: from DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::4a3a:f09e:3c5d:318c]) by DM4PR11MB5358.namprd11.prod.outlook.com ([fe80::4a3a:f09e:3c5d:318c%6]) with mapi id 15.20.7181.026; Mon, 15 Jan 2024 04:34:53 +0000 From: Bin Meng To: qemu-devel@nongnu.org Cc: Peter Maydell , qemu-arm@nongnu.org Subject: [PATCH 2/3] hw/arm: Pack the QEMU generated device tree Date: Mon, 15 Jan 2024 12:34:29 +0800 Message-Id: <20240115043431.3900922-3-bin.meng@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240115043431.3900922-1-bin.meng@windriver.com> References: <20240115043431.3900922-1-bin.meng@windriver.com> X-ClientProxiedBy: TY2PR04CA0009.apcprd04.prod.outlook.com (2603:1096:404:f6::21) To DM4PR11MB5358.namprd11.prod.outlook.com (2603:10b6:5:395::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB5358:EE_|CY8PR11MB6891:EE_ X-MS-Office365-Filtering-Correlation-Id: 30ebdda0-ff01-47f9-8b3c-08dc1583514e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zWFLkE/VolNCGTL9u3LPmBQ30LbTUV6WCu1LH7QV0JcwfaoEG6e16wKIEZs32m/LM6MXIPjbcLn5qdWGw7XLghQQacYkQ7gIvVce8jS06wHtSG/oomQwq/+nYKYdJgi1yZsxpeyD/jwt+faj+F4a0FZwm3nYoJxPQH68oerfSgmUr2/QSGc79m0rTF4DxeAarD9H+aIhjVY0kd7hM8q7k3PclL2dy1QvHOsxdU0XNVuZJvgtGNL2q7MidsmCbd/SY69QEFp8TsmDvCpE+GC3JZUk6rMIgzD64VRDrHpWxxw53OtdpLvOGuL5leJByHJ7tfRC2JUUAlGO2dreEqeFO3DNFmg9EuJbxVI7Yj9Y6OvMomsDm5S50LuZWziejKxmsvCqrN0NG2HmhQMLLy21hVppPAiujh80HbXb5zvDYMGT9f0H/PgClMuXU4+n782T+dpHr9lRDWKxc2jbmW4+EVCYiqp2FFVPUm/+t1GpOKCodsbwfnR9uyv+DW/utppcmDJrxbH9qlp+xlYOJRRqlGkuNMw0BH0Z4g8McmEEtz/28jU7V3G0Db0fBf9tfJ4gnB/c8Pg1B7uHRzXQW4LAw5witfDYjOCL8PHXkJr2C7PY53aeRhOOKzr3/Yw30GYr X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM4PR11MB5358.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376002)(366004)(39840400004)(396003)(136003)(346002)(230922051799003)(1800799012)(64100799003)(186009)(451199024)(66476007)(66946007)(66556008)(6916009)(44832011)(36756003)(8936002)(8676002)(316002)(38100700002)(6512007)(4326008)(6486002)(38350700005)(2906002)(4744005)(5660300002)(41300700001)(86362001)(478600001)(26005)(2616005)(1076003)(52116002)(6506007)(6666004); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: vJOrM/m7AvV5ATBtOluEAvf0Mm7b3nGBLjMxGHJFwBL7M4vC0saaeuDiGdVleY0Ckln3dJlrfagqkDV4NjgDZkw7TEW+A7zrENjCJmVUr0V3eIwVyYUj+V7giBRJs09+xb+bAjkmWnLPPMW6g3/GwqFjXfAXHtPT+ioVXbIWtGxjS/gBusoD8hOy9HI8iJ6Lg4BfNR1IsRX9xCOc5MhXNDpLrP4GetqCBuAeIiPTIVcD4rwZhARefQamGeOSzM+DSe+spjB/yONn1DJHD2/dzYYpxISNdXDl7ovqTtrZNjop71DF4wpkXi5MVKktABGNfi7jF0KY83vEKtMN+CMEk8diuxiypQNBwrCtXqNJW9I3xsTqP5Epxm8un04aejOR2S0RhnZooHcMdccdfbTDZ/2KK41XcH7EY09UE3dbRFp/FOZZRB7r91hSek3CWpIr4PSSs2NoPIvtKB0oC27JddGB3prgW/2Kt5NV9AwnOrop/o7V8yqt/wK2vkKbWJhQ7TN84Cwy0zJcWWMQqo1+z0NPV+fSWUlt2IY+ak9cl6oIkTkDMLJdcGcAHoK+PjdDMLggP/xEAO7SvrgKnNYZUrBdgwnzXVYuls7Gw/YT1CTeg24amXzyZFCpk0/cDN9xSyz+NOlD4V90AmyTJTpvO/h8AdmKgM6zbTY0ZInOTYQCviCL/Dbn14BKlef1M2gOe0tZvYK0RdSHSfKZn0PdqH3XOqKxeF4FPn62XryU3HxggJOKF+a28znienDavI6aMTxsYhigC9baC6hD0jHwQT6ZEbEfs7+66jxc/XK3YvFjwVlZn//o9xOMwCMCvfz+VJNIpia/vvBF/L0OEoZECfbvwPF6ji5p52swEOV1wtmxKRKFgodPKys9HxtC02ZZHjJxGxEqDsPigM/up+4Zh2JumvDU6FxtfnEALx2SDDgSnGp2s1LzksZhGejpatXkZMBHljEnUPZckinUG8u9VLdsudsaFCWK958R9mpVyefqH5uQ/ssRT8hGIjGY6ujtlnepf8usdBJyoFSucYoIlM+Vqqd8EwctsFBRJE6ZWD4TKDa0iY32azmeVDY9Y9IG+vhwAOt1V4nWqI41SEQX+tRTstZmjxHWS09rGbd2ERqqN4KyYvwAQorv0CzfCMSHnxQ5NQ0Nv8NRqxacj0xVVPwX22h6+pW6hG9eBH5S68di/+4XTqz7r0ehjXmGe4pRpXId5m4A+fFZfCNmvU7/hrrs3HtVPF91Y5YsfctJZhWpeT2JQK7jQoXVHTn9DGiWlnzPP3PsiIh25alfdPIPIoAxER30fWI5g+RTIgsKk/kz5jsUjUM7FqDCy6rsma9EjeI21LoI/cpx3R4yWYxKcSoAAFCkd9z4a41FwIZZP7HTKfQxICI52bRJPJjncYG5v7v4BPBUipIqXnJDEb3U3gHQwR6SyUa3SvgiIdZQSoK/PZUov5wToBWvy2bQhB/AvMA/VCv0czhxSPmFSMAUuVMwaX85rqDPREZNAg0jAIKl0ZMAosyVjfnrl5OTBSsXyxc8CSr6a70/PZhrda1xTiqJazmiMoODr7KV5u3mWKtk3WuI3lTCyYWHYqHNkaMJ X-OriginatorOrg: windriver.com X-MS-Exchange-CrossTenant-Network-Message-Id: 30ebdda0-ff01-47f9-8b3c-08dc1583514e X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB5358.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2024 04:34:53.1323 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ddb2873-a1ad-4a18-ae4e-4644631433be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7zKjK26MxWd1IV8kr+2Y9rArIhUXLmHZGtII707JVOp5SOR5wpcnnPyTrRDzg5bElDjrv+jPvBwwTPacrtFcxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR11MB6891 X-Proofpoint-GUID: W4dR0ncHVUWVMTzOD1vRbuUOderMu-gM X-Proofpoint-ORIG-GUID: W4dR0ncHVUWVMTzOD1vRbuUOderMu-gM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.987,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-11-16_25,2023-11-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 phishscore=0 mlxlogscore=786 suspectscore=0 malwarescore=0 adultscore=0 priorityscore=1501 spamscore=0 mlxscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401150033 Received-SPF: pass client-ip=205.220.166.238; envelope-from=prvs=1744ec9a4b=bin.meng@windriver.com; helo=mx0a-0064b401.pphosted.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, RCVD_IN_MSPIKE_H2=-0.001, 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org By default QEMU generates a 1 MiB sized device tree. Let's pack it to save some room. Signed-off-by: Bin Meng Reviewed-by: Peter Maydell --- hw/arm/boot.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/arm/boot.c b/hw/arm/boot.c index ff1173299f..511ec10ed0 100644 --- a/hw/arm/boot.c +++ b/hw/arm/boot.c @@ -662,6 +662,17 @@ int arm_load_dtb(hwaddr addr, const struct arm_boot_info *binfo, binfo->modify_dtb(binfo, fdt); } + /* + * By default QEMU generates a 1 MiB sized device tree. + * Let's pack it to save some room. + */ + if (binfo->get_dtb) { + rc = fdt_pack(fdt); + /* Should only fail if we've built a corrupted tree */ + g_assert(rc == 0); + size = fdt_totalsize(fdt); + } + qemu_fdt_dumpdtb(fdt, size); /* Put the DTB into the memory map as a ROM image: this will ensure