From nobody Thu Oct 30 23:09:16 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=1751998086; cv=pass; d=zohomail.com; s=zohoarc; b=cRyuHxXXig3JQaT4U+MIlDek7VSc8WhDUvNbMhMjDAQ38SZWkCI2EXRGqb9+24JDEP21wETsNwadageZvOEE/Y/GcU12XN9btzrXTS7+koOKfWStq3YzrH0K1apGo3mNxmC3ip5su0kzgW1jWCJak1J9NBL+reWo3jJ0z/JJYDo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751998086; 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=bPD/rKYLwoQh7EhPgtS74wicAf9RUsbK6gNUi7Q5AAI=; b=e1vWyDpWW4LweipMR2kW1/khOn9k4KNvPwmhTKwkk2nvHRDJdKJ0CVvFwtdeTkGYT4Ti5JS+OkeXVYz9cyw2BUmOf9SlZj46ZDwfm7/xVd6Nby6lzR+rnBCTazhC1m8Zw6NkMB4ZG1un+vmNkvTEs7K1rdTVrnA2K9fLCuwWh1I= 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 1751998086253146.23490910380258; Tue, 8 Jul 2025 11:08:06 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1037024.1409680 (Exim 4.92) (envelope-from ) id 1uZCjM-0005Y9-Sz; Tue, 08 Jul 2025 18:07:48 +0000 Received: by outflank-mailman (output) from mailman id 1037024.1409680; Tue, 08 Jul 2025 18:07:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjM-0005XU-PB; Tue, 08 Jul 2025 18:07:48 +0000 Received: by outflank-mailman (input) for mailman id 1037024; Tue, 08 Jul 2025 18:07:48 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjM-0005Uq-58 for xen-devel@lists.xenproject.org; Tue, 08 Jul 2025 18:07:48 +0000 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2060b.outbound.protection.outlook.com [2a01:111:f403:2009::60b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 726364d5-5c26-11f0-b894-0df219b8e170; Tue, 08 Jul 2025 20:07:45 +0200 (CEST) Received: from BYAPR06CA0026.namprd06.prod.outlook.com (2603:10b6:a03:d4::39) by DS2PR12MB9591.namprd12.prod.outlook.com (2603:10b6:8:27c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.27; Tue, 8 Jul 2025 18:07:41 +0000 Received: from CY4PEPF0000FCC2.namprd03.prod.outlook.com (2603:10b6:a03:d4:cafe::47) by BYAPR06CA0026.outlook.office365.com (2603:10b6:a03:d4::39) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8922.21 via Frontend Transport; Tue, 8 Jul 2025 18:07:41 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC2.mail.protection.outlook.com (10.167.242.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8901.15 via Frontend Transport; Tue, 8 Jul 2025 18:07:41 +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; Tue, 8 Jul 2025 13:07:39 -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: 726364d5-5c26-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HXdvDS96BA6aP+4nr6YFRIYeVczHrqZA3qCdv+8L/pJ188xaZq552I2oh+Rf3G9xR6GVaqIqv+z7lgiYjG9TJ54eWFHhqmaF5n7xZd3M3JHoEqyNlG5LEj/zhr/Oz/f/kN2CK6a+e+5wyoW4qtP9nYQifIRdAtOLPBfXbCOVBmYMYA3SEZk8WwJYv6PZWhgkXYhByOKjgWncSQbjMHF8/pcX8zAHTgCVwCFVJr0yO+tfDv4FoPUk3FyS21yfSVTxkgzraD/TDBQ48iUH9rfnspU1S3FGEp+DNCmrhpdhErbslsgGLtC90dQvktsnBZHmf/EE9UwaWdbTf1xbDgixQg== 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=bPD/rKYLwoQh7EhPgtS74wicAf9RUsbK6gNUi7Q5AAI=; b=dRImN9qh8dYOsr8UveZhBhga66T3Y2k2nUj/USmtYzNerkEHN494StkNTb0OC/qi47Xr0yDAHC4qw1juPGpXIDGdx4luCswNMExEg104aRgVWUNFnKxa1ci0SJ/mgACAOb3ffvg8xOnFK6JDqTZwek3xY3Q5sR7uuFj8bnIwteBT4wcVzqDDM9QQ6OLZM1UaSzuhQYN7bRh8NmCbHu4Ha3pyG7ZFKqo1FtCiwnPH0iZnKP9oahQD0p9cbAI6eZRbDnNXLaoaRTWLRxID5l6o8pqo9WIN0oZiwRHLINmqxWQAvoNDHlVhAcr+DAv/OUwyS9lmKKtk9xHmIcpIuvWTxw== 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=bPD/rKYLwoQh7EhPgtS74wicAf9RUsbK6gNUi7Q5AAI=; b=2KJof+Ta4OERa86tEfyvoiucEJ9oUDJ/J0Jnc2NKsAbw7NKYqqmPN+J4lQl7Wds146Ud/7FTOAbaXceTHlt02DX7EkhvIs/sAElrt2VQaS6eTr2SDoJpP48nTRYbb++J+xX07SNtt6jvmoI0+GmzL+hxgGq7rdnRTST+YL0En40= 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 , "Daniel P. Smith" Subject: [PATCH v6 01/11] xen: Conditionally compile out the boot_module.domU Date: Tue, 8 Jul 2025 20:07:10 +0200 Message-ID: <20250708180721.2338036-2-alejandro.garciavallejo@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250708180721.2338036-1-alejandro.garciavallejo@amd.com> References: <20250708180721.2338036-1-alejandro.garciavallejo@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: CY4PEPF0000FCC2:EE_|DS2PR12MB9591:EE_ X-MS-Office365-Filtering-Correlation-Id: 4b9b0f94-3f6c-46a4-3143-08ddbe4a54da X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?DTc3vLllhDhx+7AM++Vap+kYqQCXvCw/+q4TlIKtJYmmqNIX0zygFmC8Bz2B?= =?us-ascii?Q?w1QmHOSumy3keX+tCyo7ZHvTfx5DKyPjyQsrkj7n66vtFxYJ9J0Kid2qXlvO?= =?us-ascii?Q?rB++YLkmao74ShNCT1TID63+lsarpJjj6/kKW5jgYJZjg/cUWaW19QMldx3R?= =?us-ascii?Q?cCM9u+Bfl1sWryGfwWqcTngQAcmD6CPWudBLwOxn+nLQZTyB4tcoDdhH2MSu?= =?us-ascii?Q?9OAxw+HrW6xlfAd7WK5SiBtA68fO0NCbfBDxmlZhXAxZgA79FyS3SD663tdj?= =?us-ascii?Q?evq42ZpG22roy+LI3RT4/iqPdEcBW5yuoOwPxo5fU8VdqQlc7FljGil7x39z?= =?us-ascii?Q?k1nB7lnAiwswA+sy8sj9gKU4unUpDUHEfB11YHdLcfeOLjbseEa4c88g9ynx?= =?us-ascii?Q?2gC12LViLnBqFhUB541PpwXhJY3acjg/XfGOx/AJOV9e/iqaX87h+Y83VZqg?= =?us-ascii?Q?UT1DvCNznhdECbtO5Yp96Pz5LqhKpAy0DvJxjHEEnhEY3gTtWU/1iMpDmZ5n?= =?us-ascii?Q?UnlLFX+/ieKlqmD91a5Ytt4WqtgZnXF98kCU4RCpEv0svkSfxC/xiMAKjTwu?= =?us-ascii?Q?aRi0khEyol0Ixw6Ya0c4RIEsw3ijeihtArw405i5OQU8c4hBJsXG4xmy43FK?= =?us-ascii?Q?Om0wR3k2I8kvCazRlNPwODArSPmEPKoWxqSaNkyqWcvQuLG3LNIMUCFNZ8Rg?= =?us-ascii?Q?ype/+tebhRE9SS5jAsfKUldHd+IL/NzHhz7zkt6Dh78xcXf4e0JxG3D2IeWW?= =?us-ascii?Q?FAl/BbMSh7Grnqfs/OoXS/EGcgc7Fi8KGoM7k6ZM+Zbwz2ct/L7yV//TgwHC?= =?us-ascii?Q?Qe2bPqN5gPR1YEAMTpmuFg74XFHdRv8C+OxiTa9aCAIe9ZrvZVRDT4s1yZzt?= =?us-ascii?Q?y/ysNezZSHeXA06DhrtaiLu/vgbxJXpV3rjUR9r8P+J8hEnmfkIGRxqQM68f?= =?us-ascii?Q?npcj7mITwqflHO0lA0lLyfIdvDD5wJc3w+dAbk0bQDds9qbtCc8eZIRerrCY?= =?us-ascii?Q?7aFMs4ARPI1TbI0v8dY7k/97jSBntjnIEif5s42FRZfxcrK8DlBYQPEGGP+F?= =?us-ascii?Q?nS3L8x3Lqq11a8aQDdIGefzg4QlLZfRnJXSbNQD1/DvFtdgZuZaCfriAZd4G?= =?us-ascii?Q?xJNYQr1LMZXrq/yY7kjQZ3ILTeMWZ8KRWwPBdhxiDlPjCQRRsC1OhYAemkt0?= =?us-ascii?Q?nug4PPOEZ4jnCz+EiGxKXfS8a3u2PWKT6RcqCuDih8GRWFyRMxmGeoEr3fa/?= =?us-ascii?Q?UIP0SP9Nt40RROZgVQLHnRJM9e5+w4QeguNvnYrJuv5/WJbB679upGHQSqYy?= =?us-ascii?Q?JaNAvyNqDV5aGybbLqLVGJkpAWDCEcylgONmIp4z2k82w8joNWxkJNzXzXI1?= =?us-ascii?Q?ngudhmZ31/cowTSd4H0wmFUCOUGRQZSkNswvJRO3jOpL+gmpoN5Zlvm+EBdr?= =?us-ascii?Q?yCrPmF2ohOfE+8oMsuUcpUNyuNx9qH3GWLo+sWnVmmMO9kLvNwn4xtLj4DSq?= =?us-ascii?Q?KF1g5bNbGRepvXbVzdzENuLNyUWUb5QCaCSU?= 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)(376014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2025 18:07:41.5832 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4b9b0f94-3f6c-46a4-3143-08ddbe4a54da 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: CY4PEPF0000FCC2.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS2PR12MB9591 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1751998086949116600 Content-Type: text/plain; charset="utf-8" ... based on CONFIG_X86. x86 won't depend on it, and it'll only be used by the domain builder in common/device-tree/ Moving it to an arch-specific subfield (as introduced in a later patch) is unwieldy, because all other arches depend on it. Signed-off-by: Alejandro Vallejo Reviewed-by: Denis Mukhin =20 Reviewed-by: Stefano Stabellini --- My expectation is to remove the field altogether after we reach full integration in common code, by deducing this boolean from the domain capabilities given in the "capabilities" prop. That's not something I'm working at the moment though. --- xen/include/xen/bootfdt.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h index 236b456dd2..7f49d0ccdd 100644 --- a/xen/include/xen/bootfdt.h +++ b/xen/include/xen/bootfdt.h @@ -96,16 +96,18 @@ struct shared_meminfo { struct shmem_membank_extra extra[NR_SHMEM_BANKS]; }; =20 -/* - * The domU flag is set for kernels and ramdisks of "xen,domain" nodes. - * The purpose of the domU flag is to avoid getting confused in - * kernel_probe, where we try to guess which is the dom0 kernel and - * initrd to be compatible with all versions of the multiboot spec. - */ #define BOOTMOD_MAX_CMDLINE 1024 struct boot_module { boot_module_kind kind; +#ifndef CONFIG_X86 + /* + * The domU flag is set for kernels and ramdisks of "xen,domain" nodes. + * The purpose of the domU flag is to avoid getting confused in + * kernel_probe, where we try to guess which is the dom0 kernel and + * initrd to be compatible with all versions of the multiboot spec. + */ bool domU; +#endif paddr_t start; paddr_t size; }; --=20 2.43.0 From nobody Thu Oct 30 23:09:16 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=1751998092; cv=pass; d=zohomail.com; s=zohoarc; b=nPFFoxlc36F80BHPKAS+4jz0r4iICl4Z7pYjRoUAJCga1r8TMzJd0UH1bmTkqFUZeAkwVp6lGMzsQPOtkuZXPt3EdT3YT2I4QMz89Hx/EcOgubx/jVU04fO4NEe8qv0xbdKE4GdSMk/Jn9rVCbtP71NPmkUdutQtrvQpdYH0p2o= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751998092; 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=O1ExVy8nhroR1dVMZr/rltfqr8RSNSYjn10HqrXbGOY=; b=gOKFRtVoSMzDYVj2C7OF3R9nypgsOS0dakgaAFS4/bK1v9Aak4Uj1m9w8Kak8Qza+ZLEAOGVSUx0udq3dPqnW4YJ6IS94SIsyd0a0cbhggaXCDGgTWZOYYYK//3Aw6fMpQVMR+DoP9hoiVtTzK8XxIkuJPdkd5X2376bxyKxFiI= 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 1751998092701253.8157980799175; Tue, 8 Jul 2025 11:08:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1037025.1409695 (Exim 4.92) (envelope-from ) id 1uZCjS-0005zY-8H; Tue, 08 Jul 2025 18:07:54 +0000 Received: by outflank-mailman (output) from mailman id 1037025.1409695; Tue, 08 Jul 2025 18:07:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjS-0005zP-5S; Tue, 08 Jul 2025 18:07:54 +0000 Received: by outflank-mailman (input) for mailman id 1037025; Tue, 08 Jul 2025 18:07:52 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjQ-0005Uq-Ne for xen-devel@lists.xenproject.org; Tue, 08 Jul 2025 18:07:52 +0000 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20605.outbound.protection.outlook.com [2a01:111:f403:2414::605]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 7583ef87-5c26-11f0-b894-0df219b8e170; Tue, 08 Jul 2025 20:07:50 +0200 (CEST) Received: from BYAPR06CA0013.namprd06.prod.outlook.com (2603:10b6:a03:d4::26) by CH1PPF73CDB1C12.namprd12.prod.outlook.com (2603:10b6:61f:fc00::615) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.23; Tue, 8 Jul 2025 18:07:45 +0000 Received: from CY4PEPF0000FCC2.namprd03.prod.outlook.com (2603:10b6:a03:d4:cafe::15) by BYAPR06CA0013.outlook.office365.com (2603:10b6:a03:d4::26) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8901.27 via Frontend Transport; Tue, 8 Jul 2025 18:07:44 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC2.mail.protection.outlook.com (10.167.242.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8901.15 via Frontend Transport; Tue, 8 Jul 2025 18:07:44 +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; Tue, 8 Jul 2025 13:07:41 -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: 7583ef87-5c26-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=D2pYq2XaSkjoF7vo/iKqt5MwrSf60AWb/MzhWph1nSL0yH5ZdEjaP3aoGZbzDdkqFiVPpg2ZY09wvncxu2vdSeyWlxmXDseur1NbmJqQYG/kN9UkMBtM5JHPzDb3QIaeeg7qkppYzP540mWOtl9B6UB8i//AA733bftWt2OhbQYKj45JXsYNLPkLsHhxctHZLrpcYe623oavAwvOIg01aZn7Np77TCCPHhV1e+Hl4YXnBORMZiegEvOvMI5wefr2O2qIizLQjQ0xEb/sLwpioQY8AObJUt63AiNplNT8Tl2/iDvceJXyfSI1BMS0iTZfYC3DQvqRNKhRI04m2801ng== 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=O1ExVy8nhroR1dVMZr/rltfqr8RSNSYjn10HqrXbGOY=; b=NAYXTK8n3B5fzb7Tey0aUAkMiTxgYbeL3Zoo6YuGGkhr4X8YLGe/5uGx/kH4oOyFsCTCCewDQMID8XRLkurJFVrn1BRzeFlOZNc5zbPLSeXwKBAbuzMcNSWR8AGJur2ZpV/leukh5Lh+l4Af8bPAfELdQuXNpdROA5ZdiDM3A4va2N0hUA49azk8d8zXoUfsVy/DpH7KGz6vPXstaKQk6Hs0RmiBw7NcyH7PptAOlErZ8iCyxcwG9FlHm4/d0bV3oVvc2KLkO0a92KCnohaWv2yZ0kPvqW0eka7fakaSmgH6fQD86ShUcuF+jmbefe9yqZNC62aSSgFHOmomA18uvw== 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=O1ExVy8nhroR1dVMZr/rltfqr8RSNSYjn10HqrXbGOY=; b=THZob/7QBRDiGacxft0iZW0WTk5+TU+IdQYD/MyHv8etrq9ba5/fUUlRE+CtURXdDXt5X1q2I/9quRBrr0L5vTsHPJyo7lcaRwuFgVSvi9GWPLyzwe6L5wYKo1fckpONdTgNIrqNwHC0pCdsdVJsaCc7twIHGvuJDw+JlnP16hg= 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 , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Stefano Stabellini" , Julien Grall , "Bertrand Marquis" , Michal Orzel , "Daniel P. Smith" Subject: [PATCH v6 02/11] x86: Replace arch-specific boot_module with common one Date: Tue, 8 Jul 2025 20:07:11 +0200 Message-ID: <20250708180721.2338036-3-alejandro.garciavallejo@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250708180721.2338036-1-alejandro.garciavallejo@amd.com> References: <20250708180721.2338036-1-alejandro.garciavallejo@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: CY4PEPF0000FCC2:EE_|CH1PPF73CDB1C12:EE_ X-MS-Office365-Filtering-Correlation-Id: 8e346d4b-0176-4214-44b3-08ddbe4a56b9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?2x4rkXIiyttIUflhlj6+nqEbr2yQRMr78IjZY4mh9Gz8dO2SHyOvQ2BnICka?= =?us-ascii?Q?9E7tSbEFXIJEMkNunSinStgIjyP9auRD+Kwezo5FjNl+ydk0iNmYhvaWnG3s?= =?us-ascii?Q?Ksuq23EfkLrjnDE7Y9i5IvTa823fb5aY5+C1TdEG7B77NaOqe44bg/qe4ZFV?= =?us-ascii?Q?sDijLQNUhx45pDqMxs+qDCm9LzYCVD1fVcPxAFSOuFGefytwbFSWgCXUkjiq?= =?us-ascii?Q?urYC1E2eQ7GJWUb9xdt4jczprqIhC6TPGjX5OVMaq/Ofdp3xjYe+nkf1m8zl?= =?us-ascii?Q?vxFAy94/X+b5acOZyGScDE6dQ10X+qsFBX/6cZ3HzCFuGqoUPs96zXC+Vufb?= =?us-ascii?Q?EPOwcEBnswowu76mGJfOolTaLk329EJsmmGFzouEAoiSI6kAAlkD0pRCY1fu?= =?us-ascii?Q?mMisr1fI0kk0/xIVtLG7uPjHPvg0ocMxJMDIXwrgcs0oxsZ9GqNIrzdF/uRF?= =?us-ascii?Q?kHDG2quxbIGec0WoSuDErwPUfULGAVYby28h03CEIzOHzwXa3MMEqBdCJXJ5?= =?us-ascii?Q?Quf2uz71CYqpyC4hL4PmabGS4me7LvYl2qSYoNnVyECLFamJhg8zf5+VVrO5?= =?us-ascii?Q?GzYuNiNWdtAcw3TlnvNa0hXmHUh/H2pXuLAZnVajs/S/MSVLGObL3UxsyFtK?= =?us-ascii?Q?R7/VWfFONDdvjhXqmL4q+R194AGfpNFqX/drwsFP4P9cTLFomNGRhyRQ7Zq4?= =?us-ascii?Q?fAAKywqzMbdIsxx5o83X6yHfl470zbsYuhmS3fBdcOYz0s9Ovp4s6d64Nci8?= =?us-ascii?Q?xCuQ+XuO9snh2HZk+k8ZPs9RHUVCIDALLyO6Tr1fe+DxW4B/PHusES/wNxsS?= =?us-ascii?Q?i8f2/M75zVBANtWrJGTTa5voQm1f32BcvytavGccEJ6Z/bEhCxdB+XEcz2j5?= =?us-ascii?Q?BlKX+DUfRlAw2u2pYhbDdDsvNfvRGvUQGkUDjCkyLt9LKLlNtMEGzpK+A+0g?= =?us-ascii?Q?gK77g+b0OXrRtq/6eOcSBNpMf0Wvq1u3Wjd5RHjjAJYZqITN1NQuRzgSVc8w?= =?us-ascii?Q?DSsT3p5wevjyfqzJ0nlTzrKpLwxApdh0YMBlraCgazO9KgoD3iAwYKXtso4t?= =?us-ascii?Q?BkC/haafSfTtiu6+gut4DAUGsH2C2rarwQQaQGVDvOZhfIsp+2isIao9dMKU?= =?us-ascii?Q?4f/k265pMk9QC+Pjg80jONUw1qeSXKpogeZDiIFVSPZT1FtDtQgxZSj8gA5F?= =?us-ascii?Q?MRyw1aUoBFWjql9qGjrIcazQJspYfl1PL7GLsFkJnt5yxTgzljB+Qha0q/60?= =?us-ascii?Q?Iz56WrrkoCIvo7snrSHfLw48YLjloHoJrwARCDLZStxNZH/jWKYk0KAgd8Si?= =?us-ascii?Q?6sU3NkuGW0sUxXAl05CvomhGJpOEopjj7Jx7XiF2c0m4FXIL4+Hz8rFxu2nv?= =?us-ascii?Q?eQ86T/TJZnZncucqhtHDOssJuWctpsTACEvYhcblNZCxaxJIIowkRrTTfHmc?= =?us-ascii?Q?pUYfvGpsfw2tM5bGL+f8IEoxLiFju+lMYYcIOBMYSUSBnXJCcjksqeqqtafv?= =?us-ascii?Q?YAfMolhOX5f3Zmad147NZ3kFPSHCxyVVgQmB?= 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)(82310400026)(36860700013)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2025 18:07:44.7439 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8e346d4b-0176-4214-44b3-08ddbe4a56b9 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: CY4PEPF0000FCC2.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH1PPF73CDB1C12 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1751998095158116600 Content-Type: text/plain; charset="utf-8" From: Alejandro Vallejo These types resemble each other very closely in layout and intent, and with "struct boot_module" already in common code it makes perfect sense to merge them. In order to do so, rename identical fields with conflicting names. No functional change intended. Signed-off-by: Alejandro Vallejo Reviewed-by: Stefano Stabellini Acked-by: Jan Beulich --- v6: * Moved the introduction of the "arch" subfield to the previous patch --- xen/arch/x86/cpu/microcode/core.c | 7 ++-- xen/arch/x86/hvm/dom0_build.c | 6 ++-- xen/arch/x86/include/asm/bootfdt.h | 50 ++++++++++++++++++++++++++ xen/arch/x86/include/asm/bootinfo.h | 56 +++-------------------------- xen/arch/x86/pv/dom0_build.c | 4 +-- xen/arch/x86/setup.c | 43 +++++++++++----------- xen/include/xen/bootfdt.h | 8 +++++ xen/xsm/xsm_policy.c | 2 +- 8 files changed, 93 insertions(+), 83 deletions(-) create mode 100644 xen/arch/x86/include/asm/bootfdt.h diff --git a/xen/arch/x86/cpu/microcode/core.c b/xen/arch/x86/cpu/microcode= /core.c index 34a94cd25b..816e9bfe40 100644 --- a/xen/arch/x86/cpu/microcode/core.c +++ b/xen/arch/x86/cpu/microcode/core.c @@ -764,8 +764,7 @@ static int __init early_microcode_load(struct boot_info= *bi) struct cpio_data cd; =20 /* Search anything unclaimed or likely to be a CPIO archive. */ - if ( bm->type !=3D BOOTMOD_UNKNOWN && - bm->type !=3D BOOTMOD_RAMDISK ) + if ( bm->kind !=3D BOOTMOD_UNKNOWN && bm->kind !=3D BOOTMOD_RA= MDISK ) continue; =20 size =3D bm->size; @@ -815,12 +814,12 @@ static int __init early_microcode_load(struct boot_in= fo *bi) return -ENODEV; } =20 - if ( bi->mods[idx].type !=3D BOOTMOD_UNKNOWN ) + if ( bi->mods[idx].kind !=3D BOOTMOD_UNKNOWN ) { printk(XENLOG_WARNING "Microcode: Chosen module %d already use= d\n", idx); return -ENODEV; } - bi->mods[idx].type =3D BOOTMOD_MICROCODE; + bi->mods[idx].kind =3D BOOTMOD_MICROCODE; =20 size =3D bi->mods[idx].size; data =3D bootstrap_map_bm(&bi->mods[idx]); diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c index a038e58c11..2bb8ef355c 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -650,7 +650,7 @@ static int __init pvh_load_kernel( struct boot_module *image =3D bd->kernel; struct boot_module *initrd =3D bd->module; void *image_base =3D bootstrap_map_bm(image); - void *image_start =3D image_base + image->headroom; + void *image_start =3D image_base + image->arch.headroom; unsigned long image_len =3D image->size; unsigned long initrd_len =3D initrd ? initrd->size : 0; size_t cmdline_len =3D bd->cmdline ? strlen(bd->cmdline) + 1 : 0; @@ -721,9 +721,9 @@ static int __init pvh_load_kernel( { size_t initrd_space =3D elf_round_up(&elf, initrd_len); =20 - if ( initrd->cmdline_pa ) + if ( initrd->arch.cmdline_pa ) { - initrd_cmdline =3D __va(initrd->cmdline_pa); + initrd_cmdline =3D __va(initrd->arch.cmdline_pa); if ( !*initrd_cmdline ) initrd_cmdline =3D NULL; } diff --git a/xen/arch/x86/include/asm/bootfdt.h b/xen/arch/x86/include/asm/= bootfdt.h new file mode 100644 index 0000000000..a4c4bf30b9 --- /dev/null +++ b/xen/arch/x86/include/asm/bootfdt.h @@ -0,0 +1,50 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef X86_BOOTFDT_H +#define X86_BOOTFDT_H + +#include + +struct arch_boot_module +{ + /* + * Module State Flags: + * relocated: indicates module has been relocated in memory. + * released: indicates module's pages have been freed. + */ + bool relocated:1; + bool released:1; + + /* + * A boot module may need decompressing by Xen. Headroom is an estima= te of + * the additional space required to decompress the module. + * + * Headroom is accounted for at the start of the module. Decompressin= g is + * done in-place with input=3Dstart, output=3Dstart-headroom, expectin= g the + * pointers to become equal (give or take some rounding) when decompre= ssion + * is complete. + * + * Memory layout at boot: + * + * start ----+ + * v + * |<-----headroom------>|<------size------->| + * +-------------------+ + * | Compressed Module | + * +---------------------+-------------------+ + * | Decompressed Module | + * +-----------------------------------------+ + */ + unsigned long headroom; + paddr_t cmdline_pa; +}; + +#endif /* X86_BOOTFDT_H */ + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 3afc214c17..d33b100e04 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -8,6 +8,7 @@ #ifndef X86_BOOTINFO_H #define X86_BOOTINFO_H =20 +#include #include #include #include @@ -19,55 +20,6 @@ /* Max number of boot domains that Xen can construct */ #define MAX_NR_BOOTDOMS 1 =20 -/* Boot module binary type / purpose */ -enum bootmod_type { - BOOTMOD_UNKNOWN, - BOOTMOD_XEN, - BOOTMOD_KERNEL, - BOOTMOD_RAMDISK, - BOOTMOD_MICROCODE, - BOOTMOD_XSM_POLICY, -}; - -struct boot_module { - enum bootmod_type type; - - /* - * Module State Flags: - * relocated: indicates module has been relocated in memory. - * released: indicates module's pages have been freed. - */ - bool relocated:1; - bool released:1; - - /* - * A boot module may need decompressing by Xen. Headroom is an estima= te of - * the additional space required to decompress the module. - * - * Headroom is accounted for at the start of the module. Decompressin= g is - * done in-place with input=3Dstart, output=3Dstart-headroom, expectin= g the - * pointers to become equal (give or take some rounding) when decompre= ssion - * is complete. - * - * Memory layout at boot: - * - * start ----+ - * v - * |<-----headroom------>|<------size------->| - * +-------------------+ - * | Compressed Module | - * +---------------------+-------------------+ - * | Decompressed Module | - * +-----------------------------------------+ - */ - unsigned long headroom; - - paddr_t cmdline_pa; - - paddr_t start; - size_t size; -}; - /* * Xen internal representation of information provided by the * bootloader/environment, or derived from the information. @@ -94,16 +46,16 @@ struct boot_info { * Failure - a value greater than MAX_NR_BOOTMODS */ static inline unsigned int __init next_boot_module_index( - const struct boot_info *bi, enum bootmod_type t, unsigned int start) + const struct boot_info *bi, boot_module_kind k, unsigned int start) { unsigned int i; =20 - if ( t =3D=3D BOOTMOD_XEN ) + if ( k =3D=3D BOOTMOD_XEN ) return bi->nr_modules; =20 for ( i =3D start; i < bi->nr_modules; i++ ) { - if ( bi->mods[i].type =3D=3D t ) + if ( bi->mods[i].kind =3D=3D k ) return i; } =20 diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index e1b78d47c2..a4b5362357 100644 --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -422,7 +422,7 @@ static int __init dom0_construct(const struct boot_doma= in *bd) =20 image_base =3D bootstrap_map_bm(image); image_len =3D image->size; - image_start =3D image_base + image->headroom; + image_start =3D image_base + image->arch.headroom; =20 d->max_pages =3D ~0U; =20 @@ -659,7 +659,7 @@ static int __init dom0_construct(const struct boot_doma= in *bd) * pages. Tell the boot_module handling that we've freed it, s= o the * memory is left alone. */ - initrd->released =3D true; + initrd->arch.released =3D true; } =20 iommu_memory_setup(d, "initrd", mfn_to_page(_mfn(initrd_mfn)), diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 24e4f5ac7f..7e70b46332 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -303,7 +303,7 @@ struct boot_info __initdata xen_boot_info =3D { * * The extra entry exists to be able to add the Xen image as a module. */ - .mods =3D { [0 ... MAX_NR_BOOTMODS] =3D { .type =3D BOOTMOD_UNKNOWN } = }, + .mods =3D { [0 ... MAX_NR_BOOTMODS] =3D { .kind =3D BOOTMOD_UNKNOWN } = }, }; =20 static struct boot_info *__init multiboot_fill_boot_info( @@ -338,7 +338,7 @@ static struct boot_info *__init multiboot_fill_boot_inf= o( */ for ( i =3D 0; i < MAX_NR_BOOTMODS && i < bi->nr_modules; i++ ) { - bi->mods[i].cmdline_pa =3D mods[i].string; + bi->mods[i].arch.cmdline_pa =3D mods[i].string; =20 if ( efi_enabled(EFI_LOADER) ) { @@ -361,7 +361,7 @@ static struct boot_info *__init multiboot_fill_boot_inf= o( } =20 /* Variable 'i' should be one entry past the last module. */ - bi->mods[i].type =3D BOOTMOD_XEN; + bi->mods[i].kind =3D BOOTMOD_XEN; =20 return bi; } @@ -388,11 +388,11 @@ unsigned long __init initial_images_nrpages(nodeid_t = node) =20 void __init release_boot_module(struct boot_module *bm) { - ASSERT(!bm->released); + ASSERT(!bm->arch.released); =20 init_domheap_pages(bm->start, bm->start + PAGE_ALIGN(bm->size)); =20 - bm->released =3D true; + bm->arch.released =3D true; } =20 void __init free_boot_modules(void) @@ -402,7 +402,7 @@ void __init free_boot_modules(void) =20 for ( i =3D 0; i < bi->nr_modules; ++i ) { - if ( bi->mods[i].released ) + if ( bi->mods[i].arch.released ) continue; =20 release_boot_module(&bi->mods[i]); @@ -997,8 +997,8 @@ static size_t __init domain_cmdline_size(const struct b= oot_info *bi, { size_t s =3D 0; =20 - if ( bd->kernel->cmdline_pa ) - s +=3D strlen(__va(bd->kernel->cmdline_pa)); + if ( bd->kernel->arch.cmdline_pa ) + s +=3D strlen(__va(bd->kernel->arch.cmdline_pa)); =20 if ( bi->kextra ) s +=3D strlen(bi->kextra); @@ -1065,9 +1065,10 @@ static struct domain *__init create_dom0(struct boot= _info *bi) if ( !(cmdline =3D xzalloc_array(char, cmdline_size)) ) panic("Error allocating cmdline buffer for %pd\n", d); =20 - if ( bd->kernel->cmdline_pa ) + if ( bd->kernel->arch.cmdline_pa ) strlcpy(cmdline, - cmdline_cook(__va(bd->kernel->cmdline_pa), bi->loader), + cmdline_cook(__va(bd->kernel->arch.cmdline_pa), + bi->loader), cmdline_size); =20 if ( bi->kextra ) @@ -1089,7 +1090,7 @@ static struct domain *__init create_dom0(struct boot_= info *bi) strlcat(cmdline, " acpi=3D", cmdline_size); strlcat(cmdline, acpi_param, cmdline_size); } - bd->kernel->cmdline_pa =3D 0; + bd->kernel->arch.cmdline_pa =3D 0; bd->cmdline =3D cmdline; } =20 @@ -1302,7 +1303,7 @@ void asmlinkage __init noreturn __start_xen(void) } =20 /* Dom0 kernel is always first */ - bi->mods[0].type =3D BOOTMOD_KERNEL; + bi->mods[0].kind =3D BOOTMOD_KERNEL; bi->domains[0].kernel =3D &bi->mods[0]; =20 if ( pvh_boot ) @@ -1486,7 +1487,7 @@ void asmlinkage __init noreturn __start_xen(void) xen->size =3D __2M_rwdata_end - _stext; } =20 - bi->mods[0].headroom =3D + bi->mods[0].arch.headroom =3D bzimage_headroom(bootstrap_map_bm(&bi->mods[0]), bi->mods[0].size); bootstrap_unmap(); =20 @@ -1568,9 +1569,9 @@ void asmlinkage __init noreturn __start_xen(void) for ( j =3D bi->nr_modules - 1; j >=3D 0; j-- ) { struct boot_module *bm =3D &bi->mods[j]; - unsigned long size =3D PAGE_ALIGN(bm->headroom + bm->size); + unsigned long size =3D PAGE_ALIGN(bm->arch.headroom + bm->size= ); =20 - if ( bm->relocated ) + if ( bm->arch.relocated ) continue; =20 /* Don't overlap with other modules (or Xen itself). */ @@ -1580,12 +1581,12 @@ void asmlinkage __init noreturn __start_xen(void) if ( highmem_start && end > highmem_start ) continue; =20 - if ( s < end && (bm->headroom || (end - size) > bm->start) ) + if ( s < end && (bm->arch.headroom || (end - size) > bm->start= ) ) { - move_memory(end - size + bm->headroom, bm->start, bm->size= ); + move_memory(end - size + bm->arch.headroom, bm->start, bm-= >size); bm->start =3D (end - size); - bm->size +=3D bm->headroom; - bm->relocated =3D true; + bm->size +=3D bm->arch.headroom; + bm->arch.relocated =3D true; } } =20 @@ -1611,7 +1612,7 @@ void asmlinkage __init noreturn __start_xen(void) #endif } =20 - if ( bi->mods[0].headroom && !bi->mods[0].relocated ) + if ( bi->mods[0].arch.headroom && !bi->mods[0].arch.relocated ) panic("Not enough memory to relocate the dom0 kernel image\n"); for ( i =3D 0; i < bi->nr_modules; ++i ) { @@ -2169,7 +2170,7 @@ void asmlinkage __init noreturn __start_xen(void) initrdidx =3D first_boot_module_index(bi, BOOTMOD_UNKNOWN); if ( initrdidx < MAX_NR_BOOTMODS ) { - bi->mods[initrdidx].type =3D BOOTMOD_RAMDISK; + bi->mods[initrdidx].kind =3D BOOTMOD_RAMDISK; bi->domains[0].module =3D &bi->mods[initrdidx]; if ( first_boot_module_index(bi, BOOTMOD_UNKNOWN) < MAX_NR_BOOTMOD= S ) printk(XENLOG_WARNING diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h index 7f49d0ccdd..1b19069833 100644 --- a/xen/include/xen/bootfdt.h +++ b/xen/include/xen/bootfdt.h @@ -7,6 +7,10 @@ #include #include =20 +#if __has_include() +#include +#endif + #define MIN_FDT_ALIGN 8 =20 #define NR_MEM_BANKS 256 @@ -110,6 +114,10 @@ struct boot_module { #endif paddr_t start; paddr_t size; + +#if __has_include() + struct arch_boot_module arch; +#endif }; =20 /* DT_MAX_NAME is the node name max length according the DT spec */ diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c index 1f88b4fc5a..1b4030edb4 100644 --- a/xen/xsm/xsm_policy.c +++ b/xen/xsm/xsm_policy.c @@ -53,7 +53,7 @@ int __init xsm_multiboot_policy_init( printk("Policy len %#lx, start at %p.\n", _policy_len,_policy_start); =20 - bm->type =3D BOOTMOD_XSM_POLICY; + bm->kind =3D BOOTMOD_XSM; break; =20 } --=20 2.43.0 From nobody Thu Oct 30 23:09:16 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=1751998092; cv=pass; d=zohomail.com; s=zohoarc; b=iGnI8vWWNH92s1KIA7wCsWQS9fqHwLEA2oF83uwXRX22vGjy16zOhScSO8XTPckScSpRvklJ/7JJT/U96aXnZ8lXlQA428SYjkRjQxPuraens7DV7VLZ7j87oVzAe0SNK1d8ZiUQK+yBrQdvPHHbpceR+/S9hig+WYrm44zzxus= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751998092; 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=aZH0ds50kWEP222EGsjitYeALVH+fONJgDunBeIXoSo=; b=PlxHqzaP+lUN/GllbyR0OlFNt5b+m7wQY+QIT1IexhYQVrqCrfixhJ/bMQsozMGaUE5WL6dHUZaQrS59sJ/MoVes9Jil8z7RFe0QEiPZuhZTKm+Z4cMSmWhlNQJaVp8cq2416SJ3cDFskbyChy+o18OfjeHzerHfjZLwPSbKoZM= 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 1751998092470507.2906996214001; Tue, 8 Jul 2025 11:08:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1037026.1409705 (Exim 4.92) (envelope-from ) id 1uZCjV-0006Gi-Eo; Tue, 08 Jul 2025 18:07:57 +0000 Received: by outflank-mailman (output) from mailman id 1037026.1409705; Tue, 08 Jul 2025 18:07:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjV-0006GY-Ba; Tue, 08 Jul 2025 18:07:57 +0000 Received: by outflank-mailman (input) for mailman id 1037026; Tue, 08 Jul 2025 18:07:56 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjU-0005Uq-1m for xen-devel@lists.xenproject.org; Tue, 08 Jul 2025 18:07:56 +0000 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on20621.outbound.protection.outlook.com [2a01:111:f403:2412::621]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 7669fbd5-5c26-11f0-b894-0df219b8e170; Tue, 08 Jul 2025 20:07:53 +0200 (CEST) Received: from BYAPR06CA0009.namprd06.prod.outlook.com (2603:10b6:a03:d4::22) by IA1PR12MB6411.namprd12.prod.outlook.com (2603:10b6:208:388::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.22; Tue, 8 Jul 2025 18:07:48 +0000 Received: from CY4PEPF0000FCC2.namprd03.prod.outlook.com (2603:10b6:a03:d4:cafe::29) by BYAPR06CA0009.outlook.office365.com (2603:10b6:a03:d4::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8922.21 via Frontend Transport; Tue, 8 Jul 2025 18:07:47 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC2.mail.protection.outlook.com (10.167.242.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8901.15 via Frontend Transport; Tue, 8 Jul 2025 18:07:47 +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; Tue, 8 Jul 2025 13:07:44 -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: 7669fbd5-5c26-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SqGIppWC2jyd4Pq1dv8MqLYBw/YWDOnvqfm6cjA/Yy00l79AKqkTqISNwcEvyflnUXD0CJhqs3670RdI4L5jlC/4YVup0n7eoj2yTAPzphtIPXFWTKo6hgGbJ62nWp6QyVMRQIqPUVCoJmVOCMpt7yGXMmKHEU7vUWaaavE8ChBGTz0VyWHQYUf5De6Lenxdd+GIp8fWUWeirPUs6ROYNLfjSvRGeeCBY2AjGJGB9FpmQKKL+t+gUSMBMFvxHAbpyef2BKLjEDk7E/VTVR6Uryw4xUUKsV5qNfl2n/PyaB89f2061pcRBD05uPUeImC/6ZvC377sNhDLcLQiXrarWw== 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=aZH0ds50kWEP222EGsjitYeALVH+fONJgDunBeIXoSo=; b=OFrbgit5iwMHJ+VexhL+gCAFSK/bkN1Y9TCPPI26RtDbRHfi/krDdTp5KvdIeo0pvmRWZPEvSW3Sqsk8zgB8lCTueRuuaNtFAWYXHLV5xdEoWOUWV/oJL2xd84Lj68fU9cGx81RIvsVITTMCXROtSbqAYAU+TasDb9gEef2tAoET1TnBkyT9PMCEfRJ6+QQmNvzo6Sp0RkS8EIHCBvp4b/QNZQz1fIg0CsMibSJjb+lpvzcp21LFrJy3qvw9laMKeDigCKWd6Yrc8dFuz2CVr3XNX5H7DzrPH0HUQej5zigqux2THvzabTZa+faimCz1vH0wckZzXI4qS/gE2+AwJQ== 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=aZH0ds50kWEP222EGsjitYeALVH+fONJgDunBeIXoSo=; b=yiUw3dewpSndlT1Arsm548blg691mn3CDfR9+GE9dP3v/KBbLO5RsMYjoRbJoBQAIlWjn1JWNr3yzZXzjc2CdinkNsceeA4yvinoxJXgA+qaaDPo2t+4iYKONt8PmZLnGhhSss1R4qcCZ3ReIhg1FpCJkLgGBuIg5u47/DmGjhI= 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?= , "Daniel P. Smith" Subject: [PATCH v6 03/11] xen: Refactor kernel_info to have a header like boot_domain Date: Tue, 8 Jul 2025 20:07:12 +0200 Message-ID: <20250708180721.2338036-4-alejandro.garciavallejo@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250708180721.2338036-1-alejandro.garciavallejo@amd.com> References: <20250708180721.2338036-1-alejandro.garciavallejo@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: CY4PEPF0000FCC2:EE_|IA1PR12MB6411:EE_ X-MS-Office365-Filtering-Correlation-Id: 647b574e-2855-4879-a0a5-08ddbe4a586b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|36860700013|7416014|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?4rWTM+MqPU2TlAsSWaZh8k4OWZiDSoDBi8ze5x0fF43mEjKXKvOhuG4p2fk1?= =?us-ascii?Q?8aZreZqPUUtL/inLN/3RPgLkRwT86+82WdlfQ+kAcMlEZNC4OqjJkclf5/dh?= =?us-ascii?Q?FToI17eSwgaQE7/c9wAtBUygvygwpL2yM70DRjQ/8cGRY00QXJt6OKWyM0lv?= =?us-ascii?Q?MImzE9JjlDgYictgxA1/gw0S7B3lqz62yGL2Quxkrnk81lRav1Lz8cMU6A1v?= =?us-ascii?Q?/ZhgxjYPahT/hiLHp8BNVSEwtgCb9WB1Bo6HPEOt9RSjxS4aMv6xje0p5vyP?= =?us-ascii?Q?b4O4ksh7ncfyjuBp0mqwNe/vH25dqzMlNJSxd7r4AOeQMKmxCO4G5LssNLRR?= =?us-ascii?Q?owgIn1I84O7GT83pabOzus3jnkraYRTxg0ZGla63fuqeUXC1ocdAV0bylIV+?= =?us-ascii?Q?fvAhqOKHb96wDs/ywZjih/SwcVHI2gnDcInzAShXYeG8uVJKVrH9Rb+H4KU4?= =?us-ascii?Q?bLdvc9n55OFmGKUyY/H9+/PFM7lgtH84IJbeY+vmVqjK3pP4Dml7ZDbsZZEz?= =?us-ascii?Q?JpQMi3YDYwMEqPfC0brQHOLvLPnmHTtGqlwsO9v5QniT3y0WpK8y0ikRS0en?= =?us-ascii?Q?nx5p+WbtZ7XhEYvg2IGsoorbAjm8slX04QQWKMIIz1/1CEeFJKJxPND6fshG?= =?us-ascii?Q?/YmhfQ4cOKy9lEbwJp86kBFRmKpe5x0nEK8PpuyRmgpAJMtbuX8kyiOof5et?= =?us-ascii?Q?+zHsxN64BYOKc4/HaHtkjDE/8MsLwp+WtGCGzaFqaUH41EJqAMtZiR+cTZzs?= =?us-ascii?Q?p71MZvW1782M4FaoQ/HS8FFM0frMP7Q+t7nvYNuwizoWbkiyG9vJ9VHh9gyG?= =?us-ascii?Q?5jiQYnRA5Ef/s5QlizJ1PgcdhNzGmJeTc1oF1MdUDo4dpKg0fZiqgaXF/Een?= =?us-ascii?Q?6vblvRGow+JLksBra5MIW6crxLHIyrJXcmFjSXBC6q3wR4qKK85G3wsbqMAj?= =?us-ascii?Q?sC67jPsFKo0/4EDN43f+dxz93ZW/ia1ED07X8cJ8xwfkRKI45o4mjd8TyqTb?= =?us-ascii?Q?AMYcljcfNcQvADTbbp/Z9ku1Rb+Ilf8wTH8J9F30j/xzCZAystLdPqiAbaY6?= =?us-ascii?Q?vH4k8hR7JaJ4Pr2utFxfWJsieBgFO9VtRZPHD7kcns6p9IfULn3We/COrqSi?= =?us-ascii?Q?1WIvy6NejOAYnP/luqV7wLfJXx0T8mEtwOt4G+bu3PdM+BVL6SyAANRfSEkJ?= =?us-ascii?Q?5tTC0mAEWxNXZMlF0f+c2MIA8oAPLxRIr0O0TJsGYX2ZTNmaJf+wuGPI4B5z?= =?us-ascii?Q?Sb+Tr4fHE2Ga6B1XvvaoceFZkkAU8CA0590EJr7WLO25x9eAEuTSUd2Ihj9o?= =?us-ascii?Q?e0+/zxORdaTS520D6dSXgHCXLgt8pl6okaSBOnsb64gkJ+x2TCFiw+6G3EXc?= =?us-ascii?Q?urZacwRUe19Uxz9PyBOFgYQObA8Wi3yp4pWZU2AzAuWvIa8uqAOaFMqQOtmX?= =?us-ascii?Q?rTZcH7iA2cUBapgPFBtjVd0fTO8xTWDxRa6gdcT380aMppuKRnOQeBJ2hVsX?= =?us-ascii?Q?aQo2lTRO1kbfpJW3Hh9YgBaHoBKPhgS8sH80?= 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)(1800799024)(82310400026)(36860700013)(7416014)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2025 18:07:47.5910 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 647b574e-2855-4879-a0a5-08ddbe4a586b 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: CY4PEPF0000FCC2.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6411 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1751998093197116600 Content-Type: text/plain; charset="utf-8" From: Alejandro Vallejo Create a struct field within kernel_info with the contents common to kernel_info and boot_domain, and define that field in common code. This enables x86 to use that field as-is and drop x86's boot_domain. Note that x86 mutates the module when releasing it, calculating headroom, etc. So they must be made non-const on move. Not a functional change. Signed-off-by: Alejandro Vallejo Reviewed-by: Stefano Stabellini --- v6: * Removed double blank between boot_domain and shared_meminfo * s/char */char* / * Amended commit message with rationale for loss of const * s/hdr/bd/ --- xen/arch/arm/dom0less-build.c | 8 ++++---- xen/arch/arm/domain_build.c | 20 ++++++++++---------- xen/arch/arm/kernel.c | 8 ++++---- xen/common/device-tree/dom0less-build.c | 18 +++++++++--------- xen/common/device-tree/domain-build.c | 20 ++++++++++---------- xen/common/device-tree/kernel.c | 20 ++++++++++---------- xen/include/xen/bootfdt.h | 9 +++++++++ xen/include/xen/fdt-kernel.h | 5 ++--- 8 files changed, 58 insertions(+), 50 deletions(-) diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c index 4b285cff5e..69b9ea22ce 100644 --- a/xen/arch/arm/dom0less-build.c +++ b/xen/arch/arm/dom0less-build.c @@ -32,7 +32,7 @@ static int __init make_gicv2_domU_node(struct kernel_info= *kinfo) int res =3D 0; __be32 reg[(GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELLS) * 2]; __be32 *cells; - const struct domain *d =3D kinfo->d; + const struct domain *d =3D kinfo->bd.d; =20 res =3D domain_fdt_begin_node(fdt, "interrupt-controller", vgic_dist_base(&d->arch.vgic)); @@ -85,7 +85,7 @@ static int __init make_gicv3_domU_node(struct kernel_info= *kinfo) void *fdt =3D kinfo->fdt; int res =3D 0; __be32 *reg, *cells; - const struct domain *d =3D kinfo->d; + const struct domain *d =3D kinfo->bd.d; unsigned int i, len =3D 0; =20 res =3D domain_fdt_begin_node(fdt, "interrupt-controller", @@ -152,7 +152,7 @@ static int __init make_gicv3_domU_node(struct kernel_in= fo *kinfo) =20 int __init make_intc_domU_node(struct kernel_info *kinfo) { - switch ( kinfo->d->arch.vgic.version ) + switch ( kinfo->bd.d->arch.vgic.version ) { #ifdef CONFIG_GICV3 case GIC_V3: @@ -175,7 +175,7 @@ static int __init make_vpl011_uart_node(struct kernel_i= nfo *kinfo) gic_interrupt_t intr; __be32 reg[GUEST_ROOT_ADDRESS_CELLS + GUEST_ROOT_SIZE_CELLS]; __be32 *cells; - struct domain *d =3D kinfo->d; + struct domain *d =3D kinfo->bd.d; =20 res =3D domain_fdt_begin_node(fdt, "sbsa-uart", d->arch.vpl011.base_ad= dr); if ( res ) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 04d3dca38a..edc9a82c15 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -464,8 +464,8 @@ static int __init write_properties(struct domain *d, st= ruct kernel_info *kinfo, int had_dom0_bootargs =3D 0; struct dt_device_node *iommu_node; =20 - if ( kinfo->cmdline && kinfo->cmdline[0] ) - bootargs =3D &kinfo->cmdline[0]; + if ( kinfo->bd.cmdline && kinfo->bd.cmdline[0] ) + bootargs =3D &kinfo->bd.cmdline[0]; =20 /* * We always skip the IOMMU device when creating DT for hwdom if there= is @@ -579,7 +579,7 @@ static int __init write_properties(struct domain *d, st= ruct kernel_info *kinfo, =20 if ( dt_node_path_is_equal(node, "/chosen") ) { - const struct boot_module *initrd =3D kinfo->initrd; + const struct boot_module *initrd =3D kinfo->bd.initrd; =20 if ( bootargs ) { @@ -1461,7 +1461,7 @@ int __init make_timer_node(const struct kernel_info *= kinfo) if ( res ) return res; =20 - if ( !is_64bit_domain(kinfo->d) ) + if ( !is_64bit_domain(kinfo->bd.d) ) res =3D fdt_property_string(fdt, "compatible", "arm,armv7-timer"); else res =3D fdt_property_string(fdt, "compatible", "arm,armv8-timer"); @@ -1473,7 +1473,7 @@ int __init make_timer_node(const struct kernel_info *= kinfo) * It always exposes an active-low level-sensitive interrupt. */ =20 - if ( is_hardware_domain(kinfo->d) ) + if ( is_hardware_domain(kinfo->bd.d) ) { irq[TIMER_PHYS_SECURE_PPI] =3D timer_get_irq(TIMER_PHYS_SECURE_PPI= ); irq[TIMER_PHYS_NONSECURE_PPI] =3D @@ -1522,7 +1522,7 @@ int __init make_chosen_node(const struct kernel_info = *kinfo) { int res; const char *bootargs =3D NULL; - const struct boot_module *initrd =3D kinfo->initrd; + const struct boot_module *initrd =3D kinfo->bd.initrd; void *fdt =3D kinfo->fdt; =20 dt_dprintk("Create chosen node\n"); @@ -1530,9 +1530,9 @@ int __init make_chosen_node(const struct kernel_info = *kinfo) if ( res ) return res; =20 - if ( kinfo->cmdline && kinfo->cmdline[0] ) + if ( kinfo->bd.cmdline && kinfo->bd.cmdline[0] ) { - bootargs =3D &kinfo->cmdline[0]; + bootargs =3D &kinfo->bd.cmdline[0]; res =3D fdt_property(fdt, "bootargs", bootargs, strlen(bootargs) += 1); if ( res ) return res; @@ -1981,7 +1981,7 @@ static int __init construct_dom0(struct domain *d) d->max_pages =3D dom0_mem >> PAGE_SHIFT; =20 kinfo.unassigned_mem =3D dom0_mem; - kinfo.d =3D d; + kinfo.bd.d =3D d; =20 rc =3D kernel_probe(&kinfo, NULL); if ( rc < 0 ) @@ -1993,7 +1993,7 @@ static int __init construct_dom0(struct domain *d) int __init construct_hwdom(struct kernel_info *kinfo, const struct dt_device_node *node) { - struct domain *d =3D kinfo->d; + struct domain *d =3D kinfo->bd.d; int rc; =20 iommu_hwdom_init(d); diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index e734ec5c1e..48f4b56d0c 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -46,7 +46,7 @@ static void __init place_modules(struct kernel_info *info, paddr_t kernbase, paddr_t kernend) { /* Align DTB and initrd size to 2Mb. Linux only requires 4 byte alignm= ent */ - const struct boot_module *mod =3D info->initrd; + const struct boot_module *mod =3D info->bd.initrd; const struct membanks *mem =3D kernel_info_get_mem(info); const paddr_t initrd_len =3D ROUNDUP(mod ? mod->size : 0, MB(2)); const paddr_t dtb_len =3D ROUNDUP(fdt_totalsize(info->fdt), MB(2)); @@ -152,12 +152,12 @@ static void __init kernel_zimage_load(struct kernel_i= nfo *info) =20 kernel =3D ioremap_wc(paddr, len); if ( !kernel ) - panic("Unable to map the %pd kernel\n", info->d); + panic("Unable to map the %pd kernel\n", info->bd.d); =20 - rc =3D copy_to_guest_phys_flush_dcache(info->d, load_addr, + rc =3D copy_to_guest_phys_flush_dcache(info->bd.d, load_addr, kernel, len); if ( rc !=3D 0 ) - panic("Unable to copy the kernel in the %pd memory\n", info->d); + panic("Unable to copy the kernel in the %pd memory\n", info->bd.d); =20 iounmap(kernel); } diff --git a/xen/common/device-tree/dom0less-build.c b/xen/common/device-tr= ee/dom0less-build.c index 221b875a2f..e950691d1e 100644 --- a/xen/common/device-tree/dom0less-build.c +++ b/xen/common/device-tree/dom0less-build.c @@ -167,18 +167,18 @@ static int __init handle_passthrough_prop(struct kern= el_info *kinfo, return -EINVAL; } =20 - res =3D iomem_permit_access(kinfo->d, paddr_to_pfn(mstart), + res =3D iomem_permit_access(kinfo->bd.d, paddr_to_pfn(mstart), paddr_to_pfn(PAGE_ALIGN(mstart + size - = 1))); if ( res ) { printk(XENLOG_ERR "Unable to permit to dom%d access to" " 0x%"PRIpaddr" - 0x%"PRIpaddr"\n", - kinfo->d->domain_id, + kinfo->bd.d->domain_id, mstart & PAGE_MASK, PAGE_ALIGN(mstart + size) - 1); return res; } =20 - res =3D map_regions_p2mt(kinfo->d, + res =3D map_regions_p2mt(kinfo->bd.d, gaddr_to_gfn(gstart), PFN_DOWN(size), maddr_to_mfn(mstart), @@ -217,7 +217,7 @@ static int __init handle_passthrough_prop(struct kernel= _info *kinfo, return -EINVAL; } =20 - res =3D map_device_irqs_to_domain(kinfo->d, node, true, NULL); + res =3D map_device_irqs_to_domain(kinfo->bd.d, node, true, NULL); if ( res < 0 ) return res; =20 @@ -229,7 +229,7 @@ static int __init handle_passthrough_prop(struct kernel= _info *kinfo, if ( xen_force && !dt_device_is_protected(node) ) return 0; =20 - return iommu_assign_dt_device(kinfo->d, node); + return iommu_assign_dt_device(kinfo->bd.d, node); } =20 static int __init handle_prop_pfdt(struct kernel_info *kinfo, @@ -296,14 +296,14 @@ static int __init handle_prop_pfdt(struct kernel_info= *kinfo, address_cells, size_cells); if ( res < 0 ) { - printk(XENLOG_ERR "Failed to assign device to %pd\n", kinfo->d= ); + printk(XENLOG_ERR "Failed to assign device to %pd\n", kinfo->b= d.d); return res; } } else if ( (xen_path && !xen_reg) || (xen_reg && !xen_path && !xen_forc= e) ) { printk(XENLOG_ERR "xen,reg or xen,path missing for %pd\n", - kinfo->d); + kinfo->bd.d); return -EINVAL; } =20 @@ -605,7 +605,7 @@ static int __init alloc_xenstore_page(struct domain *d) =20 static int __init alloc_xenstore_params(struct kernel_info *kinfo) { - struct domain *d =3D kinfo->d; + struct domain *d =3D kinfo->bd.d; int rc =3D 0; =20 #ifdef CONFIG_HVM @@ -773,7 +773,7 @@ static int __init construct_domU(struct domain *d, =20 d->max_pages =3D ((paddr_t)mem * SZ_1K) >> PAGE_SHIFT; =20 - kinfo.d =3D d; + kinfo.bd.d =3D d; =20 rc =3D kernel_probe(&kinfo, node); if ( rc < 0 ) diff --git a/xen/common/device-tree/domain-build.c b/xen/common/device-tree= /domain-build.c index e6d7b8961e..cc14bea195 100644 --- a/xen/common/device-tree/domain-build.c +++ b/xen/common/device-tree/domain-build.c @@ -76,7 +76,7 @@ bool __init allocate_bank_memory(struct kernel_info *kinf= o, gfn_t sgfn, paddr_t tot_size) { struct membanks *mem =3D kernel_info_get_mem(kinfo); - struct domain *d =3D kinfo->d; + struct domain *d =3D kinfo->bd.d; struct membank *bank; =20 /* @@ -170,7 +170,7 @@ int __init find_unallocated_memory(const struct kernel_= info *kinfo, unsigned int i, j; int res; =20 - ASSERT(domain_use_host_layout(kinfo->d)); + ASSERT(domain_use_host_layout(kinfo->bd.d)); =20 unalloc_mem =3D rangeset_new(NULL, NULL, 0); if ( !unalloc_mem ) @@ -341,23 +341,23 @@ void __init dtb_load(struct kernel_info *kinfo, unsigned long left; =20 printk("Loading %pd DTB to 0x%"PRIpaddr"-0x%"PRIpaddr"\n", - kinfo->d, kinfo->dtb_paddr, + kinfo->bd.d, kinfo->dtb_paddr, kinfo->dtb_paddr + fdt_totalsize(kinfo->fdt)); =20 - left =3D copy_to_guest(kinfo->d, kinfo->dtb_paddr, + left =3D copy_to_guest(kinfo->bd.d, kinfo->dtb_paddr, kinfo->fdt, fdt_totalsize(kinfo->fdt)); =20 if ( left !=3D 0 ) panic("Unable to copy the DTB to %pd memory (left =3D %lu bytes)\n= ", - kinfo->d, left); + kinfo->bd.d, left); xfree(kinfo->fdt); } =20 void __init initrd_load(struct kernel_info *kinfo, copy_to_guest_phys_cb copy_to_guest) { - const struct boot_module *mod =3D kinfo->initrd; + const struct boot_module *mod =3D kinfo->bd.initrd; paddr_t load_addr =3D kinfo->initrd_paddr; paddr_t paddr, len; int node; @@ -373,7 +373,7 @@ void __init initrd_load(struct kernel_info *kinfo, len =3D mod->size; =20 printk("Loading %pd initrd from %"PRIpaddr" to 0x%"PRIpaddr"-0x%"PRIpa= ddr"\n", - kinfo->d, paddr, load_addr, load_addr + len); + kinfo->bd.d, paddr, load_addr, load_addr + len); =20 /* Fix up linux,initrd-start and linux,initrd-end in /chosen */ node =3D fdt_path_offset(kinfo->fdt, "/chosen"); @@ -396,12 +396,12 @@ void __init initrd_load(struct kernel_info *kinfo, =20 initrd =3D ioremap_wc(paddr, len); if ( !initrd ) - panic("Unable to map the %pd initrd\n", kinfo->d); + panic("Unable to map the %pd initrd\n", kinfo->bd.d); =20 - res =3D copy_to_guest(kinfo->d, load_addr, + res =3D copy_to_guest(kinfo->bd.d, load_addr, initrd, len); if ( res !=3D 0 ) - panic("Unable to copy the initrd in the %pd memory\n", kinfo->d); + panic("Unable to copy the initrd in the %pd memory\n", kinfo->bd.d= ); =20 iounmap(initrd); } diff --git a/xen/common/device-tree/kernel.c b/xen/common/device-tree/kerne= l.c index e1b22dc1c7..6de2334dbe 100644 --- a/xen/common/device-tree/kernel.c +++ b/xen/common/device-tree/kernel.c @@ -136,16 +136,16 @@ int __init kernel_probe(struct kernel_info *info, /* domain is NULL only for the hardware domain */ if ( domain =3D=3D NULL ) { - ASSERT(is_hardware_domain(info->d)); + ASSERT(is_hardware_domain(info->bd.d)); =20 mod =3D boot_module_find_by_kind(BOOTMOD_KERNEL); =20 - info->kernel =3D mod; - info->initrd =3D boot_module_find_by_kind(BOOTMOD_RAMDISK); + info->bd.kernel =3D mod; + info->bd.initrd =3D boot_module_find_by_kind(BOOTMOD_RAMDISK); =20 cmd =3D boot_cmdline_find_by_kind(BOOTMOD_KERNEL); if ( cmd ) - info->cmdline =3D &cmd->cmdline[0]; + info->bd.cmdline =3D &cmd->cmdline[0]; } else { @@ -162,7 +162,7 @@ int __init kernel_probe(struct kernel_info *info, dt_get_range(&val, node, &kernel_addr, &size); mod =3D boot_module_find_by_addr_and_kind( BOOTMOD_KERNEL, kernel_addr); - info->kernel =3D mod; + info->bd.kernel =3D mod; } else if ( dt_device_is_compatible(node, "multiboot,ramdisk") ) { @@ -171,7 +171,7 @@ int __init kernel_probe(struct kernel_info *info, =20 val =3D dt_get_property(node, "reg", &len); dt_get_range(&val, node, &initrd_addr, &size); - info->initrd =3D boot_module_find_by_addr_and_kind( + info->bd.initrd =3D boot_module_find_by_addr_and_kind( BOOTMOD_RAMDISK, initrd_addr); } else if ( dt_device_is_compatible(node, "multiboot,device-tree= ") ) @@ -192,7 +192,7 @@ int __init kernel_probe(struct kernel_info *info, name =3D dt_node_name(domain); cmd =3D boot_cmdline_find_by_name(name); if ( cmd ) - info->cmdline =3D &cmd->cmdline[0]; + info->bd.cmdline =3D &cmd->cmdline[0]; } if ( !mod || !mod->size ) { @@ -201,10 +201,10 @@ int __init kernel_probe(struct kernel_info *info, } =20 printk("Loading %pd kernel from boot module @ %"PRIpaddr"\n", - info->d, info->kernel->start); - if ( info->initrd ) + info->bd.d, info->bd.kernel->start); + if ( info->bd.initrd ) printk("Loading ramdisk from boot module @ %"PRIpaddr"\n", - info->initrd->start); + info->bd.initrd->start); =20 /* * uImage isn't really used nowadays thereby leave kernel_uimage_probe= () diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h index 1b19069833..28f7d18262 100644 --- a/xen/include/xen/bootfdt.h +++ b/xen/include/xen/bootfdt.h @@ -100,6 +100,15 @@ struct shared_meminfo { struct shmem_membank_extra extra[NR_SHMEM_BANKS]; }; =20 +struct boot_domain { + struct domain *d; + + struct boot_module *kernel; + struct boot_module *initrd; + + const char *cmdline; +}; + #define BOOTMOD_MAX_CMDLINE 1024 struct boot_module { boot_module_kind kind; diff --git a/xen/include/xen/fdt-kernel.h b/xen/include/xen/fdt-kernel.h index 12a0b42d17..8363865282 100644 --- a/xen/include/xen/fdt-kernel.h +++ b/xen/include/xen/fdt-kernel.h @@ -16,7 +16,7 @@ #endif =20 struct kernel_info { - struct domain *d; + struct boot_domain bd; =20 void *fdt; /* flat device tree */ paddr_t unassigned_mem; /* RAM not (yet) assigned to a bank */ @@ -34,8 +34,7 @@ struct kernel_info { paddr_t gnttab_size; =20 /* boot blob load addresses */ - const struct boot_module *kernel, *initrd, *dtb; - const char* cmdline; + const struct boot_module *dtb; paddr_t dtb_paddr; paddr_t initrd_paddr; =20 --=20 2.43.0 From nobody Thu Oct 30 23:09:16 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=1751998097; cv=pass; d=zohomail.com; s=zohoarc; b=WF/UBnnkBgsUr/7rXzLuPLDMXQOsWAg5tnFUWitR7ymyNjMC5veys/ITL8CZnOaKLUh7fs9zvWZNtP857yJIIBbkD9pXMmr9Cy+L7UlEJqg19Rsc/jmMfpre3Tp5dVDticJAwr2JlyGqMYTGd7O4nEBOObHd/X5GMMY78PslxaY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751998097; 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=Vso2EYruuleOBrbwx7nFpqmFdGG3+p6tqYAmzJo08dY=; b=K9rT4Cn4AnT13CM9PJS/qbJ1rjWY6ajMqWsmA2EAbsZGY725ch4PUQMFF+WlRDi7wac3Xr+XWc2wYcgwhYo49mJahlqngSPOEy6PYNdrrjy7y6kq+r7uXocVM0d32KMNZNwPJv3VZtqntvtyRpqDwpHuWuR2WHmhy3orhnXsEnw= 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 1751998097942924.7695778650825; Tue, 8 Jul 2025 11:08:17 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1037028.1409712 (Exim 4.92) (envelope-from ) id 1uZCjW-0006NH-0T; Tue, 08 Jul 2025 18:07:58 +0000 Received: by outflank-mailman (output) from mailman id 1037028.1409712; Tue, 08 Jul 2025 18:07:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjV-0006Mm-Qg; Tue, 08 Jul 2025 18:07:57 +0000 Received: by outflank-mailman (input) for mailman id 1037028; Tue, 08 Jul 2025 18:07:57 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjV-0005Uq-1x for xen-devel@lists.xenproject.org; Tue, 08 Jul 2025 18:07:57 +0000 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2062c.outbound.protection.outlook.com [2a01:111:f403:2412::62c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 77881dcd-5c26-11f0-b894-0df219b8e170; Tue, 08 Jul 2025 20:07:54 +0200 (CEST) Received: from DM6PR07CA0084.namprd07.prod.outlook.com (2603:10b6:5:337::17) by BL4PR12MB9482.namprd12.prod.outlook.com (2603:10b6:208:58d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.25; Tue, 8 Jul 2025 18:07:50 +0000 Received: from CY4PEPF0000FCC1.namprd03.prod.outlook.com (2603:10b6:5:337:cafe::44) by DM6PR07CA0084.outlook.office365.com (2603:10b6:5:337::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8901.27 via Frontend Transport; Tue, 8 Jul 2025 18:07:50 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC1.mail.protection.outlook.com (10.167.242.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8901.15 via Frontend Transport; Tue, 8 Jul 2025 18:07:49 +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; Tue, 8 Jul 2025 13:07:47 -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: 77881dcd-5c26-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Q2tBYc9rLdAKfz9+hbtVRBbFMTepAKsnXr1w9qxfHTZjPbYchM8coviNmlS1TnOfFEm8bNHeWkkCIePjMEMcL3XwetNR8fySio5j+apZHMx3HEIRe1hxWWkJcKATGOCUUvFdCaFmZ755Js6GMXSxz9+2KthO2GTDwIyo3112hnYq465vyX01499e9yv0/f1Msor1heW0rklc1PPuAiuGY6mhJuTZ3zEYrNVgjNc+34OMoQeKXptd97pCQ0CTcv6zeMLuFMOoBDPTEQN4hiKgwwZTOFBiTF7u52k+cDVzlDEtE0RQzt0rOXExVJQMQrkVv8szMjahALZSFBgg1TLxPw== 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=Vso2EYruuleOBrbwx7nFpqmFdGG3+p6tqYAmzJo08dY=; b=PiJIGTKXgOEsFAYJ1M0TQl7e4GcF5SigORMGgXlsCj/xcQereDa0jn3aaCM4gWO4ZDdxCoctMkehKU1CtMZ8jH59zah4B8t+fF/vxEZoUtWs1kGbvh9vgLG3FPBDQO9nOW+3RoT2TNeHdNx3LLuD18mWyubNhdsH+ZU+fGScICjE1rucX5iIYacomBpICsq9C53u3FIJuxZPTGLR3ZEiXRML9bfxr8nHyXuQBdNJRH6j4Ug7XNDg90KyaYWvy53MTIZapUsogfwUy7fdbX4AuNVQnTmx8UX9XJJJ1RhmFRgW2zIScZTofZ3WW3028nHcDjPfU9fS5oxwevY4mJ/4NQ== 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=Vso2EYruuleOBrbwx7nFpqmFdGG3+p6tqYAmzJo08dY=; b=4RWo+r9fll7j57YY8hHC3gX6uZ0lNJuWuvGYgbW9bses2hBUdT6Mtn9DD6FDEjgvOV/MsAA7z2UiquKDzOZlU2WqpRq2Dlqt2DKf/pXPVK/8R+AnFU6qYXMHdFoCPXEiFTEvz5Yc69DS0hTN5CacvOq0qHfNbmwLbt8xFxPFbr0= 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 , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , "Stefano Stabellini" , Julien Grall , "Bertrand Marquis" , Michal Orzel , "Daniel P. Smith" Subject: [PATCH v6 04/11] x86: Replace arch-specific boot_domain with the common one Date: Tue, 8 Jul 2025 20:07:13 +0200 Message-ID: <20250708180721.2338036-5-alejandro.garciavallejo@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250708180721.2338036-1-alejandro.garciavallejo@amd.com> References: <20250708180721.2338036-1-alejandro.garciavallejo@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: CY4PEPF0000FCC1:EE_|BL4PR12MB9482:EE_ X-MS-Office365-Filtering-Correlation-Id: 6b735f83-c687-4a2e-4f7b-08ddbe4a59da X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?tJX/cO6RTznN794ihfxPfMycWSt6iNNa+6GZBnaRkXXeuj05Ffl9HeHjP4s8?= =?us-ascii?Q?4tfFx9AOFWeCOqivVydJKvZKN5FykL7i8s7KdpAMrTOgjrFlA0EenpqeXlh5?= =?us-ascii?Q?jAt+LQC/+YSVAtP0V9mLlWO06btVoGYOsdqOQRlVTV8899OcXa6MGJ2DlyfE?= =?us-ascii?Q?KQazd5Hex7jMNm8EO1bCKHoh+F+a5103rArm7FWsLjGZz6XkRv1h5HXo36iC?= =?us-ascii?Q?47SD2jX29yBcVLfHDllRdXLX25IcvJeKfRo9+4ieUFJ5FwjHmMMkun1nKjmf?= =?us-ascii?Q?cOKNnngeLc5XDY44lUkpeD6qPVAVlhxgqpHyjomb6Wrj89VVFYMpoEvnEG44?= =?us-ascii?Q?zKiM10zW0OP1Q/YZs8Ln7y6sIgAMjfDJSD6+/bl/K5Tp4o7jH2oZhD1/anep?= =?us-ascii?Q?s/pZD0zrS9ulxyIaLzY+nDl6VeFFSwj0/vCsiESx4z0To2P81BU0kT+KTIuR?= =?us-ascii?Q?mhyeHM0ya6VCF/05FshfLk8moTiN6SpBiegNlBwge7o/k9FbRAjGHqnRf20y?= =?us-ascii?Q?pOqjmNNVUjMWvV/jIzWCZt9qIw6iPe3Ujpmv421546DC6B3HFHPWRHsWs4Cy?= =?us-ascii?Q?JYlMvHSkJpJUe4Mjw6qo3Cn0zJeQigDxhFfl0aP8ckITGGgIMU/YJWE09w84?= =?us-ascii?Q?+WIelcakqQ9rkXj6h7SxX94CxK9lNduhmuYzFPXWmAxcP131fhB97uziB3IG?= =?us-ascii?Q?6F9Gzo3CQTQ20UPZm/fKP6RXvEFg9Vk1u+L55e2RL5BMBLIAV+LAVulpuiJJ?= =?us-ascii?Q?zHGOtygO6rOFmQdSVcZLX+yZWf6JN3fGdOv3O3RNLxR8GtkVzDGY5OO/bWTI?= =?us-ascii?Q?M7FVzoGx1Ca2pQfpBsk9M3TNy6FwbSDlK7KxLrv/aW8Qh6Ohhb0Q7fqaOqj0?= =?us-ascii?Q?ouHEZ/Qiyo+8loUukNSOfj/Z23AWXILDZCp0RoeC4ySAVZ+FgnUrTbV2YA0a?= =?us-ascii?Q?58Wfcuqt5/vKnKhtrcCfR+MVtGfQuQ/wpwRNBXxeIQsZS+9rXp92yV65krEJ?= =?us-ascii?Q?1+rq9Cre2ru1KD3Xg09e8uRcGUQRQdR60oL5ONtVizGxfi1/Onu7P3QpHAb+?= =?us-ascii?Q?i5D0ZKlhWMnuV+4CF6alycodnRgCLDeIbEejp1KOZ2CajIzefQAcutZeRmub?= =?us-ascii?Q?UhorMU0EWPlCmq4vH6XlDuCC47zjOqEw9TwFr/JqohXKyACHiMXpuOYjBwKl?= =?us-ascii?Q?SraN4u6HJ5AzSmlYAuFe10Cl5gdSycOMNs6PHukwA7Y0ujqjuQsZuvWC2ate?= =?us-ascii?Q?qXjwcDxR+/wKjIQoIe0Ksebr0vdz+7wshWi8YxdP1sNcS4c+PjICljlVxnHU?= =?us-ascii?Q?/rhm3Gj91utXJJw88xP+NqmUte2GsVHaASr69KCjV/gMjCML/70DqBf007eK?= =?us-ascii?Q?0FWjXXpX54cS8OLUEWgXbbJvPDFRSOYPwe+p9eykUlOIRI2cW9zMGUKcScUO?= =?us-ascii?Q?aA3NeFYyPWP9bqhHwoH890tnFbydEheNkNrfLlKkCDZfOCjoWdLE2FUEfo5n?= =?us-ascii?Q?yHY5bGMi52TnGOWukyk7yEc4BSxVNTieLD6L?= 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)(82310400026)(36860700013)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2025 18:07:49.9918 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6b735f83-c687-4a2e-4f7b-08ddbe4a59da 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: CY4PEPF0000FCC1.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL4PR12MB9482 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1751998099246116600 Content-Type: text/plain; charset="utf-8" From: Alejandro Vallejo Add the single arch-specific field in an "arch" subfield defined in asm/bootfdt.h. No functional change intended. Signed-off-by: Alejandro Vallejo Reviewed-by: Stefano Stabellini --- xen/arch/x86/hvm/dom0_build.c | 2 +- xen/arch/x86/include/asm/boot-domain.h | 33 -------------------------- xen/arch/x86/include/asm/bootfdt.h | 6 +++++ xen/arch/x86/include/asm/bootinfo.h | 1 - xen/arch/x86/pv/dom0_build.c | 2 +- xen/arch/x86/setup.c | 12 ++++++---- xen/include/xen/bootfdt.h | 4 ++++ 7 files changed, 19 insertions(+), 41 deletions(-) delete mode 100644 xen/arch/x86/include/asm/boot-domain.h diff --git a/xen/arch/x86/hvm/dom0_build.c b/xen/arch/x86/hvm/dom0_build.c index 2bb8ef355c..8d2734f2b5 100644 --- a/xen/arch/x86/hvm/dom0_build.c +++ b/xen/arch/x86/hvm/dom0_build.c @@ -648,7 +648,7 @@ static int __init pvh_load_kernel( { struct domain *d =3D bd->d; struct boot_module *image =3D bd->kernel; - struct boot_module *initrd =3D bd->module; + struct boot_module *initrd =3D bd->initrd; void *image_base =3D bootstrap_map_bm(image); void *image_start =3D image_base + image->arch.headroom; unsigned long image_len =3D image->size; diff --git a/xen/arch/x86/include/asm/boot-domain.h b/xen/arch/x86/include/= asm/boot-domain.h deleted file mode 100644 index d7c6042e25..0000000000 --- a/xen/arch/x86/include/asm/boot-domain.h +++ /dev/null @@ -1,33 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-or-later */ -/* - * Copyright (c) 2024 Apertus Solutions, LLC - * Author: Daniel P. Smith - * Copyright (c) 2024 Christopher Clark - */ - -#ifndef __XEN_X86_BOOTDOMAIN_H__ -#define __XEN_X86_BOOTDOMAIN_H__ - -#include - -struct boot_domain { - domid_t domid; - - struct boot_module *kernel; - struct boot_module *module; - const char *cmdline; - - struct domain *d; -}; - -#endif - -/* - * Local variables: - * mode: C - * c-file-style: "BSD" - * c-basic-offset: 4 - * tab-width: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/xen/arch/x86/include/asm/bootfdt.h b/xen/arch/x86/include/asm/= bootfdt.h index a4c4bf30b9..c21dbe961b 100644 --- a/xen/arch/x86/include/asm/bootfdt.h +++ b/xen/arch/x86/include/asm/bootfdt.h @@ -3,6 +3,12 @@ #define X86_BOOTFDT_H =20 #include +#include + +struct arch_boot_domain +{ + domid_t domid; +}; =20 struct arch_boot_module { diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index d33b100e04..4f2cc5906e 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -12,7 +12,6 @@ #include #include #include -#include =20 /* Max number of boot modules a bootloader can provide in addition to Xen = */ #define MAX_NR_BOOTMODS 63 diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c index a4b5362357..c37bea9454 100644 --- a/xen/arch/x86/pv/dom0_build.c +++ b/xen/arch/x86/pv/dom0_build.c @@ -375,7 +375,7 @@ static int __init dom0_construct(const struct boot_doma= in *bd) struct vcpu *v =3D d->vcpu[0]; =20 struct boot_module *image =3D bd->kernel; - struct boot_module *initrd =3D bd->module; + struct boot_module *initrd =3D bd->initrd; void *image_base; unsigned long image_len; void *image_start; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 7e70b46332..5adb7af930 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -297,7 +297,9 @@ static const char *cmdline_cook(const char *p, const ch= ar *loader_name); struct boot_info __initdata xen_boot_info =3D { .loader =3D "unknown", .cmdline =3D "", - .domains =3D { [0 ... MAX_NR_BOOTDOMS - 1] =3D { .domid =3D DOMID_INVA= LID } }, + .domains =3D { [0 ... MAX_NR_BOOTDOMS - 1] =3D { + .arch.domid =3D DOMID_INVALID + }}, /* * There's a MAX_NR_BOOTMODS-th entry in the array. It's not off by on= e. * @@ -1048,11 +1050,11 @@ static struct domain *__init create_dom0(struct boo= t_info *bi) dom0_cfg.flags |=3D XEN_DOMCTL_CDF_iommu; =20 /* Create initial domain. Not d0 for pvshim. */ - bd->domid =3D get_initial_domain_id(); - d =3D domain_create(bd->domid, &dom0_cfg, + bd->arch.domid =3D get_initial_domain_id(); + d =3D domain_create(bd->arch.domid, &dom0_cfg, pv_shim ? 0 : CDF_privileged | CDF_hardware); if ( IS_ERR(d) ) - panic("Error creating d%u: %ld\n", bd->domid, PTR_ERR(d)); + panic("Error creating d%u: %ld\n", bd->arch.domid, PTR_ERR(d)); =20 init_dom0_cpuid_policy(d); =20 @@ -2171,7 +2173,7 @@ void asmlinkage __init noreturn __start_xen(void) if ( initrdidx < MAX_NR_BOOTMODS ) { bi->mods[initrdidx].kind =3D BOOTMOD_RAMDISK; - bi->domains[0].module =3D &bi->mods[initrdidx]; + bi->domains[0].initrd =3D &bi->mods[initrdidx]; if ( first_boot_module_index(bi, BOOTMOD_UNKNOWN) < MAX_NR_BOOTMOD= S ) printk(XENLOG_WARNING "Multiple initrd candidates, picking module #%u\n", diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h index 28f7d18262..65ba818e1a 100644 --- a/xen/include/xen/bootfdt.h +++ b/xen/include/xen/bootfdt.h @@ -107,6 +107,10 @@ struct boot_domain { struct boot_module *initrd; =20 const char *cmdline; + +#if __has_include() + struct arch_boot_domain arch; +#endif }; =20 #define BOOTMOD_MAX_CMDLINE 1024 --=20 2.43.0 From nobody Thu Oct 30 23:09:16 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=1751998104; cv=pass; d=zohomail.com; s=zohoarc; b=nSuQ0du1D5Zc6zANb8Q2wu+P9GYeMjpMyHdV/Wt9NgN02M12klDok1E9w+VrJIvmmxRFvvuMvnIV8q9UbqCfLrrezjEs6Z1zaFxjdrvEG637dzms2RX7gMdy9eXB2Cj5RneYsUb/gWn4kUglMnMd95xY+0cPd5Fi5L8ZYp1TBmc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751998104; 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=w2yi5GpSBJHPZZ8SCTN0qLV+ryEhgObEm/ZPjs2/PGU=; b=nPPZ/jlfADfLiacnTjt2G5S3CtJ2chpWFD3RZG+11RlPvkOfoh23eDQleI39wIuWpCNZob0W6Crr7mR0NxUb3TRW81+xD1RVXCESHb7wpyUbtIuW7lv8sUyNlmKQ7Ak7kxADJM4Gk+QtIekzWYxjvBdgP8/zUQjkDHXnGTnDNLk= 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 1751998104310947.9766273340268; Tue, 8 Jul 2025 11:08:24 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1037034.1409744 (Exim 4.92) (envelope-from ) id 1uZCjh-0007fz-8N; Tue, 08 Jul 2025 18:08:09 +0000 Received: by outflank-mailman (output) from mailman id 1037034.1409744; Tue, 08 Jul 2025 18:08:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjh-0007fv-3O; Tue, 08 Jul 2025 18:08:09 +0000 Received: by outflank-mailman (input) for mailman id 1037034; Tue, 08 Jul 2025 18:08:06 +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 1uZCje-0006FB-CA for xen-devel@lists.xenproject.org; Tue, 08 Jul 2025 18:08:06 +0000 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on20623.outbound.protection.outlook.com [2a01:111:f403:2406::623]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 7e48fda3-5c26-11f0-a317-13f23c93f187; Tue, 08 Jul 2025 20:08:05 +0200 (CEST) Received: from PH7P222CA0004.NAMP222.PROD.OUTLOOK.COM (2603:10b6:510:33a::15) by SA3PR12MB8761.namprd12.prod.outlook.com (2603:10b6:806:312::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.24; Tue, 8 Jul 2025 18:07:54 +0000 Received: from CY4PEPF0000FCC4.namprd03.prod.outlook.com (2603:10b6:510:33a:cafe::52) by PH7P222CA0004.outlook.office365.com (2603:10b6:510:33a::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8922.21 via Frontend Transport; Tue, 8 Jul 2025 18:07:54 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC4.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8901.15 via Frontend Transport; Tue, 8 Jul 2025 18:07:53 +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; Tue, 8 Jul 2025 13:07:49 -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: 7e48fda3-5c26-11f0-a317-13f23c93f187 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VhdX18zE0NCUPkAzyzHWZpxvzfRcdIs0E4fRaIdhVYda7hZcOsunMQR0byQq4U71kiNbzpLjS/lzvL9ltcoG9scsgngRO6MLiGCOU0DGn2AUi5TmO0iiS5LbpW+ndoRB8HPw8Ypd5U6gZKEgILO/pYRd0MYxOKLdSsQM15hOA3VjpAb7++zNhbG1/eL56rz91AUtU2swbG5JASKG2VCuTrq0xVh3XmG8c55U0bozLVTp/25pvnmqWvIm2RYjB44Xn+u60KAn+gJdRYypoNj3LKo172/NSYleRKSbZ0mbpTPKHJezQGoQVynL8jEAPxvnQAAXm1907nhrtTtdp5UtGg== 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=w2yi5GpSBJHPZZ8SCTN0qLV+ryEhgObEm/ZPjs2/PGU=; b=IgPf8Gef1LMIBvyS9EGLN4/UKW+wFw6mtIEKEHRKCegdbUCBpujLvAvF15lzgbyWdncIXopZvMF5Pl34kImIVu0HbZjTFy8rONZ0yuuruQvnLB9mUXpjJPgek+Ox2sCRALRM2iCSiB++W+78PHPzF+27Yvku9J+6YOfKBPfs+r3pvqJUKKYiIH+dZAZJNGFCkiMiJLBCWo8eeDh3soOCXWRA89hLIhcJw8SsMYxGfpljDhV/hqQ9OMq1aZXI0dvUl+IoAan86zfrHPNma81geri9iSwD677Nux7g79QmcD3qJKTxyDUb8GtgIEsgY11K3OwEaNj2nU/0hgCXhw3V2A== 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=w2yi5GpSBJHPZZ8SCTN0qLV+ryEhgObEm/ZPjs2/PGU=; b=xhRSIYx/pmD6Q0MECC38rDQYQluLDSwPOEyXcuOpl4JkMNRFYP4vUiHkAxmgaHgsSuh7qhMe5MIk4wKbKejvowaZJPbWOcIAaHbjma5ArujdlOxeqqZe3GMx+tH9P/FIGXPN3guZO1zU+x3/OEIOvCSZeMB84+34jQL+jNDBjRo= 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 , Alistair Francis , Bob Eshleman , "Connor Davis" , Oleksii Kurochko , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , Dario Faggioli , Juergen Gross , George Dunlap , "Daniel P. Smith" Subject: [PATCH v6 05/11] xen/dt: Move bootfdt functions to xen/bootfdt.h Date: Tue, 8 Jul 2025 20:07:14 +0200 Message-ID: <20250708180721.2338036-6-alejandro.garciavallejo@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250708180721.2338036-1-alejandro.garciavallejo@amd.com> References: <20250708180721.2338036-1-alejandro.garciavallejo@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: CY4PEPF0000FCC4:EE_|SA3PR12MB8761:EE_ X-MS-Office365-Filtering-Correlation-Id: 85895286-33ab-4f17-afe2-08ddbe4a5c39 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?CTDjGr/0n/4+N8GKM71/lbsBtiJXX65AomK+dyE1WWTwwpplphcsJYvcrzrx?= =?us-ascii?Q?izZ6A5Gd6FrQ6gTgVDMyoGR2bSEWHtrJ6KO7M+qcotkmZGB5b0849vZEIw6k?= =?us-ascii?Q?nnUv+3813sTqaFp0XAY6FgCVFKzOacd9S5GxO54Zwv2pv0zqD8hXMBAKbVoM?= =?us-ascii?Q?qT25ImkREvfu8l00crIDN2ZNlm+d5/FekeKKMKU0E1+E7+pYQNYDzy1DsPCR?= =?us-ascii?Q?aoRRCppa0C7RaBo1cFQpeu9aT8mgvF26sq2I72RwQDz3k+qYrBAphJjXoKW9?= =?us-ascii?Q?GiAtNFrHNxJA8sZmy3UIhX31QTRBsZrWqSVWY0LYep8gKTZoaQ4D5E4yVAt0?= =?us-ascii?Q?vmrqntTipKQJB+s34YZn8qRF0i3vhtn4C7npGOIb7e/1iMJUvXBX9qxesVsP?= =?us-ascii?Q?y1wTH4kQMDb2JYUgGGggoBLGPfjPYFmQTs5d6ZmUXElSs9tqM0lauGLrz4bn?= =?us-ascii?Q?rmz+IH9tRQSQ98+Rs7tIwaOp/eCwkTsqOh/H58g2Qphw5SEgTzeOTWgWv9ip?= =?us-ascii?Q?VcSTKwyI0MMmf+Sa6Cq04SSsyTPArG50OndnbYhf46i387LkNL3sk7VyQv0V?= =?us-ascii?Q?AmZ3BM+BFLEPW+f4/EfKupu+T21z0wTd2K7FKe0i/ucu/XmyD3rLs6rXzsH5?= =?us-ascii?Q?gFVD68c4vheFfUk+VeiwUgwdW7ANJ+jespylMNPEkdv2J2pnm+ZUYQB5A4Dr?= =?us-ascii?Q?k/JgL1kKkWBtauULaywT+u6KFk+hLoti5t3iAHbGANIZUwGzH/Ht4ZN+GuCQ?= =?us-ascii?Q?b89r721dnLU5IEEpJ5BuRY/A/NBMqpSaY9qS8VPGNGFbVH9PPo/Hfa2tm9WE?= =?us-ascii?Q?q/183ZXO1FfogAi3PVyIlCMQkKFvUDP4wkf36GqO+29gXMtbmWiYFpiJDaz9?= =?us-ascii?Q?KM1oaM8whpyzO0lLaz5pLVS4iikJbHKkM4xSUSzsO+VlvJ7diLs4Lk3CBrUa?= =?us-ascii?Q?17Dg2gutSHBCYV/xRP+/alCxql2Lv8zoDRY7fjz2rrJjYzc+VHxf8Rc9VX5W?= =?us-ascii?Q?1DArD3z9gLR/EzWpoZT6LJ2BTs0rnWE+mx2/A05mlU4BnJZKwKYmU/ERdPf0?= =?us-ascii?Q?LrJ7AgGCxfWomjIUoYN+64CNG18IjSOuHSXszTspAl3hyRNFgKypfjMzCBNp?= =?us-ascii?Q?O1iklbAhgZTmvpG8FFTfyO3pUi5AhWj7XVbaxaKrInK5/97Nc/kh6f7/zejB?= =?us-ascii?Q?zPbASU9hMfGO88wnm8CCP05Lav/jA3i4EWsyzbZLxTOCxT0HX6M+HH78WIEQ?= =?us-ascii?Q?QvilhIQtZU9JakQlM3Oqvxo0q9BZioMJj86vUaPAaLOZU9vGVbKXHNNx0qFp?= =?us-ascii?Q?QTYmgGUpXv0NcPm8KGSnutrj482O/fTIiC+PZDf0R6hwgwk5ybPkaoCeLiZz?= =?us-ascii?Q?domQT8UoFv7joGMXpJAKiOFj1QEMlo+BHdP3phwyToQkoKLpos/UM8H7v+8s?= =?us-ascii?Q?eeJn6QklEi3XGu6iUsXwD+seMGhkhSVEESGFjf3tIPuil7DjZl8cfDWY7HKd?= =?us-ascii?Q?By3Md4b8YDCdTKR0alclK6MFauk+VHu5YJhR?= 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)(376014)(7416014)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2025 18:07:53.9739 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 85895286-33ab-4f17-afe2-08ddbe4a5c39 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: CY4PEPF0000FCC4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB8761 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1751998105363116600 Content-Type: text/plain; charset="utf-8" From: Alejandro Vallejo Part of an unpicking process to extract bootfdt contents independent of boo= tinfo to a separate file for x86 to take. Move functions required for early FDT parsing from device_tree.h and arm's setup.h onto bootfdt.h Declaration motion only. Not a functional change. Signed-off-by: Alejandro Vallejo Reviewed-by: Stefano Stabellini --- xen/arch/riscv/cpufeature.c | 1 + xen/arch/riscv/smpboot.c | 1 + xen/common/device-tree/device-tree.c | 1 + xen/common/device-tree/static-evtchn.c | 1 + xen/common/sched/boot-cpupool.c | 1 + xen/include/xen/bootfdt.h | 91 ++++++++++++++++++++++++++ xen/include/xen/device_tree.h | 78 ---------------------- 7 files changed, 96 insertions(+), 78 deletions(-) diff --git a/xen/arch/riscv/cpufeature.c b/xen/arch/riscv/cpufeature.c index b7d5ec6580..b846a106a3 100644 --- a/xen/arch/riscv/cpufeature.c +++ b/xen/arch/riscv/cpufeature.c @@ -8,6 +8,7 @@ */ =20 #include +#include #include #include #include diff --git a/xen/arch/riscv/smpboot.c b/xen/arch/riscv/smpboot.c index 470f6d1311..3b8bf98e20 100644 --- a/xen/arch/riscv/smpboot.c +++ b/xen/arch/riscv/smpboot.c @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/xen/common/device-tree/device-tree.c b/xen/common/device-tree/= device-tree.c index 7bede20fa6..4ebdb2e52e 100644 --- a/xen/common/device-tree/device-tree.c +++ b/xen/common/device-tree/device-tree.c @@ -8,6 +8,7 @@ */ =20 #include +#include #include #include #include diff --git a/xen/common/device-tree/static-evtchn.c b/xen/common/device-tre= e/static-evtchn.c index 8b82e6b3d8..88342b44a1 100644 --- a/xen/common/device-tree/static-evtchn.c +++ b/xen/common/device-tree/static-evtchn.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ =20 +#include #include #include =20 diff --git a/xen/common/sched/boot-cpupool.c b/xen/common/sched/boot-cpupoo= l.c index 641f3495cb..03be73efdd 100644 --- a/xen/common/sched/boot-cpupool.c +++ b/xen/common/sched/boot-cpupool.c @@ -7,6 +7,7 @@ * Copyright (C) 2022 Arm Ltd. */ =20 +#include #include #include =20 diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h index 65ba818e1a..6cf6c1317c 100644 --- a/xen/include/xen/bootfdt.h +++ b/xen/include/xen/bootfdt.h @@ -2,8 +2,11 @@ #ifndef XEN_BOOTFDT_H #define XEN_BOOTFDT_H =20 +#include +#include #include #include +#include #include #include =20 @@ -16,8 +19,80 @@ #define NR_MEM_BANKS 256 #define NR_SHMEM_BANKS 32 =20 +/* Default #address and #size cells */ +#define DT_ROOT_NODE_ADDR_CELLS_DEFAULT 2 +#define DT_ROOT_NODE_SIZE_CELLS_DEFAULT 1 + #define MAX_MODULES 32 /* Current maximum useful modules */ =20 +#define DEVICE_TREE_MAX_DEPTH 16 + +/* Helper to read a big number; size is in cells (not bytes) */ +static inline u64 dt_read_number(const __be32 *cell, int size) +{ + u64 r =3D 0; + + while ( size-- ) + r =3D (r << 32) | be32_to_cpu(*(cell++)); + return r; +} + +/* Wrapper for dt_read_number() to return paddr_t (instead of uint64_t) */ +static inline paddr_t dt_read_paddr(const __be32 *cell, int size) +{ + uint64_t dt_r; + paddr_t r; + + /* + * dt_read_number will return uint64_t whereas paddr_t may not be 64-b= it. + * Thus, there is an implicit cast from uint64_t to paddr_t. + */ + dt_r =3D dt_read_number(cell, size); + + if ( dt_r !=3D (paddr_t)dt_r ) + { + printk("Physical address greater than max width supported\n"); + WARN(); + } + + /* + * Xen will truncate the address/size if it is greater than the maximum + * supported width and it will give an appropriate warning. + */ + r =3D dt_r; + + return r; +} + +static inline u64 dt_next_cell(int s, const __be32 **cellp) +{ + const __be32 *p =3D *cellp; + + *cellp =3D p + s; + return dt_read_number(p, s); +} + +typedef int (*device_tree_node_func)(const void *fdt, + int node, const char *name, int depth, + u32 address_cells, u32 size_cells, + void *data); + +/** + * device_tree_for_each_node - iterate over all device tree sub-nodes + * @fdt: flat device tree. + * @node: parent node to start the search from + * @func: function to call for each sub-node. + * @data: data to pass to @func. + * + * Any nodes nested at DEVICE_TREE_MAX_DEPTH or deeper are ignored. + * + * Returns 0 if all nodes were iterated over successfully. If @func + * returns a value different from 0, that value is returned immediately. + */ +int device_tree_for_each_node(const void *fdt, int node, + device_tree_node_func func, + void *data); + typedef enum { BOOTMOD_XEN, BOOTMOD_FDT, @@ -261,4 +336,20 @@ static inline struct membanks *membanks_xzalloc(unsign= ed int nr, return banks; } =20 +/* + * Interpret the property `prop_name` of `node` as a u32. + * + * Returns the property value on success; otherwise returns `dflt`. + */ +u32 device_tree_get_u32(const void *fdt, int node, + const char *prop_name, u32 dflt); + +/* + * Interpret the property `prop_name` of `node` as a "reg". + * + * Returns outputs in `start` and `size`. + */ +void device_tree_get_reg(const __be32 **cell, uint32_t address_cells, + uint32_t size_cells, paddr_t *start, paddr_t *siz= e); + #endif /* XEN_BOOTFDT_H */ diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h index a7cc092d05..8a39a60c54 100644 --- a/xen/include/xen/device_tree.h +++ b/xen/include/xen/device_tree.h @@ -22,8 +22,6 @@ #include #include =20 -#define DEVICE_TREE_MAX_DEPTH 16 - /* * Struct used for matching a device */ @@ -164,17 +162,8 @@ struct dt_raw_irq { u32 specifier[DT_MAX_IRQ_SPEC]; }; =20 -typedef int (*device_tree_node_func)(const void *fdt, - int node, const char *name, int depth, - u32 address_cells, u32 size_cells, - void *data); - extern const void *device_tree_flattened; =20 -int device_tree_for_each_node(const void *fdt, int node, - device_tree_node_func func, - void *data); - /** * dt_unflatten_host_device_tree - Unflatten the host device tree * @@ -245,10 +234,6 @@ void intc_dt_preinit(void); #define dt_node_cmp(s1, s2) strcasecmp((s1), (s2)) #define dt_compat_cmp(s1, s2) strcasecmp((s1), (s2)) =20 -/* Default #address and #size cells */ -#define DT_ROOT_NODE_ADDR_CELLS_DEFAULT 2 -#define DT_ROOT_NODE_SIZE_CELLS_DEFAULT 1 - #define dt_for_each_property_node(dn, pp) \ for ( pp =3D (dn)->properties; (pp) !=3D NULL; pp =3D (pp)->next ) =20 @@ -258,55 +243,6 @@ void intc_dt_preinit(void); #define dt_for_each_child_node(dt, dn) \ for ( dn =3D (dt)->child; (dn) !=3D NULL; dn =3D (dn)->sibling ) =20 -/* Helper to read a big number; size is in cells (not bytes) */ -static inline u64 dt_read_number(const __be32 *cell, int size) -{ - u64 r =3D be32_to_cpu(*cell); - - switch ( size ) - { - case 1: - break; - case 2: - r =3D (r << 32) | be32_to_cpu(cell[1]); - break; - default: - /* Nonsensical size. default to 1 */ - printk(XENLOG_ERR "dt_read_number(,%d) bad size\n", size); - ASSERT_UNREACHABLE(); - break; - }; - - return r; -} - -/* Wrapper for dt_read_number() to return paddr_t (instead of uint64_t) */ -static inline paddr_t dt_read_paddr(const __be32 *cell, int size) -{ - uint64_t dt_r; - paddr_t r; - - /* - * dt_read_number will return uint64_t whereas paddr_t may not be 64-b= it. - * Thus, there is an implicit cast from uint64_t to paddr_t. - */ - dt_r =3D dt_read_number(cell, size); - - if ( dt_r !=3D (paddr_t)dt_r ) - { - printk("Physical address greater than max width supported\n"); - WARN(); - } - - /* - * Xen will truncate the address/size if it is greater than the maximum - * supported width and it will give an appropriate warning. - */ - r =3D dt_r; - - return r; -} - /* Helper to convert a number of cells to bytes */ static inline int dt_cells_to_size(int size) { @@ -319,14 +255,6 @@ static inline int dt_size_to_cells(int bytes) return (bytes / sizeof(u32)); } =20 -static inline u64 dt_next_cell(int s, const __be32 **cellp) -{ - const __be32 *p =3D *cellp; - - *cellp =3D p + s; - return dt_read_number(p, s); -} - static inline const char *dt_node_full_name(const struct dt_device_node *n= p) { return (np && np->full_name) ? np->full_name : ""; @@ -984,12 +912,6 @@ int dt_map_id(const struct dt_device_node *np, uint32_= t id, =20 struct dt_device_node *dt_find_node_by_phandle(dt_phandle handle); =20 -void device_tree_get_reg(const __be32 **cell, uint32_t address_cells, - uint32_t size_cells, paddr_t *start, paddr_t *siz= e); - -u32 device_tree_get_u32(const void *fdt, int node, - const char *prop_name, u32 dflt); - #ifdef CONFIG_DEVICE_TREE_DEBUG #define dt_dprintk(fmt, args...) \ printk(XENLOG_DEBUG fmt, ## args) --=20 2.43.0 From nobody Thu Oct 30 23:09:16 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=1751998104; cv=pass; d=zohomail.com; s=zohoarc; b=lWZ1Q8dwhqG3Ha2cn2Dqu0PdPn/MSjPUK+EuHHIvL1ZH/eqVjZoEKXWbAzi5moJp1b3l4KLW1raF8VG4KVk7WKlpBvimBIABTGRb/OSG1n+/KRNRMhZ59PdLQLQu8sX430o75gXgEVM0QTysK9II+v7bx+aE8Ulv5seBR9zh6K4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751998104; 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=+W+f63IbQpmhlxaRGLVgLNdQl9GDcAPN1xFyEdoTN5I=; b=akeobz/pKsTg/JigB72Vg1cafqHOKOGGHPzI1RjdKg+iJbSjVv1xVusYsxNKmG0WPQ1zTNGmZ8mv9DTMaEdWdc8WPH7yVkppoXYnFK5Ge3aRnw/8WLphAjjMfnLaK4p/vVpK82LLLsWa90pUtAPpZtsQuXOsluZBfXQsoJeXVuw= 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 1751998104121531.0903140251388; Tue, 8 Jul 2025 11:08:24 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1037032.1409726 (Exim 4.92) (envelope-from ) id 1uZCje-00073G-BX; Tue, 08 Jul 2025 18:08:06 +0000 Received: by outflank-mailman (output) from mailman id 1037032.1409726; Tue, 08 Jul 2025 18:08:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCje-000730-5E; Tue, 08 Jul 2025 18:08:06 +0000 Received: by outflank-mailman (input) for mailman id 1037032; Tue, 08 Jul 2025 18:08:05 +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 1uZCjd-0006FB-2g for xen-devel@lists.xenproject.org; Tue, 08 Jul 2025 18:08:05 +0000 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on20604.outbound.protection.outlook.com [2a01:111:f403:2416::604]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 7bfcde34-5c26-11f0-a317-13f23c93f187; Tue, 08 Jul 2025 20:08:03 +0200 (CEST) Received: from PH7P222CA0025.NAMP222.PROD.OUTLOOK.COM (2603:10b6:510:33a::19) by LV8PR12MB9451.namprd12.prod.outlook.com (2603:10b6:408:206::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.25; Tue, 8 Jul 2025 18:07:57 +0000 Received: from CY4PEPF0000FCC4.namprd03.prod.outlook.com (2603:10b6:510:33a::4) by PH7P222CA0025.outlook.office365.com (2603:10b6:510:33a::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8922.21 via Frontend Transport; Tue, 8 Jul 2025 18:07:56 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC4.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8901.15 via Frontend Transport; Tue, 8 Jul 2025 18:07:56 +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; Tue, 8 Jul 2025 13:07:53 -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: 7bfcde34-5c26-11f0-a317-13f23c93f187 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=q8hYMMck3rnGgNokGh/d7BEwpDCpGh9BSwp/K1fPt3/R5V0LvPV3UQIPIAPpGvPMDppN/MRjLXrX25+R6JmyIZqPsCq0gj0QSxxx0UCmXwkXy2CIUNRts4ZhUSglGhZZEkNBRQL7uM1op410f/rfs/x7gVtrkVKe3AkwUoGQtdd4R+how2wgG0z8Hgzhx8xKLyeFempBfVyK83zN1pBsq0SFMxKhZf+uGcE8gRlIrPVxs+An9AX8nGXJ5EWqMnNL8UCSxWIQvE+tAOo7LsoEGbMO5W6pnoDAyqwFZtbx/MkYd8yiPPON5BngkOQzS88RSAkZctjLsQXvhnM4tzPrhg== 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=+W+f63IbQpmhlxaRGLVgLNdQl9GDcAPN1xFyEdoTN5I=; b=QoB3R3wQiOMAads0Z6ai5tm0U2R2Ydiuq/5vPfTuKVjyYul+El2aG38mhG1pJGngdWVzSvXPhQhnniOIM/wEiBlH3j/Uw7PCQTDXP9gkHBPGuazloO9EDONptK0BCMbh0lrRxObHSqQqa+/bpB3YBWIPlpY3XOnMuvjRzclkZwB/fnVwQGMJH/tmcDhGTArcqA+w9+oKqvZvoSmx6F8KBulGzl82luoa+p4eDefFqlX3Jj5YszZSFHTiFRDRgtFsA7YWvOKHVZz77IYVvBzxs5jkSac4mrdPIynViDC41tFptnDXGqS46l1c4QzXPGsjsEiHcpST0wB7B5mhMW+kvA== 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=+W+f63IbQpmhlxaRGLVgLNdQl9GDcAPN1xFyEdoTN5I=; b=vo9vGfj/PYyqOsZgj8fL0CSNFZpXBrtf47pByWF2ABpXeXj64ZJaZIDIlRbQ2r089gkTVqw6FjTAlY3D+FNbKna7K2W5xfWIh12HmHXn5et4hLx20ky5d5z7rbdyM5EZ93/g2QqtpYP+hxBgBaYuKewuSSTNNTAtOv89kc4aCWg= 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 v6 06/11] xen/dt: Move bootinfo functions to a new bootinfo.h Date: Tue, 8 Jul 2025 20:07:15 +0200 Message-ID: <20250708180721.2338036-7-alejandro.garciavallejo@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250708180721.2338036-1-alejandro.garciavallejo@amd.com> References: <20250708180721.2338036-1-alejandro.garciavallejo@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: CY4PEPF0000FCC4:EE_|LV8PR12MB9451:EE_ X-MS-Office365-Filtering-Correlation-Id: 34b0884b-d86e-4084-3daf-08ddbe4a5dc8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?JN2eq88fynQVAG6D1wBlxW90mEldHEywHDaE+SMKjVZwN7OsqmZAYu8I5Ilb?= =?us-ascii?Q?os0TgPor5mJ4xTwseXvF9tuqq8FxkV1+09sj+SXEhwHeilEJoEIADPsPOOA3?= =?us-ascii?Q?a1EUzAyCKb76cL+ELJUZiMu713kyV89u6naiHayPJaeauG01KGPmSQwyZocG?= =?us-ascii?Q?Zl2MLfhOB9hOGi8NX1DjNpk9MsVVfAxWBrAfzEqoPz8c/Jh84GTJCYGzW7jv?= =?us-ascii?Q?FJHNedFb3I8cRm5++1IsIor3Pc+YEYtJuitgr+fm+VCyGFY2Cxt192d35qdG?= =?us-ascii?Q?MFcrK8AjWUptmtRYtq1OUwnn52BczWTbXItHlndkDhq81c09tiaxWpMrY5xf?= =?us-ascii?Q?yHTCPnQCi4CSOjP4NbnE0Uwr9GYQ1/M5cyq95Y0f1vuwgLiNq3BfyvQG/ku3?= =?us-ascii?Q?Wc7jusZ6B86PHht9pFemSDR0bKEzLZK0XuDP0PXs1GBfZBT7PkcDdDdinmIl?= =?us-ascii?Q?idN66iIJW61aJRwILyv9SHRkLtktKB7s0y6fhfyfzNHrj5sLWvxrdN0sxUW5?= =?us-ascii?Q?Uao8apVj+4QKc7XS1CQfy1UNGBjDagDo/bA33uvH4uCryVEZSTdVWpQTlVGq?= =?us-ascii?Q?AdfaHuArCnvUHfAxEiiJsvCgfvEo5Ii1sZF3X0ZhPmO6IgsPQvxY4XLvaIbu?= =?us-ascii?Q?MgOfXoGl/x+RXVdpR95MyotojjGKyzAL9FN7EQE/7w5/rZuaoDvrQ3GYd7ja?= =?us-ascii?Q?eYXRBogOIMRM1SijCH/BWpa1Kx70w4YqUK4i6ZW2WNE0iYovV4r57MB5+IoN?= =?us-ascii?Q?LgmS58a4aOdgKEXl1SGvtVs5pmBqdqc1vAqwDYt4Xm4r//Tjc4N0CPYPALQ+?= =?us-ascii?Q?LCZy1D1Jkn0EVvyfoLnjQPP2YgIgk8q4oG1Lec4J4gQypdfeHqvva+SUkHgJ?= =?us-ascii?Q?5gXDgl/s7BwMvFpXerGzMtxr+d3XLafmlfl59qJw4ChKUAayWB61gO4488vS?= =?us-ascii?Q?TF/MJZJL/NYJd5KD4/7iI+JTyDJX5oI4mEB2gOd/UbZORkW1Glxviw1Z4T3o?= =?us-ascii?Q?iIOMvhA7gbm0jYQ0BrFpjsfWwu8Kll8Ws3RQ/sd9t/1Qr2Vb+DtMUu2/yN/i?= =?us-ascii?Q?rvALzQFdghs1pR3XcUzFm7yiW2/Wl6oDiyBT4uABglXmb+hscqKqseC4ztnX?= =?us-ascii?Q?81b3pYfTwWzJoHVEl89F9aitZ5opsBjdY1sXofXIWBa0p54khKTlfjKNOqaz?= =?us-ascii?Q?17/e7h8Ero7qKNInD4f27F6qnx2FimzCm70hBDjF+mIY1KNgUNZQrAdMEqq9?= =?us-ascii?Q?8dItsK3aHJgfcbnDGJ8X1WWfn/Aep819TEbXKIlx4f1HiJBmWTk4JO7aqq1j?= =?us-ascii?Q?adwhEtkNE9moBLPB0/w79rPdJzVJ5U8iR5zP4EZ7syQyi48k9P+m6AFI2NGq?= =?us-ascii?Q?YFBBQXDoKesh64id4gCswbhR8C5iLcyt/QyfP2KM5Kg/1vSY+NPO9o+78R12?= =?us-ascii?Q?MXi6jUPPVlAP4WvvPTU5KflgTNP82EIq9KSYahGyJoBud7iZ5tMkVlccoQoT?= =?us-ascii?Q?ywjYSH8SXLu1G2spemt2yvhCXjVCNoPoZuYP?= 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)(82310400026)(36860700013)(1800799024)(7416014)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2025 18:07:56.5864 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 34b0884b-d86e-4084-3daf-08ddbe4a5dc8 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: CY4PEPF0000FCC4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9451 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1751998105406116600 Content-Type: text/plain; charset="utf-8" From: Alejandro Vallejo 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 --- xen/arch/arm/domain_build.c | 1 + xen/arch/arm/include/asm/setup.h | 2 +- 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 | 207 ----------------------- xen/include/xen/bootinfo.h | 213 ++++++++++++++++++++++++ xen/include/xen/fdt-domain-build.h | 2 +- xen/include/xen/fdt-kernel.h | 2 +- 14 files changed, 225 insertions(+), 217 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 edc9a82c15..b66a172eb8 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/include/asm/setup.h b/xen/arch/arm/include/asm/se= tup.h index b199d92a42..1eaf13bd66 100644 --- a/xen/arch/arm/include/asm/setup.h +++ b/xen/arch/arm/include/asm/setup.h @@ -3,7 +3,7 @@ =20 #include #include -#include +#include #include =20 #if defined(CONFIG_MMU) diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 12b76a0a98..8abc1d641d 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 774ea42f2d..1ef015f179 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 e950691d1e..93734e0ea8 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 cc14bea195..2efc1f57aa 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 6de2334dbe..ef393182b6 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 6cf6c1317c..b886f18027 100644 --- a/xen/include/xen/bootfdt.h +++ b/xen/include/xen/bootfdt.h @@ -5,10 +5,7 @@ #include #include #include -#include #include -#include -#include =20 #if __has_include() #include @@ -16,15 +13,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) */ @@ -104,77 +96,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 @@ -208,134 +129,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/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 8363865282..33a60597bb 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 From nobody Thu Oct 30 23:09:16 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=1751998108; cv=pass; d=zohomail.com; s=zohoarc; b=a2pg0N6TKls1e1Fw/Yr+UmUIGlrEIeJkJSqzBS9Q7qT87J4ts6JwbIf2WMdIgcSpOABIUGZG8b2tbvHgXzAA+6PtZBeQklAJvYqIMXZDWbsc/k3afufPgbqDHSscCh3fihdwuNQekXNu1gXb7k5FNSnTN+WacXoHto4MrCA+G74= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751998108; 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=zZ1dNlPeQXMeWWw5Ikp+OY0masjOojVYp1eeKIwZvBE=; b=YsBHeqL/KQG46JiRf+6LYrde11VbY/Qzo7/4Wth8gIaGdCj3FmkWa/DZ6Y0RTbXsQZYIQCykBGmokA+92XTneZbI/y/9f6ycOI4Xs7UOxqrrQ9yOEMhS/hcSI7369bixJHwnZGByH98cp41pf+KcoND0f9e9KJ3soF3BID6nFFQ= 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 1751998108447923.0455519741311; Tue, 8 Jul 2025 11:08:28 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1037033.1409735 (Exim 4.92) (envelope-from ) id 1uZCjf-0007Mu-Pq; Tue, 08 Jul 2025 18:08:07 +0000 Received: by outflank-mailman (output) from mailman id 1037033.1409735; Tue, 08 Jul 2025 18:08:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjf-0007Mi-Ld; Tue, 08 Jul 2025 18:08:07 +0000 Received: by outflank-mailman (input) for mailman id 1037033; Tue, 08 Jul 2025 18:08:05 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjd-0005Uq-Gq for xen-devel@lists.xenproject.org; Tue, 08 Jul 2025 18:08:05 +0000 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2062e.outbound.protection.outlook.com [2a01:111:f403:2409::62e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 7ccb23c4-5c26-11f0-b894-0df219b8e170; Tue, 08 Jul 2025 20:08:03 +0200 (CEST) Received: from BYAPR06CA0021.namprd06.prod.outlook.com (2603:10b6:a03:d4::34) by SA1PR12MB8096.namprd12.prod.outlook.com (2603:10b6:806:326::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.24; Tue, 8 Jul 2025 18:07:59 +0000 Received: from CY4PEPF0000FCC2.namprd03.prod.outlook.com (2603:10b6:a03:d4:cafe::e6) by BYAPR06CA0021.outlook.office365.com (2603:10b6:a03:d4::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8922.21 via Frontend Transport; Tue, 8 Jul 2025 18:07:58 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC2.mail.protection.outlook.com (10.167.242.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8901.15 via Frontend Transport; Tue, 8 Jul 2025 18:07:58 +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; Tue, 8 Jul 2025 13:07:56 -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: 7ccb23c4-5c26-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nWT83pnUma0oEvHTRiHQt8/7z6nCIIKB8AW9xkXza4pGUOCgg0A8jhdnRiGn6LdcCJI+U4Pvl6d/3708U8Pc2b2qCbMrBr0tJEZ5ivUyA9AiTcoa13eJHGU9I6Ay5bIj+KW7PIhrcRwvOJZ69Rne92GR+5eHhP9K9rMyi0IYcY1vihtvK5Gx35VpNnV+pgs2SWgvFd26+seDWMbGwrSSNXfjZYvPBuJ/P1qa9x9eZBTyV9nUjRj3YS85V8yzBwbtRpPy94zAhY3WVY7WyRsLQTFcm51NDwweJCz3PwQYFc4kzBuqgmNMlorUOm+tnOEaTXsQOZW0ZSL3PoCOnuGUUA== 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=zZ1dNlPeQXMeWWw5Ikp+OY0masjOojVYp1eeKIwZvBE=; b=KSsueA4s1dl1OugPvFpdFm0o3gdZEEKdaRcGCUtVjXWjWW0NZRLa5A70VavtkKUWgFfFvnrig6XNQwz7YrTkeQ6oqD1/PNSUzFx1v6dlfDUt0A7tAk27OYH7icl7a+n4HYEsMrF/NErqQKBhEmeeuqAOEloQATWMps2IXAFx7ZGlScFxE27l/PNJb2VZVG9hCU1/OC00CaVXvMwyzDzYo35aJ8f+6Xvt2gQ8rA2RvF7cEjBgGQKRsDp3fleUgfs1xZRWBDYf7IzR0loUm9KAwmshor77QUmeX36+9m9MBtMWc/gVla8dLXW4EPVfNOGg/JHJX+V9tHhYzZkNRfqrPA== 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=zZ1dNlPeQXMeWWw5Ikp+OY0masjOojVYp1eeKIwZvBE=; b=YowKJ46Bjog0ELEby9IcFoehw5Hr0oLFustChuPWT5CtK7iBXI2F3EEgulJyHAJqzQKU5G/BNrwwSC2bY24JwsWsecblTfq7Gr/YobRrMRsMpDUZarJwMEEPCO4MCUfiQNsp/Nh2xPut/GsDcq9ZZFRb8A8qgQaoYhgw8nteONE= 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 , "Daniel P. Smith" Subject: [PATCH v6 07/11] xen/dt: Rename bootfdt.c -> bootinfo-fdt.c Date: Tue, 8 Jul 2025 20:07:16 +0200 Message-ID: <20250708180721.2338036-8-alejandro.garciavallejo@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250708180721.2338036-1-alejandro.garciavallejo@amd.com> References: <20250708180721.2338036-1-alejandro.garciavallejo@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: CY4PEPF0000FCC2:EE_|SA1PR12MB8096:EE_ X-MS-Office365-Filtering-Correlation-Id: e73e57c1-b068-42a4-56d7-08ddbe4a5f1d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?I4wgPaZ/bWTmLO2a6IbsdF6U2PnyW7r9BiMYoae7e5LSyjw/fiHBO9m/Da+x?= =?us-ascii?Q?qaBqsF1ZwK0Yak/LNI3qxpNNBi5xHw9Sz8UBaHv/KaIxl54p6CvT4k7DHEqm?= =?us-ascii?Q?N/YO1m8lrus4Zj0G7kFOsa1OcyJd/o6TCVzcJ/AZpkPQL7d8IGlqaOWt2gQ6?= =?us-ascii?Q?dK2sftuBZvgljGVj8JaGOebPXp8LYf7SVy9XGfOzC4tCv3jjDgMYiaB5sBLV?= =?us-ascii?Q?wWnkDWQCqBhmfiwwRLNi7fVK+Za1B55xAodIaFwgrf8cHxuQcp4q+qPddxpy?= =?us-ascii?Q?e4lgyMiLp9gEcejztc7arjurDEX6ERC5TRSTZyUv27+X3vRIS0ah83phwTaQ?= =?us-ascii?Q?o2sgo29Qu/SwKotD0+avflr5y4/lyAZuBZ2ZWacFxzcsWRAgbFkzJ46RCplc?= =?us-ascii?Q?PoMzfZa2VG0MLMw2VPjRuIg0NQGGRKdjA/1CpvRhvc/k2x6sQDATqePB4xF5?= =?us-ascii?Q?r+shZj78hQ64ssHj+B/Hps4hc4f2k/Vw62NGI4eYd2t77l5nUPpR9VJpXsXK?= =?us-ascii?Q?IKptxph7qTrpDU+gLNoPPLJg1RiLlEPvFZCwoQYcgSZ5HDQifIsrj/7ETPrA?= =?us-ascii?Q?/BKtMV6lgvFD5uCR9n13xJx6OQXkGYF1vM2yYHGfudp/dmD8wINV/6+bYe3R?= =?us-ascii?Q?VUkUOLkUPHosn7Hj5+/GCOIkBFOEsDOZZNdaxteSwxI0SV8OHNMclUwMiznU?= =?us-ascii?Q?bmxzSbgqw49pgBt0uEpd5mkpFWxAcikAko57iHwfbx0njDchTLdcbraP8ii6?= =?us-ascii?Q?ygUchBzPv3ZOSK+rfR6k11DdAowGTAIQZx4MjUk1H6YRHtZpth7TPPtmPSqo?= =?us-ascii?Q?lX63TghKEe2hlsIFgLfg4Z5pDsgwdzP1zvUHydJNat1XLdyzgyvlV3p2+bAa?= =?us-ascii?Q?Fvt9FkrTO0HfQphgssP7vO9RF0ONEAy9h53s2D7nQag+JM2I8Gje85imxbvK?= =?us-ascii?Q?BpO7jAy9phMNN9dwfcxkS4E0vF19QbmKirRUR8786Q6+WNp57LQOCvUa+3gI?= =?us-ascii?Q?5r8xkA/yMB80ZOgJobykntmUTitGCp3zZNHWyNMujHrjvFEuTkCu3hhNGmlW?= =?us-ascii?Q?kHjMhyuqpntABKR79Dhg17jKlURTM/pMIx+lSjfHvS64qqjbK1QSRLNiBGjq?= =?us-ascii?Q?EbmCgHvRbqHZ8CSKTJplNWEAX05Zzj4fIMP07kgr1EIhP45K6hOOSuZ6eb7J?= =?us-ascii?Q?PQAgveHuqq1sSu+HRYl0MKjjsLjLPTyQm4PnmWukMJ1cLsiprQfi23FEfhYu?= =?us-ascii?Q?TPNnPwnKP94StAz1SXU5AvEhqwgj7cz6Hk9OC95o6C9Aqq0IiunLZ6y6/i+V?= =?us-ascii?Q?2TbwO6Viz/XOmhmFY1FRAFDl7K7MFflBVjOSleNBpb7sfIxGLX1YDTCwW7CZ?= =?us-ascii?Q?JZQ8MSGX+svPJXkVrmmDKZJQirX0C1sI3aoE49FpGuRmIiNmOue0pQgjapSH?= =?us-ascii?Q?S5GLMUD8znpWdthfSNmCSM4HdZOu65+c69M2xP/lcg+vf35tVgQrvHwqhljV?= =?us-ascii?Q?aV5ifm1KwzLJV/lfHtNb4FJ0o33PJmZRZTUt?= 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)(376014)(36860700013)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2025 18:07:58.8220 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e73e57c1-b068-42a4-56d7-08ddbe4a5f1d 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: CY4PEPF0000FCC2.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8096 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1751998109284116600 Content-Type: text/plain; charset="utf-8" From: Alejandro Vallejo This file will eventually contain bootfdt helpers that make heavy use of bootinfo. To simplify git history do the rename here explicitly. A later patch extracts bootinfo-independent helpers into bootfdt.c. Doing so here would needlessly pollute the diffs. Not a functional change. Signed-off-by: Alejandro Vallejo Reviewed-by: Stefano Stabellini --- xen/common/device-tree/Makefile | 1 + xen/common/device-tree/bootfdt.c | 646 +------------------------- xen/common/device-tree/bootinfo-fdt.c | 597 ++++++++++++++++++++++++ 3 files changed, 619 insertions(+), 625 deletions(-) create mode 100644 xen/common/device-tree/bootinfo-fdt.c diff --git a/xen/common/device-tree/Makefile b/xen/common/device-tree/Makef= ile index 13127296cb..8abc069c4b 100644 --- a/xen/common/device-tree/Makefile +++ b/xen/common/device-tree/Makefile @@ -1,4 +1,5 @@ obj-y +=3D bootfdt.init.o +obj-y +=3D bootinfo-fdt.init.o obj-y +=3D bootinfo.init.o obj-y +=3D device-tree.o obj-$(CONFIG_DOMAIN_BUILD_HELPERS) +=3D domain-build.init.o diff --git a/xen/common/device-tree/bootfdt.c b/xen/common/device-tree/boot= fdt.c index 1848478e82..0d8d9ea357 100644 --- a/xen/common/device-tree/bootfdt.c +++ b/xen/common/device-tree/bootfdt.c @@ -1,206 +1,8 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -/* - * Early Device Tree - * - * Copyright (C) 2012-2014 Citrix Systems, Inc. - */ - -#include -#include -#include -#include -#include +#include +#include #include -#include -#include -#include -#include -#include - -static void __init __maybe_unused build_assertions(void) -{ - /* - * Check that no padding is between struct membanks "bank" flexible ar= ray - * member and struct meminfo "bank" member - */ - BUILD_BUG_ON((offsetof(struct membanks, bank) !=3D - offsetof(struct meminfo, bank))); - /* Ensure "struct membanks" and "struct membank" are equally aligned */ - BUILD_BUG_ON(alignof(struct membanks) !=3D alignof(struct membank)); -} - -static bool __init device_tree_node_is_available(const void *fdt, int node) -{ - const char *status; - int len; - - status =3D fdt_getprop(fdt, node, "status", &len); - if ( !status ) - return true; - - if ( len > 0 ) - { - if ( !strcmp(status, "ok") || !strcmp(status, "okay") ) - return true; - } - - return false; -} - -static bool __init device_tree_node_matches(const void *fdt, int node, - const char *match) -{ - const char *name; - size_t match_len; - - name =3D fdt_get_name(fdt, node, NULL); - match_len =3D strlen(match); - - /* Match both "match" and "match@..." patterns but not - "match-foo". */ - return strncmp(name, match, match_len) =3D=3D 0 - && (name[match_len] =3D=3D '@' || name[match_len] =3D=3D '\0'); -} - -static bool __init device_tree_node_compatible(const void *fdt, int node, - const char *match) -{ - int len, l; - const void *prop; - - prop =3D fdt_getprop(fdt, node, "compatible", &len); - if ( prop =3D=3D NULL ) - return false; - - while ( len > 0 ) { - if ( !dt_compat_cmp(prop, match) ) - return true; - l =3D strlen(prop) + 1; - prop +=3D l; - len -=3D l; - } - - return false; -} - -/* - * Check if a node is a proper /memory node according to Devicetree - * Specification v0.4, chapter 3.4. - */ -static bool __init device_tree_is_memory_node(const void *fdt, int node, - int depth) -{ - const char *type; - int len; - - if ( depth !=3D 1 ) - return false; - - if ( !device_tree_node_matches(fdt, node, "memory") ) - return false; - - type =3D fdt_getprop(fdt, node, "device_type", &len); - if ( !type ) - return false; - - if ( (len <=3D strlen("memory")) || strcmp(type, "memory") ) - return false; - - return true; -} - -void __init device_tree_get_reg(const __be32 **cell, uint32_t address_cell= s, - uint32_t size_cells, paddr_t *start, - paddr_t *size) -{ - uint64_t dt_start, dt_size; - - /* - * dt_next_cell will return uint64_t whereas paddr_t may not be 64-bit. - * Thus, there is an implicit cast from uint64_t to paddr_t. - */ - dt_start =3D dt_next_cell(address_cells, cell); - dt_size =3D dt_next_cell(size_cells, cell); - - if ( dt_start !=3D (paddr_t)dt_start ) - { - printk("Physical address greater than max width supported\n"); - WARN(); - } - - if ( dt_size !=3D (paddr_t)dt_size ) - { - printk("Physical size greater than max width supported\n"); - WARN(); - } - - /* - * Xen will truncate the address/size if it is greater than the maximum - * supported width and it will give an appropriate warning. - */ - *start =3D dt_start; - *size =3D dt_size; -} - -static int __init device_tree_get_meminfo(const void *fdt, int node, - const char *prop_name, - u32 address_cells, u32 size_cell= s, - struct membanks *mem, - enum membank_type type) -{ - const struct fdt_property *prop; - unsigned int i, banks; - const __be32 *cell; - u32 reg_cells =3D address_cells + size_cells; - paddr_t start, size; - - if ( !device_tree_node_is_available(fdt, node) ) - return 0; - - if ( address_cells < 1 || size_cells < 1 ) - { - printk("fdt: property `%s': invalid #address-cells or #size-cells", - prop_name); - return -EINVAL; - } - - prop =3D fdt_get_property(fdt, node, prop_name, NULL); - if ( !prop ) - return -ENOENT; - - cell =3D (const __be32 *)prop->data; - banks =3D fdt32_to_cpu(prop->len) / (reg_cells * sizeof (u32)); - - for ( i =3D 0; i < banks && mem->nr_banks < mem->max_banks; i++ ) - { - device_tree_get_reg(&cell, address_cells, size_cells, &start, &siz= e); - /* - * Some valid device trees, such as those generated by OpenPOWER - * skiboot firmware, expose all reserved memory regions in the - * FDT memory reservation block AND in the reserved-memory node wh= ich - * has already been parsed. Thus, any matching overlaps in the - * reserved_mem banks should be ignored. - */ - if ( mem =3D=3D bootinfo_get_reserved_mem() && - check_reserved_regions_overlap(start, size, true) ) - return -EINVAL; - /* Some DT may describe empty bank, ignore them */ - if ( !size ) - continue; - mem->bank[mem->nr_banks].start =3D start; - mem->bank[mem->nr_banks].size =3D size; - mem->bank[mem->nr_banks].type =3D type; - mem->nr_banks++; - } - - if ( i < banks ) - { - printk("Warning: Max number of supported memory regions reached.\n= "); - return -ENOSPC; - } - - return 0; -} +#include =20 u32 __init device_tree_get_u32(const void *fdt, int node, const char *prop_name, u32 dflt) @@ -214,18 +16,6 @@ u32 __init device_tree_get_u32(const void *fdt, int nod= e, return fdt32_to_cpu(*(uint32_t*)prop->data); } =20 -/** - * device_tree_for_each_node - iterate over all device tree sub-nodes - * @fdt: flat device tree. - * @node: parent node to start the search from - * @func: function to call for each sub-node. - * @data: data to pass to @func. - * - * Any nodes nested at DEVICE_TREE_MAX_DEPTH or deeper are ignored. - * - * Returns 0 if all nodes were iterated over successfully. If @func - * returns a value different from 0, that value is returned immediately. - */ int __init device_tree_for_each_node(const void *fdt, int node, device_tree_node_func func, void *data) @@ -273,429 +63,35 @@ int __init device_tree_for_each_node(const void *fdt,= int node, return 0; } =20 -static int __init process_memory_node(const void *fdt, int node, - const char *name, int depth, - u32 address_cells, u32 size_cells, - struct membanks *mem) -{ - return device_tree_get_meminfo(fdt, node, "reg", address_cells, size_c= ells, - mem, MEMBANK_DEFAULT); -} - -static int __init process_reserved_memory_node(const void *fdt, int node, - const char *name, int depth, - u32 address_cells, - u32 size_cells, - void *data) -{ - int rc =3D process_memory_node(fdt, node, name, depth, address_cells, - size_cells, data); - - if ( rc =3D=3D -ENOSPC ) - panic("Max number of supported reserved-memory regions reached.\n"= ); - else if ( rc !=3D -ENOENT ) - return rc; - return 0; -} - -static int __init process_reserved_memory(const void *fdt, int node, - const char *name, int depth, - u32 address_cells, u32 size_cell= s) -{ - return device_tree_for_each_node(fdt, node, - process_reserved_memory_node, - bootinfo_get_reserved_mem()); -} - -static void __init process_multiboot_node(const void *fdt, int node, - const char *name, - u32 address_cells, u32 size_cell= s) -{ - static int __initdata kind_guess =3D 0; - const struct fdt_property *prop; - const __be32 *cell; - boot_module_kind kind; - paddr_t start, size; - int len; - /* sizeof("/chosen/") + DT_MAX_NAME + '/' + DT_MAX_NAME + '/0' =3D> 92= */ - char path[92]; - int parent_node, ret; - bool domU; - - parent_node =3D fdt_parent_offset(fdt, node); - ASSERT(parent_node >=3D 0); - - /* Check that the node is under "/chosen" (first 7 chars of path) */ - ret =3D fdt_get_path(fdt, node, path, sizeof (path)); - if ( ret !=3D 0 || strncmp(path, "/chosen", 7) ) - return; - - prop =3D fdt_get_property(fdt, node, "reg", &len); - if ( !prop ) - panic("node %s missing `reg' property\n", name); - - if ( len < dt_cells_to_size(address_cells + size_cells) ) - panic("fdt: node `%s': `reg` property length is too short\n", - name); - - cell =3D (const __be32 *)prop->data; - device_tree_get_reg(&cell, address_cells, size_cells, &start, &size); - - if ( fdt_node_check_compatible(fdt, node, "xen,linux-zimage") =3D=3D 0= || - fdt_node_check_compatible(fdt, node, "multiboot,kernel") =3D=3D 0= ) - kind =3D BOOTMOD_KERNEL; - else if ( fdt_node_check_compatible(fdt, node, "xen,linux-initrd") =3D= =3D 0 || - fdt_node_check_compatible(fdt, node, "multiboot,ramdisk") = =3D=3D 0 ) - kind =3D BOOTMOD_RAMDISK; - else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") =3D= =3D 0 ) - kind =3D BOOTMOD_XSM; - else if ( fdt_node_check_compatible(fdt, node, "multiboot,device-tree"= ) =3D=3D 0 ) - kind =3D BOOTMOD_GUEST_DTB; - else if ( fdt_node_check_compatible(fdt, node, "multiboot,microcode") = =3D=3D 0 ) - kind =3D BOOTMOD_MICROCODE; - else - kind =3D BOOTMOD_UNKNOWN; - - /** - * Guess the kind of these first two unknowns respectively: - * (1) The first unknown must be kernel. - * (2) Detect the XSM Magic from the 2nd unknown: - * a. If it's XSM, set the kind as XSM, and that also means we - * won't load ramdisk; - * b. if it's not XSM, set the kind as ramdisk. - * So if user want to load ramdisk, it must be the 2nd unknown. - * We also detect the XSM Magic for the following unknowns, - * then set its kind according to the return value of has_xsm_magic. - */ - if ( kind =3D=3D BOOTMOD_UNKNOWN ) - { - switch ( kind_guess++ ) - { - case 0: kind =3D BOOTMOD_KERNEL; break; - case 1: kind =3D BOOTMOD_RAMDISK; break; - default: break; - } - if ( kind_guess > 1 && has_xsm_magic(start) ) - kind =3D BOOTMOD_XSM; - } - - domU =3D fdt_node_check_compatible(fdt, parent_node, "xen,domain") =3D= =3D 0; - add_boot_module(kind, start, size, domU); - - prop =3D fdt_get_property(fdt, node, "bootargs", &len); - if ( !prop ) - return; - add_boot_cmdline(fdt_get_name(fdt, parent_node, &len), prop->data, - kind, start, domU); -} - -static int __init process_chosen_node(const void *fdt, int node, - const char *name, - u32 address_cells, u32 size_cells) -{ - const struct fdt_property *prop; - paddr_t start, end; - int len; - - if ( fdt_get_property(fdt, node, "xen,static-heap", NULL) ) - { - int rc; - - printk("Checking for static heap in /chosen\n"); - - rc =3D device_tree_get_meminfo(fdt, node, "xen,static-heap", - address_cells, size_cells, - bootinfo_get_reserved_mem(), - MEMBANK_STATIC_HEAP); - if ( rc ) - return rc; - - using_static_heap =3D true; - } - - printk("Checking for initrd in /chosen\n"); - - prop =3D fdt_get_property(fdt, node, "linux,initrd-start", &len); - if ( !prop ) - /* No initrd present. */ - return 0; - if ( len !=3D sizeof(u32) && len !=3D sizeof(u64) ) - { - printk("linux,initrd-start property has invalid length %d\n", len); - return -EINVAL; - } - start =3D dt_read_paddr((const void *)&prop->data, dt_size_to_cells(le= n)); - - prop =3D fdt_get_property(fdt, node, "linux,initrd-end", &len); - if ( !prop ) - { - printk("linux,initrd-end not present but -start was\n"); - return -EINVAL; - } - if ( len !=3D sizeof(u32) && len !=3D sizeof(u64) ) - { - printk("linux,initrd-end property has invalid length %d\n", len); - return -EINVAL; - } - end =3D dt_read_paddr((const void *)&prop->data, dt_size_to_cells(len)= ); - - if ( start >=3D end ) - { - printk("linux,initrd limits invalid: %"PRIpaddr" >=3D %"PRIpaddr"\= n", - start, end); - return -EINVAL; - } - - printk("Initrd %"PRIpaddr"-%"PRIpaddr"\n", start, end - 1); - - add_boot_module(BOOTMOD_RAMDISK, start, end-start, false); - - return 0; -} - -static int __init process_domain_node(const void *fdt, int node, - const char *name, - u32 address_cells, u32 size_cells) -{ - const struct fdt_property *prop; - - printk("Checking for \"xen,static-mem\" in domain node\n"); - - prop =3D fdt_get_property(fdt, node, "xen,static-mem", NULL); - if ( !prop ) - /* No "xen,static-mem" present. */ - return 0; - - return device_tree_get_meminfo(fdt, node, "xen,static-mem", address_ce= lls, - size_cells, bootinfo_get_reserved_mem(), - MEMBANK_STATIC_DOMAIN); -} - -#ifndef CONFIG_STATIC_SHM -static inline int process_shm_node(const void *fdt, int node, - uint32_t address_cells, uint32_t size_c= ells) -{ - printk("CONFIG_STATIC_SHM must be enabled for parsing static shared" - " memory nodes\n"); - return -EINVAL; -} -#endif - -static int __init early_scan_node(const void *fdt, - int node, const char *name, int depth, - u32 address_cells, u32 size_cells, - void *data) +void __init device_tree_get_reg(const __be32 **cell, uint32_t address_cell= s, + uint32_t size_cells, paddr_t *start, + paddr_t *size) { - int rc =3D 0; + uint64_t dt_start, dt_size; =20 /* - * If Xen has been booted via UEFI, the memory banks are - * populated. So we should skip the parsing. + * dt_next_cell will return uint64_t whereas paddr_t may not be 64-bit. + * Thus, there is an implicit cast from uint64_t to paddr_t. */ - if ( !efi_enabled(EFI_BOOT) && - device_tree_is_memory_node(fdt, node, depth) ) - rc =3D process_memory_node(fdt, node, name, depth, - address_cells, size_cells, bootinfo_get_m= em()); - else if ( depth =3D=3D 1 && !dt_node_cmp(name, "reserved-memory") ) - rc =3D process_reserved_memory(fdt, node, name, depth, - address_cells, size_cells); - else if ( depth <=3D 3 && (device_tree_node_compatible(fdt, node, "xen= ,multiboot-module" ) || - device_tree_node_compatible(fdt, node, "multiboot,module" ))) - process_multiboot_node(fdt, node, name, address_cells, size_cells); - else if ( depth =3D=3D 1 && device_tree_node_matches(fdt, node, "chose= n") ) - rc =3D process_chosen_node(fdt, node, name, address_cells, size_ce= lls); - else if ( depth =3D=3D 2 && device_tree_node_compatible(fdt, node, "xe= n,domain") ) - rc =3D process_domain_node(fdt, node, name, address_cells, size_ce= lls); - else if ( depth <=3D 3 && device_tree_node_compatible(fdt, node, "xen,= domain-shared-memory-v1") ) - rc =3D process_shm_node(fdt, node, address_cells, size_cells); - - if ( rc < 0 ) - printk("fdt: node `%s': parsing failed\n", name); - return rc; -} - -static void __init early_print_info(void) -{ - const struct membanks *mi =3D bootinfo_get_mem(); - const struct membanks *mem_resv =3D bootinfo_get_reserved_mem(); - struct boot_modules *mods =3D &bootinfo.modules; - struct bootcmdlines *cmds =3D &bootinfo.cmdlines; - unsigned int i; - - for ( i =3D 0; i < mi->nr_banks; i++ ) - printk("RAM: %"PRIpaddr" - %"PRIpaddr"\n", - mi->bank[i].start, - mi->bank[i].start + mi->bank[i].size - 1); - printk("\n"); - for ( i =3D 0 ; i < mods->nr_mods; i++ ) - printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %-12s\n", - i, - mods->module[i].start, - mods->module[i].start + mods->module[i].size - 1, - boot_module_kind_as_string(mods->module[i].kind)); - - for ( i =3D 0; i < mem_resv->nr_banks; i++ ) - { - printk(" RESVD[%u]: %"PRIpaddr" - %"PRIpaddr"\n", i, - mem_resv->bank[i].start, - mem_resv->bank[i].start + mem_resv->bank[i].size - 1); - } -#ifdef CONFIG_STATIC_SHM - early_print_info_shmem(); -#endif - printk("\n"); - for ( i =3D 0 ; i < cmds->nr_mods; i++ ) - printk("CMDLINE[%"PRIpaddr"]:%s %s\n", cmds->cmdline[i].start, - cmds->cmdline[i].dt_name, - &cmds->cmdline[i].cmdline[0]); - printk("\n"); -} - -/* This function assumes that memory regions are not overlapped */ -static int __init cmp_memory_node(const void *key, const void *elem) -{ - const struct membank *handler0 =3D key; - const struct membank *handler1 =3D elem; - - if ( handler0->start < handler1->start ) - return -1; - - if ( handler0->start >=3D (handler1->start + handler1->size) ) - return 1; - - return 0; -} - -static void __init swap_memory_node(void *_a, void *_b, size_t size) -{ - struct membank *a =3D _a, *b =3D _b; - - SWAP(*a, *b); -} - -/** - * boot_fdt_info - initialize bootinfo from a DTB - * @fdt: flattened device tree binary - * - * Returns the size of the DTB. - */ -size_t __init boot_fdt_info(const void *fdt, paddr_t paddr) -{ - struct membanks *reserved_mem =3D bootinfo_get_reserved_mem(); - struct membanks *mem =3D bootinfo_get_mem(); - unsigned int i; - int nr_rsvd; - int ret; - - ret =3D fdt_check_header(fdt); - if ( ret < 0 ) - panic("No valid device tree\n"); - - add_boot_module(BOOTMOD_FDT, paddr, fdt_totalsize(fdt), false); - - nr_rsvd =3D fdt_num_mem_rsv(fdt); - if ( nr_rsvd < 0 ) - panic("Parsing FDT memory reserve map failed (%d)\n", nr_rsvd); + dt_start =3D dt_next_cell(address_cells, cell); + dt_size =3D dt_next_cell(size_cells, cell); =20 - for ( i =3D 0; i < nr_rsvd; i++ ) + if ( dt_start !=3D (paddr_t)dt_start ) { - struct membank *bank; - paddr_t s, sz; - - if ( fdt_get_mem_rsv_paddr(device_tree_flattened, i, &s, &sz) < 0 ) - continue; - - if ( reserved_mem->nr_banks < reserved_mem->max_banks ) - { - bank =3D &reserved_mem->bank[reserved_mem->nr_banks]; - bank->start =3D s; - bank->size =3D sz; - bank->type =3D MEMBANK_FDT_RESVMEM; - reserved_mem->nr_banks++; - } - else - panic("Cannot allocate reserved memory bank\n"); + printk("Physical address greater than max width supported\n"); + WARN(); } =20 - ret =3D device_tree_for_each_node(fdt, 0, early_scan_node, NULL); - if ( ret ) - panic("Early FDT parsing failed (%d)\n", ret); - - /* - * On Arm64 setup_directmap_mappings() expects to be called with the l= owest - * bank in memory first. There is no requirement that the DT will prov= ide - * the banks sorted in ascending order. So sort them through. - */ - sort(mem->bank, mem->nr_banks, sizeof(struct membank), - cmp_memory_node, swap_memory_node); - - early_print_info(); - - return fdt_totalsize(fdt); -} - -const __init char *boot_fdt_cmdline(const void *fdt) -{ - int node; - const struct fdt_property *prop; - - node =3D fdt_path_offset(fdt, "/chosen"); - if ( node < 0 ) - return NULL; - - prop =3D fdt_get_property(fdt, node, "xen,xen-bootargs", NULL); - if ( prop =3D=3D NULL ) + if ( dt_size !=3D (paddr_t)dt_size ) { - struct bootcmdline *dom0_cmdline =3D - boot_cmdline_find_by_kind(BOOTMOD_KERNEL); - - if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL) || - ( dom0_cmdline && dom0_cmdline->cmdline[0] ) ) - prop =3D fdt_get_property(fdt, node, "bootargs", NULL); + printk("Physical size greater than max width supported\n"); + WARN(); } - if ( prop =3D=3D NULL ) - return NULL; - - return prop->data; -} =20 -/* - * Wrapper to convert physical address from paddr_t to uint64_t and - * invoke fdt_begin_node(). This is required as the physical address - * provided as part of node name should not contain any leading - * zeroes. Thus, one should use PRIx64 (instead of PRIpaddr) to append - * unit (which contains the physical address) with name to generate a - * node name. - */ -int __init domain_fdt_begin_node(void *fdt, const char *name, uint64_t uni= t) -{ /* - * The size of the buffer to hold the longest possible string (i.e. - * interrupt-controller@ + a 64-bit number + \0). + * Xen will truncate the address/size if it is greater than the maximum + * supported width and it will give an appropriate warning. */ - char buf[38]; - int ret; - - /* ePAPR 3.4 */ - ret =3D snprintf(buf, sizeof(buf), "%s@%"PRIx64, name, unit); - - if ( ret >=3D sizeof(buf) ) - { - printk(XENLOG_ERR - "Insufficient buffer. Minimum size required is %d\n", - (ret + 1)); - - return -FDT_ERR_TRUNCATED; - } - - return fdt_begin_node(fdt, buf); + *start =3D dt_start; + *size =3D dt_size; } - -/* - * Local variables: - * mode: C - * c-file-style: "BSD" - * c-basic-offset: 4 - * indent-tabs-mode: nil - * End: - */ diff --git a/xen/common/device-tree/bootinfo-fdt.c b/xen/common/device-tree= /bootinfo-fdt.c new file mode 100644 index 0000000000..16036472f3 --- /dev/null +++ b/xen/common/device-tree/bootinfo-fdt.c @@ -0,0 +1,597 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Early Device Tree with bootinfo hooks + * + * Copyright (C) 2012-2014 Citrix Systems, Inc. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static void __init __maybe_unused build_assertions(void) +{ + /* + * Check that no padding is between struct membanks "bank" flexible ar= ray + * member and struct meminfo "bank" member + */ + BUILD_BUG_ON((offsetof(struct membanks, bank) !=3D + offsetof(struct meminfo, bank))); + /* Ensure "struct membanks" and "struct membank" are equally aligned */ + BUILD_BUG_ON(alignof(struct membanks) !=3D alignof(struct membank)); +} + +static bool __init device_tree_node_is_available(const void *fdt, int node) +{ + const char *status; + int len; + + status =3D fdt_getprop(fdt, node, "status", &len); + if ( !status ) + return true; + + if ( len > 0 ) + { + if ( !strcmp(status, "ok") || !strcmp(status, "okay") ) + return true; + } + + return false; +} + +static bool __init device_tree_node_matches(const void *fdt, int node, + const char *match) +{ + const char *name; + size_t match_len; + + name =3D fdt_get_name(fdt, node, NULL); + match_len =3D strlen(match); + + /* Match both "match" and "match@..." patterns but not + "match-foo". */ + return strncmp(name, match, match_len) =3D=3D 0 + && (name[match_len] =3D=3D '@' || name[match_len] =3D=3D '\0'); +} + +static bool __init device_tree_node_compatible(const void *fdt, int node, + const char *match) +{ + int len, l; + const void *prop; + + prop =3D fdt_getprop(fdt, node, "compatible", &len); + if ( prop =3D=3D NULL ) + return false; + + while ( len > 0 ) { + if ( !dt_compat_cmp(prop, match) ) + return true; + l =3D strlen(prop) + 1; + prop +=3D l; + len -=3D l; + } + + return false; +} + +/* + * Check if a node is a proper /memory node according to Devicetree + * Specification v0.4, chapter 3.4. + */ +static bool __init device_tree_is_memory_node(const void *fdt, int node, + int depth) +{ + const char *type; + int len; + + if ( depth !=3D 1 ) + return false; + + if ( !device_tree_node_matches(fdt, node, "memory") ) + return false; + + type =3D fdt_getprop(fdt, node, "device_type", &len); + if ( !type ) + return false; + + if ( (len <=3D strlen("memory")) || strcmp(type, "memory") ) + return false; + + return true; +} + +static int __init device_tree_get_meminfo(const void *fdt, int node, + const char *prop_name, + u32 address_cells, u32 size_cell= s, + struct membanks *mem, + enum membank_type type) +{ + const struct fdt_property *prop; + unsigned int i, banks; + const __be32 *cell; + u32 reg_cells =3D address_cells + size_cells; + paddr_t start, size; + + if ( !device_tree_node_is_available(fdt, node) ) + return 0; + + if ( address_cells < 1 || size_cells < 1 ) + { + printk("fdt: property `%s': invalid #address-cells or #size-cells", + prop_name); + return -EINVAL; + } + + prop =3D fdt_get_property(fdt, node, prop_name, NULL); + if ( !prop ) + return -ENOENT; + + cell =3D (const __be32 *)prop->data; + banks =3D fdt32_to_cpu(prop->len) / (reg_cells * sizeof (u32)); + + for ( i =3D 0; i < banks && mem->nr_banks < mem->max_banks; i++ ) + { + device_tree_get_reg(&cell, address_cells, size_cells, &start, &siz= e); + /* + * Some valid device trees, such as those generated by OpenPOWER + * skiboot firmware, expose all reserved memory regions in the + * FDT memory reservation block AND in the reserved-memory node wh= ich + * has already been parsed. Thus, any matching overlaps in the + * reserved_mem banks should be ignored. + */ + if ( mem =3D=3D bootinfo_get_reserved_mem() && + check_reserved_regions_overlap(start, size, true) ) + return -EINVAL; + /* Some DT may describe empty bank, ignore them */ + if ( !size ) + continue; + mem->bank[mem->nr_banks].start =3D start; + mem->bank[mem->nr_banks].size =3D size; + mem->bank[mem->nr_banks].type =3D type; + mem->nr_banks++; + } + + if ( i < banks ) + { + printk("Warning: Max number of supported memory regions reached.\n= "); + return -ENOSPC; + } + + return 0; +} + +static int __init process_memory_node(const void *fdt, int node, + const char *name, int depth, + u32 address_cells, u32 size_cells, + struct membanks *mem) +{ + return device_tree_get_meminfo(fdt, node, "reg", address_cells, size_c= ells, + mem, MEMBANK_DEFAULT); +} + +static int __init process_reserved_memory_node(const void *fdt, int node, + const char *name, int depth, + u32 address_cells, + u32 size_cells, + void *data) +{ + int rc =3D process_memory_node(fdt, node, name, depth, address_cells, + size_cells, data); + + if ( rc =3D=3D -ENOSPC ) + panic("Max number of supported reserved-memory regions reached.\n"= ); + else if ( rc !=3D -ENOENT ) + return rc; + return 0; +} + +static int __init process_reserved_memory(const void *fdt, int node, + const char *name, int depth, + u32 address_cells, u32 size_cell= s) +{ + return device_tree_for_each_node(fdt, node, + process_reserved_memory_node, + bootinfo_get_reserved_mem()); +} + +static void __init process_multiboot_node(const void *fdt, int node, + const char *name, + u32 address_cells, u32 size_cell= s) +{ + static int __initdata kind_guess =3D 0; + const struct fdt_property *prop; + const __be32 *cell; + boot_module_kind kind; + paddr_t start, size; + int len; + /* sizeof("/chosen/") + DT_MAX_NAME + '/' + DT_MAX_NAME + '/0' =3D> 92= */ + char path[92]; + int parent_node, ret; + bool domU; + + parent_node =3D fdt_parent_offset(fdt, node); + ASSERT(parent_node >=3D 0); + + /* Check that the node is under "/chosen" (first 7 chars of path) */ + ret =3D fdt_get_path(fdt, node, path, sizeof (path)); + if ( ret !=3D 0 || strncmp(path, "/chosen", 7) ) + return; + + prop =3D fdt_get_property(fdt, node, "reg", &len); + if ( !prop ) + panic("node %s missing `reg' property\n", name); + + if ( len < dt_cells_to_size(address_cells + size_cells) ) + panic("fdt: node `%s': `reg` property length is too short\n", + name); + + cell =3D (const __be32 *)prop->data; + device_tree_get_reg(&cell, address_cells, size_cells, &start, &size); + + if ( fdt_node_check_compatible(fdt, node, "xen,linux-zimage") =3D=3D 0= || + fdt_node_check_compatible(fdt, node, "multiboot,kernel") =3D=3D 0= ) + kind =3D BOOTMOD_KERNEL; + else if ( fdt_node_check_compatible(fdt, node, "xen,linux-initrd") =3D= =3D 0 || + fdt_node_check_compatible(fdt, node, "multiboot,ramdisk") = =3D=3D 0 ) + kind =3D BOOTMOD_RAMDISK; + else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") =3D= =3D 0 ) + kind =3D BOOTMOD_XSM; + else if ( fdt_node_check_compatible(fdt, node, "multiboot,device-tree"= ) =3D=3D 0 ) + kind =3D BOOTMOD_GUEST_DTB; + else if ( fdt_node_check_compatible(fdt, node, "multiboot,microcode") = =3D=3D 0 ) + kind =3D BOOTMOD_MICROCODE; + else + kind =3D BOOTMOD_UNKNOWN; + + /** + * Guess the kind of these first two unknowns respectively: + * (1) The first unknown must be kernel. + * (2) Detect the XSM Magic from the 2nd unknown: + * a. If it's XSM, set the kind as XSM, and that also means we + * won't load ramdisk; + * b. if it's not XSM, set the kind as ramdisk. + * So if user want to load ramdisk, it must be the 2nd unknown. + * We also detect the XSM Magic for the following unknowns, + * then set its kind according to the return value of has_xsm_magic. + */ + if ( kind =3D=3D BOOTMOD_UNKNOWN ) + { + switch ( kind_guess++ ) + { + case 0: kind =3D BOOTMOD_KERNEL; break; + case 1: kind =3D BOOTMOD_RAMDISK; break; + default: break; + } + if ( kind_guess > 1 && has_xsm_magic(start) ) + kind =3D BOOTMOD_XSM; + } + + domU =3D fdt_node_check_compatible(fdt, parent_node, "xen,domain") =3D= =3D 0; + add_boot_module(kind, start, size, domU); + + prop =3D fdt_get_property(fdt, node, "bootargs", &len); + if ( !prop ) + return; + add_boot_cmdline(fdt_get_name(fdt, parent_node, &len), prop->data, + kind, start, domU); +} + +static int __init process_chosen_node(const void *fdt, int node, + const char *name, + u32 address_cells, u32 size_cells) +{ + const struct fdt_property *prop; + paddr_t start, end; + int len; + + if ( fdt_get_property(fdt, node, "xen,static-heap", NULL) ) + { + int rc; + + printk("Checking for static heap in /chosen\n"); + + rc =3D device_tree_get_meminfo(fdt, node, "xen,static-heap", + address_cells, size_cells, + bootinfo_get_reserved_mem(), + MEMBANK_STATIC_HEAP); + if ( rc ) + return rc; + + using_static_heap =3D true; + } + + printk("Checking for initrd in /chosen\n"); + + prop =3D fdt_get_property(fdt, node, "linux,initrd-start", &len); + if ( !prop ) + /* No initrd present. */ + return 0; + if ( len !=3D sizeof(u32) && len !=3D sizeof(u64) ) + { + printk("linux,initrd-start property has invalid length %d\n", len); + return -EINVAL; + } + start =3D dt_read_paddr((const void *)&prop->data, dt_size_to_cells(le= n)); + + prop =3D fdt_get_property(fdt, node, "linux,initrd-end", &len); + if ( !prop ) + { + printk("linux,initrd-end not present but -start was\n"); + return -EINVAL; + } + if ( len !=3D sizeof(u32) && len !=3D sizeof(u64) ) + { + printk("linux,initrd-end property has invalid length %d\n", len); + return -EINVAL; + } + end =3D dt_read_paddr((const void *)&prop->data, dt_size_to_cells(len)= ); + + if ( start >=3D end ) + { + printk("linux,initrd limits invalid: %"PRIpaddr" >=3D %"PRIpaddr"\= n", + start, end); + return -EINVAL; + } + + printk("Initrd %"PRIpaddr"-%"PRIpaddr"\n", start, end - 1); + + add_boot_module(BOOTMOD_RAMDISK, start, end-start, false); + + return 0; +} + +static int __init process_domain_node(const void *fdt, int node, + const char *name, + u32 address_cells, u32 size_cells) +{ + const struct fdt_property *prop; + + printk("Checking for \"xen,static-mem\" in domain node\n"); + + prop =3D fdt_get_property(fdt, node, "xen,static-mem", NULL); + if ( !prop ) + /* No "xen,static-mem" present. */ + return 0; + + return device_tree_get_meminfo(fdt, node, "xen,static-mem", address_ce= lls, + size_cells, bootinfo_get_reserved_mem(), + MEMBANK_STATIC_DOMAIN); +} + +#ifndef CONFIG_STATIC_SHM +static inline int process_shm_node(const void *fdt, int node, + uint32_t address_cells, uint32_t size_c= ells) +{ + printk("CONFIG_STATIC_SHM must be enabled for parsing static shared" + " memory nodes\n"); + return -EINVAL; +} +#endif + +static int __init early_scan_node(const void *fdt, + int node, const char *name, int depth, + u32 address_cells, u32 size_cells, + void *data) +{ + int rc =3D 0; + + /* + * If Xen has been booted via UEFI, the memory banks are + * populated. So we should skip the parsing. + */ + if ( !efi_enabled(EFI_BOOT) && + device_tree_is_memory_node(fdt, node, depth) ) + rc =3D process_memory_node(fdt, node, name, depth, + address_cells, size_cells, bootinfo_get_m= em()); + else if ( depth =3D=3D 1 && !dt_node_cmp(name, "reserved-memory") ) + rc =3D process_reserved_memory(fdt, node, name, depth, + address_cells, size_cells); + else if ( depth <=3D 3 && (device_tree_node_compatible(fdt, node, "xen= ,multiboot-module" ) || + device_tree_node_compatible(fdt, node, "multiboot,module" ))) + process_multiboot_node(fdt, node, name, address_cells, size_cells); + else if ( depth =3D=3D 1 && device_tree_node_matches(fdt, node, "chose= n") ) + rc =3D process_chosen_node(fdt, node, name, address_cells, size_ce= lls); + else if ( depth =3D=3D 2 && device_tree_node_compatible(fdt, node, "xe= n,domain") ) + rc =3D process_domain_node(fdt, node, name, address_cells, size_ce= lls); + else if ( depth <=3D 3 && device_tree_node_compatible(fdt, node, "xen,= domain-shared-memory-v1") ) + rc =3D process_shm_node(fdt, node, address_cells, size_cells); + + if ( rc < 0 ) + printk("fdt: node `%s': parsing failed\n", name); + return rc; +} + +static void __init early_print_info(void) +{ + const struct membanks *mi =3D bootinfo_get_mem(); + const struct membanks *mem_resv =3D bootinfo_get_reserved_mem(); + struct boot_modules *mods =3D &bootinfo.modules; + struct bootcmdlines *cmds =3D &bootinfo.cmdlines; + unsigned int i; + + for ( i =3D 0; i < mi->nr_banks; i++ ) + printk("RAM: %"PRIpaddr" - %"PRIpaddr"\n", + mi->bank[i].start, + mi->bank[i].start + mi->bank[i].size - 1); + printk("\n"); + for ( i =3D 0 ; i < mods->nr_mods; i++ ) + printk("MODULE[%d]: %"PRIpaddr" - %"PRIpaddr" %-12s\n", + i, + mods->module[i].start, + mods->module[i].start + mods->module[i].size - 1, + boot_module_kind_as_string(mods->module[i].kind)); + + for ( i =3D 0; i < mem_resv->nr_banks; i++ ) + { + printk(" RESVD[%u]: %"PRIpaddr" - %"PRIpaddr"\n", i, + mem_resv->bank[i].start, + mem_resv->bank[i].start + mem_resv->bank[i].size - 1); + } +#ifdef CONFIG_STATIC_SHM + early_print_info_shmem(); +#endif + printk("\n"); + for ( i =3D 0 ; i < cmds->nr_mods; i++ ) + printk("CMDLINE[%"PRIpaddr"]:%s %s\n", cmds->cmdline[i].start, + cmds->cmdline[i].dt_name, + &cmds->cmdline[i].cmdline[0]); + printk("\n"); +} + +/* This function assumes that memory regions are not overlapped */ +static int __init cmp_memory_node(const void *key, const void *elem) +{ + const struct membank *handler0 =3D key; + const struct membank *handler1 =3D elem; + + if ( handler0->start < handler1->start ) + return -1; + + if ( handler0->start >=3D (handler1->start + handler1->size) ) + return 1; + + return 0; +} + +static void __init swap_memory_node(void *_a, void *_b, size_t size) +{ + struct membank *a =3D _a, *b =3D _b; + + SWAP(*a, *b); +} + +/** + * boot_fdt_info - initialize bootinfo from a DTB + * @fdt: flattened device tree binary + * + * Returns the size of the DTB. + */ +size_t __init boot_fdt_info(const void *fdt, paddr_t paddr) +{ + struct membanks *reserved_mem =3D bootinfo_get_reserved_mem(); + struct membanks *mem =3D bootinfo_get_mem(); + unsigned int i; + int nr_rsvd; + int ret; + + ret =3D fdt_check_header(fdt); + if ( ret < 0 ) + panic("No valid device tree\n"); + + add_boot_module(BOOTMOD_FDT, paddr, fdt_totalsize(fdt), false); + + nr_rsvd =3D fdt_num_mem_rsv(fdt); + if ( nr_rsvd < 0 ) + panic("Parsing FDT memory reserve map failed (%d)\n", nr_rsvd); + + for ( i =3D 0; i < nr_rsvd; i++ ) + { + struct membank *bank; + paddr_t s, sz; + + if ( fdt_get_mem_rsv_paddr(device_tree_flattened, i, &s, &sz) < 0 ) + continue; + + if ( reserved_mem->nr_banks < reserved_mem->max_banks ) + { + bank =3D &reserved_mem->bank[reserved_mem->nr_banks]; + bank->start =3D s; + bank->size =3D sz; + bank->type =3D MEMBANK_FDT_RESVMEM; + reserved_mem->nr_banks++; + } + else + panic("Cannot allocate reserved memory bank\n"); + } + + ret =3D device_tree_for_each_node(fdt, 0, early_scan_node, NULL); + if ( ret ) + panic("Early FDT parsing failed (%d)\n", ret); + + /* + * On Arm64 setup_directmap_mappings() expects to be called with the l= owest + * bank in memory first. There is no requirement that the DT will prov= ide + * the banks sorted in ascending order. So sort them through. + */ + sort(mem->bank, mem->nr_banks, sizeof(struct membank), + cmp_memory_node, swap_memory_node); + + early_print_info(); + + return fdt_totalsize(fdt); +} + +const __init char *boot_fdt_cmdline(const void *fdt) +{ + int node; + const struct fdt_property *prop; + + node =3D fdt_path_offset(fdt, "/chosen"); + if ( node < 0 ) + return NULL; + + prop =3D fdt_get_property(fdt, node, "xen,xen-bootargs", NULL); + if ( prop =3D=3D NULL ) + { + struct bootcmdline *dom0_cmdline =3D + boot_cmdline_find_by_kind(BOOTMOD_KERNEL); + + if (fdt_get_property(fdt, node, "xen,dom0-bootargs", NULL) || + ( dom0_cmdline && dom0_cmdline->cmdline[0] ) ) + prop =3D fdt_get_property(fdt, node, "bootargs", NULL); + } + if ( prop =3D=3D NULL ) + return NULL; + + return prop->data; +} + +/* + * Wrapper to convert physical address from paddr_t to uint64_t and + * invoke fdt_begin_node(). This is required as the physical address + * provided as part of node name should not contain any leading + * zeroes. Thus, one should use PRIx64 (instead of PRIpaddr) to append + * unit (which contains the physical address) with name to generate a + * node name. + */ +int __init domain_fdt_begin_node(void *fdt, const char *name, uint64_t uni= t) +{ + /* + * The size of the buffer to hold the longest possible string (i.e. + * interrupt-controller@ + a 64-bit number + \0). + */ + char buf[38]; + int ret; + + /* ePAPR 3.4 */ + ret =3D snprintf(buf, sizeof(buf), "%s@%"PRIx64, name, unit); + + if ( ret >=3D sizeof(buf) ) + { + printk(XENLOG_ERR + "Insufficient buffer. Minimum size required is %d\n", + (ret + 1)); + + return -FDT_ERR_TRUNCATED; + } + + return fdt_begin_node(fdt, buf); +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + */ --=20 2.43.0 From nobody Thu Oct 30 23:09:16 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=1751998111; cv=pass; d=zohomail.com; s=zohoarc; b=XxZUe8BUyVTzzMROC227xagJMWcu3ez84kDyGirKKzgUegrk8+KnaGVCpcnoKIj8H5MDBFSgajRFf2O5FIcieFHk0OAzIzaDadHb3zLZXxUkBqtwMwFW2Soe9qEC1iekv8Fmi6/YgPBuOOsAuIiEdieU1lRwk4KFoWBnYJhg83M= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751998111; 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=xuSp+bKQrE/XEUMr5CDqREjTnOdAk7uiSalviiZKreU=; b=W2GtwXTlX8fd1FnPxZt5ZQUTO87c6jvEoewF2A6O95A47Dha2rumIUf/BtAPKzvFif9P5WoqH5SnMfiBsWK03oUJl5AgnM0++o0i7JAqTLfm+Ad0D5pAPBez8SGWV0nEFyjrWb+LsVSZMrmOznl0UIJN3Urvbwr0prfyZLqQ0cs= 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 1751998111426769.8805584175019; Tue, 8 Jul 2025 11:08:31 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1037037.1409752 (Exim 4.92) (envelope-from ) id 1uZCjh-0007nj-Re; Tue, 08 Jul 2025 18:08:09 +0000 Received: by outflank-mailman (output) from mailman id 1037037.1409752; Tue, 08 Jul 2025 18:08:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjh-0007l8-He; Tue, 08 Jul 2025 18:08:09 +0000 Received: by outflank-mailman (input) for mailman id 1037037; Tue, 08 Jul 2025 18:08:07 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjf-0005Uq-De for xen-devel@lists.xenproject.org; Tue, 08 Jul 2025 18:08:07 +0000 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on20608.outbound.protection.outlook.com [2a01:111:f403:2413::608]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 7e23c76b-5c26-11f0-b894-0df219b8e170; Tue, 08 Jul 2025 20:08:05 +0200 (CEST) Received: from BYAPR06CA0005.namprd06.prod.outlook.com (2603:10b6:a03:d4::18) by LV3PR12MB9233.namprd12.prod.outlook.com (2603:10b6:408:194::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.27; Tue, 8 Jul 2025 18:08:02 +0000 Received: from CY4PEPF0000FCC2.namprd03.prod.outlook.com (2603:10b6:a03:d4:cafe::4a) by BYAPR06CA0005.outlook.office365.com (2603:10b6:a03:d4::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8922.21 via Frontend Transport; Tue, 8 Jul 2025 18:08:01 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC2.mail.protection.outlook.com (10.167.242.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8901.15 via Frontend Transport; Tue, 8 Jul 2025 18:08:01 +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; Tue, 8 Jul 2025 13:07:58 -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: 7e23c76b-5c26-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yotbBMtqe8m/ZKnko263HXYtCyZ32ENs0m0dYsJbbxMMvI4filXmK9g58CvAhyEDsgdTs8jx4yeYitJEndO3kWQA5q9mrNo/qLUau/6mGKpbldMwP3q8TcQUs83fKVvEoipLanHINRy7QCH+20I6tbfyUpb5MNqCT0l2DMkiqH05NYZYlQLJS5m8aWE4LACLkUCtxEmDx4mZNtY4NnSydlJv/oETHK24I8opX65zTKyxIlEBuAfyl7UqSADenu3qLPyve67z+Oc3DPoXt3ooPExm2iUiCZRmEgxtBhNJMVJvaESQp+GHgOt2ReV1bjl/7DmRWTy6kJH9jIAobTmCow== 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=xuSp+bKQrE/XEUMr5CDqREjTnOdAk7uiSalviiZKreU=; b=q+CQzFgQNUSAkLAD0j+3ze/QTj+JIVMeKiahyOmWhRpXXcEbZTPcIxSl/zjC9+Ny3nC5SV9tpM7oAko6NaYFXxAi116RIvG5C5lTpZ4FpYZjQq1S87olsOmzwOZAVIcUryOZUSt9KuPXr0XxCoHn37zvlaTo+S/H7jz9Y9PkCXj402s9Q3OocmxJEHCvqiAcGPfPCzSRWcaUobz7c5KrUsdKGirAFr1pfpRKrgbsH540CtRoa3GlUA23y/w6FBUFTyMr1T86fPlxWKsY5gT2aJBLZse7vqKPJufwPmBSYRubBa1O9yNXgZcQPRhT1jdZWHn1fnUV+EsI7QltXQuf+Q== 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=xuSp+bKQrE/XEUMr5CDqREjTnOdAk7uiSalviiZKreU=; b=nQUlN+Np9P0zqSxbynaFcqsDN1wo8aRknQ538tTagiByrpxCQix9LMlfKGkQcua2Lfa1QeusAg2GGDP2nSxjCAoxzynASUyzn3+2L4glV+Zru83lWWhuY15+5gKvgsBW2twM/nIg0NVFWTU0k3swsU4diG0jU6RewEi+VtGZAh0= 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 , "Daniel P. Smith" Subject: [PATCH v6 08/11] xen/dt: Extract helper to map nodes to module kinds Date: Tue, 8 Jul 2025 20:07:17 +0200 Message-ID: <20250708180721.2338036-9-alejandro.garciavallejo@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250708180721.2338036-1-alejandro.garciavallejo@amd.com> References: <20250708180721.2338036-1-alejandro.garciavallejo@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: CY4PEPF0000FCC2:EE_|LV3PR12MB9233:EE_ X-MS-Office365-Filtering-Correlation-Id: b0b9ddbd-fabe-436a-5f81-08ddbe4a60d1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?+yeNCSCbmitpyzIAIk9242es3wU+IJyhxehGX+j9TDDw/F/XNg6jEAkCE+Ha?= =?us-ascii?Q?uTZ7qX0In2ctZi9LGf1xq/awmLZRzFH1yIjOQS64OHMh84zq43uWl1lVynAS?= =?us-ascii?Q?1+RUKPNi6H0+/di/P2DoW6WLKrQmc8fD42FY7AzP0Sf0+0UvKvbFVGI4i96o?= =?us-ascii?Q?5N3mKofSTnfJjZ7u4B9RLid1RzgBpJHD7k6hB/xBGiF1M3S3jnRfSvzFNwjE?= =?us-ascii?Q?GQVRiV6UJFp7a4MnvOfK5ETonvetvstiDyS+QpqV4AR8QddZOkY2PMZMgKSk?= =?us-ascii?Q?z3Y0fKM8AA8d8LJJbzMq8zoJSB4SgwDZnqTqcev+AgpmxxJYCuygwKpIN70T?= =?us-ascii?Q?nCVviPv424aqS+jlot4/+8InPI8K7/oJCcib+vgLV7pyO2bYu7J8O5zomz86?= =?us-ascii?Q?MFT/bzO8bjohJkZDjuOBWZG8gC+ufOT1CPBZiFNYDkUrxnv2cANsUmv6yIE0?= =?us-ascii?Q?QYCuyZLISdi5Ru/FuJNRlrQOKgDBE3uXfw8gtAskCkEQTCLPnRyiYA5iaA9o?= =?us-ascii?Q?KBIwsibk1M4AfaUzyKfviWGtTJri/tN867A2TtWdmAjLXBRXMLTjY9++en4p?= =?us-ascii?Q?dv9wWtEjXCs/IQfXMljUeoLhFmX48bjZ1HayjmVwx8kOme88GSvGHTilRD84?= =?us-ascii?Q?SGn3D1fSlqMPabrim0Llb7c6fJOVPvJ/47S+vOhOhaXlkiWmxU6Jvnszg7tS?= =?us-ascii?Q?ePD86WqMr1wLe77fReBatG5mC641gllCQDjUhykElmTQDBdaKEpTiQtwMK5X?= =?us-ascii?Q?m8I+7zoSHmyTfnlkU5lKu//cYZm3yxhYaZI4vxQt8SmJwRCQRQDMQhjXYSUF?= =?us-ascii?Q?JEDJ+M+XkbWG1Ixm70GappXYZVoqSEv39uzTKPP1I90WJiFYCT6lx72rgtOJ?= =?us-ascii?Q?q+g+FUYu/S30Qo6y2+wKbBMTCnCQQDWts70J+035JANaLptU+vJ3SVTJhT3x?= =?us-ascii?Q?gXE9Ll/WlnKU3GXR1KtUInsPTs/vlqN1XwHHqjFVHcP7v+MlTRwsXiuaiFeN?= =?us-ascii?Q?tyQ4JQ7jHBgPH74diKifXR2WY77RjUv4t5B/SqiQVttdu0NnaeJ86Y73Orx5?= =?us-ascii?Q?OMvexSQFDAgis09oVVaBD6kTaOJLe2BDTywuflP5zzdTSZWzXchv98TVlOuV?= =?us-ascii?Q?CKSUMixOLUIEjfIl9QoRLKuTAeu6g6G6W4MFL1RmY/h6+8xji8bp3wv46nAu?= =?us-ascii?Q?Dd8eklcMUgs9TX5IEIL9PDdtrhsqFe9AHA2VzYzXPiTOQ6KSF++D1pVDG6d3?= =?us-ascii?Q?xWLIgI+KsNX/sHfzWF07xgYWgPThi4YhZTrE1dw8Iz+LExjCUpDI7NGFDUKy?= =?us-ascii?Q?tNCvxoCDmOxFqK0NfjdN95VpUxO4QuTmmL8X2/0/HZDg1OmuNUoHWAKnRlxS?= =?us-ascii?Q?YaLUQ3UHYk1llx5SFzaebnnTu5qy6GxKGcZjv7xiT02zwLmkmQ93D7Y5FgR5?= =?us-ascii?Q?5o8FhlLh12BFC4Ikr8BCOhyLypBf9cO9Z3+zUnUGeOdLuPn5O1RVSsIBMPCb?= =?us-ascii?Q?qaqG+tkpGpPbQ9N6Wv9a70ZziXH840HggDYA?= 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)(82310400026)(376014)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2025 18:08:01.6793 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b0b9ddbd-fabe-436a-5f81-08ddbe4a60d1 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: CY4PEPF0000FCC2.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9233 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1751998113274116600 Content-Type: text/plain; charset="utf-8" From: Alejandro Vallejo This will be required later by x86 code in order to do early identification of boot modules when booting off a DTB. Not a functional change. Signed-off-by: Alejandro Vallejo Reviewed-by: Stefano Stabellini --- xen/common/device-tree/bootfdt.c | 18 ++++++++++++++++++ xen/common/device-tree/bootinfo-fdt.c | 16 +--------------- xen/include/xen/bootfdt.h | 7 +++++++ 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/xen/common/device-tree/bootfdt.c b/xen/common/device-tree/boot= fdt.c index 0d8d9ea357..8218c0a10b 100644 --- a/xen/common/device-tree/bootfdt.c +++ b/xen/common/device-tree/bootfdt.c @@ -4,6 +4,24 @@ #include #include =20 +boot_module_kind __init fdt_node_to_kind(const void *fdt, int node) +{ + if ( fdt_node_check_compatible(fdt, node, "xen,linux-zimage") =3D=3D 0= || + fdt_node_check_compatible(fdt, node, "multiboot,kernel") =3D=3D 0= ) + return BOOTMOD_KERNEL; + if ( fdt_node_check_compatible(fdt, node, "xen,linux-initrd") =3D=3D 0= || + fdt_node_check_compatible(fdt, node, "multiboot,ramdisk") =3D=3D = 0 ) + return BOOTMOD_RAMDISK; + if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") =3D=3D 0 ) + return BOOTMOD_XSM; + if ( fdt_node_check_compatible(fdt, node, "multiboot,device-tree") =3D= =3D 0 ) + return BOOTMOD_GUEST_DTB; + if ( fdt_node_check_compatible(fdt, node, "multiboot,microcode") =3D= =3D 0 ) + return BOOTMOD_MICROCODE; + + return BOOTMOD_UNKNOWN; +} + u32 __init device_tree_get_u32(const void *fdt, int node, const char *prop_name, u32 dflt) { diff --git a/xen/common/device-tree/bootinfo-fdt.c b/xen/common/device-tree= /bootinfo-fdt.c index 16036472f3..9b426c0a98 100644 --- a/xen/common/device-tree/bootinfo-fdt.c +++ b/xen/common/device-tree/bootinfo-fdt.c @@ -236,21 +236,7 @@ static void __init process_multiboot_node(const void *= fdt, int node, =20 cell =3D (const __be32 *)prop->data; device_tree_get_reg(&cell, address_cells, size_cells, &start, &size); - - if ( fdt_node_check_compatible(fdt, node, "xen,linux-zimage") =3D=3D 0= || - fdt_node_check_compatible(fdt, node, "multiboot,kernel") =3D=3D 0= ) - kind =3D BOOTMOD_KERNEL; - else if ( fdt_node_check_compatible(fdt, node, "xen,linux-initrd") =3D= =3D 0 || - fdt_node_check_compatible(fdt, node, "multiboot,ramdisk") = =3D=3D 0 ) - kind =3D BOOTMOD_RAMDISK; - else if ( fdt_node_check_compatible(fdt, node, "xen,xsm-policy") =3D= =3D 0 ) - kind =3D BOOTMOD_XSM; - else if ( fdt_node_check_compatible(fdt, node, "multiboot,device-tree"= ) =3D=3D 0 ) - kind =3D BOOTMOD_GUEST_DTB; - else if ( fdt_node_check_compatible(fdt, node, "multiboot,microcode") = =3D=3D 0 ) - kind =3D BOOTMOD_MICROCODE; - else - kind =3D BOOTMOD_UNKNOWN; + kind =3D fdt_node_to_kind(fdt, node); =20 /** * Guess the kind of these first two unknowns respectively: diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h index b886f18027..dc6b7005e3 100644 --- a/xen/include/xen/bootfdt.h +++ b/xen/include/xen/bootfdt.h @@ -145,4 +145,11 @@ u32 device_tree_get_u32(const void *fdt, int node, void device_tree_get_reg(const __be32 **cell, uint32_t address_cells, uint32_t size_cells, paddr_t *start, paddr_t *siz= e); =20 +/* + * Probe an FDT node thought to be a boot module to identify its kind. + * + * If correctly identified, returns the detected kind, otherwise BOOTMOD_U= NKNOWN + */ +boot_module_kind fdt_node_to_kind(const void *fdt, int node); + #endif /* XEN_BOOTFDT_H */ --=20 2.43.0 From nobody Thu Oct 30 23:09:16 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=1751998270; cv=pass; d=zohomail.com; s=zohoarc; b=i3foyFoSY7neF0IECXlaLHZ85v+584T8TVM+/NflJfMCg/zUhTp6L9FRfsyS9xIdgeRbheANILPsEUPVSrFoHke/KV6AQLZ42fcgod1Z5fyrgH9+ybWhk34VrfxHfVkPcx4PaOn1GW0J5YEsF2c/MTrmhZBSbJJHb6K8feMAF8I= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751998270; 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=10E6VzKB3fwD/ENPIpAwDvtsuuhPS0KL8wr85SCVuek=; b=LWv40fEDWSPGfqpXaKeE2QGS4YgS0krbjRqinxtTAXSm6B2UgMrB/MXXei76iBXX2zhjBEjVtdDmFs82+mdvfjXchbuMIs27uVOEwvUsB6uUq2ucDKvxR7tN47XOXO/wpokUZ1ZYMVZ65eUCIncmn6Qm0UwVCZPC5h2bWtmGruE= 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 1751998270904461.730456031294; Tue, 8 Jul 2025 11:11:10 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1037100.1409775 (Exim 4.92) (envelope-from ) id 1uZCmM-0003k0-MS; Tue, 08 Jul 2025 18:10:54 +0000 Received: by outflank-mailman (output) from mailman id 1037100.1409775; Tue, 08 Jul 2025 18:10:54 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCmM-0003ju-G2; Tue, 08 Jul 2025 18:10:54 +0000 Received: by outflank-mailman (input) for mailman id 1037100; Tue, 08 Jul 2025 18:10:53 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjp-0005Uq-Jt for xen-devel@lists.xenproject.org; Tue, 08 Jul 2025 18:08:17 +0000 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on20602.outbound.protection.outlook.com [2a01:111:f403:2418::602]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 838ee911-5c26-11f0-b894-0df219b8e170; Tue, 08 Jul 2025 20:08:14 +0200 (CEST) Received: from PH7P222CA0001.NAMP222.PROD.OUTLOOK.COM (2603:10b6:510:33a::14) by IA1PR12MB7495.namprd12.prod.outlook.com (2603:10b6:208:419::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.25; Tue, 8 Jul 2025 18:08:10 +0000 Received: from CY4PEPF0000FCC4.namprd03.prod.outlook.com (2603:10b6:510:33a:cafe::66) by PH7P222CA0001.outlook.office365.com (2603:10b6:510:33a::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8922.21 via Frontend Transport; Tue, 8 Jul 2025 18:08:09 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC4.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8901.15 via Frontend Transport; Tue, 8 Jul 2025 18:08:09 +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; Tue, 8 Jul 2025 13:08:00 -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: 838ee911-5c26-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VGcEMfwTV1GJnJ5djfCEAhWlWmPneGqiMsOInleuDhDy3wr3gC7o3fm4fiOrLt/72Yak+DgGF/YXbetNridRjBxkVF7jlzqcz9Hio2P7aHetNy2wKbNvMNAAr6hRcf0+7H3dPbyjCfmJcovxgD/CPL2j4JnygPIZoA+dks4RpAOC78/kRF42MV+q2uHcSQOFmybk8hsNZXItTG+81kjg696AMT+5Gm4xs3qfJWpUL8cSliQNKOIwonP20BIAYXjUzBX30ChF8nW0lNuVbDfmoo/foOJ2lrxK1ZUo/9TsVaLAPSsyQN0a4vPKIgYqqMnQmLCEEOS1ZZXFDK4otTAjOw== 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=10E6VzKB3fwD/ENPIpAwDvtsuuhPS0KL8wr85SCVuek=; b=UBnpFmnLoFi/lQJIJB9JxneIy4ktDNZk3Aq+hngk4YFPqnW6/0ZocgjyU9XOxrTon1yFgoZf/Ihuf/C0XJyVF/pA/QxkPoPqA/SUAlGD1S4FABCRFT4grtn0VSg1uVYAgDhCvnSRT9HwmIydBzpA4XkyWdQGiZkPAXQL+qjLDxy2kBMaio6RkAHEK7z+dVtWmc7Pcta+xrm/aAQfIJcssSCfbbTSgVSL8mVA0b8fsLXLULkyw2T76/urXBXCrig8np4GEfXMpYZzaqARt816jrgEBwQMs3Gpq04mMw5UTXjs88ZjKJxFqrSzTE3NdGtidlO9IaZ94RCFlLPpfNroyQ== 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=10E6VzKB3fwD/ENPIpAwDvtsuuhPS0KL8wr85SCVuek=; b=PQcz8UiZyPCWagzOp41GM07HwK7CByI/qKC+574clsrHQ64KbENDa1vgVE2a1/q+8mtJ2Ff+H3iXCWcHdV/+Jq5/e0YYsd6MQpN5vuyx7C9/eYQJi/P8oGzScSAMWSDm3D3bEcsnqosN3nyUm+lvLqy9MK7dR4Z+nrkOuFGriVY= 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 , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , "Julien Grall" , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , "Bertrand Marquis" , Volodymyr Babchuk , Shawn Anastasio , Alistair Francis , Bob Eshleman , "Connor Davis" , Oleksii Kurochko , "Daniel P. Smith" , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Dario Faggioli , Juergen Gross , George Dunlap Subject: [PATCH v6 09/11] xen: Split HAS_DEVICE_TREE in two Date: Tue, 8 Jul 2025 20:07:18 +0200 Message-ID: <20250708180721.2338036-10-alejandro.garciavallejo@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250708180721.2338036-1-alejandro.garciavallejo@amd.com> References: <20250708180721.2338036-1-alejandro.garciavallejo@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: CY4PEPF0000FCC4:EE_|IA1PR12MB7495:EE_ X-MS-Office365-Filtering-Correlation-Id: 564fb9cb-bbe0-4886-4d92-08ddbe4a65a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|1800799024|7416014|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?sSxT+zmL50iV85pnQB3EwIJ9hcC74vrkO9kIrXR4CKjhvUNUMJXoEWGWaLaR?= =?us-ascii?Q?muRRPlY6Q9t/mTuWx/DovpNqa7qpYq7NikEW6n1DBL4nwiluT9ub0UEBcLKg?= =?us-ascii?Q?pNiErlbvMN/jzvRo6YJvrMPlAvhOPSJq+wgpmekBKVHYGXzw3cHPZa6X5NaX?= =?us-ascii?Q?5lqtHdxfn/fJqtXj/3QN8VyOaslJfS5G4bIHksG+fqz2F+s66XNJ9wF1R5wv?= =?us-ascii?Q?YLWhxTaufDbVRkRZSe/Lwf/ReyONH545QZxjIyvS0t/qr50nprsTKJfByy2j?= =?us-ascii?Q?zcn+yvrLcXis4BJKI5vO33ooHNUGUwgVSVyNZ2+LZFCA5j+cwywJGfdEyVM2?= =?us-ascii?Q?VN+ZPxjVsygGkC0+ufuGDiLUAAdqgv7cgHFgD2ZLjN4TBXM6XL9loPna5C7V?= =?us-ascii?Q?Ds+dubbmILDHEH0yHQ/fsYR0WnC3/G1WK079U8x0QjnAAZlXQltXII9a82k/?= =?us-ascii?Q?Tl7kPPuziv/d6fcM0OKjzD++IvqNmKd7OBytVLcTc6zYCOyGMUWeGv2AP0qP?= =?us-ascii?Q?q8uS4eiYmSkwUHh8MbGLBWZuZJo+46Ckdx9Hhhr0CH5vvAIt1deofNh2Foj8?= =?us-ascii?Q?B9ulp5n3eqnpeYqlAFOD9K0JcHvHQCwiuLISpaaesQxkiwS/nY3xjeh376Jr?= =?us-ascii?Q?3dIkHCi3uia6ZpRV+ui3nz4dXvcnneKYzWg3Lgc4NbbfxU1Lt5Cw/0Gys+55?= =?us-ascii?Q?WzN5FbZmgVrb2+x+6yIWuqQclaA4OmZituJxMijD4EsMGCG9C5SZTFndREUJ?= =?us-ascii?Q?7PQX3H7+1F8q7OODySIG+drOPIrIOjryd61dvLXJ3fOV+kPckYMCQTfvc9dx?= =?us-ascii?Q?F5wxAbXP69rUCjfPVgnyWWPG1E+wPN+axGMuWc+JPyYERwU1udCbwQcK3FKS?= =?us-ascii?Q?cOwlIXR4mw9YaykcaNwVb4O/oNyM3F6wQ4S5uQM7OmUmEN9h5c39LW8qDrHa?= =?us-ascii?Q?f7U1bYQi45MyT30Wmio64IGGp9I7Nt7eZApu9LzHwR3H2PmT8NEdKQls/Oxu?= =?us-ascii?Q?3dzC9RSt8h9SWmZbjNL1iaha0pmg5KQdPYnqnVcIaqc/zPNInjXs9TfLJbn0?= =?us-ascii?Q?duUBDFry5WHj879yrP6iUj+mhZ9nnP1pwb5wpJutHZR5lpNRLWNIXjMR7IJ6?= =?us-ascii?Q?FWUc0J0wPEfDePzEXJoUIv7zbh1qwpPr3WxZrZpEKot+dkHEa6kUl8uUNm5y?= =?us-ascii?Q?w4WrGU3nebuN3QmZAEQU0ttFTrGjNF89aqeRLrLCmzqYJgK6ac5MU6t0d7ne?= =?us-ascii?Q?l5a5pa5Q0ssjMNCwQm7xd0OokJUzfQPcj9ElOIPchmFFnq4J1Q+rEo2sOYmQ?= =?us-ascii?Q?DLSg6sV5Hwjrxj3LoiSKROuvnxtETugzqzEmCvCNMr/BfCOo9b2lXPPyyAMQ?= =?us-ascii?Q?ddG73kAk2DGWjoBhcMrJM3YcGPWWrrE3UhOps1o6g9QrXI0w7SG5nHYaeZgk?= =?us-ascii?Q?t5/B9mTuwq9eQjfCPbG5iyO+omR7JUYUJvD2jN1jymnhBgypADDodfIswnq/?= =?us-ascii?Q?ViSSCsBjSnPZGlIatBJ7ILVTWnn/mSkUbEMq?= 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)(82310400026)(36860700013)(1800799024)(7416014)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2025 18:08:09.7905 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 564fb9cb-bbe0-4886-4d92-08ddbe4a65a7 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: CY4PEPF0000FCC4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7495 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1751998273435116600 Content-Type: text/plain; charset="utf-8" From: Alejandro Vallejo Moving forward the idea is for there to be: 1. Basic DT support: used by dom0less/hyperlaunch. 2. Full DT support: used for device discovery and HW setup. Rename HAS_DEVICE_TREE to HAS_DEVICE_TREE_DISCOVERY to describe (2) and create a new DEVICE_TREE_PARSE to describe (1). Have DEVICE_TREE_PARSE selected by both HAS_DEVICE_TREE_DISCOVERY and DOM0LESS_BOOT. Add a dependency on STATIC_MEMORY for discovery, as it relies on the memory map itself being described on the DTB. Signed-off-by: Alejandro Vallejo Acked-by: Jan Beulich # iommu Reviewed-by: Stefano Stabellini --- v6: * Moved CONFIG_DEVICE_TREE_PARSE to preserve sorting --- xen/Kconfig.debug | 2 +- xen/arch/arm/Kconfig | 2 +- xen/arch/ppc/Kconfig | 2 +- xen/arch/riscv/Kconfig | 2 +- xen/common/Kconfig | 15 ++++++++++----- xen/common/Makefile | 4 ++-- xen/common/device.c | 4 ++-- xen/common/efi/boot.c | 2 +- xen/common/sched/Kconfig | 2 +- xen/drivers/char/ns16550.c | 6 +++--- xen/drivers/passthrough/Makefile | 2 +- xen/drivers/passthrough/iommu.c | 2 +- xen/include/asm-generic/device.h | 10 +++++----- xen/include/xen/iommu.h | 8 ++++---- xen/include/xsm/dummy.h | 4 ++-- xen/include/xsm/xsm.h | 12 ++++++------ xen/xsm/dummy.c | 2 +- xen/xsm/flask/hooks.c | 6 +++--- xen/xsm/xsm_core.c | 4 ++-- xen/xsm/xsm_policy.c | 4 ++-- 20 files changed, 50 insertions(+), 45 deletions(-) diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug index 38a134fa3b..d900d926c5 100644 --- a/xen/Kconfig.debug +++ b/xen/Kconfig.debug @@ -92,7 +92,7 @@ config VERBOSE_DEBUG =20 config DEVICE_TREE_DEBUG bool "Device tree debug messages" - depends on HAS_DEVICE_TREE + depends on DEVICE_TREE_PARSE help Device tree parsing and DOM0 device tree building messages are logged in the Xen ring buffer. diff --git a/xen/arch/arm/Kconfig b/xen/arch/arm/Kconfig index 3f25da3ca5..74b16f7167 100644 --- a/xen/arch/arm/Kconfig +++ b/xen/arch/arm/Kconfig @@ -15,7 +15,7 @@ config ARM select FUNCTION_ALIGNMENT_4B select GENERIC_UART_INIT select HAS_ALTERNATIVE if HAS_VMAP - select HAS_DEVICE_TREE + select HAS_DEVICE_TREE_DISCOVERY select HAS_DOM0LESS select HAS_GRANT_CACHE_FLUSH if GRANT_TABLE select HAS_STACK_PROTECTOR diff --git a/xen/arch/ppc/Kconfig b/xen/arch/ppc/Kconfig index 917f5d53a6..5bedf6055e 100644 --- a/xen/arch/ppc/Kconfig +++ b/xen/arch/ppc/Kconfig @@ -1,7 +1,7 @@ config PPC def_bool y select FUNCTION_ALIGNMENT_4B - select HAS_DEVICE_TREE + select HAS_DEVICE_TREE_DISCOVERY select HAS_UBSAN select HAS_VMAP =20 diff --git a/xen/arch/riscv/Kconfig b/xen/arch/riscv/Kconfig index 62c5b7ba34..8fd3c314ea 100644 --- a/xen/arch/riscv/Kconfig +++ b/xen/arch/riscv/Kconfig @@ -2,7 +2,7 @@ config RISCV def_bool y select FUNCTION_ALIGNMENT_16B select GENERIC_BUG_FRAME - select HAS_DEVICE_TREE + select HAS_DEVICE_TREE_DISCOVERY select HAS_PMAP select HAS_UBSAN select HAS_VMAP diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 6d784da839..8806beeb27 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -12,9 +12,14 @@ config CORE_PARKING bool depends on NR_CPUS > 1 =20 +config DEVICE_TREE_PARSE + bool + select LIBFDT + config DOM0LESS_BOOT bool "Dom0less boot support" if EXPERT - depends on HAS_DOM0LESS && HAS_DEVICE_TREE && DOMAIN_BUILD_HELPERS + depends on HAS_DOM0LESS && DOMAIN_BUILD_HELPERS + select DEVICE_TREE_PARSE default y help Dom0less boot support enables Xen to create and start domU guests during @@ -85,9 +90,9 @@ config HAS_ALTERNATIVE config HAS_COMPAT bool =20 -config HAS_DEVICE_TREE +config HAS_DEVICE_TREE_DISCOVERY bool - select LIBFDT + select DEVICE_TREE_PARSE =20 config HAS_DOM0LESS bool @@ -154,7 +159,7 @@ config NUMA =20 config STATIC_MEMORY bool "Static Allocation Support (UNSUPPORTED)" if UNSUPPORTED - depends on DOM0LESS_BOOT + depends on DOM0LESS_BOOT && HAS_DEVICE_TREE_DISCOVERY help Static Allocation refers to system or sub-system(domains) for which memory areas are pre-defined by configuration using physical @@ -553,7 +558,7 @@ config DOM0_MEM =20 config DTB_FILE string "Absolute path to device tree blob" - depends on HAS_DEVICE_TREE + depends on HAS_DEVICE_TREE_DISCOVERY help When using a bootloader that has no device tree support or when there is no bootloader at all, use this option to specify the absolute path diff --git a/xen/common/Makefile b/xen/common/Makefile index 98f0873056..d541fbcf49 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -6,9 +6,9 @@ obj-$(CONFIG_HYPFS_CONFIG) +=3D config_data.o obj-$(CONFIG_CORE_PARKING) +=3D core_parking.o obj-y +=3D cpu.o obj-$(CONFIG_DEBUG_TRACE) +=3D debugtrace.o -obj-$(CONFIG_HAS_DEVICE_TREE) +=3D device.o +obj-$(CONFIG_HAS_DEVICE_TREE_DISCOVERY) +=3D device.o obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) +=3D device.o -obj-$(CONFIG_HAS_DEVICE_TREE) +=3D device-tree/ +obj-$(CONFIG_HAS_DEVICE_TREE_DISCOVERY) +=3D device-tree/ obj-$(CONFIG_IOREQ_SERVER) +=3D dm.o obj-y +=3D domain.o obj-y +=3D event_2l.o diff --git a/xen/common/device.c b/xen/common/device.c index 33e0d58f2f..0c0afad49f 100644 --- a/xen/common/device.c +++ b/xen/common/device.c @@ -11,7 +11,7 @@ =20 #include =20 -#ifdef CONFIG_HAS_DEVICE_TREE +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY =20 extern const struct device_desc _sdevice[], _edevice[]; =20 @@ -56,7 +56,7 @@ enum device_class device_get_class(const struct dt_device= _node *dev) return DEVICE_UNKNOWN; } =20 -#endif +#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */ =20 #ifdef CONFIG_ACPI =20 diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c index 9306dc8953..31b4039049 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -623,7 +623,7 @@ static int __init __maybe_unused set_color(uint32_t mas= k, int bpp, return max(*pos + *sz, bpp); } =20 -#ifndef CONFIG_HAS_DEVICE_TREE +#ifndef CONFIG_HAS_DEVICE_TREE_DISCOVERY static int __init efi_check_dt_boot(const EFI_LOADED_IMAGE *loaded_image) { return 0; diff --git a/xen/common/sched/Kconfig b/xen/common/sched/Kconfig index 18ca1ce7ab..1fb622e6cf 100644 --- a/xen/common/sched/Kconfig +++ b/xen/common/sched/Kconfig @@ -67,7 +67,7 @@ endmenu =20 config BOOT_TIME_CPUPOOLS bool "Create cpupools at boot time" - depends on HAS_DEVICE_TREE + depends on HAS_DEVICE_TREE_DISCOVERY help Creates cpupools during boot time and assigns cpus to them. Cpupools options can be specified in the device tree. diff --git a/xen/drivers/char/ns16550.c b/xen/drivers/char/ns16550.c index 6b4fb4ad31..c1c08b235e 100644 --- a/xen/drivers/char/ns16550.c +++ b/xen/drivers/char/ns16550.c @@ -34,7 +34,7 @@ #include #include #include -#ifdef CONFIG_HAS_DEVICE_TREE +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY #include #endif #ifdef CONFIG_X86 @@ -1766,7 +1766,7 @@ void __init ns16550_init(int index, struct ns16550_de= faults *defaults) =20 #endif /* CONFIG_X86 */ =20 -#ifdef CONFIG_HAS_DEVICE_TREE +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY static int __init ns16550_uart_dt_init(struct dt_device_node *dev, const void *data) { @@ -1845,7 +1845,7 @@ DT_DEVICE_START(ns16550, "NS16550 UART", DEVICE_SERIA= L) .init =3D ns16550_uart_dt_init, DT_DEVICE_END =20 -#endif /* HAS_DEVICE_TREE */ +#endif /* HAS_DEVICE_TREE_DISCOVERY */ =20 #if defined(CONFIG_ACPI) && defined(CONFIG_ARM) #include diff --git a/xen/drivers/passthrough/Makefile b/xen/drivers/passthrough/Mak= efile index a1621540b7..eb4aeafb42 100644 --- a/xen/drivers/passthrough/Makefile +++ b/xen/drivers/passthrough/Makefile @@ -5,6 +5,6 @@ obj-$(CONFIG_ARM) +=3D arm/ =20 obj-y +=3D iommu.o obj-$(CONFIG_HAS_PCI) +=3D pci.o -obj-$(CONFIG_HAS_DEVICE_TREE) +=3D device_tree.o +obj-$(CONFIG_HAS_DEVICE_TREE_DISCOVERY) +=3D device_tree.o obj-$(CONFIG_HAS_PCI) +=3D ats.o obj-$(CONFIG_HAS_PCI_MSI) +=3D msi.o diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iomm= u.c index 16aad86973..c9425d6971 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -638,7 +638,7 @@ int iommu_do_domctl( ret =3D iommu_do_pci_domctl(domctl, d, u_domctl); #endif =20 -#ifdef CONFIG_HAS_DEVICE_TREE +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY if ( ret =3D=3D -ENODEV ) ret =3D iommu_do_dt_domctl(domctl, d, u_domctl); #endif diff --git a/xen/include/asm-generic/device.h b/xen/include/asm-generic/dev= ice.h index 1acd1ba1d8..3bd97e33c5 100644 --- a/xen/include/asm-generic/device.h +++ b/xen/include/asm-generic/device.h @@ -6,7 +6,7 @@ =20 enum device_type { -#ifdef CONFIG_HAS_DEVICE_TREE +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY DEV_DT, #endif DEV_PCI @@ -26,7 +26,7 @@ enum device_class struct device { enum device_type type; -#ifdef CONFIG_HAS_DEVICE_TREE +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY struct dt_device_node *of_node; /* Used by drivers imported from Linux= */ #endif #ifdef CONFIG_HAS_PASSTHROUGH @@ -37,7 +37,7 @@ struct device =20 typedef struct device device_t; =20 -#ifdef CONFIG_HAS_DEVICE_TREE +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY =20 #include =20 @@ -87,9 +87,9 @@ struct device_desc { int (*init)(struct dt_device_node *dev, const void *data); }; =20 -#else /* !CONFIG_HAS_DEVICE_TREE */ +#else /* !CONFIG_HAS_DEVICE_TREE_DISCOVERY */ #define dev_is_dt(dev) ((void)(dev), false) -#endif /* CONFIG_HAS_DEVICE_TREE */ +#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */ =20 #define dev_is_pci(dev) ((dev)->type =3D=3D DEV_PCI) =20 diff --git a/xen/include/xen/iommu.h b/xen/include/xen/iommu.h index ebfada1d88..d3dcd942fa 100644 --- a/xen/include/xen/iommu.h +++ b/xen/include/xen/iommu.h @@ -230,7 +230,7 @@ struct msi_msg; #define PT_IRQ_TIME_OUT MILLISECS(8) #endif /* HAS_PCI */ =20 -#ifdef CONFIG_HAS_DEVICE_TREE +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY #include =20 #ifdef CONFIG_HAS_PASSTHROUGH @@ -307,7 +307,7 @@ static inline int iommu_add_dt_pci_sideband_ids(struct = pci_dev *pdev) =20 #endif /* HAS_PASSTHROUGH */ =20 -#endif /* HAS_DEVICE_TREE */ +#endif /* HAS_DEVICE_TREE_DISCOVERY */ =20 struct page_info; =20 @@ -374,7 +374,7 @@ struct iommu_ops { int (*get_reserved_device_memory)(iommu_grdm_t *func, void *ctxt); void (*dump_page_tables)(struct domain *d); =20 -#ifdef CONFIG_HAS_DEVICE_TREE +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY /* * All IOMMU drivers which support generic IOMMU DT bindings should use * this callback. This is a way for the framework to provide the driver @@ -422,7 +422,7 @@ struct domain_iommu { /* iommu_ops */ const struct iommu_ops *platform_ops; =20 -#ifdef CONFIG_HAS_DEVICE_TREE +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY /* List of DT devices assigned to this domain */ struct list_head dt_devices; #endif diff --git a/xen/include/xsm/dummy.h b/xen/include/xsm/dummy.h index 9227205fcd..12792c3a43 100644 --- a/xen/include/xsm/dummy.h +++ b/xen/include/xsm/dummy.h @@ -423,7 +423,7 @@ static XSM_INLINE int cf_check xsm_deassign_device( =20 #endif /* HAS_PASSTHROUGH && HAS_PCI */ =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE) +#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) static XSM_INLINE int cf_check xsm_assign_dtdevice( XSM_DEFAULT_ARG struct domain *d, const char *dtpath) { @@ -438,7 +438,7 @@ static XSM_INLINE int cf_check xsm_deassign_dtdevice( return xsm_default_action(action, current->domain, d); } =20 -#endif /* HAS_PASSTHROUGH && HAS_DEVICE_TREE */ +#endif /* HAS_PASSTHROUGH && HAS_DEVICE_TREE_DISCOVERY */ =20 static XSM_INLINE int cf_check xsm_resource_plug_core(XSM_DEFAULT_VOID) { diff --git a/xen/include/xsm/xsm.h b/xen/include/xsm/xsm.h index 24acc16125..abeb4b04ad 100644 --- a/xen/include/xsm/xsm.h +++ b/xen/include/xsm/xsm.h @@ -125,7 +125,7 @@ struct xsm_ops { int (*deassign_device)(struct domain *d, uint32_t machine_bdf); #endif =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE) +#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) int (*assign_dtdevice)(struct domain *d, const char *dtpath); int (*deassign_dtdevice)(struct domain *d, const char *dtpath); #endif @@ -535,7 +535,7 @@ static inline int xsm_deassign_device( } #endif /* HAS_PASSTHROUGH && HAS_PCI) */ =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE) +#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) static inline int xsm_assign_dtdevice( xsm_default_t def, struct domain *d, const char *dtpath) { @@ -548,7 +548,7 @@ static inline int xsm_deassign_dtdevice( return alternative_call(xsm_ops.deassign_dtdevice, d, dtpath); } =20 -#endif /* HAS_PASSTHROUGH && HAS_DEVICE_TREE */ +#endif /* HAS_PASSTHROUGH && HAS_DEVICE_TREE_DISCOVERY */ =20 static inline int xsm_resource_plug_pci(xsm_default_t def, uint32_t machin= e_bdf) { @@ -789,7 +789,7 @@ int xsm_multiboot_policy_init( struct boot_info *bi, void **policy_buffer, size_t *policy_size); #endif =20 -#ifdef CONFIG_HAS_DEVICE_TREE +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY /* * Initialize XSM * @@ -839,7 +839,7 @@ static inline int xsm_multiboot_init(struct boot_info *= bi) } #endif =20 -#ifdef CONFIG_HAS_DEVICE_TREE +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY static inline int xsm_dt_init(void) { return 0; @@ -849,7 +849,7 @@ static inline bool has_xsm_magic(paddr_t start) { return false; } -#endif /* CONFIG_HAS_DEVICE_TREE */ +#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */ =20 #endif /* CONFIG_XSM */ =20 diff --git a/xen/xsm/dummy.c b/xen/xsm/dummy.c index 93fbfc43cc..7f67683839 100644 --- a/xen/xsm/dummy.c +++ b/xen/xsm/dummy.c @@ -81,7 +81,7 @@ static const struct xsm_ops __initconst_cf_clobber dummy_= ops =3D { .deassign_device =3D xsm_deassign_device, #endif =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE) +#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) .assign_dtdevice =3D xsm_assign_dtdevice, .deassign_dtdevice =3D xsm_deassign_dtdevice, #endif diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c index 6a53487ea4..78bad6e56b 100644 --- a/xen/xsm/flask/hooks.c +++ b/xen/xsm/flask/hooks.c @@ -1456,7 +1456,7 @@ static int cf_check flask_deassign_device( } #endif /* HAS_PASSTHROUGH && HAS_PCI */ =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE) +#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) static int flask_test_assign_dtdevice(const char *dtpath) { uint32_t rsid; @@ -1517,7 +1517,7 @@ static int cf_check flask_deassign_dtdevice( return avc_current_has_perm(rsid, SECCLASS_RESOURCE, RESOURCE__REMOVE_= DEVICE, NULL); } -#endif /* HAS_PASSTHROUGH && HAS_DEVICE_TREE */ +#endif /* HAS_PASSTHROUGH && HAS_DEVICE_TREE_DISCOVERY */ =20 static int cf_check flask_platform_op(uint32_t op) { @@ -1981,7 +1981,7 @@ static const struct xsm_ops __initconst_cf_clobber fl= ask_ops =3D { .deassign_device =3D flask_deassign_device, #endif =20 -#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE) +#if defined(CONFIG_HAS_PASSTHROUGH) && defined(CONFIG_HAS_DEVICE_TREE_DISC= OVERY) .assign_dtdevice =3D flask_assign_dtdevice, .deassign_dtdevice =3D flask_deassign_dtdevice, #endif diff --git a/xen/xsm/xsm_core.c b/xen/xsm/xsm_core.c index f255fb63bf..b7e864a874 100644 --- a/xen/xsm/xsm_core.c +++ b/xen/xsm/xsm_core.c @@ -25,7 +25,7 @@ #include #endif =20 -#ifdef CONFIG_HAS_DEVICE_TREE +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY #include #endif =20 @@ -166,7 +166,7 @@ int __init xsm_multiboot_init(struct boot_info *bi) } #endif =20 -#ifdef CONFIG_HAS_DEVICE_TREE +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY int __init xsm_dt_init(void) { int ret =3D 0; diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c index 1b4030edb4..3f04375347 100644 --- a/xen/xsm/xsm_policy.c +++ b/xen/xsm/xsm_policy.c @@ -24,7 +24,7 @@ #include #endif #include -#ifdef CONFIG_HAS_DEVICE_TREE +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY # include # include #endif @@ -65,7 +65,7 @@ int __init xsm_multiboot_policy_init( } #endif =20 -#ifdef CONFIG_HAS_DEVICE_TREE +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY int __init xsm_dt_policy_init(void **policy_buffer, size_t *policy_size) { struct boot_module *mod =3D boot_module_find_by_kind(BOOTMOD_XSM); --=20 2.43.0 From nobody Thu Oct 30 23:09:16 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=1751998112; cv=pass; d=zohomail.com; s=zohoarc; b=DbGrJuWYgTp1JcE7lyGkBalEjMoR3YTZF+A/U+IBfIYncRlyRNL3lXm6cOKT8UfL68jmSsvBLEG93a9g2DrsrjAatBuNfBdIN7D0ona+SY6uVYnwht7LXZ5NmkjQ+AeatxunGrhr3qRK4xYTEskjovZzq1BnT4zdlK/Rb3fSRBc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751998112; 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=aawmRkDQfgpKUld2wU0InG12ut22yRhJeR9B5PxPCGA=; b=YtLpf+ENgZnBzU73KCHkkKjPNmkCm8tIZIvL6FsLimuS7nSzKWXYW4SvB0a8Vcvq9dmy0FV2haGC0Ql0C0rtYh9AfdW6FfR0ufUL/2L2qPvZ9AGujVmFIQomrQR+crch3THBt5z7J60Ty4rJyV/Y4Q0PsaE3IgqHEQvENlnUhH8= 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 1751998112098395.31383907411555; Tue, 8 Jul 2025 11:08:32 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1037050.1409765 (Exim 4.92) (envelope-from ) id 1uZCjp-0000NG-77; Tue, 08 Jul 2025 18:08:17 +0000 Received: by outflank-mailman (output) from mailman id 1037050.1409765; Tue, 08 Jul 2025 18:08:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjp-0000N2-3U; Tue, 08 Jul 2025 18:08:17 +0000 Received: by outflank-mailman (input) for mailman id 1037050; Tue, 08 Jul 2025 18:08:16 +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 1uZCjo-0006FB-0w for xen-devel@lists.xenproject.org; Tue, 08 Jul 2025 18:08:16 +0000 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2060c.outbound.protection.outlook.com [2a01:111:f403:2414::60c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 84aa4649-5c26-11f0-a317-13f23c93f187; Tue, 08 Jul 2025 20:08:15 +0200 (CEST) Received: from DS7P220CA0028.NAMP220.PROD.OUTLOOK.COM (2603:10b6:8:223::17) by PH8PR12MB6867.namprd12.prod.outlook.com (2603:10b6:510:1ca::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8880.24; Tue, 8 Jul 2025 18:08:12 +0000 Received: from CY4PEPF0000FCBE.namprd03.prod.outlook.com (2603:10b6:8:223:cafe::ac) by DS7P220CA0028.outlook.office365.com (2603:10b6:8:223::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8901.27 via Frontend Transport; Tue, 8 Jul 2025 18:08:11 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCBE.mail.protection.outlook.com (10.167.242.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8901.15 via Frontend Transport; Tue, 8 Jul 2025 18:08:11 +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; Tue, 8 Jul 2025 13:08:04 -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: 84aa4649-5c26-11f0-a317-13f23c93f187 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=MJsVm11Fk2Yyg5fHIlOH8bLZVl/mx5/qKOBXkWw6n3mTJmbq3uGfoCVa5Xt3MU93ndTq8Y8Z9T40238ur+WlgD2U7U6n/yXXx+DUP8Etbl5LQROBLfW3+S6MxKqxPeXvN5sAj6yEY2kBEPNy/oVbTMgZhrUe7HRJILLMTJg6EgNYCdZk8zf5FmmkK2JWXVOcEF5yCfRgYTqLUp0njtWbBk19sppHYbh92NgIQStPwPAxGm3ARxl8v7jRQ5G8vViDjUQNc7AobXitZ+4sZbAV21r60wceXfxJgr306vok8x3/F+XN7GQup3ISxkKfRK21ogdF3yDshkUb6qaC4Z0gqA== 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=aawmRkDQfgpKUld2wU0InG12ut22yRhJeR9B5PxPCGA=; b=R2CwykSJlR2sthzmVZveKl+r5m0G2d8WCTqgKtINPD5jBc0SrBZVtr9gVvN1WB7ZP4SEFojMLNBOjfiq0xWU1+egiKRtxj4Ihr59aPjtIPrCfffG50lDLiB5rQcRfeHkUi53Be9otMYutz999WZhW75tF4qNI4yJjbusWH+QBhubx1c5KvSHVINDn8e0Z1XGlR/DRbtvsoNKmHVj7VJlIaJAc+phH9MEWAMx1yY+F+8B800vOdZMl46hkocTSk43lVrFwLfBeMH35B8JizNrpcfslvyz2cHi58ko0m5WhnA8GF4ozAvMrw5vIQ1jRUmINmePX7+fxHN+nkk8id2r/A== 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=aawmRkDQfgpKUld2wU0InG12ut22yRhJeR9B5PxPCGA=; b=uAuhq01dhF+doH28VlQ182pV/NTXLhdkFtC/JIX35O10B14pYfWmbrxhUZLm+KbMYSZuYNe2dX0B53VxzXOtiMvl4D0R4qahHBmVKkPekXENc5Lanvz3O5HIMS5xKvz9KDF1Xq3EwFxH0v2Vw+GxqKGrXzQ17JXx/bpEEJMxsLs= 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 , "Daniel P. Smith" Subject: [PATCH v6 10/11] xen/dt: ifdef out DEV_DT-related bits from device_tree.{c,h} Date: Tue, 8 Jul 2025 20:07:19 +0200 Message-ID: <20250708180721.2338036-11-alejandro.garciavallejo@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250708180721.2338036-1-alejandro.garciavallejo@amd.com> References: <20250708180721.2338036-1-alejandro.garciavallejo@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: CY4PEPF0000FCBE:EE_|PH8PR12MB6867:EE_ X-MS-Office365-Filtering-Correlation-Id: e3deb64f-f6c8-4c28-9894-08ddbe4a6663 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?whSQ554B2rPxItYBYiU5g0DwO3AP8OhcdrZ3IPHVbrOkmG5Gq3NO8Nsgi9IY?= =?us-ascii?Q?EBUM0EmZ/d2eAugFj//ZzU2LmWuiQNi6Dt1riuisC3DcYB+3teNUDH89rg9U?= =?us-ascii?Q?ArBgiskatEL0XVdRqNJPdWdiuXLdIigBPxEnslZMovZEwCfZ4yWQF0DNIWur?= =?us-ascii?Q?Eus4HWiPxzeUuvWO+M6I7yK/iyDZFr0h6/8rKy9sgAjqdCuZVniRAxRWChtE?= =?us-ascii?Q?J/GG5JDwcsMfZMXVHoRN/3ie5ZFUUQKPiT6JYvbviqcrU0W5mIXcwrbsRGaD?= =?us-ascii?Q?b6Y0JtcQ51vugHJMspMvn2mlRQKLzWYBgfeETwjOE7evlnsuqk53YL+T0CJF?= =?us-ascii?Q?fK3unvCjL1AYKcgv2403PQOLviYzLwlH15nS4UGY3/MPjvXzL0EVtmI/rQmY?= =?us-ascii?Q?zUwi8steRfNl9jbQwlnjOyTcZeZozl6yd1Jt3qDCxPfQuX1L3GN9k8XbwGcK?= =?us-ascii?Q?6yJYz+pMi6knLwTU0OhnyL0DNZHGpWAlAjeQ04Af/j6Z2spucdco8ljIRCXr?= =?us-ascii?Q?hNU6NkHdhRRxtTNQPmucN1vhMrBgPC3fUSxmYjAJudn4aCCjgsPdBrmwFVmM?= =?us-ascii?Q?JIMDwtCnBsgDvKplicDWs6h28hWutSpW2F/DfYajNfL8bwBoy7X2nz2wMDvW?= =?us-ascii?Q?4p4HRE9J9TT9t+d4ftjrdaClaxDYKgf2Kdk7HZZ77Bf45wNsXk+48D/uqYRr?= =?us-ascii?Q?RkgZ+1t/nu9QMMwkIVHd2DxsUd5r+Io2UnfZp270UQcyupxXVrXCO+/2HY8E?= =?us-ascii?Q?tddPMBSSxaboqBIbWjvmXaPHpbS0s4pPzcB3pF/ePG58yMVic2tDQRn4BkQU?= =?us-ascii?Q?zxBB1VZxi0DFHd4mCWdpT0qZUzQRi12EqVb/9RhowkEXuPkUFL4HZqnBEeO3?= =?us-ascii?Q?G7KaFBY0dd8HxK+ngpaqPkeQQ25GP6tmFh2gCZOwT4LYbMRnSGjCOzBGW2rM?= =?us-ascii?Q?VAYXuFNaOd/CmmR8ZGP+EXRqDN1ScIKx17PpK+Oc6rICTZoFvfpfyvvz0yfv?= =?us-ascii?Q?TtuzS77LNvWVNNxT0swEujTbohZUXnMM38PWYi6PR3AT2eZvV2RTQCjet6uL?= =?us-ascii?Q?Y0F/pCk91xzzJWKbx1vWfDWZo0FVM3VYMWfO4ktchza/5k9QbkufmRjSPC1g?= =?us-ascii?Q?p/2L7qzX/Q85H1UU/T8ndLA3xo/t5EDciqHpKiXBBh8n1PWvgUbDGB+OUiWf?= =?us-ascii?Q?CK8typs6x3Yqpz0LViB3YdAUt+CPr8PZIZ2jPOL88PIr6bnqtHuXaf28Kgtf?= =?us-ascii?Q?dVMy8NYQ7DB4wcN+muNUQMq8d+t+CceCPbm979GNnguAMrBH0bXpZ2ojCy5j?= =?us-ascii?Q?90/Y1V35lnPWlCgxJz6jSEck6hbp3p2e83qnrBqBB6QjkBKhBtWjZIc3hmUA?= =?us-ascii?Q?D3WaaQ85spggVzKd9uZ6ZVmY6E2i9dejQ2cPH+GeJV2zAeSsQj4liRaIDxXf?= =?us-ascii?Q?U+eqDy9alQ4qi1Pq+DXmuEjFK7I2MIKojp7vVkC+lTfbA4dTtMH0qpVnJGwF?= =?us-ascii?Q?gV1thwcCSCXpBWYdUN2+fC9nKWNsa8EKH5ml?= 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)(82310400026)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2025 18:08:11.0262 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e3deb64f-f6c8-4c28-9894-08ddbe4a6663 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: CY4PEPF0000FCBE.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6867 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1751998113182116600 Content-Type: text/plain; charset="utf-8" From: Alejandro Vallejo Architectures that don't discover devices via DT may skip anything to do with device_t during the DT unflattening phase. Make device-tree.c stop requiring CONFIG_HAS_DEVICE_TREE_DISCOVERY so it may function with CONFIG_DEVICE_TREE_PARSE alone. This allows CONFIG_DEVICE_TREE_PARSE to unflatten a DT ignoring its devices if CONFIG_HAS_DEVICE_TREE_DISCOVERY is not selected. Signed-off-by: Alejandro Vallejo Reviewed-by: Stefano Stabellini --- xen/common/device-tree/device-tree.c | 2 ++ xen/include/xen/device_tree.h | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/xen/common/device-tree/device-tree.c b/xen/common/device-tree/= device-tree.c index 4ebdb2e52e..84daa3f0ed 100644 --- a/xen/common/device-tree/device-tree.c +++ b/xen/common/device-tree/device-tree.c @@ -2030,9 +2030,11 @@ static unsigned long unflatten_dt_node(const void *f= dt, ((char *)pp->value)[sz - 1] =3D 0; dt_dprintk("fixed up name for %s -> %s\n", pathp, (char *)pp->value); +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY /* Generic device initialization */ np->dev.type =3D DEV_DT; np->dev.of_node =3D np; +#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */ } } if ( allnextpp ) diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h index 8a39a60c54..06d7643622 100644 --- a/xen/include/xen/device_tree.h +++ b/xen/include/xen/device_tree.h @@ -108,9 +108,12 @@ struct dt_device_node { */ struct list_head domain_list; =20 +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY struct device dev; +#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */ }; =20 +#ifdef CONFIG_HAS_DEVICE_TREE_DISCOVERY #define dt_to_dev(dt_node) (&(dt_node)->dev) =20 static inline struct dt_device_node *dev_to_dt(struct device *dev) @@ -119,6 +122,7 @@ static inline struct dt_device_node *dev_to_dt(struct d= evice *dev) =20 return container_of(dev, struct dt_device_node, dev); } +#endif /* CONFIG_HAS_DEVICE_TREE_DISCOVERY */ =20 #define MAX_PHANDLE_ARGS 16 struct dt_phandle_args { --=20 2.43.0 From nobody Thu Oct 30 23:09:16 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=1751998268; cv=pass; d=zohomail.com; s=zohoarc; b=IhSHjKj1HUKNLt2s+XABJHcSEAqiR/xkF0NpoaBbcAIvGz7oCS1MUqhxTL1hqLOt0CUNMjcPruEOaWpRb93bDq0AmEWBlZcbQwYEu9TmnuvDIdON1SlH7xhE0DkjP92HyDIDX0fKQUHospf5LIV7RP/cEV/HNXTsSMQnfF2r4pM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1751998268; 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=YWgA6ZcAAgNHomu+hS5t/Jbt4vV9HHO7nNlAbbTffuo=; b=bbCBHq8riDijtwqjITAWRsY0CjbTMSvfIlewhrxU5RMI2jv0B6QHkkFe7hL3I4wlqrKXohu2NB60cqIvd/uDYtflzPGBYWt+9Xg0aNaK0iGYAvaAIjx2mQGpPwka9s3E3loCsFZkDRC+i0NlnYt2/Ag6hq/sBtDhfEdNY5hzOSQ= 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 1751998267749735.5362161930311; Tue, 8 Jul 2025 11:11:07 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1037106.1409785 (Exim 4.92) (envelope-from ) id 1uZCmO-0003y7-1S; Tue, 08 Jul 2025 18:10:56 +0000 Received: by outflank-mailman (output) from mailman id 1037106.1409785; Tue, 08 Jul 2025 18:10:56 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCmN-0003y0-Tv; Tue, 08 Jul 2025 18:10:55 +0000 Received: by outflank-mailman (input) for mailman id 1037106; Tue, 08 Jul 2025 18:10:54 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uZCjv-0005Uq-PK for xen-devel@lists.xenproject.org; Tue, 08 Jul 2025 18:08:23 +0000 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on20605.outbound.protection.outlook.com [2a01:111:f403:2412::605]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 874cc157-5c26-11f0-b894-0df219b8e170; Tue, 08 Jul 2025 20:08:21 +0200 (CEST) Received: from PH7P222CA0003.NAMP222.PROD.OUTLOOK.COM (2603:10b6:510:33a::18) by CY8PR12MB7706.namprd12.prod.outlook.com (2603:10b6:930:85::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8901.26; Tue, 8 Jul 2025 18:08:12 +0000 Received: from CY4PEPF0000FCC4.namprd03.prod.outlook.com (2603:10b6:510:33a:cafe::9) by PH7P222CA0003.outlook.office365.com (2603:10b6:510:33a::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8922.21 via Frontend Transport; Tue, 8 Jul 2025 18:08:12 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000FCC4.mail.protection.outlook.com (10.167.242.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8901.15 via Frontend Transport; Tue, 8 Jul 2025 18:08:12 +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; Tue, 8 Jul 2025 13:08:06 -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: 874cc157-5c26-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QovpYgd9I33kZ94d8PlNBwwm9X1YJKmajIuLuGAPNpGJhGbk9bCnRWKQvt03O3mJF+tLyl8tRJHMktHXEAHv7RNxQvmPhNzQNSyHbj4uqJ42foa4xFPvIon5r0U221YHcUV7Muqzp6PrMZsy9Q8CqKtsyymoiLBF62y19q7IGn88cbT4527ptWR3CuU45jh/xMTeyVO1BIZ682tIk0cSU71D1PAwYpOR9jovb8jfZp8y4IN/yQAUEZ9xTTJYTrfCXgS3DlQ9M1Fe/400G4eiwxwd9gFbwzkKGYwcMLc/sXu6S4NEUn61k5dPcq4sNfb3m9K8WP1Y1f191/4xl2Cxng== 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=YWgA6ZcAAgNHomu+hS5t/Jbt4vV9HHO7nNlAbbTffuo=; b=ct2SGmHlDXDn2h8G2EcknXg7SvqCYeEt5+Dja8WT2Gx33Ox+v4sav6kMxAI/zS88deeyRlx0XDUEfoEELEQ+SdJ6od1N1MxQArg5zwlk5gKcVd/yr0opmbaRCJnosHjW14TS1Tj0CiYIHg4+8lbuEDdA82yhBuUbYXfDUQEkRuH15Kkv56TUy+d1ng+/ExhLTXbgKA7KLYfr9cODcb5QRugHy2u/1kKfeOXYNRUuagHa4LKRvkTuJE5u9w2bX7KZzpMQsdJru4TQSePIDt0GZUaJyDEl3pTb8YFQVN/vHFCXcLSOGLXKxRpc4GwZpPzpWGni1ahzXKQisubtwjljLA== 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=YWgA6ZcAAgNHomu+hS5t/Jbt4vV9HHO7nNlAbbTffuo=; b=B52PHA/d/HpBHSsgFVKd37p2AhlgasS5filpaZbV3hkCMCKtOja2wiGfVqSCu0lSAT2YjrhB9DujfXjtXh0ws75ZUlhYhJ1BTy/D31sWSalZqTu+NMS3rgPH4mCfqK43k9myQK+3R4wSiG5l2n0UljhJFQrxrODDcfkPWIxBXsg= 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 , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , "Julien Grall" , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , "Bertrand Marquis" , "Daniel P. Smith" Subject: [PATCH v6 11/11] xen/dt: Allow CONFIG_DEVICE_TREE_PARSE to include device-tree/ Date: Tue, 8 Jul 2025 20:07:20 +0200 Message-ID: <20250708180721.2338036-12-alejandro.garciavallejo@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250708180721.2338036-1-alejandro.garciavallejo@amd.com> References: <20250708180721.2338036-1-alejandro.garciavallejo@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: CY4PEPF0000FCC4:EE_|CY8PR12MB7706:EE_ X-MS-Office365-Filtering-Correlation-Id: 72c2c111-f43f-43e3-0200-08ddbe4a671f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?it8xAxzjBIHfDdTBS2dihktmxd1FTmCAsf+N2NFtxmoaaN5FBBchXRFMcSvT?= =?us-ascii?Q?wDyKR2KyZMwDBvnQbz1fKt+3Yyst75BwjiTDfEZSIQoHPwUSAXJ99P0+xVcy?= =?us-ascii?Q?ta91Nx4L8LhcoAVg1qBNfP9ykQ2nDmr/tWQZWPztly4fEFCK2WJbyFgaH0Bd?= =?us-ascii?Q?Ggikn4GW16tZUq/RxXOOqQduZwcgEdKnOwsrbpi6NE16ZjTTv5PAmy1U1Mq1?= =?us-ascii?Q?6+9K7vNCqCqHfCQ2VbVuOW4GJP0X3H9f+mwujh08QfA6LFwfVfO+G5/Y1Fdn?= =?us-ascii?Q?WQwJELZzQ5EHG8b4bPUEctz8kUJqqn0dLoVFD3r0DuHdt7nwgc2Sc1DDgjOk?= =?us-ascii?Q?52lZTK67G1cNWmPZxuRo3n7wEc3UuaTdDoyCFQC+67lAUCDT8nI/QiGFCisj?= =?us-ascii?Q?HmjYaZzDFcxNJ3H6nT1nMjjIevxg7DPfJ/VWxRcTUMLWHLSIG2R9RGGm2gPO?= =?us-ascii?Q?NGQg5UHtIGi3a6l1i2t6wjKrexPwwHlid1/ZfKqkbGAEHAXQJJAGoTCPQJrW?= =?us-ascii?Q?8sfjmYIvvvWQisZqbkr4ugX5/m+1wIGp4BHp/BIE1Kzdd22DnxVRgAN0kjJc?= =?us-ascii?Q?p5fnWVL+T/yK2Vqg9PKaRHyeCc3+0PJi7NU/nZeyBSermf1UNrXHG0gAP4qe?= =?us-ascii?Q?nNVZLFoi/MbHnfhD4pLse84W59yDtfQDwrdnnLot4ATyAUbbAKVDwrsXRWZy?= =?us-ascii?Q?UCY/zYUazwLg1QJvxZRcvG9OsXXI65P1HhvKke95CvfOwT9OJFrQigaCh1le?= =?us-ascii?Q?eRlTHbqEqhv9pz6mmrmnLMEN2tJh90GH5PaKAD+TY2U9U1eES8WgfxodWC/a?= =?us-ascii?Q?0xdYA9E1TlfrGDxhX4UC8SKG+rN1Ve+roKd8TZog610593hsmEPBOjFD4Z7J?= =?us-ascii?Q?o3S8RtttXRDU18PCrbMwhLg7Ic8m8VqRmH0M6iU+7LzFAcZSuIR7GSHP6YAg?= =?us-ascii?Q?z9wA20cm5s1nhWDWZxXxbaNOeChUEV+tlUx9bv5EDhFJHFScIPiW4uJdXDyW?= =?us-ascii?Q?pQ4WBe9K7VVhe1sS3MCezdPFoj5mTEvY6feNc24sv0VlxyVogr/hvLoi5yhi?= =?us-ascii?Q?PrpDmQf5PDYtFbJwfiXb1WCUb7uNlg0FKtqI4etCi1Iqgi+L7JCvMLmrPfAu?= =?us-ascii?Q?ltk9KhHVgghTMugFfrKo3I4R/t45AgTyzNq4z7WxE3wyoCMTBz5WHpIGocd5?= =?us-ascii?Q?IBmUi/J2IgHir2b6SSFNRO0WmKhk2mbkE4MtY99tI9If9eL3MnCsWAIjW9l8?= =?us-ascii?Q?RMOU6ZDN0SvCn7+rshqIkGBAGaTQm8Cr3FBLz6LCnAX+dL717wFSbpZZ7lEa?= =?us-ascii?Q?irXFlNrFKxjJY10ebqT/nxELHCZvpiLbwOzO0C3y524FXDa2B4cREiydsyxo?= =?us-ascii?Q?LgSb7hQedhRgwAeDcSKrXl54VTBPBdsoxv5gl/nl/ubpbHIgLd9DTuKN0XQB?= =?us-ascii?Q?NwkZZDycZqqf8swidzNQb/9PSI3Ql7yCN+WbDifQdVoOGdmEGL+v8jEl0xq/?= =?us-ascii?Q?evLETc1zkE6P+3FvpxNhwHc+ljUbTle1FuCH?= 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)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2025 18:08:12.2488 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 72c2c111-f43f-43e3-0200-08ddbe4a671f 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: CY4PEPF0000FCC4.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7706 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1751998268864116600 Content-Type: text/plain; charset="utf-8" From: Alejandro Vallejo This allows bootfdt.c and device-tree.c to be usable without CONFIG_HAS_DEVICE_TREE_DISCOVERY. Gate everything else on CONFIG_HAS_DEVICE_TREE_DISCOVERY. Signed-off-by: Alejandro Vallejo Acked-by: Michal Orzel --- xen/common/Makefile | 2 +- xen/common/device-tree/Makefile | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/common/Makefile b/xen/common/Makefile index d541fbcf49..265468d751 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -8,7 +8,7 @@ obj-y +=3D cpu.o obj-$(CONFIG_DEBUG_TRACE) +=3D debugtrace.o obj-$(CONFIG_HAS_DEVICE_TREE_DISCOVERY) +=3D device.o obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) +=3D device.o -obj-$(CONFIG_HAS_DEVICE_TREE_DISCOVERY) +=3D device-tree/ +obj-$(CONFIG_DEVICE_TREE_PARSE) +=3D device-tree/ obj-$(CONFIG_IOREQ_SERVER) +=3D dm.o obj-y +=3D domain.o obj-y +=3D event_2l.o diff --git a/xen/common/device-tree/Makefile b/xen/common/device-tree/Makef= ile index 8abc069c4b..e399242cdf 100644 --- a/xen/common/device-tree/Makefile +++ b/xen/common/device-tree/Makefile @@ -1,11 +1,11 @@ obj-y +=3D bootfdt.init.o -obj-y +=3D bootinfo-fdt.init.o -obj-y +=3D bootinfo.init.o +obj-$(CONFIG_HAS_DEVICE_TREE_DISCOVERY) +=3D bootinfo-fdt.init.o +obj-$(CONFIG_HAS_DEVICE_TREE_DISCOVERY) +=3D bootinfo.init.o obj-y +=3D device-tree.o obj-$(CONFIG_DOMAIN_BUILD_HELPERS) +=3D domain-build.init.o obj-$(CONFIG_DOM0LESS_BOOT) +=3D dom0less-build.init.o obj-$(CONFIG_OVERLAY_DTB) +=3D dt-overlay.o -obj-y +=3D intc.o +obj-$(CONFIG_HAS_DEVICE_TREE_DISCOVERY) +=3D intc.o obj-$(CONFIG_DOMAIN_BUILD_HELPERS) +=3D kernel.o obj-$(CONFIG_STATIC_EVTCHN) +=3D static-evtchn.init.o obj-$(CONFIG_STATIC_MEMORY) +=3D static-memory.init.o --=20 2.43.0