From nobody Fri Oct 31 09:47:41 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass(p=quarantine dis=none) header.from=amd.com ARC-Seal: i=2; a=rsa-sha256; t=1749827841; cv=pass; d=zohomail.com; s=zohoarc; b=R9VA2ZM2/a4qR+olljgzB4N0wF88PXEmwbB05XqZjoVxPS6Scgw99LsGQeaG3k3eNksBQ/YM3LlrPAYPSK3tifHT2+BrD8nOX50t20ZzcRwmGCTeqeaZWp/Y05ATuIEJZlqVylZsX6ofFl5sejkp86gkKw7DAeSXtcFudAuibQE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1749827841; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=gqa711ud/gT5kwpGl0L7NZOMPRD7hoTJv+jyvoVvM74=; b=TqXQCZN2BrmjULeESXU7Gb3yXTXFO5Wgmc+iEuOrl9uTOAxaR9jYhlx3t70CLVIyoWdn7ZlFpXugkeMzIokOfTxvvejqRjVmSUAT0L77c7FRpfqnTqPNsvGHsfafPP2SWZMBh4eW47YKp8TG0ZHToPCGfDJtvdUrdumIGGsiLok= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=amd.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1749827841202956.535109138068; Fri, 13 Jun 2025 08:17:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1014466.1392627 (Exim 4.92) (envelope-from ) id 1uQ69N-0003Io-Id; Fri, 13 Jun 2025 15:17:01 +0000 Received: by outflank-mailman (output) from mailman id 1014466.1392627; Fri, 13 Jun 2025 15:17:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uQ69N-0003IX-EZ; Fri, 13 Jun 2025 15:17:01 +0000 Received: by outflank-mailman (input) for mailman id 1014466; Fri, 13 Jun 2025 15:16:59 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uQ69L-0000Kb-G3 for xen-devel@lists.xenproject.org; Fri, 13 Jun 2025 15:16:59 +0000 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on20623.outbound.protection.outlook.com [2a01:111:f403:2412::623]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 716e6506-4869-11f0-a309-13f23c93f187; Fri, 13 Jun 2025 17:16:57 +0200 (CEST) Received: from DS7PR03CA0174.namprd03.prod.outlook.com (2603:10b6:5:3b2::29) by MN0PR12MB6001.namprd12.prod.outlook.com (2603:10b6:208:37d::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8835.23; Fri, 13 Jun 2025 15:16:53 +0000 Received: from DS1PEPF00017099.namprd05.prod.outlook.com (2603:10b6:5:3b2:cafe::1d) by DS7PR03CA0174.outlook.office365.com (2603:10b6:5:3b2::29) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8835.23 via Frontend Transport; Fri, 13 Jun 2025 15:16:52 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF00017099.mail.protection.outlook.com (10.167.18.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8835.15 via Frontend Transport; Fri, 13 Jun 2025 15:16:52 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 13 Jun 2025 10:16:48 -0500 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 716e6506-4869-11f0-a309-13f23c93f187 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=C7kGyY+86JEmuwlqUDAYaO3UO0t/hCZcjzeoWENkslylKwwsjiSeetogTkf2Aa/EpbnNZ8QRUzv2BzMPRsc8TjV/RMGMBxAusEU9BJ1v2G3hzvi/e3szy430ZaG52EvHeUtUyrvUyRMVHs+bzL9auX0rPBtWKEg6zb7cmuoQQJzfg5d1mVhXd41bxU3hh1XeI/Mgj1HMwsXSW/LBE+aor2gyTMnNP+ynOj6ExiubHUw5Qa7NZnzV7wvIyEP6DeIOTmUmSD2CXJpKxN7PTUyLm8nWVhm3eTh7Xgzngvr/SHLpwkR/C6kbX9ifYVStxlePnWewrjcQ7JH6YBFOz6KzsQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=gqa711ud/gT5kwpGl0L7NZOMPRD7hoTJv+jyvoVvM74=; b=Ey5K2udFytN8DLoeyAo9jteAIFUx/fmkazTHTAUdv8apR3Fom9lyuyVQggXGi9MlLsIgFMnSSSaBsgQOF2gJGzfaHO788sQIkP51wG8kheDPxwV5A1i1She3NlVgHnTa63b+O7X4NmXOYgis2m4nhoIWbejZThwQx1xq1mKo30YxxHrJhy//Ha4/NYzkiFYxqRU27qdOBXTgRqZM5PPVbk/une9a4Py/dpUhf5dSJ02VDJ6dQUBBe8MyfOz7i0rRk2Fl8e/HWQQU4hqSqXol3f+2RLAbkIxyPZc7lbdAdu3rjBDhg2T0VSJi44nzl3dsLfEcOcPx+/pWtHUqQEma4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gqa711ud/gT5kwpGl0L7NZOMPRD7hoTJv+jyvoVvM74=; b=iV3HShoAUJjPDsipmqxQyEgwKkevM68kF3B6V5bibP3w/+l5G+kMOv1Db1dvIX22V4lpuiiacyBO26efs4jYOMSNRG09T94GX/ShX6RZrTnBYhyaZyVJnTDqqq4ogEBiSxE7MZAn6iLUXSzwNyb918bh9EU4SZfkwFg4VuVXlIc= X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C From: Alejandro Vallejo To: CC: Alejandro Vallejo , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , "Volodymyr Babchuk" , Andrew Cooper , Anthony PERARD , "Jan Beulich" , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Alistair Francis , "Bob Eshleman" , Connor Davis , Oleksii Kurochko , "Daniel P. Smith" Subject: [PATCH v3 09/14] xen/dt: Move bootinfo functions to a new bootinfo.h Date: Fri, 13 Jun 2025 17:13:18 +0200 Message-ID: <20250613151612.754222-10-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250613151612.754222-1-agarciav@amd.com> References: <20250613151612.754222-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF00017099:EE_|MN0PR12MB6001:EE_ X-MS-Office365-Filtering-Correlation-Id: 9742bea9-2ced-4c20-3e16-08ddaa8d538f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|376014|7416014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?AZDMOp4g5M+qdA7kJ694Q4fhefL7ydGF3F7pkEcbiUohT27iQEnDLc6dNy1F?= =?us-ascii?Q?uXomHZjP5LlmiIM+D0/Iy+fvqPIO3o5/OgOdKo6/3YH5ZMovIdZpxcDHjhfZ?= =?us-ascii?Q?TPQ/9IeWJOKbRAwO0xzyJe6eXRpTjS806+Ys2Y1vM5+EiMrtG+tVhdZslaP1?= =?us-ascii?Q?1D/MVoCa8YCZX5+lFPIh6PmdW7uQD9RV7ppqZP9QNvrzzEbsRqqeewDovP0y?= =?us-ascii?Q?UUELmd/nddmW6fz2RGdF919LARjfLzqe5ofAwhLyk8N5xOQ5B5S+5zEeGpMy?= =?us-ascii?Q?K78ksYZcgalQ7nSLz/n3B0ZGLqxOQtqI2epuAf2U5RpEtrN86WiH8EBA8F8X?= =?us-ascii?Q?ax7D++/qquKcVTXWK1RBsVnaCh6c7SNeONGYgwpSjVrqM4ejY4hmrLYb2rIm?= =?us-ascii?Q?16pxAag73Az28Vj4wJnCumg0r8Cby30QkhsS4RivqLTB6OBS5hvov5xOao20?= =?us-ascii?Q?3biOAnRYmziRQlks0bi0jAsO3u/Sm/QAWx2jJ6DrQtMazkSUvQVz8w9LR4eB?= =?us-ascii?Q?hBHR9HNLBDZqFv9YvpVUjL12nPSzzXhqyFwipvMUDl6GdPnw666+IwnF/Rzs?= =?us-ascii?Q?mJdLjZIIKj0uU5rRSoh1GOoYMz8nb/PahY1tdtOCqKiRnwirmeyFP6JfSheE?= =?us-ascii?Q?Bm46pnJQ9C7aoXD7LczdHzTW6PfIuOSIOeUXru8O8QIAIwfu8e3R1F9iiC+D?= =?us-ascii?Q?z67H7SXQ2N6FXbYdlD/teywlJViaacsgRc/ORkquhGJ73SsYQ/CpZTE5KZy6?= =?us-ascii?Q?ysmAgyqXUNmc9v1QIzbDhp9xP02pbsMG0quyHESsDIvqA3diKVpo21KEg+MO?= =?us-ascii?Q?1y5goJMQQsa91bPe5slDd2uSYJicl20NQDDqR7Rtf9uUxKGe8NHiR4Q9k9Za?= =?us-ascii?Q?NMWDvPk2mtEO9jjFKf8jVU/LlqIuBE7VnLaxP2z+HahG0ksO0mywjejLS6us?= =?us-ascii?Q?2xMmEIh4MGHPbPffWfjivVPbuXq1bgk8JPwx4tSUoHeeVRp7Zf4m2iFgFj2i?= =?us-ascii?Q?KE9wusM9MTQnUunWyqhudgAhWvRy9pl9hwIKUpHNJEjmAIX0Eg9SZIMCW50p?= =?us-ascii?Q?pD/G0BPG6SkJhYrD/jd6ueaz5A4nH60Vp93+3ikaPPyCKH7HPAHvYKa/D8RC?= =?us-ascii?Q?1P5q8iKYn4Tgz85u+ZgChkh8LKViTwlw/no/OnPZHk2K/DBA7fOLFnoYJhUL?= =?us-ascii?Q?xeq47rOyc/Duhbzsus77i6Rc7f6b395xEQ8msQye+X4VXlyqs3q7pgv1ubDg?= =?us-ascii?Q?Sdh/9gmFteJTGqY1cLGy+m6LGVhgUzvcEYyhqJgGOKLzmG9JPOpX/CQ1wNbV?= =?us-ascii?Q?zfO56O0VGIsBWGDMyJWCq6uwg1lC/Ve+Z5Jhg3lu+CpnwPj5j5uBEqsAeXjq?= =?us-ascii?Q?kKCLGj+tT2scjRHwmd6snsUKt+gajUmjC9fB2jj4Q/ljfUfhQCdd+7pRGySo?= =?us-ascii?Q?Hj0kx8hHcC7yH0XXvWOcjWGLWew37ljWFJfI6CewYlycKg+igH7iXfPqPmQ1?= =?us-ascii?Q?d3i5/ud5Cd6XVP3LXX86ihlchazA5QZcaZgw?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(82310400026)(376014)(7416014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jun 2025 15:16:52.4677 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9742bea9-2ced-4c20-3e16-08ddaa8d538f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF00017099.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6001 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1749827842463116600 Content-Type: text/plain; charset="utf-8" Part of an unpicking process to extract bootfdt contents independent of bootinfo to a separate file for x86 to take. With this, bootfdt.h can be cleanly included from x86. A later patch extracts the definitions so the functions may be called too. Not a functional change. Signed-off-by: Alejandro Vallejo Reviewed-by: Stefano Stabellini --- v3: * Remove spurious include for bootinfo.h in mmu/mm.c --- xen/arch/arm/domain_build.c | 1 + xen/arch/arm/setup.c | 1 + xen/arch/riscv/mm.c | 2 +- xen/arch/riscv/setup.c | 2 +- xen/common/device-tree/bootfdt.c | 2 +- xen/common/device-tree/bootinfo.c | 2 +- xen/common/device-tree/dom0less-build.c | 2 +- xen/common/device-tree/domain-build.c | 2 +- xen/common/device-tree/kernel.c | 2 +- xen/include/xen/bootfdt.h | 208 ----------------------- xen/include/xen/bootinfo.h | 213 ++++++++++++++++++++++++ xen/include/xen/device_tree.h | 2 +- xen/include/xen/fdt-domain-build.h | 2 +- xen/include/xen/fdt-kernel.h | 2 +- 14 files changed, 225 insertions(+), 218 deletions(-) create mode 100644 xen/include/xen/bootinfo.h diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 4eb1ed0548..4eb1b12916 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include #include #include #include diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 8b2e65a1a5..cc5e1be223 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -8,6 +8,7 @@ * Copyright (c) 2011 Citrix Systems. */ =20 +#include #include #include #include diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c index 4047d67c0e..6ccd38091b 100644 --- a/xen/arch/riscv/mm.c +++ b/xen/arch/riscv/mm.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ =20 -#include +#include #include #include #include diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index 8bcd19218d..3e99e2e194 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -2,7 +2,7 @@ =20 #include #include -#include +#include #include #include #include diff --git a/xen/common/device-tree/bootfdt.c b/xen/common/device-tree/boot= fdt.c index 39334d6205..1848478e82 100644 --- a/xen/common/device-tree/bootfdt.c +++ b/xen/common/device-tree/bootfdt.c @@ -5,7 +5,7 @@ * Copyright (C) 2012-2014 Citrix Systems, Inc. */ =20 -#include +#include #include #include #include diff --git a/xen/common/device-tree/bootinfo.c b/xen/common/device-tree/boo= tinfo.c index 2a27d1318b..00a43fb358 100644 --- a/xen/common/device-tree/bootinfo.c +++ b/xen/common/device-tree/bootinfo.c @@ -10,7 +10,7 @@ */ =20 #include -#include +#include #include #include #include diff --git a/xen/common/device-tree/dom0less-build.c b/xen/common/device-tr= ee/dom0less-build.c index e321747175..4413b17aac 100644 --- a/xen/common/device-tree/dom0less-build.c +++ b/xen/common/device-tree/dom0less-build.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ =20 -#include +#include #include #include #include diff --git a/xen/common/device-tree/domain-build.c b/xen/common/device-tree= /domain-build.c index 6014e39fd6..0da598eac1 100644 --- a/xen/common/device-tree/domain-build.c +++ b/xen/common/device-tree/domain-build.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ =20 -#include +#include #include #include #include diff --git a/xen/common/device-tree/kernel.c b/xen/common/device-tree/kerne= l.c index 7a00768e6b..7f73520388 100644 --- a/xen/common/device-tree/kernel.c +++ b/xen/common/device-tree/kernel.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ =20 -#include +#include #include #include #include diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h index b6ae7d6aa6..373b548f20 100644 --- a/xen/include/xen/bootfdt.h +++ b/xen/include/xen/bootfdt.h @@ -4,9 +4,6 @@ =20 #include #include -#include -#include -#include =20 #if __has_include() #include @@ -14,15 +11,10 @@ =20 #define MIN_FDT_ALIGN 8 =20 -#define NR_MEM_BANKS 256 -#define NR_SHMEM_BANKS 32 - /* Default #address and #size cells */ #define DT_ROOT_NODE_ADDR_CELLS_DEFAULT 2 #define DT_ROOT_NODE_SIZE_CELLS_DEFAULT 1 =20 -#define MAX_MODULES 32 /* Current maximum useful modules */ - #define DEVICE_TREE_MAX_DEPTH 16 =20 /* Helper to read a big number; size is in cells (not bytes) */ @@ -75,78 +67,6 @@ typedef enum { BOOTMOD_UNKNOWN } boot_module_kind; =20 -enum membank_type { - /* - * The MEMBANK_DEFAULT type refers to either reserved memory for the - * device/firmware (when the bank is in 'reserved_mem') or any RAM (wh= en - * the bank is in 'mem'). - */ - MEMBANK_DEFAULT, - /* - * The MEMBANK_STATIC_DOMAIN type is used to indicate whether the memo= ry - * bank is bound to a static Xen domain. It is only valid when the bank - * is in reserved_mem. - */ - MEMBANK_STATIC_DOMAIN, - /* - * The MEMBANK_STATIC_HEAP type is used to indicate whether the memory - * bank is reserved as static heap. It is only valid when the bank is - * in reserved_mem. - */ - MEMBANK_STATIC_HEAP, - /* - * The MEMBANK_FDT_RESVMEM type is used to indicate whether the memory - * bank is from the FDT reserve map. - */ - MEMBANK_FDT_RESVMEM, -}; - -enum region_type { - MEMORY, - RESERVED_MEMORY, - STATIC_SHARED_MEMORY -}; - -/* Indicates the maximum number of characters(\0 included) for shm_id */ -#define MAX_SHM_ID_LENGTH 16 - -struct shmem_membank_extra { - char shm_id[MAX_SHM_ID_LENGTH]; - unsigned int nr_shm_borrowers; -}; - -struct membank { - paddr_t start; - paddr_t size; - union { - enum membank_type type; -#ifdef CONFIG_STATIC_SHM - struct shmem_membank_extra *shmem_extra; -#endif - }; -}; - -struct membanks { - __struct_group(membanks_hdr, common, , - unsigned int nr_banks; - unsigned int max_banks; - enum region_type type; - ); - struct membank bank[]; -}; - -struct meminfo { - struct membanks_hdr common; - struct membank bank[NR_MEM_BANKS]; -}; - -struct shared_meminfo { - struct membanks_hdr common; - struct membank bank[NR_SHMEM_BANKS]; - struct shmem_membank_extra extra[NR_SHMEM_BANKS]; -}; - - struct boot_domain { struct domain *d; =20 @@ -178,134 +98,6 @@ struct boot_module { #endif }; =20 -/* DT_MAX_NAME is the node name max length according the DT spec */ -#define DT_MAX_NAME 41 -struct bootcmdline { - boot_module_kind kind; - bool domU; - paddr_t start; - char dt_name[DT_MAX_NAME]; - char cmdline[BOOTMOD_MAX_CMDLINE]; -}; - -struct boot_modules { - int nr_mods; - struct boot_module module[MAX_MODULES]; -}; - -struct bootcmdlines { - unsigned int nr_mods; - struct bootcmdline cmdline[MAX_MODULES]; -}; - -struct bootinfo { - struct meminfo mem; - /* The reserved regions are only used when booting using Device-Tree */ - struct meminfo reserved_mem; - struct boot_modules modules; - struct bootcmdlines cmdlines; -#ifdef CONFIG_ACPI - struct meminfo acpi; -#endif -#ifdef CONFIG_STATIC_SHM - struct shared_meminfo shmem; -#endif -}; - -#ifdef CONFIG_ACPI -#define BOOTINFO_ACPI_INIT \ - .acpi.common.max_banks =3D NR_MEM_BANKS, \ - .acpi.common.type =3D MEMORY, -#else -#define BOOTINFO_ACPI_INIT -#endif - -#ifdef CONFIG_STATIC_SHM -#define BOOTINFO_SHMEM_INIT \ - .shmem.common.max_banks =3D NR_SHMEM_BANKS, \ - .shmem.common.type =3D STATIC_SHARED_MEMORY, -#else -#define BOOTINFO_SHMEM_INIT -#endif - -#define BOOTINFO_INIT \ -{ \ - .mem.common.max_banks =3D NR_MEM_BANKS, \ - .mem.common.type =3D MEMORY, \ - .reserved_mem.common.max_banks =3D NR_MEM_BANKS, \ - .reserved_mem.common.type =3D RESERVED_MEMORY, \ - BOOTINFO_ACPI_INIT \ - BOOTINFO_SHMEM_INIT \ -} - -extern struct bootinfo bootinfo; - -bool check_reserved_regions_overlap(paddr_t region_start, - paddr_t region_size, - bool allow_memreserve_overlap); - -struct boot_module *add_boot_module(boot_module_kind kind, - paddr_t start, paddr_t size, bool domU); -struct boot_module *boot_module_find_by_kind(boot_module_kind kind); -struct boot_module * boot_module_find_by_addr_and_kind(boot_module_kind ki= nd, - paddr_t start= ); -void add_boot_cmdline(const char *name, const char *cmdline, - boot_module_kind kind, paddr_t start, bool domU); -struct bootcmdline *boot_cmdline_find_by_kind(boot_module_kind kind); -struct bootcmdline * boot_cmdline_find_by_name(const char *name); -const char *boot_module_kind_as_string(boot_module_kind kind); - -void populate_boot_allocator(void); - -size_t boot_fdt_info(const void *fdt, paddr_t paddr); - -const char *boot_fdt_cmdline(const void *fdt); -int domain_fdt_begin_node(void *fdt, const char *name, uint64_t unit); - -static inline struct membanks *bootinfo_get_reserved_mem(void) -{ - return container_of(&bootinfo.reserved_mem.common, struct membanks, co= mmon); -} - -static inline struct membanks *bootinfo_get_mem(void) -{ - return container_of(&bootinfo.mem.common, struct membanks, common); -} - -#ifdef CONFIG_ACPI -static inline struct membanks *bootinfo_get_acpi(void) -{ - return container_of(&bootinfo.acpi.common, struct membanks, common); -} -#endif - -#ifdef CONFIG_STATIC_SHM -static inline struct membanks *bootinfo_get_shmem(void) -{ - return container_of(&bootinfo.shmem.common, struct membanks, common); -} - -static inline struct shmem_membank_extra *bootinfo_get_shmem_extra(void) -{ - return bootinfo.shmem.extra; -} -#endif - -static inline struct membanks *membanks_xzalloc(unsigned int nr, - enum region_type type) -{ - struct membanks *banks =3D xzalloc_flex_struct(struct membanks, bank, = nr); - - if ( !banks ) - goto out; - - banks->max_banks =3D nr; - banks->type =3D type; - - out: - return banks; -} - /* * Interpret the property `prop_name` of `node` as a u32. * diff --git a/xen/include/xen/bootinfo.h b/xen/include/xen/bootinfo.h new file mode 100644 index 0000000000..f834f19571 --- /dev/null +++ b/xen/include/xen/bootinfo.h @@ -0,0 +1,213 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef XEN_BOOTINFO_H +#define XEN_BOOTINFO_H + +#include +#include +#include +#include + +#define NR_MEM_BANKS 256 +#define NR_SHMEM_BANKS 32 + +#define MAX_MODULES 32 /* Current maximum useful modules */ + +enum membank_type { + /* + * The MEMBANK_DEFAULT type refers to either reserved memory for the + * device/firmware (when the bank is in 'reserved_mem') or any RAM (wh= en + * the bank is in 'mem'). + */ + MEMBANK_DEFAULT, + /* + * The MEMBANK_STATIC_DOMAIN type is used to indicate whether the memo= ry + * bank is bound to a static Xen domain. It is only valid when the bank + * is in reserved_mem. + */ + MEMBANK_STATIC_DOMAIN, + /* + * The MEMBANK_STATIC_HEAP type is used to indicate whether the memory + * bank is reserved as static heap. It is only valid when the bank is + * in reserved_mem. + */ + MEMBANK_STATIC_HEAP, + /* + * The MEMBANK_FDT_RESVMEM type is used to indicate whether the memory + * bank is from the FDT reserve map. + */ + MEMBANK_FDT_RESVMEM, +}; + +enum region_type { + MEMORY, + RESERVED_MEMORY, + STATIC_SHARED_MEMORY +}; + +/* Indicates the maximum number of characters(\0 included) for shm_id */ +#define MAX_SHM_ID_LENGTH 16 + +struct shmem_membank_extra { + char shm_id[MAX_SHM_ID_LENGTH]; + unsigned int nr_shm_borrowers; +}; + +struct membank { + paddr_t start; + paddr_t size; + union { + enum membank_type type; +#ifdef CONFIG_STATIC_SHM + struct shmem_membank_extra *shmem_extra; +#endif + }; +}; + +struct membanks { + __struct_group(membanks_hdr, common, , + unsigned int nr_banks; + unsigned int max_banks; + enum region_type type; + ); + struct membank bank[]; +}; + +struct meminfo { + struct membanks_hdr common; + struct membank bank[NR_MEM_BANKS]; +}; + +struct shared_meminfo { + struct membanks_hdr common; + struct membank bank[NR_SHMEM_BANKS]; + struct shmem_membank_extra extra[NR_SHMEM_BANKS]; +}; + +/* DT_MAX_NAME is the node name max length according the DT spec */ +#define DT_MAX_NAME 41 +struct bootcmdline { + boot_module_kind kind; + bool domU; + paddr_t start; + char dt_name[DT_MAX_NAME]; + char cmdline[BOOTMOD_MAX_CMDLINE]; +}; + +struct boot_modules { + int nr_mods; + struct boot_module module[MAX_MODULES]; +}; + +struct bootcmdlines { + unsigned int nr_mods; + struct bootcmdline cmdline[MAX_MODULES]; +}; + +struct bootinfo { + struct meminfo mem; + /* The reserved regions are only used when booting using Device-Tree */ + struct meminfo reserved_mem; + struct boot_modules modules; + struct bootcmdlines cmdlines; +#ifdef CONFIG_ACPI + struct meminfo acpi; +#endif +#ifdef CONFIG_STATIC_SHM + struct shared_meminfo shmem; +#endif +}; + +#ifdef CONFIG_ACPI +#define BOOTINFO_ACPI_INIT \ + .acpi.common.max_banks =3D NR_MEM_BANKS, \ + .acpi.common.type =3D MEMORY, +#else +#define BOOTINFO_ACPI_INIT +#endif + +#ifdef CONFIG_STATIC_SHM +#define BOOTINFO_SHMEM_INIT \ + .shmem.common.max_banks =3D NR_SHMEM_BANKS, \ + .shmem.common.type =3D STATIC_SHARED_MEMORY, +#else +#define BOOTINFO_SHMEM_INIT +#endif + +#define BOOTINFO_INIT \ +{ \ + .mem.common.max_banks =3D NR_MEM_BANKS, \ + .mem.common.type =3D MEMORY, \ + .reserved_mem.common.max_banks =3D NR_MEM_BANKS, \ + .reserved_mem.common.type =3D RESERVED_MEMORY, \ + BOOTINFO_ACPI_INIT \ + BOOTINFO_SHMEM_INIT \ +} + +extern struct bootinfo bootinfo; + +bool check_reserved_regions_overlap(paddr_t region_start, + paddr_t region_size, + bool allow_memreserve_overlap); + +struct boot_module *add_boot_module(boot_module_kind kind, + paddr_t start, paddr_t size, bool domU= ); +struct boot_module *boot_module_find_by_kind(boot_module_kind kind); +struct boot_module * boot_module_find_by_addr_and_kind(boot_module_kind ki= nd, + paddr_t start= ); +void add_boot_cmdline(const char *name, const char *cmdline, + boot_module_kind kind, paddr_t start, bool domU); +struct bootcmdline *boot_cmdline_find_by_kind(boot_module_kind kind); +struct bootcmdline * boot_cmdline_find_by_name(const char *name); +const char *boot_module_kind_as_string(boot_module_kind kind); + +void populate_boot_allocator(void); + +size_t boot_fdt_info(const void *fdt, paddr_t paddr); +const char *boot_fdt_cmdline(const void *fdt); +int domain_fdt_begin_node(void *fdt, const char *name, uint64_t unit); + +static inline struct membanks *bootinfo_get_reserved_mem(void) +{ + return container_of(&bootinfo.reserved_mem.common, struct membanks, co= mmon); +} + +static inline struct membanks *bootinfo_get_mem(void) +{ + return container_of(&bootinfo.mem.common, struct membanks, common); +} + +#ifdef CONFIG_ACPI +static inline struct membanks *bootinfo_get_acpi(void) +{ + return container_of(&bootinfo.acpi.common, struct membanks, common); +} +#endif + +#ifdef CONFIG_STATIC_SHM +static inline struct membanks *bootinfo_get_shmem(void) +{ + return container_of(&bootinfo.shmem.common, struct membanks, common); +} + +static inline struct shmem_membank_extra *bootinfo_get_shmem_extra(void) +{ + return bootinfo.shmem.extra; +} +#endif + +static inline struct membanks *membanks_xzalloc(unsigned int nr, + enum region_type type) +{ + struct membanks *banks =3D xzalloc_flex_struct(struct membanks, bank, = nr); + + if ( !banks ) + goto out; + + banks->max_banks =3D nr; + banks->type =3D type; + + out: + return banks; +} + +#endif /* XEN_BOOTINFO_H */ diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h index 0a22b1ba1d..7d1c8bc305 100644 --- a/xen/include/xen/device_tree.h +++ b/xen/include/xen/device_tree.h @@ -10,7 +10,7 @@ #ifndef __XEN_DEVICE_TREE_H__ #define __XEN_DEVICE_TREE_H__ =20 -#include +#include #include =20 #include diff --git a/xen/include/xen/fdt-domain-build.h b/xen/include/xen/fdt-domai= n-build.h index 45981dbec0..60565fdbf9 100644 --- a/xen/include/xen/fdt-domain-build.h +++ b/xen/include/xen/fdt-domain-build.h @@ -3,7 +3,7 @@ #ifndef __XEN_FDT_DOMAIN_BUILD_H__ #define __XEN_FDT_DOMAIN_BUILD_H__ =20 -#include +#include #include #include #include diff --git a/xen/include/xen/fdt-kernel.h b/xen/include/xen/fdt-kernel.h index fee8eac1db..ee29aad9fe 100644 --- a/xen/include/xen/fdt-kernel.h +++ b/xen/include/xen/fdt-kernel.h @@ -7,7 +7,7 @@ #ifndef __XEN_FDT_KERNEL_H__ #define __XEN_FDT_KERNEL_H__ =20 -#include +#include #include #include =20 --=20 2.43.0