From nobody Fri Oct 31 03:54:05 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=1750444214; cv=pass; d=zohomail.com; s=zohoarc; b=kgnKD54Dga+ZarOTCd07hTnNbDvh+ttew0rRFpD2oXfF00XPZnWBou3NgpQ2cTxeli2X2YXHIvPS+WfVo4L2Iclk49q9eUZgrUKKS5ih/OlYl21j82Ek0/rFBi9ePFQeG0kbOEF5LqtS1v7GzJBNt0d4kpKbeXsZaQ9SROPI2i8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750444214; 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=qPIMmLTlV3KNkR+uQ9J8eRat1nufRPKVw3tSoa4EpJs=; b=MZIi5jKfnNqpFX+NKmElEs4Gr65R7ig7sTtQvBm1Fwl6O9atx2+fVIQOn2ellKTVMCC5dPQwmNL9He6XNrITkWP/BnTdfN9Dm0/RXsg6/fN22/2a9w6fd4kDVpPhIZQ0Un5tbHnpIS92QjS7g7hUixc9Kt93yhz+4whbBw7Gbyk= 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 17504442142863.334297525656325; Fri, 20 Jun 2025 11:30:14 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1021077.1397122 (Exim 4.92) (envelope-from ) id 1uSgUp-0005L5-JX; Fri, 20 Jun 2025 18:29:51 +0000 Received: by outflank-mailman (output) from mailman id 1021077.1397122; Fri, 20 Jun 2025 18:29:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uSgUp-0005Ky-Gr; Fri, 20 Jun 2025 18:29:51 +0000 Received: by outflank-mailman (input) for mailman id 1021077; Fri, 20 Jun 2025 18:29:50 +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 1uSgUo-00057I-8r for xen-devel@lists.xenproject.org; Fri, 20 Jun 2025 18:29:50 +0000 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on20628.outbound.protection.outlook.com [2a01:111:f403:2413::628]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8c076d95-4e04-11f0-a30e-13f23c93f187; Fri, 20 Jun 2025 20:29:49 +0200 (CEST) Received: from BN9P220CA0011.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:13e::16) by SA1PR12MB6703.namprd12.prod.outlook.com (2603:10b6:806:253::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8835.35; Fri, 20 Jun 2025 18:29:45 +0000 Received: from BN1PEPF00006000.namprd05.prod.outlook.com (2603:10b6:408:13e:cafe::17) by BN9P220CA0011.outlook.office365.com (2603:10b6:408:13e::16) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8857.25 via Frontend Transport; Fri, 20 Jun 2025 18:29:43 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by BN1PEPF00006000.mail.protection.outlook.com (10.167.243.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8857.21 via Frontend Transport; Fri, 20 Jun 2025 18:29:43 +0000 Received: from xcbagarciav01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 20 Jun 2025 13:29:37 -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: 8c076d95-4e04-11f0-a30e-13f23c93f187 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qJUMJR8PPmBlmzzCRfdrCD4OMLk8cXTLh4X7Rcjib82138YQbfWGuHXw6JxISWFjA343rUOHTTVC5T1NDuppqF5moXrRf6VLHIRHWNoXYTPLUSzNHG4w/OhXFMic2JdHbdCYg4WCM584oQ3uBkdXf5mYDr40SEdOD/pQKqRaC3bBiElo6UkJrYDzE53RjIiCu8BTKCVm1C1XTZKp03Tv5D2zVlfXXKlxFYNLMbp8HJsQ+1Cfc0czQBZBYDLMyPnwvjPrhuCw6HBACA6wd2nHzqaaCWLS0evi2+M/7IqvL5rSRF21lY93s17jmrP5hRO/LiGo+oUbWoi+Onz8xckmdw== 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=qPIMmLTlV3KNkR+uQ9J8eRat1nufRPKVw3tSoa4EpJs=; b=hx3dmwh0B94GCsWUcB5awv8UJyrDZ7DaOX/S6iWn+bcRWSF8X7LQGBW3Dlg70pcGAoh0P+gdlxbjpYeof2nF6hBWTs6edujWKSLb/7FxcrdG7ISBT7WK4jXmobd2KLMdebAg9d1kev0fTn09Y6MO7ogF7QleyGcOhgHl0ujpXSrFOJL45REdfJZ7Qm2tYLSiUZXFRsAkWS5omscXD69XUz+ob1vXkau2kYVfao/II8RweGFgg6J94FdsYNBEfQTKsG8In77MQU6NPfU53dlGRg2uIRiCplEN7axHYPnzl7Vs5yUOYTkn1ddFAQFtG0SutctqlhP7Lr/usTRXprrXAg== 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=qPIMmLTlV3KNkR+uQ9J8eRat1nufRPKVw3tSoa4EpJs=; b=e7vwp0y0V10T+N2WciXi9jsiPyJxgoA5pVkVdlHMxflFt9871+JrzFcBXyHwlqUQATy0kgzOSSHM422JtFPVPThBPUOR6ifn0EFj0lhECMU6C93zg4mGb7wtXDm3vmlrq+KWeviyVy8wBHGQrszjylkf2UkikL7e8MKh0wEih3Q= 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 Subject: [PATCH v4 01/12] CODING_STYLE: Custom type names must be snake-cased by word. Date: Fri, 20 Jun 2025 20:28:47 +0200 Message-ID: <20250620182859.23378-2-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250620182859.23378-1-agarciav@amd.com> References: <20250620182859.23378-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00006000:EE_|SA1PR12MB6703:EE_ X-MS-Office365-Filtering-Correlation-Id: 45b4271b-7e38-4012-db89-08ddb0286d91 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?wS+9PJyOWceFqQHOVQ7Ztf5t7khxF02zCSQHr0Bg7e+Patz31e/FNvKNBbR6?= =?us-ascii?Q?OcI8n/GVEvlRsBwsu4y9KnBgc6yGT0NeEn6lIKdJh5d1DWMD+axCmYNNY6r1?= =?us-ascii?Q?ErI4yPjaMDAE3oIrYPTiaE1eSgB4+E/7lvdWvb24QbZM1btdw6Gr7mPNqFSr?= =?us-ascii?Q?hgc16VsGjHgiIut0n3/IJcxvFWxkDUf6E5xoOFxw+fDi+fnqRuUbALQbMFf0?= =?us-ascii?Q?C5gbef6+qwhYxuZh7qr2T/p3OlWwjLEB7/y7AsO1f390TmoTaki5nyfsEUno?= =?us-ascii?Q?kV4NP1bZ3Mydy8+gagWpC4/fIx6V1hOw2bpgKgy2hnAbUdJ8J+pIdpR7RnQQ?= =?us-ascii?Q?TQf4k58z2dWXbAlAmkfkP5BQyH7BNt5HRpVk3Hq4xFesqFUuzTynP9RM08li?= =?us-ascii?Q?CqzLOTnphmz+QidCkCSJkMjhw1nA3acWCYWXJAhUZHVolB06jwHFKNUSje2L?= =?us-ascii?Q?fBdSubw+SyHc7OdYYFCAd+YIMNe1w3tCI8kHOigKPo4bZSEhrE7re74F4sz2?= =?us-ascii?Q?L92SUNGug6SL//PyohzOxA3ue4x9oAYIwwpf0MTfxKEG8TFLrwNa76IWeL+9?= =?us-ascii?Q?/zVQGqI/oH7cG9hobs3/KtjnYChxOaO635JDCki1w4RUqzuDgpuVs/bMR6LI?= =?us-ascii?Q?4zDCY5cgtirTUCIwn0I7lzDkMTiA3N8NNxiRI2uQ5cwsVuwvSygJwh/JE//2?= =?us-ascii?Q?wUM1fN46m47o6SuxZxXLJPi/WsjH8xRJMq7AhfXyMeST52vPI2n7lvrjbxnC?= =?us-ascii?Q?rSkDyJnvmRbDbrGTZih+9EPtbSKThFIyHyUwY/VoOYvH9rfZzNX0h3T+tGpx?= =?us-ascii?Q?H8W7GW4mcrWNQZnLvhv78BdMMvhJLrU51oZYUbnpm34RzrK9W6xKSUPFL2dz?= =?us-ascii?Q?tTuGiD2jZdvGTpd187j+ZEM541ampuNthQ4BtJvs6SkdcQUquU8ZjDFM3s68?= =?us-ascii?Q?qZ3ahf2+v/1ogfAm0Wsih9GjqR1f83ZPD1iO7Eh+2KiU5ztzZGmgI1m95vk1?= =?us-ascii?Q?gXrFcLnIccQzuR/9uN/MoQcEDDQdxAtypJxipWAKNYNAkGbCC9U76/ZFkywr?= =?us-ascii?Q?21Fq9vYTE3/C0LL+3Kw4IE2cdgrhkdHY0tDJJ6Zci9pESpUwhMCTOi2PByQJ?= =?us-ascii?Q?WIMS7VvisOOc1HoCG10V/uq9c8n2JBq2vySrhFCfcXtaBsXkw+d6XGAwNwfA?= =?us-ascii?Q?1NDR2gyxZAYSuZkMDJJpRIcBIOI6GVQcEArZAHuz4xGNniM9vZFxGHZ7AlHO?= =?us-ascii?Q?zjkgbVs18h8E0EwlYva1MgYy9q8/41vIpgY8/5VjAarqGzTi2YsnNB5H0lub?= =?us-ascii?Q?rgC5uVkSVLTDoVpEU+CzZRWLalJZFif+QtLMYeCUhzayT06a/VXNFQtA59Rf?= =?us-ascii?Q?PPDVMFkzPRbkOun1SCNjW+mlyEK5N5vFtiNM4iT/d1GJIDqWMqjRPyf0cY5C?= =?us-ascii?Q?GJjvkt2HJ3IHe+7P/eHWAlSyY5lvVWMeaUBTBHjnzUeIKUf9mrOmg12m2k59?= =?us-ascii?Q?7idJxy/wu1SnrlvBU1HIXPFyIOlM1vmM/maT?= 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)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2025 18:29:43.9512 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 45b4271b-7e38-4012-db89-08ddb0286d91 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: BN1PEPF00006000.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB6703 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1750444216458116600 Content-Type: text/plain; charset="utf-8" There's the unwritten convention in x86 of splitting type names using underscores. Add such convention to the CODINNG_STYLE to make it common and less unwritten. Signed-off-by: Alejandro Vallejo Acked-by: Stefano Stabellini --- v4: * Move new paragraph into a new "Identifiers" section --- CODING_STYLE | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CODING_STYLE b/CODING_STYLE index 5644f1697f..7bf3848444 100644 --- a/CODING_STYLE +++ b/CODING_STYLE @@ -113,6 +113,12 @@ Braces should be omitted for blocks with a single stat= ement. e.g., if ( condition ) single_statement(); =20 +Identifiers +----------- + +When giving names to identifiers (variables, functions, constants...), sep= arate +words using underscores (for example, use "my_foo" instead of "myfoo"). + Types ----- =20 --=20 2.43.0 From nobody Fri Oct 31 03:54:05 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=1750444218; cv=pass; d=zohomail.com; s=zohoarc; b=ckEcU4u4NU3v5J8QvwNmdx4ao9Db9+FDmvl7e7T7G4bXCJkmHy37rF2ZzmwW/I+Lj7UNjriC8HPZUnrZm2Q/r1L9dFJ1i2IN6VSPAkbqjGf9LxFQDQWliIveRzzQOQZz/nskf2fUJUzt83InrEdV2v6xkcJlW/uD8mpW0Bx4nK8= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750444218; 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=p44M7RzHGXTyxxIkCh7v0gyMVi75uj2BQ3nBpbpii4U=; b=fhsDOMIEOVams0+g1/AeI6rjkPo8ISOPg3ythGB2T/NWnnOFwNbcVmllZ6gSjeUb9XtOGr9UZGvamXFLN63HAVovaOph0k1fsB0wbKk4Ugvclbbpe06FfN85utH6nfw+dlIlNMcurF32i1aRUw8o56zCmjlWo5dmAhp3DP4S/+k= 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 1750444218985425.9823716375828; Fri, 20 Jun 2025 11:30:18 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1021082.1397133 (Exim 4.92) (envelope-from ) id 1uSgV0-0005sY-Vm; Fri, 20 Jun 2025 18:30:02 +0000 Received: by outflank-mailman (output) from mailman id 1021082.1397133; Fri, 20 Jun 2025 18:30:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uSgV0-0005sD-ST; Fri, 20 Jun 2025 18:30:02 +0000 Received: by outflank-mailman (input) for mailman id 1021082; Fri, 20 Jun 2025 18:30:02 +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 1uSgUz-00057I-TH for xen-devel@lists.xenproject.org; Fri, 20 Jun 2025 18:30:02 +0000 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2061e.outbound.protection.outlook.com [2a01:111:f403:2406::61e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 90d3be23-4e04-11f0-a30e-13f23c93f187; Fri, 20 Jun 2025 20:29:57 +0200 (CEST) Received: from BL6PEPF00016417.NAMP222.PROD.OUTLOOK.COM (2603:10b6:22e:400:0:1004:0:5) by SN7PR12MB7227.namprd12.prod.outlook.com (2603:10b6:806:2aa::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8835.28; Fri, 20 Jun 2025 18:29:53 +0000 Received: from BN1PEPF00005FFD.namprd05.prod.outlook.com (2a01:111:f403:c803::2) by BL6PEPF00016417.outlook.office365.com (2603:1036:903:4::a) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8857.25 via Frontend Transport; Fri, 20 Jun 2025 18:29:53 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by BN1PEPF00005FFD.mail.protection.outlook.com (10.167.243.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8857.21 via Frontend Transport; Fri, 20 Jun 2025 18:29:52 +0000 Received: from xcbagarciav01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 20 Jun 2025 13:29: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: 90d3be23-4e04-11f0-a30e-13f23c93f187 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=JnkJWWZvK0S8x1phXZ/FVznDQQudmQY3DY6f0NZ96dzVibGehnw5s8STzZmiaPGlX8HAArHFxoUEllCk1BzNt6ZchEBJwf+cb0h3bymBMMlLKhE2G4YPqxGS6vCQ9saRNA+hARaMzcd0Gq8XzWK6LMdKy+BNpuWzHZNyfUSCFpY9pODjOeLmqzr8hJJBxg3WW6uzsCTSw4BlyzuNtTV4I15rtoZH8duvz/jGMG82ndQQA6xyZLbJkyr0JoSpBLAGNAyL4Do4jLm+T61YpkA6cyA64TXohVI0isWBiP0pfreZsKCCuONeoZ95FE4f1VQPA7beucjfaeEue3ltE56/Aw== 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=p44M7RzHGXTyxxIkCh7v0gyMVi75uj2BQ3nBpbpii4U=; b=K+aZpKz4kX4kXlNNGD2FtB6/ppGOZcfzN/RHN+Masej8iZHde7HUqY2FfX87K94GIrtZ7f5Mo5DrCFzmn4geOruNC+azpXKJjmoekncjqzAJtimIWVBBOpdnYU5GMsiXR0Pm4RorGFftwS17uqofx53m3wOR/CELSYn659mIzHs1VHCvJyUEw6L3f48fVfxAqF13IvOa6z+crizHMgWKjaGBXuLFmfnxQ6n09p1r8oP1TB6BOiRs+cFRKOhobzUlCaCgl/+bpt5LF18UKvnMm3qB+uFABAGPZvFgVQBOpmvzKVQBrtlCMwCiw6SZmnOgQUP1sE/ZY8CM5Xgfv5pHjw== 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=p44M7RzHGXTyxxIkCh7v0gyMVi75uj2BQ3nBpbpii4U=; b=IvknDJyBIEZqnTHaG8QVIKijYh8J5GbNRKuj6Qj/B/EuTb7E7xyl+mNohELVaLvHX+Tt4tEaLKq6teQU4cbwt2AsQ5IWx2+v/AvYCt+TgN08wgoYgWEOf9Qgijph8rSkDn+kEgpOZR3MO2gtyLhhMDhodvLzgbIogGf1JmDXwkU= 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 v4 02/12] xen: Rename bootmodule{,s} to boot_module{,s} Date: Fri, 20 Jun 2025 20:28:48 +0200 Message-ID: <20250620182859.23378-3-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250620182859.23378-1-agarciav@amd.com> References: <20250620182859.23378-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00005FFD:EE_|SN7PR12MB7227:EE_ X-MS-Office365-Filtering-Correlation-Id: 67fbfb97-3f0f-4e56-2078-08ddb02872cf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|7416014|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?FJrMlR6NWbsUdP4XnMREuiiza4C58+PIFGAD8r4sMQ6nouQetgM3Xu2No7iK?= =?us-ascii?Q?vJ5+uRiGwq/PUpgx9N4lh0GHbGcNBRQ0TGFQZpY5/5Vn4XfYn9UifN3g67H0?= =?us-ascii?Q?YsjyYgUZ1P5zzXOTm6J3EthWrCsk9vP9quafTttYD/X7EFMj6a63x7OCbRrS?= =?us-ascii?Q?Mfl0JjNTiM3nON/gfy0R/YmbPx+znKV0vgkFz23LL+fNR1+MLvE8YMF7JBJh?= =?us-ascii?Q?SI4ekZT7kiBzDb0+K2yd7r1n37/MFlYkx2o2mN8lIivdDAALiwop1Zmz2Wd8?= =?us-ascii?Q?21w5AVNhUhu/8jp4E1D2VmzbyH1PgIb+y8dR1vyIgH4Z1mDQjjEOsUZf+/UE?= =?us-ascii?Q?WHPXWC2p5OWEOulhN1yhW/XxNbkXJJJ2PyCjvRROqgmvPBR3mD2BesKVMn7D?= =?us-ascii?Q?u30XAewiERmpuATImKtARY2G75cmR1FCdCEag94ORkOIauddJt2+hhpC6csh?= =?us-ascii?Q?mCaEI+cE5dILnvRhs0ijs0kDPojr2xLhFnTFPOy8A3FOjwBR5Kn4V17c250n?= =?us-ascii?Q?3tmIG3lxoRzGtqKWIL6dbSCj3SIQFmqcotgCr/nqvf8FREVziA+hR8ssGKUl?= =?us-ascii?Q?r5B/ZACRvA8mIUUiY7I8Jcq/3BnvdnseggJECcAE36beLG0RAtUQEb8Zreqz?= =?us-ascii?Q?BK7A9Zbh2+cSdIrpT4sqN+janMmzrztrQ3HBzHCHmacNAAJ91Fn57rkSkCrr?= =?us-ascii?Q?muXuW8GDT5nRUl4Y7GJB/UlpvzyMRlB28OtOtnTE+GRDcj2ZF5johrRzh1sA?= =?us-ascii?Q?cLWr+7nuIajeCeZNki+FbgUZyuc5FmzyAhkgijqvtJvod0wxNJ7XPC9yU7bi?= =?us-ascii?Q?0qTTkmRy4zRxI/X9B4GuTgwVxZk0j/h1rwE6Y19u+od4kH2nebnQwW4Z/C+H?= =?us-ascii?Q?W4j+ed8tO5hfsDIUhlG5G7cJlRyE1yPSD0dnA/M7xI7AlOCh6BSJNrOJQ1A6?= =?us-ascii?Q?pE4KhBHylgvbyUsnVk8mu2Lr3EcP6Kwa/dyBabMVWnc94cURtnXAlF0PzpKU?= =?us-ascii?Q?C4EKANDUDH71q28Ooqa0/rIY3tnTE3lIAiZ5f4oUzhRA5QX0XpgTZKkx2Z/e?= =?us-ascii?Q?XyH6KYYGETwk2jDhUEyz6CK18jl2xGVIEbI7+SUeBInNPomP4wCswLEe5B/K?= =?us-ascii?Q?hmPFU3EF4mlPNAsafioAcdpAZvLy13awvn9vUp7PwIB9+TK7NcpUWZTQuxRu?= =?us-ascii?Q?p9PKGu0cLp+cS1DBMcSvuJbXWvYWNpH9HML750MOdLoHl4tXL3mFnfnHQbaR?= =?us-ascii?Q?FlEb89OddeBSbaqB4fGWDB74gtKD6qMbeQVvMVsXk7X0YI6Abt/X8ijrw5MM?= =?us-ascii?Q?J3SfFv3zljPS+5SB2J1c2D6maqFwzYg8VhMfRyk/Yu8lhg9Xa206XZut3vVB?= =?us-ascii?Q?K48KabOPJlydwjV0RnQq7lA4sUQri+9B7ae5+NkEDBKznyFHQDnbK/3sh8EW?= =?us-ascii?Q?Ks92cg87W+awLyHQA7X19qdz4D+IrJy5VN1S1wf6TgvA2HDA/+TaJsQ+2JoB?= =?us-ascii?Q?AgPDA57sPys+hDVwvkdDG/sM+cT+yZpHGu9d?= 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)(7416014)(376014)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2025 18:29:52.7415 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 67fbfb97-3f0f-4e56-2078-08ddb02872cf 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: BN1PEPF00005FFD.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7227 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1750444221632116600 Content-Type: text/plain; charset="utf-8" ... in alignment with the new coding style on word splitting for type names. This aligns its name with the largely duplicate boot_module struct in x86. While there's no equivalent to "struct bootmodules" in x86, changing one and not the other is just confusing. Same with various comments and function names. Rather than making a long subfield name even longer, remove the _bootmodule suffix in the kernel, initrd and dtb subfields. Not a functional change. Signed-off-by: Alejandro Vallejo Reviewed-by: Stefano Stabellini Acked-By: Daniel P. Smith --- xen/arch/arm/domain_build.c | 4 +- xen/arch/arm/efi/efi-boot.h | 6 +-- xen/arch/arm/kernel.c | 4 +- xen/arch/arm/llc-coloring.c | 8 ++-- xen/arch/arm/mmu/setup.c | 10 ++--- xen/arch/arm/setup.c | 10 ++--- xen/common/device-tree/bootfdt.c | 4 +- xen/common/device-tree/bootinfo.c | 52 ++++++++++++------------- xen/common/device-tree/dom0less-build.c | 25 ++++++------ xen/common/device-tree/domain-build.c | 2 +- xen/common/device-tree/kernel.c | 22 +++++------ xen/include/xen/bootfdt.h | 26 ++++++------- xen/include/xen/fdt-kernel.h | 7 ++-- xen/xsm/xsm_policy.c | 2 +- 14 files changed, 90 insertions(+), 92 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 4ff161887e..3f5c7c2e5a 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -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 bootmodule *initrd =3D kinfo->initrd_bootmodule; + const struct boot_module *initrd =3D kinfo->initrd; =20 if ( bootargs ) { @@ -1517,7 +1517,7 @@ int __init make_chosen_node(const struct kernel_info = *kinfo) { int res; const char *bootargs =3D NULL; - const struct bootmodule *initrd =3D kinfo->initrd_bootmodule; + const struct boot_module *initrd =3D kinfo->initrd; void *fdt =3D kinfo->fdt; =20 dt_dprintk("Create chosen node\n"); diff --git a/xen/arch/arm/efi/efi-boot.h b/xen/arch/arm/efi/efi-boot.h index ee80560e13..faabe5a6a8 100644 --- a/xen/arch/arm/efi/efi-boot.h +++ b/xen/arch/arm/efi/efi-boot.h @@ -20,7 +20,7 @@ typedef struct { } module_info; =20 /* - * Binaries will be translated into bootmodules, the maximum number for th= em is + * Binaries will be translated into boot_modules, the maximum number for t= hem is * MAX_MODULES where we should remove a unit for Xen and one for Xen DTB */ #define MAX_UEFI_MODULES (MAX_MODULES - 2) @@ -602,9 +602,9 @@ static void __init efi_arch_handle_module(const struct = file *file, =20 /* * modules_available is decremented here because for each dom0 file ad= ded - * from the configuration file, there will be an additional bootmodule, + * from the configuration file, there will be an additional boot_modul= e, * so the number of available slots will be decremented because there = is a - * maximum amount of bootmodules that can be loaded. + * maximum amount of boot_modules that can be loaded. */ modules_available--; } diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index cb1efb19e7..e734ec5c1e 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 bootmodule *mod =3D info->initrd_bootmodule; + const struct boot_module *mod =3D info->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)); @@ -175,7 +175,7 @@ static void __init kernel_zimage_load(struct kernel_inf= o *info) * Check if the image is a uImage and setup kernel_info */ int __init kernel_uimage_probe(struct kernel_info *info, - struct bootmodule *mod) + struct boot_module *mod) { struct { __be32 magic; /* Image Header Magic Number */ diff --git a/xen/arch/arm/llc-coloring.c b/xen/arch/arm/llc-coloring.c index 99ac10b610..6f78817c57 100644 --- a/xen/arch/arm/llc-coloring.c +++ b/xen/arch/arm/llc-coloring.c @@ -123,12 +123,12 @@ static paddr_t __init xen_colored_map_size(void) =20 void __init arch_llc_coloring_init(void) { - struct bootmodule *xen_bootmodule =3D boot_module_find_by_kind(BOOTMOD= _XEN); + struct boot_module *xen_boot_module =3D boot_module_find_by_kind(BOOTM= OD_XEN); =20 - BUG_ON(!xen_bootmodule); + BUG_ON(!xen_boot_module); =20 - xen_bootmodule->size =3D xen_colored_map_size(); - xen_bootmodule->start =3D get_xen_paddr(xen_bootmodule->size); + xen_boot_module->size =3D xen_colored_map_size(); + xen_boot_module->start =3D get_xen_paddr(xen_boot_module->size); } =20 /* diff --git a/xen/arch/arm/mmu/setup.c b/xen/arch/arm/mmu/setup.c index 30afe97781..eb8ed19ca1 100644 --- a/xen/arch/arm/mmu/setup.c +++ b/xen/arch/arm/mmu/setup.c @@ -246,7 +246,7 @@ paddr_t __init consider_modules(paddr_t s, paddr_t e, #ifdef CONFIG_STATIC_SHM const struct membanks *shmem =3D bootinfo_get_shmem(); #endif - const struct bootmodules *mi =3D &bootinfo.modules; + const struct boot_modules *mi =3D &bootinfo.modules; int i; int nr; =20 @@ -273,8 +273,8 @@ paddr_t __init consider_modules(paddr_t s, paddr_t e, } =20 /* - * i is the current bootmodule we are evaluating, across all - * possible kinds of bootmodules. + * i is the current boot_module we are evaluating, across all + * possible kinds of boot_modules. * * When retrieving the corresponding reserved-memory addresses, we * need to index the reserved_mem bank starting from 0, and only count= ing @@ -328,8 +328,8 @@ static void __init create_llc_coloring_mappings(void) { lpae_t pte; unsigned int i; - struct bootmodule *xen_bootmodule =3D boot_module_find_by_kind(BOOTMOD= _XEN); - mfn_t start_mfn =3D maddr_to_mfn(xen_bootmodule->start), mfn; + struct boot_module *xen_boot_module =3D boot_module_find_by_kind(BOOTM= OD_XEN); + mfn_t start_mfn =3D maddr_to_mfn(xen_boot_module->start), mfn; =20 for_each_xen_colored_mfn ( start_mfn, mfn, i ) { diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index ed72317af3..58acc2d0d4 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -206,11 +206,11 @@ static void __init processor_id(void) =20 void __init discard_initial_modules(void) { - struct bootmodules *mi =3D &bootinfo.modules; + struct boot_modules *mi =3D &bootinfo.modules; int i; =20 /* - * When using static heap feature, don't give bootmodules memory back = to + * When using static heap feature, don't give boot_modules memory back= to * the heap allocator */ if ( using_static_heap ) @@ -303,7 +303,7 @@ void asmlinkage __init start_xen(unsigned long fdt_padd= r) { size_t fdt_size; const char *cmdline; - struct bootmodule *xen_bootmodule; + struct boot_module *xen_boot_module; struct domain *d; int rc, i; =20 @@ -327,10 +327,10 @@ void asmlinkage __init start_xen(unsigned long fdt_pa= ddr) fdt_paddr); =20 /* Register Xen's load address as a boot module. */ - xen_bootmodule =3D add_boot_module(BOOTMOD_XEN, + xen_boot_module =3D add_boot_module(BOOTMOD_XEN, virt_to_maddr(_start), (paddr_t)(uintptr_t)(_end - _start), false); - BUG_ON(!xen_bootmodule); + BUG_ON(!xen_boot_module); =20 fdt_size =3D boot_fdt_info(device_tree_flattened, fdt_paddr); =20 diff --git a/xen/common/device-tree/bootfdt.c b/xen/common/device-tree/boot= fdt.c index 9daea06e57..39334d6205 100644 --- a/xen/common/device-tree/bootfdt.c +++ b/xen/common/device-tree/bootfdt.c @@ -314,7 +314,7 @@ static void __init process_multiboot_node(const void *f= dt, int node, static int __initdata kind_guess =3D 0; const struct fdt_property *prop; const __be32 *cell; - bootmodule_kind kind; + boot_module_kind kind; paddr_t start, size; int len; /* sizeof("/chosen/") + DT_MAX_NAME + '/' + DT_MAX_NAME + '/0' =3D> 92= */ @@ -518,7 +518,7 @@ 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 bootmodules *mods =3D &bootinfo.modules; + struct boot_modules *mods =3D &bootinfo.modules; struct bootcmdlines *cmds =3D &bootinfo.cmdlines; unsigned int i; =20 diff --git a/xen/common/device-tree/bootinfo.c b/xen/common/device-tree/boo= tinfo.c index 717cfa0962..2a27d1318b 100644 --- a/xen/common/device-tree/bootinfo.c +++ b/xen/common/device-tree/bootinfo.c @@ -21,7 +21,7 @@ =20 struct bootinfo __initdata bootinfo =3D BOOTINFO_INIT; =20 -const char * __init boot_module_kind_as_string(bootmodule_kind kind) +const char * __init boot_module_kind_as_string(boot_module_kind kind) { switch ( kind ) { @@ -49,7 +49,7 @@ static void __init dt_unreserved_regions(paddr_t s, paddr= _t e, unsigned int i; =20 /* - * i is the current bootmodule we are evaluating across all possible + * i is the current boot_module we are evaluating across all possible * kinds. */ for ( i =3D first; i < reserved_mem->nr_banks; i++ ) @@ -143,18 +143,18 @@ static bool __init meminfo_overlap_check(const struct= membanks *mem, * TODO: '*_end' could be 0 if the module/region is at the end of the phys= ical * address space. This is for now not handled as it requires more rework. */ -static bool __init bootmodules_overlap_check(struct bootmodules *bootmodul= es, - paddr_t region_start, - paddr_t region_size) +static bool __init boot_modules_overlap_check(struct boot_modules *boot_mo= dules, + paddr_t region_start, + paddr_t region_size) { paddr_t mod_start =3D INVALID_PADDR, mod_end =3D 0; paddr_t region_end =3D region_start + region_size; - unsigned int i, mod_num =3D bootmodules->nr_mods; + unsigned int i, mod_num =3D boot_modules->nr_mods; =20 for ( i =3D 0; i < mod_num; i++ ) { - mod_start =3D bootmodules->module[i].start; - mod_end =3D mod_start + bootmodules->module[i].size; + mod_start =3D boot_modules->module[i].start; + mod_end =3D mod_start + boot_modules->module[i].size; =20 if ( region_end <=3D mod_start || region_start >=3D mod_end ) continue; @@ -210,20 +210,20 @@ bool __init check_reserved_regions_overlap(paddr_t re= gion_start, allow_memreserve_overlap) ) return true; =20 - /* Check if input region is overlapping with bootmodules */ - if ( bootmodules_overlap_check(&bootinfo.modules, - region_start, region_size) ) + /* Check if input region is overlapping with boot_modules */ + if ( boot_modules_overlap_check(&bootinfo.modules, + region_start, region_size) ) return true; =20 return false; } =20 -struct bootmodule __init *add_boot_module(bootmodule_kind kind, - paddr_t start, paddr_t size, - bool domU) +struct boot_module __init *add_boot_module(boot_module_kind kind, + paddr_t start, paddr_t size, + bool domU) { - struct bootmodules *mods =3D &bootinfo.modules; - struct bootmodule *mod; + struct boot_modules *mods =3D &bootinfo.modules; + struct boot_module *mod; unsigned int i; =20 if ( mods->nr_mods =3D=3D MAX_MODULES ) @@ -266,10 +266,10 @@ struct bootmodule __init *add_boot_module(bootmodule_= kind kind, * XSM, DTB) or Dom0 modules. This is not suitable for looking up guest * modules. */ -struct bootmodule * __init boot_module_find_by_kind(bootmodule_kind kind) +struct boot_module * __init boot_module_find_by_kind(boot_module_kind kind) { - struct bootmodules *mods =3D &bootinfo.modules; - struct bootmodule *mod; + struct boot_modules *mods =3D &bootinfo.modules; + struct boot_module *mod; int i; for (i =3D 0 ; i < mods->nr_mods ; i++ ) { @@ -281,7 +281,7 @@ struct bootmodule * __init boot_module_find_by_kind(boo= tmodule_kind kind) } =20 void __init add_boot_cmdline(const char *name, const char *cmdline, - bootmodule_kind kind, paddr_t start, bool dom= U) + boot_module_kind kind, paddr_t start, bool do= mU) { struct bootcmdlines *cmds =3D &bootinfo.cmdlines; struct bootcmdline *cmd; @@ -310,7 +310,7 @@ void __init add_boot_cmdline(const char *name, const ch= ar *cmdline, * XSM, DTB) or Dom0 modules. This is not suitable for looking up guest * modules. */ -struct bootcmdline * __init boot_cmdline_find_by_kind(bootmodule_kind kind) +struct bootcmdline * __init boot_cmdline_find_by_kind(boot_module_kind kin= d) { struct bootcmdlines *cmds =3D &bootinfo.cmdlines; struct bootcmdline *cmd; @@ -340,11 +340,11 @@ struct bootcmdline * __init boot_cmdline_find_by_name= (const char *name) return NULL; } =20 -struct bootmodule * __init boot_module_find_by_addr_and_kind(bootmodule_ki= nd kind, - paddr_t start) +struct boot_module * __init boot_module_find_by_addr_and_kind( + boot_module_kind kind, paddr_t start) { - struct bootmodules *mods =3D &bootinfo.modules; - struct bootmodule *mod; + struct boot_modules *mods =3D &bootinfo.modules; + struct boot_module *mod; unsigned int i; =20 for (i =3D 0 ; i < mods->nr_mods ; i++ ) @@ -366,7 +366,7 @@ struct bootmodule * __init boot_module_find_by_addr_and= _kind(bootmodule_kind kin */ static paddr_t __init next_module(paddr_t s, paddr_t *end) { - struct bootmodules *mi =3D &bootinfo.modules; + struct boot_modules *mi =3D &bootinfo.modules; paddr_t lowest =3D ~(paddr_t)0; int i; =20 diff --git a/xen/common/device-tree/dom0less-build.c b/xen/common/device-tr= ee/dom0less-build.c index 3d503c6973..221b875a2f 100644 --- a/xen/common/device-tree/dom0less-build.c +++ b/xen/common/device-tree/dom0less-build.c @@ -44,13 +44,13 @@ void __init set_xs_domain(struct domain *d) =20 bool __init is_dom0less_mode(void) { - struct bootmodules *mods =3D &bootinfo.modules; - struct bootmodule *mod; + struct boot_modules *mods =3D &bootinfo.modules; + struct boot_module *mod; unsigned int i; bool dom0found =3D false; bool domUfound =3D false; =20 - /* Look into the bootmodules */ + /* Look into the boot_modules */ for ( i =3D 0 ; i < mods->nr_mods ; i++ ) { mod =3D &mods->module[i]; @@ -374,18 +374,17 @@ static int __init check_partial_fdt(void *pfdt, size_= t size) return 0; } =20 -static int __init domain_handle_dtb_bootmodule(struct domain *d, - struct kernel_info *kinfo) +static int __init domain_handle_dtb_boot_module(struct domain *d, + struct kernel_info *kinfo) { void *pfdt; int res, node_next; =20 - pfdt =3D ioremap_cache(kinfo->dtb_bootmodule->start, - kinfo->dtb_bootmodule->size); + pfdt =3D ioremap_cache(kinfo->dtb->start, kinfo->dtb->size); if ( pfdt =3D=3D NULL ) return -EFAULT; =20 - res =3D check_partial_fdt(pfdt, kinfo->dtb_bootmodule->size); + res =3D check_partial_fdt(pfdt, kinfo->dtb->size); if ( res < 0 ) goto out; =20 @@ -459,8 +458,8 @@ static int __init prepare_dtb_domU(struct domain *d, st= ruct kernel_info *kinfo) sizecells =3D GUEST_ROOT_SIZE_CELLS; =20 /* Account for domU passthrough DT size */ - if ( kinfo->dtb_bootmodule ) - fdt_size +=3D kinfo->dtb_bootmodule->size; + if ( kinfo->dtb ) + fdt_size +=3D kinfo->dtb->size; =20 /* Cap to max DT size if needed */ fdt_size =3D min(fdt_size, SZ_2M); @@ -507,13 +506,13 @@ static int __init prepare_dtb_domU(struct domain *d, = struct kernel_info *kinfo) goto err; =20 /* - * domain_handle_dtb_bootmodule has to be called before the rest of + * domain_handle_dtb_boot_module has to be called before the rest of * the device tree is generated because it depends on the value of * the field phandle_intc. */ - if ( kinfo->dtb_bootmodule ) + if ( kinfo->dtb ) { - ret =3D domain_handle_dtb_bootmodule(d, kinfo); + ret =3D domain_handle_dtb_boot_module(d, kinfo); if ( ret ) goto err; } diff --git a/xen/common/device-tree/domain-build.c b/xen/common/device-tree= /domain-build.c index 99ea81198a..cd01a8b4bc 100644 --- a/xen/common/device-tree/domain-build.c +++ b/xen/common/device-tree/domain-build.c @@ -352,7 +352,7 @@ void __init dtb_load(struct kernel_info *kinfo, void __init initrd_load(struct kernel_info *kinfo, copy_to_guest_phys_cb copy_to_guest) { - const struct bootmodule *mod =3D kinfo->initrd_bootmodule; + const struct boot_module *mod =3D kinfo->initrd; paddr_t load_addr =3D kinfo->initrd_paddr; paddr_t paddr, len; int node; diff --git a/xen/common/device-tree/kernel.c b/xen/common/device-tree/kerne= l.c index cb04cd9d50..e1b22dc1c7 100644 --- a/xen/common/device-tree/kernel.c +++ b/xen/common/device-tree/kernel.c @@ -21,7 +21,7 @@ static uint32_t __init output_length(char *image, unsigne= d long image_len) return *(uint32_t *)&image[image_len - 4]; } =20 -int __init kernel_decompress(struct bootmodule *mod, uint32_t offset) +int __init kernel_decompress(struct boot_module *mod, uint32_t offset) { char *output, *input; char magic[2]; @@ -92,7 +92,7 @@ int __init kernel_decompress(struct bootmodule *mod, uint= 32_t offset) free_domheap_page(pages + i); =20 /* - * When using static heap feature, don't give bootmodules memory back = to + * When using static heap feature, don't give boot_modules memory back= to * the heap allocator */ if ( using_static_heap ) @@ -118,7 +118,7 @@ int __init kernel_decompress(struct bootmodule *mod, ui= nt32_t offset) int __init kernel_probe(struct kernel_info *info, const struct dt_device_node *domain) { - struct bootmodule *mod =3D NULL; + struct boot_module *mod =3D NULL; struct bootcmdline *cmd =3D NULL; struct dt_device_node *node; u64 kernel_addr, initrd_addr, dtb_addr, size; @@ -140,8 +140,8 @@ int __init kernel_probe(struct kernel_info *info, =20 mod =3D boot_module_find_by_kind(BOOTMOD_KERNEL); =20 - info->kernel_bootmodule =3D mod; - info->initrd_bootmodule =3D boot_module_find_by_kind(BOOTMOD_RAMDI= SK); + info->kernel =3D mod; + info->initrd =3D boot_module_find_by_kind(BOOTMOD_RAMDISK); =20 cmd =3D boot_cmdline_find_by_kind(BOOTMOD_KERNEL); if ( cmd ) @@ -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_bootmodule =3D mod; + info->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_bootmodule =3D boot_module_find_by_addr_and_k= ind( + info->initrd =3D boot_module_find_by_addr_and_kind( BOOTMOD_RAMDISK, initrd_addr); } else if ( dt_device_is_compatible(node, "multiboot,device-tree= ") ) @@ -183,7 +183,7 @@ int __init kernel_probe(struct kernel_info *info, if ( val =3D=3D NULL ) continue; dt_get_range(&val, node, &dtb_addr, &size); - info->dtb_bootmodule =3D boot_module_find_by_addr_and_kind( + info->dtb =3D boot_module_find_by_addr_and_kind( BOOTMOD_GUEST_DTB, dtb_addr); } else @@ -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_bootmodule->start); - if ( info->initrd_bootmodule ) + info->d, info->kernel->start); + if ( info->initrd ) printk("Loading ramdisk from boot module @ %"PRIpaddr"\n", - info->initrd_bootmodule->start); + info->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 ff40f3078e..236b456dd2 100644 --- a/xen/include/xen/bootfdt.h +++ b/xen/include/xen/bootfdt.h @@ -23,7 +23,7 @@ typedef enum { BOOTMOD_GUEST_DTB, BOOTMOD_MICROCODE, BOOTMOD_UNKNOWN -} bootmodule_kind; +} boot_module_kind; =20 enum membank_type { /* @@ -103,8 +103,8 @@ struct shared_meminfo { * initrd to be compatible with all versions of the multiboot spec. */ #define BOOTMOD_MAX_CMDLINE 1024 -struct bootmodule { - bootmodule_kind kind; +struct boot_module { + boot_module_kind kind; bool domU; paddr_t start; paddr_t size; @@ -113,16 +113,16 @@ struct bootmodule { /* DT_MAX_NAME is the node name max length according the DT spec */ #define DT_MAX_NAME 41 struct bootcmdline { - bootmodule_kind kind; + boot_module_kind kind; bool domU; paddr_t start; char dt_name[DT_MAX_NAME]; char cmdline[BOOTMOD_MAX_CMDLINE]; }; =20 -struct bootmodules { +struct boot_modules { int nr_mods; - struct bootmodule module[MAX_MODULES]; + struct boot_module module[MAX_MODULES]; }; =20 struct bootcmdlines { @@ -134,7 +134,7 @@ struct bootinfo { struct meminfo mem; /* The reserved regions are only used when booting using Device-Tree */ struct meminfo reserved_mem; - struct bootmodules modules; + struct boot_modules modules; struct bootcmdlines cmdlines; #ifdef CONFIG_ACPI struct meminfo acpi; @@ -176,16 +176,16 @@ bool check_reserved_regions_overlap(paddr_t region_st= art, paddr_t region_size, bool allow_memreserve_overlap); =20 -struct bootmodule *add_boot_module(bootmodule_kind kind, +struct boot_module *add_boot_module(boot_module_kind kind, paddr_t start, paddr_t size, bool domU); -struct bootmodule *boot_module_find_by_kind(bootmodule_kind kind); -struct bootmodule * boot_module_find_by_addr_and_kind(bootmodule_kind kind, +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, - bootmodule_kind kind, paddr_t start, bool domU); -struct bootcmdline *boot_cmdline_find_by_kind(bootmodule_kind kind); + 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(bootmodule_kind kind); +const char *boot_module_kind_as_string(boot_module_kind kind); =20 void populate_boot_allocator(void); =20 diff --git a/xen/include/xen/fdt-kernel.h b/xen/include/xen/fdt-kernel.h index 1939c3ebf7..12a0b42d17 100644 --- a/xen/include/xen/fdt-kernel.h +++ b/xen/include/xen/fdt-kernel.h @@ -34,7 +34,7 @@ struct kernel_info { paddr_t gnttab_size; =20 /* boot blob load addresses */ - const struct bootmodule *kernel_bootmodule, *initrd_bootmodule, *dtb_b= ootmodule; + const struct boot_module *kernel, *initrd, *dtb; const char* cmdline; paddr_t dtb_paddr; paddr_t initrd_paddr; @@ -121,7 +121,7 @@ int kernel_probe(struct kernel_info *info, const struct= dt_device_node *domain); */ void kernel_load(struct kernel_info *info); =20 -int kernel_decompress(struct bootmodule *mod, uint32_t offset); +int kernel_decompress(struct boot_module *mod, uint32_t offset); =20 int kernel_zimage_probe(struct kernel_info *info, paddr_t addr, paddr_t si= ze); =20 @@ -130,8 +130,7 @@ int kernel_zimage_probe(struct kernel_info *info, paddr= _t addr, paddr_t size); * call here just for compatability with Arm code. */ #ifdef CONFIG_ARM -struct bootmodule; -int kernel_uimage_probe(struct kernel_info *info, struct bootmodule *mod); +int kernel_uimage_probe(struct kernel_info *info, struct boot_module *mod); #endif =20 #endif /* __XEN_FDT_KERNEL_H__ */ diff --git a/xen/xsm/xsm_policy.c b/xen/xsm/xsm_policy.c index 7f70d860bd..1f88b4fc5a 100644 --- a/xen/xsm/xsm_policy.c +++ b/xen/xsm/xsm_policy.c @@ -68,7 +68,7 @@ int __init xsm_multiboot_policy_init( #ifdef CONFIG_HAS_DEVICE_TREE int __init xsm_dt_policy_init(void **policy_buffer, size_t *policy_size) { - struct bootmodule *mod =3D boot_module_find_by_kind(BOOTMOD_XSM); + struct boot_module *mod =3D boot_module_find_by_kind(BOOTMOD_XSM); paddr_t paddr, len; =20 if ( !mod || !mod->size ) --=20 2.43.0 From nobody Fri Oct 31 03:54:05 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=1750444229; cv=pass; d=zohomail.com; s=zohoarc; b=QGFcZuLrY6ID1UdRYDfmG6Gcg14nXLxf5IruNc/808apdj45P1OjMSW3TyOYKhrx9qP4AW9kZJJm4mWdiPbSzY9CZNKNAW62yfE3HhrdhZDCGYNQ7cEmfswUbZbRqgxoOtgukPtcNl1B+KVlPcfX6RFIPCd5FayD5t0q2v6Nbwc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750444229; 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=JJP/7zFzGccQJ1DD4IZ+lMNNJUGQ+1vPwz1sxHunn6s=; b=ZY9TlDZe4Z9D/dLxXMB7AXf1pFogfKgM5ZwwZ1wDqHgV3Ppw4GxY8C1HrcY71cwNKYGthn/GigsMLRuUdG4NHfwOxNjzD0E2VzgE62o+REA7Wu/QumR5pyTdfq8bTja0b8AgPQBlvhZICHufg7w+/LOExmrkQgE5jLM3TatXjvs= 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 1750444229415805.5754183222618; Fri, 20 Jun 2025 11:30:29 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1021083.1397143 (Exim 4.92) (envelope-from ) id 1uSgV8-00070H-Aq; Fri, 20 Jun 2025 18:30:10 +0000 Received: by outflank-mailman (output) from mailman id 1021083.1397143; Fri, 20 Jun 2025 18:30:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uSgV8-000705-85; Fri, 20 Jun 2025 18:30:10 +0000 Received: by outflank-mailman (input) for mailman id 1021083; Fri, 20 Jun 2025 18:30:08 +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 1uSgV6-000575-Df for xen-devel@lists.xenproject.org; Fri, 20 Jun 2025 18:30:08 +0000 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on20621.outbound.protection.outlook.com [2a01:111:f403:2009::621]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 95dd5fe3-4e04-11f0-b894-0df219b8e170; Fri, 20 Jun 2025 20:30:06 +0200 (CEST) Received: from BN9P220CA0025.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:13e::30) by SN7PR12MB7955.namprd12.prod.outlook.com (2603:10b6:806:34d::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8835.35; Fri, 20 Jun 2025 18:30:01 +0000 Received: from BN1PEPF00006000.namprd05.prod.outlook.com (2603:10b6:408:13e:cafe::d0) by BN9P220CA0025.outlook.office365.com (2603:10b6:408:13e::30) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8857.25 via Frontend Transport; Fri, 20 Jun 2025 18:30:01 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by BN1PEPF00006000.mail.protection.outlook.com (10.167.243.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8857.21 via Frontend Transport; Fri, 20 Jun 2025 18:30:01 +0000 Received: from xcbagarciav01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 20 Jun 2025 13:29: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: 95dd5fe3-4e04-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=fTRGKuLA8nGR+TJdFyb+LASmshns7tAbneqgXtmoFFDRWCPjKs+lwEWeTJrE4q+rwecsghkOsbEdZ93d0iB9H7fAb3UbmFxinmXokZXxi0NbkHenVIaW8lSs7Smc2RKUuEvC1a4R6pHBqaNkeWLp5C6V6wJkg7tHfmMOHCEeSEDkPLC/pDRi4VIc9L/FT1w6D+xojTE5T/vlhmGabqljjxKcVMflNgpGQ1sYVbBYFo/bkosZfxm9wvVlMfu15Ax2V8lSXVAc37agE1C/5+3RDeRST113LLH5LiHWKjhdcBhKUSO6sCtGX8RTplVnPVrdP+bjWgjZn2o6B82Uc8vcbA== 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=JJP/7zFzGccQJ1DD4IZ+lMNNJUGQ+1vPwz1sxHunn6s=; b=R+MS2htwA7ktuplGmMEsz5Czs1k3/ZiNOjsSa3hjMrmT/6ke1bz7GKzdCo2GPWDq4F6VPD6LUSOENLsD8vgRwf0PhEF3ySV9VqqFIj+OESpUcaD6TAOKvTMxcb+YVB5MI3v8WKC0o4yoHJWkywHBmVKZEtOC2Pdx15olEuw4v8gIjeA9dU7U6jRl1lX+u62zeyVRLpU4/K8YiSSFJv2U9Ce4IPtmaSB3jZpVezx5OfDQgZOIxO85KbYpOfz30NVQODvOrmMrMMBbWCULAPs2CLsLZ5+T7nes4HJKjWwWZwpRL8GU5mef2Qw+js5UnWDl8O/wyHPI2CdtcWP5Wwyqcw== 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=JJP/7zFzGccQJ1DD4IZ+lMNNJUGQ+1vPwz1sxHunn6s=; b=isOpt0ZU4dINwrGb19QntkP0bIJwxcOLKRP0bSDfSpilzMnx1zsxQ7BOsXXhq/Ac3CxpPIe66La9SL0tqnwRCb0mnplJImz/KGNOH/jshQV2An7y9nqPu8J6nIprHaeI3LPi9oVxOywnZWRR8EbRXHoii47mkvij8ovMMdUnpXc= 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 v4 03/12] x86: Replace arch-specific boot_module with common one Date: Fri, 20 Jun 2025 20:28:49 +0200 Message-ID: <20250620182859.23378-4-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250620182859.23378-1-agarciav@amd.com> References: <20250620182859.23378-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00006000:EE_|SN7PR12MB7955:EE_ X-MS-Office365-Filtering-Correlation-Id: 93289895-068c-4a1c-f5ce-08ddb028782e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?88fty3px2g/A3fcoUS2CTQQtrm8hGnakXUYvd2/fHfEWu01vY0BrqqTMXzW2?= =?us-ascii?Q?EEVYJBVhxzz1nHyY2LJNYUaS/Q4YQsWTTlr7FbQ/dhjPNu2zCruN2/2g68QU?= =?us-ascii?Q?IkohVM0ZHVsWBlRIf5WZNdN8THj/IeMAv5PhOOejZDi/JTGcKdVzeOEmyd/u?= =?us-ascii?Q?eL5vGhqkN0oI3BwN6VIO9K8c3kDI+xrlJKedteYYstxkDQaDy+GQIoHBJukM?= =?us-ascii?Q?J17aguOv6MOCEDtNKurWhUlU+llH5LoVZmHd1MoMVO3i5UNEOhb49jlJ+/Gn?= =?us-ascii?Q?c2lOpQAefwCJYJg9Ab6IOwTSR2etHhagRFYMzV8F+oFucZrI1Yi6RixWE1+e?= =?us-ascii?Q?XeUuc6lqvkxmYVE8aCrFRPjFNYurgFQ3g3CFsvmc+SHBkbDtruJ3nvrca4He?= =?us-ascii?Q?qJzFSk+EYQFAReH8CBJ+XiQjv+hoq//jhHvqkxUO940N9R5oiqZPU2hxQ4gc?= =?us-ascii?Q?WjqU4jphH6EMxHLBIKO0fwAkWSKHRDC9RD1FL57kvg+PGlKN8Q09Va8UN/aY?= =?us-ascii?Q?q/jCsbBB1z54J5b7sMAJTd9Tv3wMWKQEznF68X/A8J9CMiXJYX3iIZ7kmJ98?= =?us-ascii?Q?zr97mPHARrbzXNRIkMdJEuBkZzt9bLEjg/ysvBKvuIYHlJ3O2zImLneLoJZv?= =?us-ascii?Q?POscwEeE41LhlZSCgS+yx8kmMoYnR1bU2m43afSZil8KC8YqkYUWvibpqa5T?= =?us-ascii?Q?RI+FIvvqkfJZZWF624/dXogAAsdd1KBGbhsv8Gnvmtqi1/Es/7zLfVyVXJIQ?= =?us-ascii?Q?Fp0HIUMsn3nIjnX6s6VTvPWTk0Mm2uggQwSA2pGVR55kMixjlbXCU6QObWWs?= =?us-ascii?Q?ZAOM1ybXBTOwRaHLg+/V5Ou1yaAsj2198sckglHSEqYPxY4L/JpquB3WEOpK?= =?us-ascii?Q?2iiSNp2WZe4GcXBC7nKV1SGMb2YBpv2AEVR7Fu6tHJhHd6i92b3lWrScltBw?= =?us-ascii?Q?4yYremGVhSNlOlH7TIZb8sIrYTYuvhQmQvMO+tKReqIueOIZs4qZL93k4TYU?= =?us-ascii?Q?oQPvnJ5Cb1tCnQOqL1qMDr0N83ujQbV9mHbCJW6YwaoQ8EkHHwAqkZ/puZrq?= =?us-ascii?Q?Z9r68z4D7OkX637D5YKa5K6IGI2Ay+pcipXKcneDWEDk9bD+F2uUhwWcK5ZL?= =?us-ascii?Q?YH9YGLq+0GvfL9Oo3xYwEtvUL4kRQ8OrLDBSu0iYcY9cF8D2SBOVes+ghD5T?= =?us-ascii?Q?xH8f+AtS07/jiz+qrJxvdzkf07bOOLnwXAUQkA0MUFgITpI5+zEXuao/vuJf?= =?us-ascii?Q?EkZ2zjK5sNWaL2fAPfu5Ix3ET8dUqDusgdy9EZ9W1cRhnvum+7MJqvANNRlc?= =?us-ascii?Q?QhJm52mggg0IqRBABJuuNxdNQ+mLglc+PfvmkItjnldTa18dOqIqQ5qY7VOk?= =?us-ascii?Q?LwGKWV7B4NlNt7UwHvdOq796StTLMDw5uxz4QSHka9g738di0rQ8cvkkJyn+?= =?us-ascii?Q?9FQxDXRZ0J7X4btqYTKnJzgTaAL5xdTH8VgYsRyZPuQXUz+D+txPchOs/kgP?= =?us-ascii?Q?++C6TTYUMWG8iZlXyXQsCzjloMJmBsuXzXWA?= 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)(376014)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2025 18:30:01.7572 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 93289895-068c-4a1c-f5ce-08ddb028782e 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: BN1PEPF00006000.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7955 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1750444231632116600 Content-Type: text/plain; charset="utf-8" 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, add an arch-specific area for x86-specific tidbits, and rename identical fields with conflicting names. No functional change intended. Signed-off-by: Alejandro Vallejo Reviewed-by: Stefano Stabellini --- 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 f32efa7c60..4f34bbe688 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); @@ -1062,9 +1062,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 ) @@ -1086,7 +1087,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 @@ -1299,7 +1300,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 ) @@ -1483,7 +1484,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 @@ -1565,9 +1566,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). */ @@ -1577,12 +1578,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 @@ -1608,7 +1609,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 ) { @@ -2166,7 +2167,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 236b456dd2..854e7f1ed9 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 @@ -108,6 +112,10 @@ struct boot_module { bool domU; 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 Fri Oct 31 03:54:05 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=1750444238; cv=pass; d=zohomail.com; s=zohoarc; b=WytitqlLU4JoCDi7ka0aK4fJ+BEFl+c36fxjCoSNGJx/drh2UqtpCxQu8yI+EPlZz/n/pHhSODYukP+5mZ3FYhVr9G0osWlhBV5zbNl8ke8F00FXQrj/fxkDA212jks9mMgRh8vlxr2iXwhOHWvwwjJBztx7mjgR9n9pxFWkhFA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750444238; 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=ud/TQIZp2ue4dBTHWbX6XL/bQtyUjvSVs/0Ir1+e1is=; b=O4/HW7mL54qwfV3GsDys6/X8OrPCmH/cfomr3WZiQ5CT3z4ohjLP29MCzxkW/Q8xhxZzYeHeP6EOx3ZqbDspmrjbLh8eLBxk9VUA6fdtRjtb1tTQqd6TnZ6HYpBy2akNwjkD4Cd1seltdP/Xwbw8rSrhADo4vekzRQUqOAvEoK0= 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 1750444238972580.8976697601224; Fri, 20 Jun 2025 11:30:38 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1021092.1397153 (Exim 4.92) (envelope-from ) id 1uSgVG-0007Te-KQ; Fri, 20 Jun 2025 18:30:18 +0000 Received: by outflank-mailman (output) from mailman id 1021092.1397153; Fri, 20 Jun 2025 18:30:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uSgVG-0007TV-Gm; Fri, 20 Jun 2025 18:30:18 +0000 Received: by outflank-mailman (input) for mailman id 1021092; Fri, 20 Jun 2025 18:30: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 1uSgVE-00057I-PU for xen-devel@lists.xenproject.org; Fri, 20 Jun 2025 18:30:16 +0000 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on20624.outbound.protection.outlook.com [2a01:111:f403:2416::624]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 9b394206-4e04-11f0-a30e-13f23c93f187; Fri, 20 Jun 2025 20:30:15 +0200 (CEST) Received: from BN8PR03CA0024.namprd03.prod.outlook.com (2603:10b6:408:94::37) by PH7PR12MB6393.namprd12.prod.outlook.com (2603:10b6:510:1ff::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8835.38; Fri, 20 Jun 2025 18:30:11 +0000 Received: from BN1PEPF00006002.namprd05.prod.outlook.com (2603:10b6:408:94:cafe::9) by BN8PR03CA0024.outlook.office365.com (2603:10b6:408:94::37) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8857.25 via Frontend Transport; Fri, 20 Jun 2025 18:30:11 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by BN1PEPF00006002.mail.protection.outlook.com (10.167.243.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8857.21 via Frontend Transport; Fri, 20 Jun 2025 18:30:10 +0000 Received: from xcbagarciav01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 20 Jun 2025 13:30:01 -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: 9b394206-4e04-11f0-a30e-13f23c93f187 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LKqbXYmxlwYOpv+aef1UraqpyNZK87VJ4V8I+7uCGlOH4+KWCy8FlosWg/BlYE7abA5WujSacOjVa4+cM3FseZWYZJfp3P2PR7f7gwFeo8HnoxpUEhTzBU4GgVl9lQDAA+SSIqTBWMQwLVUHYmk4fnWY1KzFX0Y4VEgKG71qgMDkqRVBHFyioaEweHyxgtcifWJKjXtO0MVBsRsjUhs0WrBnLC/WTC4vA6kVZej2wdzdbXw04xsTFP8MMD6WLsVZ0ZLfVbQsds5KSmCsVg3gE5rlTocFJwTopI+3FfwDG7drUHdMxqCTiR/2fFnw5y+G4T34tWrEtc5PNDgxiOYHdw== 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=ud/TQIZp2ue4dBTHWbX6XL/bQtyUjvSVs/0Ir1+e1is=; b=yvRRsqEgA5MkNs9cMizPVRQnHCzDdBP8dCpzMt0MnIblVGVai89n1k2J1wC4z8W3gJa2xNM0AAaUqDiMbXa4QM8E9pO5T7pIr5SoR8r9bOQVf/t9LrFuLq9MoDRAeEAf8dHni82H6KiL7hT95efF4q5ud7Q8gzryS71ya6Df1mNTh/OrppONSlo8YJMRjlI09ROw56PzsDA/5SW3aeG6YpCjubElauR8zWZVrd+HB06G0QghZoL+yjkOG63/AVgWh7LlcXBzG5rqDMKmsFNB7LNwcUTIRqFCLBV3GQ0WVrDZUGPta2S+bEvIXKhM+nlfY0v5flpBgqx72jjRKUmLgQ== 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=ud/TQIZp2ue4dBTHWbX6XL/bQtyUjvSVs/0Ir1+e1is=; b=I5mCXNhl6PdASNCcc2dLD+jznwKbGMa3B8krJFwrVdhq3y9N7KG2FjOT3d5SclNgPC5DH/9zsjtlfrpFahQbR033G9ioOEplxdSQX9JEmlGMehsBk0ZWga7ZkenUVHB/FUA5qZSRvoOHWwPavlGTKwkBnIC2ZMAxaoU7VGmNyyw= 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?= Subject: [PATCH v4 04/12] xen: Refactor kernel_info to have a header like boot_domain Date: Fri, 20 Jun 2025 20:28:50 +0200 Message-ID: <20250620182859.23378-5-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250620182859.23378-1-agarciav@amd.com> References: <20250620182859.23378-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00006002:EE_|PH7PR12MB6393:EE_ X-MS-Office365-Filtering-Correlation-Id: 29b0441e-caff-4b66-8a63-08ddb0287d7c 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?OwwH5J7/PeCQ5KieHIarabJKIWRl8qIrJ/Hqf6qIYoGv5i86CM9NnwvA0Bwx?= =?us-ascii?Q?76ifsJf53M2YgvCDjk6WntxYZ52jrj7t/jRckpQqnzMwd8zhyYbFcxdTwiGZ?= =?us-ascii?Q?Dx2F5hbb/PdCW3jpggsvJGySX36YnvUSp0CqrqTzU1pFRV5WKx/XIPh7zt3R?= =?us-ascii?Q?T45g8cqG9f0h9WVbapY5Cf5xKahPgRa0fV0hiHQyi4Wto+O8CYI28BPHy3/L?= =?us-ascii?Q?pd3lv9I7NcWXhxXSXwmN0p3R3Fho32f8edOYOA5Ln3pLBH3jtQfuZN/cuhDx?= =?us-ascii?Q?qI6BZ32oBHvuYyn28iGGqtELoOWXfNBjb9XB7D3SJQ0g6iR0DqHnaaF6q3Kl?= =?us-ascii?Q?x9Bjg+HoR1P29HQS8RQn/fQ+5kG/dVl6VGVbCu5dXRbeU+nDUU2kIryoYGG4?= =?us-ascii?Q?eXy9DSPx1IX+iTzszjarfYQFcTVNXIH0imIW+urtdrarxuJkzVQKxwCPmWAi?= =?us-ascii?Q?lElH/yqSKJ/rTbnaImrRgwiNsTgwj6amVIGyUXA91y7UcTc+U2uxiOFxOpjP?= =?us-ascii?Q?gpn8nmy0TYRyQFFzH5ZkkFAWEj1+Qls76MJft8h6DobbUhDOuRNs1oim6RFG?= =?us-ascii?Q?+d6c0yelB0vHygZSSIGOqmCiZoXNxRWzDKX8DE1U+WSsmReZRK7AVB2Tbut9?= =?us-ascii?Q?m0IHLJPzneYEls8LUsCpPNNCdrrQXEHhsC6Trih3tCOMl41ABLWVjeFMcFbU?= =?us-ascii?Q?2JpzIWaDcVWa41Nbp2Ec0V03H0Wx5MqGrkhi/EITN7W2nanpQT3OpHH6paca?= =?us-ascii?Q?uBLJctYvfsMEYkarxT3z+GnLSqntSvwfQP8vGG7GsrQ3LG0xUlgDd8CVZ3gi?= =?us-ascii?Q?9Fk5jd/QySpbkv8zEqUyFg/AjZrdP7l7fZI351Nv/nqDMEgL8R3k5TOe/6h0?= =?us-ascii?Q?lKnY+RdIeDoZmqzvci3E5iBGo5qRV3B9YDtyHnXhw5T06T7p2ku64QgQqBL9?= =?us-ascii?Q?ug4K0UZ9wcA5TiE1n0RMHATehW8NHydzYhP3LiIGqSo7ETRWLeXl857+PyJ5?= =?us-ascii?Q?wUZNlN0TLife9NJCYMEbLcvSatjPd81HBPW1TH+fj323rCP4qgMYqgfQKRXM?= =?us-ascii?Q?zF5QAYV3cmaE0Vtcg9ypyzbptABd2ZN7YOSX6xsEtw5fyAl4y7f+dGBcV46y?= =?us-ascii?Q?JJD/ucQ467xe7b2C02cWdR5GG3C64hFUuLh7klTCSrXQkENjGRTJzHQkG0jY?= =?us-ascii?Q?ve04SvA8CYwg52giaL+77hHqbdY/O1e5GSnnpaRs9pV8fYA+d5sRHJW7qJ/q?= =?us-ascii?Q?ZmhEUjpam5H4txOlURnsXuwTljP5xrr/gjLVaOhH2QpI7UUPueKcQHf7VhZW?= =?us-ascii?Q?hUAgPVSkci36EGiWaODo9iC63E+NWvIWyN0aEdyw5s8QBCnFYSxRyI8Zwfbr?= =?us-ascii?Q?QBKBcCVyx0rvH39UdV/pjloBEeynCPfvdaHmgWzFRLO2UcweeXZ+4+/XFvbn?= =?us-ascii?Q?DSaVJ6lPqHH/NfU+5t+SUZwXYaMdJvwNXHws9ZlxQ0zn6z1j2qWqzTLQl8DB?= =?us-ascii?Q?omUpIspK9vK+zKHIVDcNNtXdxfQTvbEtRRmn?= 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: 20 Jun 2025 18:30:10.6550 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 29b0441e-caff-4b66-8a63-08ddb0287d7c 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: BN1PEPF00006002.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6393 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1750444239624116600 Content-Type: text/plain; charset="utf-8" Create a struct header within kernel_info with the contents common to kernel_info and boot_domain, and define that header in common code. This en= ables x86 to use that header as-is and drop x86's boot_domain. Not a functional change. Signed-off-by: Alejandro Vallejo Reviewed-by: Stefano Stabellini --- 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 | 10 ++++++++++ xen/include/xen/fdt-kernel.h | 5 ++--- 8 files changed, 59 insertions(+), 50 deletions(-) diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c index 4b285cff5e..08e8424030 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->hdr.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->hdr.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->hdr.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->hdr.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 3f5c7c2e5a..fb577f816f 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->hdr.cmdline && kinfo->hdr.cmdline[0] ) + bootargs =3D &kinfo->hdr.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->hdr.initrd; =20 if ( bootargs ) { @@ -1456,7 +1456,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->hdr.d) ) res =3D fdt_property_string(fdt, "compatible", "arm,armv7-timer"); else res =3D fdt_property_string(fdt, "compatible", "arm,armv8-timer"); @@ -1468,7 +1468,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->hdr.d) ) { irq[TIMER_PHYS_SECURE_PPI] =3D timer_get_irq(TIMER_PHYS_SECURE_PPI= ); irq[TIMER_PHYS_NONSECURE_PPI] =3D @@ -1517,7 +1517,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->hdr.initrd; void *fdt =3D kinfo->fdt; =20 dt_dprintk("Create chosen node\n"); @@ -1525,9 +1525,9 @@ int __init make_chosen_node(const struct kernel_info = *kinfo) if ( res ) return res; =20 - if ( kinfo->cmdline && kinfo->cmdline[0] ) + if ( kinfo->hdr.cmdline && kinfo->hdr.cmdline[0] ) { - bootargs =3D &kinfo->cmdline[0]; + bootargs =3D &kinfo->hdr.cmdline[0]; res =3D fdt_property(fdt, "bootargs", bootargs, strlen(bootargs) += 1); if ( res ) return res; @@ -1976,7 +1976,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.hdr.d =3D d; =20 rc =3D kernel_probe(&kinfo, NULL); if ( rc < 0 ) @@ -1988,7 +1988,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->hdr.d; int rc; =20 iommu_hwdom_init(d); diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index e734ec5c1e..10e5dcad5e 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->hdr.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->hdr.d); =20 - rc =3D copy_to_guest_phys_flush_dcache(info->d, load_addr, + rc =3D copy_to_guest_phys_flush_dcache(info->hdr.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->hdr.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..e321747175 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->hdr.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->hdr.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->hdr.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->hdr.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->hdr.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->h= dr.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->hdr.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->hdr.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.hdr.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 cd01a8b4bc..51182d10ef 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->hdr.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->hdr.d)); =20 unalloc_mem =3D rangeset_new(NULL, NULL, 0); if ( !unalloc_mem ) @@ -336,23 +336,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->hdr.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->hdr.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->hdr.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->hdr.initrd; paddr_t load_addr =3D kinfo->initrd_paddr; paddr_t paddr, len; int node; @@ -368,7 +368,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->hdr.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"); @@ -391,12 +391,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->hdr.d); =20 - res =3D copy_to_guest(kinfo->d, load_addr, + res =3D copy_to_guest(kinfo->hdr.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->hdr.= d); =20 iounmap(initrd); } diff --git a/xen/common/device-tree/kernel.c b/xen/common/device-tree/kerne= l.c index e1b22dc1c7..7a00768e6b 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->hdr.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->hdr.kernel =3D mod; + info->hdr.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->hdr.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->hdr.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->hdr.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->hdr.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->hdr.d, info->hdr.kernel->start); + if ( info->hdr.initrd ) printk("Loading ramdisk from boot module @ %"PRIpaddr"\n", - info->initrd->start); + info->hdr.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 854e7f1ed9..be0abe30ef 100644 --- a/xen/include/xen/bootfdt.h +++ b/xen/include/xen/bootfdt.h @@ -100,6 +100,16 @@ 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; +}; + /* * 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 diff --git a/xen/include/xen/fdt-kernel.h b/xen/include/xen/fdt-kernel.h index 12a0b42d17..fee8eac1db 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 hdr; =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 Fri Oct 31 03:54:05 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=1750444241; cv=pass; d=zohomail.com; s=zohoarc; b=muTYVTFKlwS9mlvUl7bu+I/p2V/xwtNK0VoYlOXtG15QvJKeL9aIRCTOKMeQwugAVG9jsWSsU09lcCiAMTG3St/UYL8SM32kfayQiosMSfaZ5FsC/oE3lhjxm2SFGiLxe74IRaVCgjoeBXK0thC8cVvXKotoqimF45KeuZvygWY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750444241; 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=p9ZiP25AT0NUU0OB8svKEcTwDIsiPq7Hv28Amb3Kek8=; b=ZNmWfbzNPhnrMWwH9MALemgF7NAnARmVky6l4g61eRpxg7HHAmZB+iK86tYlQDzTGOkiY44gFXn6xwoPHSkqEaN8mx08aX4gJbtCM1hju9LdNcQlqexV62wv7U84feLwNMP90c1OedDoCL+vB8l6R0I/WwD0n0uHA8ZRtMhsJws= 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 1750444241887477.67323066476547; Fri, 20 Jun 2025 11:30:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1021098.1397163 (Exim 4.92) (envelope-from ) id 1uSgVP-0007yB-0G; Fri, 20 Jun 2025 18:30:27 +0000 Received: by outflank-mailman (output) from mailman id 1021098.1397163; Fri, 20 Jun 2025 18:30:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uSgVO-0007y2-TM; Fri, 20 Jun 2025 18:30:26 +0000 Received: by outflank-mailman (input) for mailman id 1021098; Fri, 20 Jun 2025 18:30:25 +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 1uSgVN-000575-Mp for xen-devel@lists.xenproject.org; Fri, 20 Jun 2025 18:30:25 +0000 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on20600.outbound.protection.outlook.com [2a01:111:f403:240a::600]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a049c974-4e04-11f0-b894-0df219b8e170; Fri, 20 Jun 2025 20:30:24 +0200 (CEST) Received: from BL6PEPF0001641E.NAMP222.PROD.OUTLOOK.COM (2603:10b6:22e:400:0:1004:0:e) by SJ0PR12MB6965.namprd12.prod.outlook.com (2603:10b6:a03:448::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8835.28; Fri, 20 Jun 2025 18:30:18 +0000 Received: from BN1PEPF00005FFD.namprd05.prod.outlook.com (2a01:111:f403:c803::2) by BL6PEPF0001641E.outlook.office365.com (2603:1036:903:4::a) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8857.25 via Frontend Transport; Fri, 20 Jun 2025 18:30:18 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by BN1PEPF00005FFD.mail.protection.outlook.com (10.167.243.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8857.21 via Frontend Transport; Fri, 20 Jun 2025 18:30:18 +0000 Received: from xcbagarciav01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 20 Jun 2025 13:30:10 -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: a049c974-4e04-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZZcgzibemFh2EUQ3ui18kppj2ztf349xn7nNTryhtQxnBl0EnhU2Cv4+4iYhjPVK9OyG6lIZLCk8f4VFb6d3QKXcOIPKh+TP/W4GsIYYBfm3isgzfv28nbugdYT/R1EVFRuD0x7Pi3GzhFK5oV2Hv2iiZcF5AVLd6DQbZYsaqWcSPqeDmvg1gC9yhF2fXImrJXhuJpd+lRUzV1Ds8dgwAiTFnOya+r1beTqbSp7sDauxDRMOBRIpLfO5X/UN2cHhpLJ+Avfg2NU7QY3epWQlYJCVcmbshH1JOZe3TjKUTriKYIHwb8TG8jfHZIYYLrN83hq52X4XJX3Ijq6nlghWLA== 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=p9ZiP25AT0NUU0OB8svKEcTwDIsiPq7Hv28Amb3Kek8=; b=d4Hdp5WSEMXRJ8nKngItZ6USAn1TneqoDMB0EA1DFPMKVc+RAX/e8OMCy5BDC9CSGwEdz9RPiZOaO0BBEkf+3YLBLpbc/jln3yKQZCyCCojIf3yd3pHfWsYplTB1fZl4r3Ir/KEsaIyDeiFGlECGU149KElVrYRFEAFOZG/wAzsJHz9y/vu4B7xuyvcHErItD/AAqFCArKq/OmwIs1xq9+gnlzJYs2JLBqWJS7bAzIP6ilGpTAcgvi4Adi9XbMC36mLkL6xcgYC3Tg0pKfSQsjZZcY/MDvVk8J3tAMjWGh3uSVFMK5Dr2VF6zvm8fjW3feh0EjSsKE7ppnmrSsKmZg== 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=p9ZiP25AT0NUU0OB8svKEcTwDIsiPq7Hv28Amb3Kek8=; b=lA0Hpj77mOMmqte2e2olZQWORDHxS90q1YN9HOIu6J3Kjld19QY/WeOtcaDe0EmR8jAgpLfs+OtMGThU1aJLIxTS6bQ+2Gq+11/K4x17jemez3Lk7DKxvfyLkcBB9bN6OpEdR/YaGnxJtkPCLY7m3MD06OCWqvJmm1y+ES3CE+0= 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 Subject: [PATCH v4 05/12] x86: Replace arch-specific boot_domain with the common one Date: Fri, 20 Jun 2025 20:28:51 +0200 Message-ID: <20250620182859.23378-6-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250620182859.23378-1-agarciav@amd.com> References: <20250620182859.23378-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00005FFD:EE_|SJ0PR12MB6965:EE_ X-MS-Office365-Filtering-Correlation-Id: 9d58d30b-e508-4837-f066-08ddb02881ed X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?FZIIrzxyJfAEmfyHoJLMD53c0t0uG8/svPD/Ji/rlDdFBcWDTXc2SiGiUGOX?= =?us-ascii?Q?qPxzHePxVi42Ccl1hFoUpTIxlOW7dKasHLnU/HFqvGHlvWanWQ6I4Qn2fhbL?= =?us-ascii?Q?bOuEdUvA8qKI8BOcKVCYkIGIv622mPbrm/6QxB0w+XMmuw9kFNX11uMmdILt?= =?us-ascii?Q?2EndQ1hdwO9idmlkze4PKrWOeNGPOJ22yBzdOPEIayUYvS4T0UCCHPRoAUO2?= =?us-ascii?Q?8cVYvPQwPr2xJi9E+y+O0IDi8i3UxDthmSQ3Ef1WwqgJ93LLbIrxsMxRpdoJ?= =?us-ascii?Q?tDDuaWRHNQnCWMhFPXM6A5cx5vLD+iVLXVQe88GYkxEzBX/30WMHbiMX1Vbi?= =?us-ascii?Q?q8TfWJkvf8+7GzZccatUrYUWmnXxuZoBhhkg3UYCi94ULJ/x3xzwOQzt8SBx?= =?us-ascii?Q?rLr/P+AIOcPfZPlFw6WUVAgpUc0+2wjF3Y4PfOZac4qJUZQoHhcfwG0YVOqy?= =?us-ascii?Q?pMxRGLjdxT0JHaZrUmXiOhPaof3TepWOTC69unJF/4o7OzIb2GUCsljWpX9M?= =?us-ascii?Q?8YVXCWxMz1zcXu6a/DklNAQlwROL+X3aScv3i9Wel81JgIUMU6NBJrs44p+X?= =?us-ascii?Q?2ofd7GMfHT2zQqIigb0YzpDiwh2avA+RDHVm92vNNu5Ju5Qy6cWaN56LKQ35?= =?us-ascii?Q?PXDxlSNQvC9GkmA7TQSYFL1U41gUnRXQWf06hijt3PcD5mvfUlMmIM7+35AO?= =?us-ascii?Q?0KHotc43ei+dFwc/62qq5Oaeqw+kAKSkOmzyy/enYj60i5eW/M8xGjtZ5n0/?= =?us-ascii?Q?cdbyA3D1LfWVfmN4JmyjcrGDmmz99PtwZT7hKjWhv1cD87ADUlfGup4WK3gb?= =?us-ascii?Q?4qwFS7hd8qlrI9l/vnORkkwVtvstSfs3YoVtK8fXzjXczi9qvm8Fp2EuHWfp?= =?us-ascii?Q?1NF8UFOdHO3BeNNcGyekiG+G6zGWUu3NSHrPVzuoWCiZP0Shi18c8BKL30ki?= =?us-ascii?Q?Aan04xTPd3Pwhiww65Ii4Xe7zDBlDzbdOJOWOcl0ERWIzYNLipbaUL5gzDs7?= =?us-ascii?Q?nM0p7FV9soE4jzG951yNkj7yu0WXEbb9pOXVudJeB+Dp1xCgSRZeoLLyHEv+?= =?us-ascii?Q?YoWMAChwXuxgi6SU/qnqGL/41fpUX3eourYJfFN/1e/QzgvtukfsZT6zEmPY?= =?us-ascii?Q?VLMNbuvJ5Xnw8Lma40ZDEjPo0XV6PLEv47TwWpAJegtzJUxhbJ1tsEN10lbY?= =?us-ascii?Q?wQZLUhce03Y+BHZRzwCPrBfF/B23bphKEWOGX2qWb0cO9lAiLRHJyfs3KXNU?= =?us-ascii?Q?jf5sK8oW9UJrm3mhS5kHbtmd38TxiyfNMqyij08CLxQ4xz8XY/rvwWMNfeaP?= =?us-ascii?Q?C7tHP4LSYN6dDHUu2wVYqyQTaNzFJAFnYj6qzne6lJPPFJ1bwJBVDuX6TOJ2?= =?us-ascii?Q?XQcQ+Js+hP3fnffCJlz4Y6hli+qCTEhO/BP8fhmclknPSg5qTt2xNuiW+c3t?= =?us-ascii?Q?Ly3wUGp3sTyMovyR/GpXgonw0n2HywKG4qUZ/tc/hgPqwfyLzOwX/IJ19aG0?= =?us-ascii?Q?aIyl4FmZm/O8au1Q02ev+ZbQubJbBrxAz1vu?= 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)(36860700013)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2025 18:30:18.1106 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9d58d30b-e508-4837-f066-08ddb02881ed 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: BN1PEPF00005FFD.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6965 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1750444243479116600 Content-Type: text/plain; charset="utf-8" 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 4f34bbe688..a9560ac619 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. * @@ -1045,11 +1047,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 @@ -2168,7 +2170,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 be0abe30ef..8ea52290b7 100644 --- a/xen/include/xen/bootfdt.h +++ b/xen/include/xen/bootfdt.h @@ -108,6 +108,10 @@ struct boot_domain { struct boot_module *initrd; =20 const char* cmdline; + +#if __has_include() + struct arch_boot_domain arch; +#endif }; =20 /* --=20 2.43.0 From nobody Fri Oct 31 03:54:05 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=1750444258; cv=pass; d=zohomail.com; s=zohoarc; b=CmZ+WbuBYO/xyoykD3mjJ6rp7qUCbwcfX/MCU2OeA+deke/JnP3axtnFcYa8m9QTaSzk2/gxP48TGZqf5XnV1J+hlynJKVKDo5m3ncoQVpu+ZJOb9vTtwWwEP3+VwHUWL+HpQ0ukKI+4EfV1lKRmlb20JcCumIxW6nRT9QhAoSM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750444258; 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=27UTwRuwh14+8Le/U5yX2jQE9IYhU3yQMi8KNRacHYY=; b=c0SdRxsUY6mFRhe2twQ8XAJfDH5ajafTXKRCv29NZeBZ/cCtHQ/v/g6IeAMNR1pEbPztiNQrckhMJvAQVU0j6tFQvvHSj8nSWq2RE0GpsWgQg5Fkac/bK3xAVkHBZ1UDyKHD4WpPewbieJ7zkbtktFIES2s0+5ZDfWN7amT+Ugc= 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 1750444258219926.0259223593062; Fri, 20 Jun 2025 11:30:58 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1021107.1397173 (Exim 4.92) (envelope-from ) id 1uSgVb-0000OU-Cp; Fri, 20 Jun 2025 18:30:39 +0000 Received: by outflank-mailman (output) from mailman id 1021107.1397173; Fri, 20 Jun 2025 18:30:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uSgVb-0000OI-6q; Fri, 20 Jun 2025 18:30:39 +0000 Received: by outflank-mailman (input) for mailman id 1021107; Fri, 20 Jun 2025 18:30:38 +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 1uSgVU-000575-8F for xen-devel@lists.xenproject.org; Fri, 20 Jun 2025 18:30:32 +0000 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on20617.outbound.protection.outlook.com [2a01:111:f403:2416::617]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a3fe9f29-4e04-11f0-b894-0df219b8e170; Fri, 20 Jun 2025 20:30:30 +0200 (CEST) Received: from BN8PR03CA0016.namprd03.prod.outlook.com (2603:10b6:408:94::29) by DS0PR12MB9057.namprd12.prod.outlook.com (2603:10b6:8:c7::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8857.21; Fri, 20 Jun 2025 18:30:26 +0000 Received: from BN1PEPF00006002.namprd05.prod.outlook.com (2603:10b6:408:94:cafe::49) by BN8PR03CA0016.outlook.office365.com (2603:10b6:408:94::29) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8857.25 via Frontend Transport; Fri, 20 Jun 2025 18:30:26 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by BN1PEPF00006002.mail.protection.outlook.com (10.167.243.234) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8857.21 via Frontend Transport; Fri, 20 Jun 2025 18:30:25 +0000 Received: from xcbagarciav01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 20 Jun 2025 13:30:17 -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: a3fe9f29-4e04-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gXldZLee1suRU5jPqXf4Q+TmB1c8NjCZxFoTPzvG2khV8h9pEOgYp9HGo4cD+kwKWxUegU++mumDigmmifUsSzdnaS+sNAOMV3a4rzroXNAOiAlKaZjR/UHFS1qJTZ+9Gwotr+wOeqB6aPDkhvRhE/lkCyjgOCoR2/zP42iuhOJBryTXPph9OMtdvUlquPFe++B4NuOcSAZ997gJciGakcjsVytBSrUIpber/akBebVZhOL8P3AUc+tAR5PHw3ITSb9qiVYiGn2ZUNrIJmYSgDeVXr7BXDhGQ+nWczVmue62cUA3m8R/54vZ+05hLFMLmzU8Dv+rcGXoJky2xL/CfA== 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=27UTwRuwh14+8Le/U5yX2jQE9IYhU3yQMi8KNRacHYY=; b=U9QO40nnpnBlbyTGWG/pkeGkv6OMY7gRnvJor38pxq13K1ZUH1foULYL+NJbG9WrzsVxN5jx9/53rqC57LfD/Cr3eQT4vJ1LSGohq3dKH3pEfvUslHe1DmMbjfZfdE9YazAiyo4RHvGfh8NXyqh/ZTaIxSOF4H8ryY4dY3F9izdeRB0TypQX/lKMHFj/OfCey6Mx/WahfW4/aKsA6WuihxRJND5leUfvC/MOHmES1bFS+GSpzDZKgsIuJqba3lo4/tKZfJ31MTC9yuNOttvqhCAkC6FUwFCvmFQ9CGBN4BSvvshZozr4kJfBdhyad+EhIo+eMn2RtqvEwcfmpPfm6g== 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=27UTwRuwh14+8Le/U5yX2jQE9IYhU3yQMi8KNRacHYY=; b=4vgJ11auWFSQYmNt2gXJD6zU64hQL0hgvnIUGFoMaLOC7kjPyKcIXgpbDnE8+Emnbjo3UGMoGtndgkOy1famll9/jIYbCr3bD9Wob9qnD2jb4n8+xxIgs3Vie6zqz48CxX8DI/uJjROc1ALFaiWEAYvxR9aPHqHMGc/DbPZZmBo= 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 Subject: [PATCH v4 06/12] xen/dt: Move bootfdt functions to xen/bootfdt.h Date: Fri, 20 Jun 2025 20:28:52 +0200 Message-ID: <20250620182859.23378-7-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250620182859.23378-1-agarciav@amd.com> References: <20250620182859.23378-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00006002:EE_|DS0PR12MB9057:EE_ X-MS-Office365-Filtering-Correlation-Id: 86c131b1-033c-40d4-75ec-08ddb028869e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|7416014|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?SQwtzao/b9j9QlAjCf7PwVPQTCuO0eaM+NmOgGu6Q7DEJ/124Kfbf8n9lhOA?= =?us-ascii?Q?SrNFUHjb/qgrK2GcBSr92fCRxj18wqMDg6Qw14GdxP7mcV5Ju8tRc1a45oNt?= =?us-ascii?Q?S6yaScEaXe4lcy/29YjnZWz5BRh4k4rSs7Zs7XCsvtLe9mWrTDcTJ1U0mOKR?= =?us-ascii?Q?RB06YrY/5vtbeMP1MJzE2ASBRG168BmtWx9iucSW3YX9M8JSwbPxuOXrsjXE?= =?us-ascii?Q?LTjJuRZ1MoJzf1d9/2Odyt098JZyYZrUURBCsrTTCgKIpzCzJwGZWygE3hxz?= =?us-ascii?Q?x7JYMHF/DwLZW7nWQIFPeoAg3MLrf/5k171C/Us0RfcbaCmQqtS391afaQcu?= =?us-ascii?Q?pM1yaLkOYRPj5vAlVtVnRJaFoE80LCLnOBOufJQT+v/moJ/sDN0TPH/UoViC?= =?us-ascii?Q?KVzK2SywPuePdB+JWphg0KpphdKMXmCR5nIX4u18Hgb+Aj1RVOFCiHR5DKjE?= =?us-ascii?Q?CmAXxC5/5i53UKAzXHtmleAUmf2tZGtsszkeyAjTcDnUT9Y0vDJ6IH+H8nqn?= =?us-ascii?Q?c531ePIT3k9WfTSByazCEwZ5FKZluhhEUQzmcjy5W/Xuh7fU33Ee44PQWwDh?= =?us-ascii?Q?WOaSKNPNh3JZn1epGBwboEBZM92we1X3P6qGmzXDf26v7oHIHbWD2U+kOAio?= =?us-ascii?Q?+2e3uMHKeqecDBN1mTXS4dJ24MZgbcy5chaFrM74d4v7qFHaJDJ00JkAxosa?= =?us-ascii?Q?j1q+d8wNSbMZttCdAHcYhi0P43y7a8AEfkhTPuYBSxF+H23lDS7Wegq7ySbu?= =?us-ascii?Q?R1n4vLbxvqvGkzCCpxOfnlm+TTr6aJ6fdq9pPqMuGqD81clP8hLUAQoKn6tI?= =?us-ascii?Q?YPF7cxXm0COTFttUA7sDuk+MWHSCZ7yqmvRt4LpKNkjccE7sQyDNog8jF8/W?= =?us-ascii?Q?UYYnvfSw3zpqv07f1VgcdTtVknKqmRJy/MEek8i2n8zLZe2ojdc2rVqEuLPv?= =?us-ascii?Q?9oeP+GkTAIpluZgk4Sjv29nsJpxSgSaMWcu/hICCFVxmpEowBypBuryj1Nx0?= =?us-ascii?Q?bFeYrxJ0iZ9ReZe5MuvWwIXa9M7hSXqwiVovbQi5n19xOCG6H/BH0bI74mZ0?= =?us-ascii?Q?cv+xc+AN53I5q17sCIxqUv5yVfUmVpuORO/PcRJ0y/LnEl0xxHbY3dNM9UDw?= =?us-ascii?Q?bNB9t6IQSKhvYTDSOaeeUTPSfGalwoFjOPxA6FFBSeJmpcMDaRv0oT8OQUl7?= =?us-ascii?Q?bXt7ZuVPFmNic2lMOLmQmkix5X44LK+Yh/tq+SFfspgykfWCwZDhCADHtS0f?= =?us-ascii?Q?fm4AyOaizp95nXG9ZdPiw48vcAjRi9sHCn9tQDAhwb++Z4+NNbx5iyBhDg9c?= =?us-ascii?Q?tKDtoEzbmzVysamZUbfXLRDWT3BDLVWzA8detR0zrfciMAqjH6R5b+DGbcQe?= =?us-ascii?Q?yM7bW/1YcQ9K4nCWleLVP5PJpvEMPSnObcs13wW/Zb4ZZNlElINJN2PKNTDO?= =?us-ascii?Q?7RB1bIIhlSldynAK76qhZSTwszZ3MY/smhiv0mSfulECaY3M3gFXfhaChFeM?= =?us-ascii?Q?N+JorQvNHhTS8fEfF3bPIE3ly6z39QhBwW0D?= 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)(7416014)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2025 18:30:25.9769 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 86c131b1-033c-40d4-75ec-08ddb028869e 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: BN1PEPF00006002.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB9057 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1750444260007116600 Content-Type: text/plain; charset="utf-8" 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 --- v4: * Remove bootfdt.h include from device_tree.h (move dt_read_paddr and fix up static-evtchn.c + device-tree.c + boot-cpupool.c + riscv/smpboot.c + riscv/cpufeature.c) --- 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 | 66 ------------------- 7 files changed, 96 insertions(+), 66 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 886e6c7712..725ff71646 100644 --- a/xen/common/device-tree/device-tree.c +++ b/xen/common/device-tree/device-tree.c @@ -7,6 +7,7 @@ * benh@kernel.crashing.org */ =20 +#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 8ea52290b7..0846317f30 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, @@ -260,4 +335,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 75017e4266..b6d16756fc 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,43 +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 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; -} - /* Helper to convert a number of cells to bytes */ static inline int dt_cells_to_size(int size) { @@ -307,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 : ""; @@ -949,12 +889,6 @@ int dt_get_pci_domain_nr(struct dt_device_node *node); =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 Fri Oct 31 03:54:05 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=1750444883; cv=pass; d=zohomail.com; s=zohoarc; b=nhOy/gOUQtxha6Yoq1ROhcvwaMCmc/hl+sFetQacQIybynSpBr6jQTWj/UU4ZYTGHC9OGkHbf65ZlzQYLTjVS+G9Kvmd465EtY7o6Icn/nK5Prn/7BRzY8WIlkYjwQ/8rX6pRWyPgNL32qgWmhQBxQ0OtdUtyLRVAbDhmDNTvOA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750444883; 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=/7py0bQBo16Si/KjYQcTanGTQKRE2T2hwTwQgY2DPHQ=; b=Ff8lz3XEIFsA5jO/kcfaHBJCOzWNtN0E/Xe6lCre6by6taztUGJS5MdyP4xMpdeAcvAoH422nzz4Txxd65MMOhNmPFfPjspVBnjAv2JRjy3tC2/WT4v7eqJTy5oczE4spiANVA0nZsc/bZtDVZm8cUpS/leswU51c3u2Vl33cZo= 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 1750444883847653.8032596811944; Fri, 20 Jun 2025 11:41:23 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1021150.1397213 (Exim 4.92) (envelope-from ) id 1uSgfm-00041Z-E3; Fri, 20 Jun 2025 18:41:10 +0000 Received: by outflank-mailman (output) from mailman id 1021150.1397213; Fri, 20 Jun 2025 18:41:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uSgfm-00040m-A2; Fri, 20 Jun 2025 18:41:10 +0000 Received: by outflank-mailman (input) for mailman id 1021150; Fri, 20 Jun 2025 18:41:08 +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 1uSgVe-00057I-Ka for xen-devel@lists.xenproject.org; Fri, 20 Jun 2025 18:30:42 +0000 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20610.outbound.protection.outlook.com [2a01:111:f403:2414::610]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id ab178746-4e04-11f0-a30e-13f23c93f187; Fri, 20 Jun 2025 20:30:41 +0200 (CEST) Received: from BN1PR14CA0024.namprd14.prod.outlook.com (2603:10b6:408:e3::29) by DS0PR12MB7533.namprd12.prod.outlook.com (2603:10b6:8:132::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8835.35; Fri, 20 Jun 2025 18:30:35 +0000 Received: from BN1PEPF00005FFD.namprd05.prod.outlook.com (2603:10b6:408:e3:cafe::17) by BN1PR14CA0024.outlook.office365.com (2603:10b6:408:e3::29) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8857.25 via Frontend Transport; Fri, 20 Jun 2025 18:30:35 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by BN1PEPF00005FFD.mail.protection.outlook.com (10.167.243.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8857.21 via Frontend Transport; Fri, 20 Jun 2025 18:30:35 +0000 Received: from xcbagarciav01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 20 Jun 2025 13:30:26 -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: ab178746-4e04-11f0-a30e-13f23c93f187 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BZpmjO+Jf7rMoiom6E1ZkrlOnt7o6ixKdV9wnBmEVCxfe5GRXx8zQRUIKmBNeDoXnZ8L7r2R29QbecyWyzlY0OhtOaXXZ0xg6r5GOGTqHIMxnqZWjtj34SKYi/8YgCe/K4f0aQ8/Y33u95iggrUxdWDKYi+R2SjprFA44lrV39qpDIJS+VrxCUDVsusYgEz1FPyEiInwGDu33+XIIdWxwD75vunSVXD3dNebZGlVb+PZzAdN22EfW8UCSSPKCaZAZomRpHW9+lwAVUVzJMRrVTokebgjLUdgg6nR2Wcvpv6fGS02N2WNawdB2vGexVT0+ba0eQ7k+YEbdk67YbfO4Q== 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=/7py0bQBo16Si/KjYQcTanGTQKRE2T2hwTwQgY2DPHQ=; b=pnmSZziiSmCKMnZuyP//htyVDi4I1jUdwRFUy6Detm8vN72YqFLo5oYd5na17CyPfRd9dT8GIxgb2FAaWCK2EyfwO4l2ZHo7iyagKHKyc0IPvGvrE1IZ8cy6p/3dKB6lR1yCr4n7/c/L+A9aTwLjbeHFwpFdRDoMVntzcJ6tuoafYIHJsDAPI3TOaiZq7/XplaiHw/jiO7T4NxFSdaNJwLBWL+4G6v+JEjCYPmfDUKgZv9bwWI7GEAIaYT0yNP+B6TiV3MYS5ixYEmL1VbHk9sxOzUqL6uApaDU+glG5mQ7PAGvr75vH1vxqF0fRGmGt8in+EuNaUgMCUSWIZHgLYA== 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=/7py0bQBo16Si/KjYQcTanGTQKRE2T2hwTwQgY2DPHQ=; b=UbLL6PH+HXEMqjdu0Ldi+TT3FYg5+vE9I95f+Yz0+2WqKGjaKPIb0835/aV877WpGO5dOyYaKhGaCBflNNue7tOfM0U2YyALHWcPsLxWwa97ttpWVl4ZAPBUB/kshz5vKaCEfH7RbHsH8G9crC6dTu0jNpybrDymhIspj2uwW88= 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 Subject: [PATCH v4 07/12] xen/dt: Move bootinfo functions to a new bootinfo.h Date: Fri, 20 Jun 2025 20:28:53 +0200 Message-ID: <20250620182859.23378-8-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250620182859.23378-1-agarciav@amd.com> References: <20250620182859.23378-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00005FFD:EE_|DS0PR12MB7533:EE_ X-MS-Office365-Filtering-Correlation-Id: 392694c6-6cdb-465c-11cf-08ddb0288c43 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|82310400026|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Is4FzcyOgkal7AIRyc2RH4JzTWYxvs+Bi8doAslcjEh40FZerm7IB82LqWtX?= =?us-ascii?Q?hMADqXU5Ach0BzDTBFJanPuoutk44asAdEzi9JC7xD5h2aCwuk+Wnqs5pm1U?= =?us-ascii?Q?L6CK+zY0A3kFNl3Y3x8Cr5P6GQsgwYSY54XS+ZOQaDFgBH3NsqfGWNHVJtJ8?= =?us-ascii?Q?OLxB9bzEavbubnN75QR+TBC0sP11P/VzoYlpsrnAWeYwHVABmzQWQ0mGO0oP?= =?us-ascii?Q?NjWutlMHY7Awjyhdhyi/cDpec4i1gl5f27el7bK/d2XrVC4i7+GS/7MZt1CW?= =?us-ascii?Q?dSILrPhqhHLHUVma29tGEnpzFGDaNiCgv0oFWBCgZOb2sJqs4W43ih6oqoTL?= =?us-ascii?Q?8U7l4bv3VY2DA12AocdJC9ispD7hJIRZ57pTjnt7v+m00VPgMvu+odI4kLSY?= =?us-ascii?Q?fsVHnBirrgySviYWYMOWocb0S94ApagiaD/Idh7akKjWZhh4QcfG5tTfaFrU?= =?us-ascii?Q?6QA9tMJ9RvDPGddrJgzGW4U0+G57bvillrn7j9Ubyx/zP7QvNamxN6sCarEk?= =?us-ascii?Q?pZAVxHkP/t6C/LyvJq4nR0sPScCfuJYQ43OrEERf9PN0PzC89i4HmJjJ6zng?= =?us-ascii?Q?Gobx8/43GeHat+RfwAjw/oPYM+Oh4iBj37fmcI3sr3HRfBOJJEwhVMsANdlZ?= =?us-ascii?Q?dADEY3n2ThZ42qqbgybl/3rdVGWCHHe/LjT7Dgu2F0XXpEWsjEQiB/3g6YJZ?= =?us-ascii?Q?+ldvGkL4PS20i7IxCsWrk/oGD/KWfiiN6A0EgQgsiRsmJ/9SmsE6Lmi8CNHs?= =?us-ascii?Q?7Ve8MSkYlwO44vQnLJNWf/Zl90yvGrpikcMI5+KhhTb5K4ST2klF9f8v7iKS?= =?us-ascii?Q?8dxSYSw+rxOMfQGSrNeKd36Wz8JPP7Ut9jJozpj/UansO4Lny8sq6YlhApjR?= =?us-ascii?Q?Umix20kIHC2RReOiL83gM/IQ2BQRPC+Jpmiu54L4KfEvkpFATBWdT7vSVem7?= =?us-ascii?Q?K9YXpLlH2qJo+3VbFId1DSh1QnnTArz8hR839sIeyeJswtYpPzNdkDC0qko/?= =?us-ascii?Q?+0WXXpEgniBXA8J9BJR78qm4mro7PF+hoTg6nIUCf6CTko7Mnzt2NqCeO05D?= =?us-ascii?Q?qXn4V5BzswbijCZlIZh1wpGJW6z4Sl5XVKo4Y/UpXlwe6inTAvzNY32z4g20?= =?us-ascii?Q?pjvzoy4L30zC9PDibTZubyT+5gKsdlGL701IIIRrLSf2rf8l705I897JJo7/?= =?us-ascii?Q?DGzYFNnDOpw+G17SBnBnGAeQr/wuut+iQ4pKN3594JVO+2kFWTt7gx6/udFW?= =?us-ascii?Q?q0J+jRzSrdS0oODkiNohWtIr30RAxKYDmyv7EyiuxqA+BGKjt3ys9i2xJgAa?= =?us-ascii?Q?51tShAwYE1jQeMiH3FYzAUO9IEL/9dEf9EbNGAf5m3MYp0OJKPX8JdE5kwEz?= =?us-ascii?Q?/FDmKEKktecINfZghGQ/oJkjlsDSUjXkVyXdZ4jqBqkxJ/qoXrkj3+sR+UQ6?= =?us-ascii?Q?9DSNegNtR35L4l5fwR5vG4+hnQ1ymJyYuIyTxHdFc0DJAp1QNgy4/RYPlszG?= =?us-ascii?Q?j1nN0cj2NzPn2iOymF3VdNgwORikk9KdqfNV?= 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)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2025 18:30:35.4445 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 392694c6-6cdb-465c-11cf-08ddb0288c43 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: BN1PEPF00005FFD.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7533 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1750444886147116600 Content-Type: text/plain; charset="utf-8" Part of an unpicking process to extract bootfdt contents independent of bootinfo to a separate file for x86 to take. With this, bootfdt.h can be cleanly included from x86. A later patch extracts the definitions so the functions may be called too. Not a functional change. Signed-off-by: Alejandro Vallejo Reviewed-by: Stefano Stabellini --- v4: * Replace bootfdt.h in arm/setup.h with bootinfo.h --- 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 | 208 ----------------------- 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(+), 218 deletions(-) create mode 100644 xen/include/xen/bootinfo.h diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index fb577f816f..822f7430bd 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 2b58549c1a..418b7d53b5 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 58acc2d0d4..28fe1de3e2 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 e321747175..4413b17aac 100644 --- a/xen/common/device-tree/dom0less-build.c +++ b/xen/common/device-tree/dom0less-build.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ =20 -#include +#include #include #include #include diff --git a/xen/common/device-tree/domain-build.c b/xen/common/device-tree= /domain-build.c index 51182d10ef..b97206c917 100644 --- a/xen/common/device-tree/domain-build.c +++ b/xen/common/device-tree/domain-build.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ =20 -#include +#include #include #include #include diff --git a/xen/common/device-tree/kernel.c b/xen/common/device-tree/kerne= l.c index 7a00768e6b..7f73520388 100644 --- a/xen/common/device-tree/kernel.c +++ b/xen/common/device-tree/kernel.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ =20 -#include +#include #include #include #include diff --git a/xen/include/xen/bootfdt.h b/xen/include/xen/bootfdt.h index 0846317f30..ad6b11cb6d 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,78 +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 @@ -207,134 +127,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 fee8eac1db..ee29aad9fe 100644 --- a/xen/include/xen/fdt-kernel.h +++ b/xen/include/xen/fdt-kernel.h @@ -7,7 +7,7 @@ #ifndef __XEN_FDT_KERNEL_H__ #define __XEN_FDT_KERNEL_H__ =20 -#include +#include #include #include =20 --=20 2.43.0 From nobody Fri Oct 31 03:54:05 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=1750444857; cv=pass; d=zohomail.com; s=zohoarc; b=BbZSVYyJvG5rC7umkuADhmcQwWgRXVdDzWTq6CGvfoTflfNXvWBy/idTJ73K4yDed0B8FzpqgL83P3xqjqZvJ7iyKfdhU43sE1pRk+fhW78Hcd/1aaz4xVZHsEjtrgdIiXTZWg5/jy0hHhTWmcHgwygMbl/WHL1Mi0DxjXzruiM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750444857; 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=EZ8mPV20eg3UxX25KPokn65IJOL0jNvmLs3RF/kL5p8=; b=bArMq9UQawmFykf3zrgaP5bxIWUSyWyl1ghhUl/Xkj9AtQUiREFuoDunZKDGYANVq9TCnoAVsqIIZmY6HpNMVyDa+gdIb2a7oomLpyUPxZ++cfYoLpV+Hfg4sgGb6+M2XZIF/yIyKYxdxwCW/cMgcj0/zXa6CGT3JrCrup4VTxM= 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 1750444857334126.9377665747661; Fri, 20 Jun 2025 11:40:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1021138.1397182 (Exim 4.92) (envelope-from ) id 1uSgfH-0002j1-DU; Fri, 20 Jun 2025 18:40:39 +0000 Received: by outflank-mailman (output) from mailman id 1021138.1397182; Fri, 20 Jun 2025 18:40:39 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uSgfH-0002iu-Ao; Fri, 20 Jun 2025 18:40:39 +0000 Received: by outflank-mailman (input) for mailman id 1021138; Fri, 20 Jun 2025 18:40:38 +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 1uSgVs-000575-2O for xen-devel@lists.xenproject.org; Fri, 20 Jun 2025 18:30:56 +0000 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on20630.outbound.protection.outlook.com [2a01:111:f403:2412::630]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b09974c4-4e04-11f0-b894-0df219b8e170; Fri, 20 Jun 2025 20:30:51 +0200 (CEST) Received: from BN9PR03CA0769.namprd03.prod.outlook.com (2603:10b6:408:13a::24) by PH0PR12MB5647.namprd12.prod.outlook.com (2603:10b6:510:144::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8835.28; Fri, 20 Jun 2025 18:30:43 +0000 Received: from BN1PEPF00005FFE.namprd05.prod.outlook.com (2603:10b6:408:13a:cafe::1f) by BN9PR03CA0769.outlook.office365.com (2603:10b6:408:13a::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8857.26 via Frontend Transport; Fri, 20 Jun 2025 18:30:42 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by BN1PEPF00005FFE.mail.protection.outlook.com (10.167.243.230) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8857.21 via Frontend Transport; Fri, 20 Jun 2025 18:30:42 +0000 Received: from xcbagarciav01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 20 Jun 2025 13:30:35 -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: b09974c4-4e04-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BpzkX+GzIlvQ8kk6ON9FxhVrT7MI/G7z/GSK46jiX7Z/5h6QCNsgkrbaUCaX/0Zks/fT+AwN+xylMommu054qLIJMbKScaFSz4HfmfuMrh6VFkr6iqsFBE59t4ZJ6fUTjsboYmTxbWTXPZB/+++pEaJPCJB41SR50SghybwGdGS6lLpISeXwoVyEtez534EGqBPPslqLhLweOKMAT+7JLjkFMSQdo/n+YZrif1MUH/fw+OhY2qEfLIAgXPEMlkmLL0JHoz2JdRvE7EW+DVpYWnvPdbeC1G3NV9IC3gW7B+CLUG8Do7MaKAMvEUbxQhWS5hukH/LCqUVDES+Fj8dM9Q== 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=EZ8mPV20eg3UxX25KPokn65IJOL0jNvmLs3RF/kL5p8=; b=xNI7sdB/YKrlLqedKWvKWm2BPVHx8wGvEhdGmSirTJBGpi5EFvBlZzoqTdh0XltPjGaNFu4lxPIB86XHnboE9WNuJx6Gr89wIsD5PVySXjspD0SBjlagq4UB4LSVfVTT04RU7EMYYEdVFITwotcjXk0Ii1bxmf4PAID5DZYuPnELCHWProIu8acLyZsPtOYffDgcTxGukRH5FlaO7V2N9pt4i8MerHqwm2MZhFq3Uf3ioNbL7TKCqA8udLg2iWHgv70OE1hyE4Uc8ZyZSas9Ri4cwiC67ZUg2V7zS5r4aQYxAkXnIQ2Lo9qBjMR9FipqYm9UUbzEsRG9JqP0pxl5ZA== 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=EZ8mPV20eg3UxX25KPokn65IJOL0jNvmLs3RF/kL5p8=; b=t8pVMdqkVMasl6d7C/RRUcOqZnKf4r66EuE08XN0zDy78QsimkTYzKpszSrT1ST3rwOzIkwxd7Mh1Gupv98qZWYUZXj1GldSez7ti2bV8NpldBbcIJ9Ns1+oDmq0p/405Ni3UWXigdM5iOeU0ncN63w4RFlEyqK6eQrsQyXs0H8= 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 v4 08/12] xen/dt: Rename bootfdt.c -> bootinfo-fdt.c Date: Fri, 20 Jun 2025 20:28:54 +0200 Message-ID: <20250620182859.23378-9-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250620182859.23378-1-agarciav@amd.com> References: <20250620182859.23378-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00005FFE:EE_|PH0PR12MB5647:EE_ X-MS-Office365-Filtering-Correlation-Id: 30c02afa-27c5-433c-2dbc-08ddb0289066 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?+HIfRooqYYRoPuf9cWp5met9PTSLaBgwKB5nHG7jINHEGGViqykfq7e38Buw?= =?us-ascii?Q?FEP5YYm5wWP7uIoY0Rnw6GhOLq0JaW4k+DPwRNVMk16DYxWeawJCBKbhC39W?= =?us-ascii?Q?TfdhS1VCVwMCwapj8HtQUiSCNyaZrchRhkJ0xqehnNDmiGeg+UBJ7rvBZzYG?= =?us-ascii?Q?kkO6a6IOPEcVMV3iaunn+25U01ukXjUBy3xZ7I7ODc5ZYDluOdD/SBrkky6X?= =?us-ascii?Q?otJxJ142n8Fy8Iv8D9zipWXetBBQnTJ3KmVkIkqgczKF5Qb3PXsxkmxfzfuF?= =?us-ascii?Q?aO7CMPnky3pLuPM/LipJguCbTVWpl0Nrc8L2hRSfvVOOYtWxqRtxXVHU5pOo?= =?us-ascii?Q?2RhZtsWmyBXpl43Gt1qtZmXdcQ3Zh9chTnvFXJ5VO2cvoyzWWlUTcLsKxpSe?= =?us-ascii?Q?w175t6LaVjz0O51xZJD+IeL69gqwPg0/uIhPr4pmkSTfsGQ878/J7K/3Hf5a?= =?us-ascii?Q?pYuvljwzTaH+241LBnvZ3z56QaL/Nqo2KoMbFdwyUPzuLwybW+TjuSqRXNCA?= =?us-ascii?Q?LllkMmjWUjSr+Dye3lXfTsye6ntliqSD12D8T/g9IiB4hyLF2RrAzAg2dqjs?= =?us-ascii?Q?cwuFdHpyZExhNkidGJ5FpNL119P/DvFcHhvwGrBAU1VE+Qr5NmYR8A08hYcF?= =?us-ascii?Q?o+3hEdyO0lPbm8YQmpL/z35L4jZHdeH5F+YLsIXGsztz8RkEpCx69AoNAyMx?= =?us-ascii?Q?XPxgrkLLR7IEYTKkBT8Us3i2kuJLn1lkq7yoQfe68InuJGWLYP3de46rYZmk?= =?us-ascii?Q?VTXT7yZjm8l9FVWxuQdBYpy+sf7NLANVkupDkKexQ9NCnj540614usWnKxFg?= =?us-ascii?Q?J85h/3im6Ey8y2NyZItLTtZ/WEqpGnbSkPSAqJBurk3Glmxlk2MREUVcmQ/1?= =?us-ascii?Q?0TL3cSh60sRFQObmxcRZ1qGGCWCZKShxkKGLUD0jb2T7I8izBvwGTDiby/l/?= =?us-ascii?Q?9R52dpM8i1+6Cu8eW5YTRyYiKZ7JgkITYY2yV9mh0pl3h1+X4au5VsLp8AWy?= =?us-ascii?Q?n0zDHF4OcYY/5ae3LS1egW21bIRk26GnBGpxjwA0U7HCZ16p/zDbgjd4+QfI?= =?us-ascii?Q?xUKKJX4PG3/+v4NdmwMIXmedyrvG61VkSQ3rHYGdcqauHFuuUIPKfwQCtPHD?= =?us-ascii?Q?hD3UnxXFGZw28HISVRnVxHPoDcF+o/RjrDVnKWFQ08AwXCMuSq9fFxb62wp7?= =?us-ascii?Q?DfX+0HGTAm6B3pGo2QS2SSte8cfrlM/mb7KAua9A5U3oc1H1OLYcW9ZVwjge?= =?us-ascii?Q?ndCUjY9bD0ynQxV+cRUNMV3ZVNBqmZEj+PqXQF2NmL5K0Wtmet5TmAHC50No?= =?us-ascii?Q?sts259TqUBsRzXPzl+vvkKswVK+w8AajrjYpokjpyCJ+rr8jLtAFD77GxeVW?= =?us-ascii?Q?sNCNRjYpqfYUKA/+19HJDuFbr2WrjKf7BBOz4wWQs5m6uX9QTk+Qzrr7MPoC?= =?us-ascii?Q?zfOCFP8GfpwEp94FEmlhBjN+uCN+CnUO9OkeKfJ88r6n8ydyqSWOkR6bbzDb?= =?us-ascii?Q?vlla6SCT0CscFzVBgEftdyRECF7PRTXfLupk?= 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)(376014)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2025 18:30:42.3852 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 30c02afa-27c5-433c-2dbc-08ddb0289066 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: BN1PEPF00005FFE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB5647 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1750444859928116600 Content-Type: text/plain; charset="utf-8" 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 Fri Oct 31 03:54:05 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=1750444912; cv=pass; d=zohomail.com; s=zohoarc; b=j/ohD44OYuA8iXx21m5qqTgbrUO4nLf2RYJCOJhJP9O3IFjBpMTT8l8XFvnp0/ZLoxLz6vU0VILw5VYTR/PoivlPhXfZNez2wtVOHrdAq9W7QHmGyqkB6wv84Bp7ea/Wm8D74NdIosdpJP/bvPau3dKebpP1rSl24DQZFdln1Mo= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750444912; 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=zd2eubkDW8FKsjdHvMt4efYEdWC1FtbTeDT9SBTH9xo=; b=RqqnBerLCvV/bA8jo1+alyua/Tq6FACdtqZ213kIeyOyFGW5k+msrgtP/UBPVjDXeFPcjLyHogxmCF3d81Yp0re0rBm1tYf8LFz4hLngqPSj9FII5eGWZxetl16bw7lL3DOmtNkE7uOZyrjQ336D1ZdmcQhCH+u186urbY2b+0Y= 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 1750444912145948.112586046581; Fri, 20 Jun 2025 11:41:52 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1021174.1397223 (Exim 4.92) (envelope-from ) id 1uSggE-00051i-MI; Fri, 20 Jun 2025 18:41:38 +0000 Received: by outflank-mailman (output) from mailman id 1021174.1397223; Fri, 20 Jun 2025 18:41:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uSggE-00051a-J7; Fri, 20 Jun 2025 18:41:38 +0000 Received: by outflank-mailman (input) for mailman id 1021174; Fri, 20 Jun 2025 18:41:37 +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 1uSgVo-00057I-K3 for xen-devel@lists.xenproject.org; Fri, 20 Jun 2025 18:30:52 +0000 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on20621.outbound.protection.outlook.com [2a01:111:f403:2417::621]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b10e5d76-4e04-11f0-a30e-13f23c93f187; Fri, 20 Jun 2025 20:30:51 +0200 (CEST) Received: from BL6PEPF00016417.NAMP222.PROD.OUTLOOK.COM (2603:10b6:22e:400:0:1004:0:5) by SA5PPF7F0CA3746.namprd12.prod.outlook.com (2603:10b6:80f:fc04::8d1) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8835.19; Fri, 20 Jun 2025 18:30:48 +0000 Received: from BN1PEPF00006003.namprd05.prod.outlook.com (2a01:111:f403:c803::2) by BL6PEPF00016417.outlook.office365.com (2603:1036:903:4::a) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8857.25 via Frontend Transport; Fri, 20 Jun 2025 18:30:48 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by BN1PEPF00006003.mail.protection.outlook.com (10.167.243.235) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8857.21 via Frontend Transport; Fri, 20 Jun 2025 18:30:47 +0000 Received: from xcbagarciav01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 20 Jun 2025 13:30:42 -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: b10e5d76-4e04-11f0-a30e-13f23c93f187 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yt7F4NUrK2PgTV2Ogp6d5jWn56vnSYITZGWqe+s4xbIGfj5+jKpQGNOJxRUKM1MPtDvtYskyPRWonaOWzMxm6HYCqyLWsNm4f4/9nQWTdgyEpW2C7lQK9/SCZy53/ubMf5Ntagxq2We60GxoRxnkPSEM7mlWmgHEa6+fzybC4/nLCnzWoMLBkY0AJJ20ywjP0B22sZUrSd+avvgknfGXpSLo9b2W4e5UO60JbR1kAuyXxEgfYVzGC0hTUuRofeemWqxbISbRam6zP3ME5HveN4A41HvKhgWWFOGXQWAAg/3hHzgIRq+t4NTPWIO67hASS+UZNa7P3YJdniV0Q9Gvsw== 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=zd2eubkDW8FKsjdHvMt4efYEdWC1FtbTeDT9SBTH9xo=; b=f2S/4OLuR6h5Le3rnxbw+eaXkzJg0CYjMpWOn2y1LXnzV9R7DPfl0aNFGMyqIp3KrfUMuYzZd9SKC5zmtqMs4uJBIJo8BVMfo2fH+2VDxTLTPnj1Y6c/HeTdQjE8qTBTuU91HbAFNkrPNzpVXI10sfzTLN7lc+46RlXG2HqSF1Allmtr16Xgki/L5of/ctLEzvKvUXkhUvH+ALNoZhMDjsc2vEHYyCP9IafQ67D8C0l/ruKcktdYuAXylBXnP2vjeHDl6DZRg+14UTFSfbPAMoRXsBhjARxz3vXgd9HDy7DiaYQjPvsaMzFLt1PR84zJYPcPM01t5gSGfsVAmsaI2A== 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=zd2eubkDW8FKsjdHvMt4efYEdWC1FtbTeDT9SBTH9xo=; b=HvwJiDg6PS+XYyVDiC8oSW8nNY4y/6MEc54gweh7JoqQDLAjvAutA/CuhDIKxGB178MT6POS1gkWB133eCsHvSoAq0XWyJ7DgALZzeXdLIol5e4ljlBFHBs36NU23DMU0a77kynNwHxP3sVg1M1nF7VqcJIps9DES0G2Aphtt6A= 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 v4 09/12] xen/dt: Extract helper to map nodes to module kinds Date: Fri, 20 Jun 2025 20:28:55 +0200 Message-ID: <20250620182859.23378-10-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250620182859.23378-1-agarciav@amd.com> References: <20250620182859.23378-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00006003:EE_|SA5PPF7F0CA3746:EE_ X-MS-Office365-Filtering-Correlation-Id: c98714fb-3854-458a-ceba-08ddb0289390 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?kAn1nGtAdoV1lEH9OrbMqZt2G8nHN4YmUg/E4+43ldQqmMiQ72nUzR+FKCO9?= =?us-ascii?Q?4p2ztTubI8CryB8Yyjt89YUfAXoKqZohbhlByAh5CuyR2B2MrVjIYALLOkfb?= =?us-ascii?Q?sEQbXHck4GCUOgZ6uaaZgfY85fVGG/lmZbWOHBM+FOJBE/bt/JXgKA0m1JsW?= =?us-ascii?Q?tmm5JniB4YGJWRYKXyq31D6eJr9KAvUvggoIR1y1MDtq0OHDVD1jHvh0Dt4m?= =?us-ascii?Q?Mw0DsGJNw0Xg8lzREo4hvOGb29Q5X9mlr8eKNVF9/BZY8MsKp2Raz/7Bg9+J?= =?us-ascii?Q?L4k6/Yu7SKDh0UTYbV6mFC3cMuQMSm81XUSMPgjeIaPPBkqUU+e/LWra8pf5?= =?us-ascii?Q?ddd7iGM3JeJ1EAQfLQEXVOvYquoJBjx3Pqxm3I0B6wZkB1MtYodTZ3obS3ga?= =?us-ascii?Q?gm9/yuYgK9kepOXABWz+/bbkr4whNgwAgzW31RehpRJojspP57ADj3Icb1SL?= =?us-ascii?Q?IWWKqJ5u6dhfQl7Eql8ID8PMYKC2k50O4vnFjlNW0mUdGpeaW1JcKx/wIE8G?= =?us-ascii?Q?4c/dwIM9ND4aaUgu7MjzhHgVRBEWw3W1PCHY1nEOcqy3QWFtdtThKC5PzkzL?= =?us-ascii?Q?C7Dt2ewqfe7T7/op6+GZ/5NUIXMnHRKMFC8eGfyOcPDIvtpjjeDNbW/w7BlM?= =?us-ascii?Q?exs4hayYSfanmGhaonyzwVSdvt1thFxeTFDo6uJSEXI7Gy0do2MbJubuUSCf?= =?us-ascii?Q?Jatq6dO62VUX0oO5goXzASMAmShACKvhnOuEgC7+yGAaRGE8ZJGGNhTWoZsI?= =?us-ascii?Q?lxP90B5lq7WgaW6Wl8cOIq3g3nIq7YcWN2RmtRVoUD4mD5Wx6etrEtkvv+th?= =?us-ascii?Q?bbyG5RHKW4BP4JQmKBjJEcIWphw4dSyjLsw4Ys++2Nk0s9it921GngVvNEIh?= =?us-ascii?Q?5YDVL4HMIvSmdFEnWIjgRpAQHDJPKuF6tYjhuQZx4jEXu6w0H2xBArSVyYny?= =?us-ascii?Q?beDKIvPoEYyLGsLeXGFYiu8x/mt0hx0klh49yXHIY/xqE+qTPXj8oLwMCdkm?= =?us-ascii?Q?qVzlu5OmQux7F+UQXsWiiR68KrP2WjaBu0KBegnMD2lkdlkT7lIEPAv6FIya?= =?us-ascii?Q?JL9MFq16odjU9eoY36xDuDpFwRhgd16coAIzvjAbMALtqEVdYixyYBpSP9af?= =?us-ascii?Q?HJW37+GNtNK5iLCPfvW08gjWTFiMJ+aSaOV9PvoxDOxY6RFDWwVwG3rQTXDw?= =?us-ascii?Q?unpHdlsbXuQD7X7j+jrMrIGrqTRK/X1wsnjZRVU/Ycd6Vh+wM1JuGXfTPW1p?= =?us-ascii?Q?uF6C21W/zCuynHqBZnt3RXN8zK+UZhfSU8qW60RPfll0FowCdlESXVLBFV5I?= =?us-ascii?Q?OLuyQKWBY2DrFaEvcn00HywbLZ0lD2rnA3CPCEVIzJ8mAaf4ueddfPG+iqE+?= =?us-ascii?Q?qvglx+hXMSoGIock53ORojAV2ftuaV4nYuGVZzQUUJN6QAIW2m+qCOfjtftc?= =?us-ascii?Q?sryycK/gf0Y1UNoRdRPu2qoU3j61LB34JpQQh8qoSbzKZRlp/1BHehjSLpPJ?= =?us-ascii?Q?l0jBgQCyIqpxjARsryK0XTuxSFvU/GpeIM0W?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2025 18:30:47.6984 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c98714fb-3854-458a-ceba-08ddb0289390 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: BN1PEPF00006003.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA5PPF7F0CA3746 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1750444914419116600 Content-Type: text/plain; charset="utf-8" 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 ad6b11cb6d..bc5fc995b0 100644 --- a/xen/include/xen/bootfdt.h +++ b/xen/include/xen/bootfdt.h @@ -143,4 +143,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 Fri Oct 31 03:54:05 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=1750444865; cv=pass; d=zohomail.com; s=zohoarc; b=J+yuEv4k4SpRE0v04PQBbfG3UxT9ECb9HM5pDppwExayX1BKSiTWIJbJdfzjsQI5q+ULnJ94x3PQojmlepOztjW5e61mM+Az1nG5Z0oyVcGgSv3DiqjOLgZ+IyiYUYDF2V+ejxl4RT6m7jWnhahq2ZFj2KDvwRF1pTct+WrqNAc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750444865; 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=A32bMUto8OiFkZ1KkrsMiha7h5Dnym+pId15RGk2+9o=; b=f9srrBIgZqm0CQ7yk3lGK3vUuReoaX2C7YVvkvDuK3CsgPDfnMIu1Dr3O41fvSy9WhyT0Cx8vmc7RaXuk6l362ZGIz1e8yHgrugdImzP7fBQQ4+CqkfO1kFE6TNGHQ9PQzBkIzXeVq7dqEYH7PEObn36NFt0cFFsVu2WvwxXLow= 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 1750444865534549.3701584599843; Fri, 20 Jun 2025 11:41:05 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1021141.1397193 (Exim 4.92) (envelope-from ) id 1uSgfU-000369-Qw; Fri, 20 Jun 2025 18:40:52 +0000 Received: by outflank-mailman (output) from mailman id 1021141.1397193; Fri, 20 Jun 2025 18:40:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uSgfU-000360-Nh; Fri, 20 Jun 2025 18:40:52 +0000 Received: by outflank-mailman (input) for mailman id 1021141; Fri, 20 Jun 2025 18:40: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 1uSgW2-000575-A1 for xen-devel@lists.xenproject.org; Fri, 20 Jun 2025 18:31:06 +0000 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20627.outbound.protection.outlook.com [2a01:111:f403:2414::627]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b880e9b9-4e04-11f0-b894-0df219b8e170; Fri, 20 Jun 2025 20:31:04 +0200 (CEST) Received: from BN9P220CA0002.NAMP220.PROD.OUTLOOK.COM (2603:10b6:408:13e::7) by SJ2PR12MB8831.namprd12.prod.outlook.com (2603:10b6:a03:4d0::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8835.35; Fri, 20 Jun 2025 18:31:00 +0000 Received: from BN1PEPF00006001.namprd05.prod.outlook.com (2603:10b6:408:13e:cafe::ac) by BN9P220CA0002.outlook.office365.com (2603:10b6:408:13e::7) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8857.25 via Frontend Transport; Fri, 20 Jun 2025 18:30:59 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by BN1PEPF00006001.mail.protection.outlook.com (10.167.243.233) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8857.21 via Frontend Transport; Fri, 20 Jun 2025 18:30:59 +0000 Received: from xcbagarciav01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 20 Jun 2025 13:30: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: b880e9b9-4e04-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=mozxrJBD4h806OxtW9OKjLve39slNB6SyZyg/dPERlNW7V5jhRlvDtkbjrdunxqXCedE1tVYENyACVagFJeLBCcM/NTMhMNOiS5sSAlmFhyhxWB6tVh4W9fRuRrgHyOYUtKDV6s/fyFclXl4UhykOdnJYV73bgXKHHK8EvehrQQ3/4yQ3SFvhhA5BIrirntn+BKBCmfbEjrQjvov5ZvHYV+RqHQj5/0TRSQPc/VdBGdoPg2lrkeSo44eRCpbmN5gevcnhgilnng5/hKUOx8SS9wBG9QahgPtFdpj2GIVEbfcNBNvfDctTSyEPEyTE3ncxwnXVSDHbiLgF6WuwoLBsw== 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=A32bMUto8OiFkZ1KkrsMiha7h5Dnym+pId15RGk2+9o=; b=wk35lImRWRVdtFVGzQehcpbiWy/FUyt2bSbYCJGxX4W3beybRuLaZXrTTlE1uQXKMDDPCdGYJw1G9xjawkyXe6qoUPXZ1XGOYLsnYMBgi8Ng+pMwMsUORWzbFMMjA9zPVEDynzeoRldU8psSyTsojwRdn083TCu+Vuz/ukTuV8l68PM3sYbXyPpA++scytgCv6tsK4uBUkfGmptUa97eOqUqt4h4uY+yhL/xxSTiq6AxMaLQWB4NbSYOJDephSVKX1sygzfYX0gnuMW7I/s8Cxz1e+E1TmIpY55dkb1+k3ygxlDq0QpUkQz2LiEXpfIOpHseXxaSKS+D+h5OvOUYpQ== 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=A32bMUto8OiFkZ1KkrsMiha7h5Dnym+pId15RGk2+9o=; b=WslG99NBfGR/mi9A3QHWERZfwNjFzgJm8LTT+nS/doAlaS0s60cbLyCOTyQeaPvNxA66LOqXhXbXn+nkL6bMtgKJhiraf0W6WrRLLZmf/Tx2pg2IWo1LtRnWT6QgCdGeD5298RVSZymaXHG575gSV4dYKgB9+ynJxUbrv9GyHnY= 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 v4 10/12] xen: Rename CONFIG_HAS_DEVICE_TREE to CONFIG_HAS_DEVICE_TREE_DISCOVERY Date: Fri, 20 Jun 2025 20:28:56 +0200 Message-ID: <20250620182859.23378-11-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250620182859.23378-1-agarciav@amd.com> References: <20250620182859.23378-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00006001:EE_|SJ2PR12MB8831:EE_ X-MS-Office365-Filtering-Correlation-Id: 8e779e40-3b20-45e6-e1b9-08ddb0289a9c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|36860700013|7416014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?dhSB5tap1s11sJOUrHMp0sckU/ioFXl3DoOZmxWrZ5icsDlmFxb8my/QNpxl?= =?us-ascii?Q?rWIWaN3YyBCMSzFI48mqKZMN0mMPHpO5AiIsXsIe9pW6Tafi8lQAadjEnK2X?= =?us-ascii?Q?jo9MKQHvP7pThB/oP14hWmnPEZTAsvNXEBHifaJNzVc/YUqfPPuaIyglWMLo?= =?us-ascii?Q?UGxzIkkdsOKsWXpO7HfzvwlPx7bBM0vHWYtxjHEXI42Ifep0FmIj/doIIyiN?= =?us-ascii?Q?/lUjlszqSJTjskfTEexV8zH8yino4GdDEmqQeG0d9IqXZKHzyll+KvN/YnSU?= =?us-ascii?Q?+4nYwX8p/wYsH+yJg6Xaamuu/PkoO270+q1ISe+nxudIvzsr4p/7YOV5qaKN?= =?us-ascii?Q?t8uxBhAU0MV98iwXHp+XqGG/GbIgVsV8rG0ju2PIwIQqesuEjjdpLYhhf3XX?= =?us-ascii?Q?ebDXFIHimcKlOGaeAXPF2vN7W4TDzg+AlpyAfvDvv7+sIh/5O0NxmmPvjhfa?= =?us-ascii?Q?V9SkIHpNf/geVQoxBxYQdoQoFGNgf813rlM/EPscedndzhl2+2zqxPn3BY2C?= =?us-ascii?Q?xULPoPE+UK4aldjikNLkum0ubfd9iEHSUS0hnNa2+4j9oRcTS4mKPQIefY08?= =?us-ascii?Q?FSTHs5DHydeRWsb/DZko1AYeuhT3IRBK37J0VKfB9uyPqea5TmuaNqKf0IaN?= =?us-ascii?Q?AkBTGVJk/aMcpc4g4hxXmfsXkCwXuxhhnq1L9NwTyWABPF8JkrsVeY1SvKeh?= =?us-ascii?Q?cxXrAKU6vYdMqTfr7chBAZOUWgriyAw0/VeIOfDB9KD26uoEr6zzL7Jvc+Dq?= =?us-ascii?Q?5y9DjD2lEpv3XwTCNS807M15Tbfl8qofXowbtgqvMIDD1n/zsN/e7RPQGbd1?= =?us-ascii?Q?1TSEhgILVpd2bo0CSXXdaXKH2UXfnySiFX8zXYblQ5SClPcQrFzp/IRv3H9e?= =?us-ascii?Q?j5wqNID3zxO0K9NxHCaPzvrLagmkz2BPCbhZsH3G5TzJLSFZnqtW7bc8UITy?= =?us-ascii?Q?tQohckZAQNM4pdDEgF+tryV5Lh9kGanPDCnSk3+/QxtJR0SgPgP5CKZ/oi/I?= =?us-ascii?Q?T7e9pfU6/g8k/9h01152nwHnLEbFm8/L2otZSGKARebl5mSTts+2v4MxQEiU?= =?us-ascii?Q?Rp4vqk30ELvKwZJp5PlltK/hOVebphhjEeFZ9ftZ7FS9p5EEHaKnAkPWy6v5?= =?us-ascii?Q?HbOR5xXCpvxbOOE+YtLy77RFSVgdTJgZ8hXMLUilL9n8MEKwsMrZKMhqH/1b?= =?us-ascii?Q?6mkrq/UB1sAJUNu31/MSpSMv0oO1vDsSceJmJfrU3Vn2j7NnrMfg+E3k7etl?= =?us-ascii?Q?7r54vrSIl4GEE2CucQLzdn+tyAmXP7lW7g106Re2qKoUZs+mxmPI6TJSD+fG?= =?us-ascii?Q?6H2e9iUNbvQtArSyioi0A4PZTHDY3V6GcFkcwVSLwnChkVeLfVqN7dEziWzm?= =?us-ascii?Q?n9CVBH3Mn7isIyuJW93tdkYXuaFH9+JPqZculZMQwbNBOec7/7AhrUJ79IAU?= =?us-ascii?Q?ZBI+4jb+lGqWY8ey6zwS1O2Vw13Ig5B6x0TrfHJcPgW4NBTXMhOkb29wWR8N?= =?us-ascii?Q?9uEmTYE+BVLSfL+DUPPR2s6EH95f6zh9UYaF?= 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)(7416014)(82310400026)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2025 18:30:59.5119 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8e779e40-3b20-45e6-e1b9-08ddb0289a9c 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: BN1PEPF00006001.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8831 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1750444868161116600 Content-Type: text/plain; charset="utf-8" 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), while DOM0LESS_BOOT is left to describe (1). Signed-off-by: Alejandro Vallejo Reviewed-by: Stefano Stabellini --- xen/Kconfig.debug | 2 +- xen/arch/arm/Kconfig | 2 +- xen/arch/ppc/Kconfig | 2 +- xen/arch/riscv/Kconfig | 2 +- xen/common/Kconfig | 6 +++--- 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, 43 insertions(+), 43 deletions(-) diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug index d14093017e..9192d593a7 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 HAS_DEVICE_TREE_DISCOVERY 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 867710134a..6294cd7939 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -14,7 +14,7 @@ config CORE_PARKING =20 config DOM0LESS_BOOT bool "Dom0less boot support" if EXPERT - depends on HAS_DOM0LESS && HAS_DEVICE_TREE && DOMAIN_BUILD_HELPERS + depends on HAS_DOM0LESS && HAS_DEVICE_TREE_DISCOVERY && DOMAIN_BUILD_HELP= ERS default y help Dom0less boot support enables Xen to create and start domU guests during @@ -85,7 +85,7 @@ config HAS_ALTERNATIVE config HAS_COMPAT bool =20 -config HAS_DEVICE_TREE +config HAS_DEVICE_TREE_DISCOVERY bool select LIBFDT =20 @@ -553,7 +553,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 e39fbc3529..0ead1381c8 100644 --- a/xen/common/efi/boot.c +++ b/xen/common/efi/boot.c @@ -601,7 +601,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 eaeb0e09d0..b060e502f3 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 @@ -1754,7 +1754,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) { @@ -1833,7 +1833,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 832775754b..5483840645 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 @@ -288,7 +288,7 @@ static inline int iommu_release_dt_devices(struct domai= n *d) =20 #endif /* HAS_PASSTHROUGH */ =20 -#endif /* HAS_DEVICE_TREE */ +#endif /* HAS_DEVICE_TREE_DISCOVERY */ =20 struct page_info; =20 @@ -355,7 +355,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 @@ -403,7 +403,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 Fri Oct 31 03:54:05 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=1750444876; cv=pass; d=zohomail.com; s=zohoarc; b=FRF96IL0iQ9mMzV36vlQ2wuv56EmQfndfjKQku4HZilcUtbw7q/12Sn0hYqFx0GwQEPENYRGN1Fkmn9O/iop4v7A6oKh2MuUZ6mKDIqXWF2G5mXnBo9H7bLG84pDUlcqWuq7wr38YzltId3g0OFbuiPwsxgUHK+KdXGtj1EWPag= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750444876; 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=snID8HzNzcBZgNFX9WTQWN+pDYAdWe59wYWpzaONW8Y=; b=nsCWZ1Z3Hs8nASR+B8WdVUMkUkAX73co27Z6pCDHuOwPZukAfSpCe3CEke6yax7sknDFDcf6kkDl/bcvs7A8IX1j4o7kzgelUKItgd3d0M/yopcUz1X/+XiB/he+8TpE2G+KO0ep7GRf97UcBW4KsNqQRXyIuR4bncIsCaIDqJs= 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 1750444876587576.3052918159049; Fri, 20 Jun 2025 11:41:16 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1021147.1397203 (Exim 4.92) (envelope-from ) id 1uSgfi-0003bH-2v; Fri, 20 Jun 2025 18:41:06 +0000 Received: by outflank-mailman (output) from mailman id 1021147.1397203; Fri, 20 Jun 2025 18:41: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 1uSgfh-0003bA-Vz; Fri, 20 Jun 2025 18:41:05 +0000 Received: by outflank-mailman (input) for mailman id 1021147; Fri, 20 Jun 2025 18:41: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 1uSgW7-000575-0O for xen-devel@lists.xenproject.org; Fri, 20 Jun 2025 18:31:11 +0000 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on20613.outbound.protection.outlook.com [2a01:111:f403:2418::613]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bb8539aa-4e04-11f0-b894-0df219b8e170; Fri, 20 Jun 2025 20:31:09 +0200 (CEST) Received: from BN9PR03CA0764.namprd03.prod.outlook.com (2603:10b6:408:13a::19) by SA3PR12MB9130.namprd12.prod.outlook.com (2603:10b6:806:37f::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8835.30; Fri, 20 Jun 2025 18:31:06 +0000 Received: from BN1PEPF00005FFE.namprd05.prod.outlook.com (2603:10b6:408:13a:cafe::6c) by BN9PR03CA0764.outlook.office365.com (2603:10b6:408:13a::19) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8857.25 via Frontend Transport; Fri, 20 Jun 2025 18:31:06 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by BN1PEPF00005FFE.mail.protection.outlook.com (10.167.243.230) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8857.21 via Frontend Transport; Fri, 20 Jun 2025 18:31:06 +0000 Received: from xcbagarciav01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 20 Jun 2025 13:30:59 -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: bb8539aa-4e04-11f0-b894-0df219b8e170 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kMhqa1kTIYCf4NzWImT5JpH49AqwHqfKfygSxTixuJF3OK3syOg6QcCXEEBRhHDlNBmy0+LWoaDG87tQUl4C++3oJHq/JiM0k4ZH3u6KwBYNFIpa6z9kT35mvUMTBsE1KF7zJcLBDdBv5F323Ha6mLzUOZWzBwyBs8lc/+GIPjPwenOWh/vrHoCboinaDtajr3KKGo2QVsm1I0V0W+JgW4gZBmWEv410O9tH9nf1che0ai67CeOEoeywca8esPhhxpAdJnQG8plcVE9VltbQbolvARVKpdNw7Pul0sUdyotZeVJq0pgc2COo9hJfsWhA6yrdK5g2Tam4zRN1eypTpA== 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=snID8HzNzcBZgNFX9WTQWN+pDYAdWe59wYWpzaONW8Y=; b=kATa3HSdtbpe8kH6R54jP8YlQUMXmiHHi7amhjo17I6GetDaC6ffHP+//zW4Q7padOWQ6FUms3BbEhFsWfoy3Td389AmnicIRieDzdeQuxNgGmsuNmr7LCtwmdii7Co9n6SIvPFvy1+YrbXHv9zazI5ba4Mt/qE6MlXkxuoAvX/QmNbhiTrw+gq7pEnyl9gmBJonl+toOdcrAsP3TKD13gkL+dAovgFhA/0wIVVe37f2bIcpuj/N+OdDq78XD6t/dDFtuOU5r1xGgYMdpz/JGcupkeALdqnyJc4n2yBBHMmn8yP1zuNT7BtbGpkwzw8g/izomcPUCjv/pxlv2n7qGQ== 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=snID8HzNzcBZgNFX9WTQWN+pDYAdWe59wYWpzaONW8Y=; b=LI1JO43DhjthShNzR2/bHOnfgF/imP8KpPPuCGpWvKtc45sXYR5Sovd1cNX2pCG5J6HPKdxU4o2QM4W17JuZ4wycQamY7YEOtNE3j2jMwGxc4P4AzZWgx4bwbR7mcnScOH/c6qBUGmLuv4KPI0mD2wDcMo+tyrQ3PpzH8hdKO/8= 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 Subject: [PATCH v4 11/12] xen/dt: ifdef out DEV_DT-related bits from device_tree.{c,h} Date: Fri, 20 Jun 2025 20:28:57 +0200 Message-ID: <20250620182859.23378-12-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250620182859.23378-1-agarciav@amd.com> References: <20250620182859.23378-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00005FFE:EE_|SA3PR12MB9130:EE_ X-MS-Office365-Filtering-Correlation-Id: 2ce9a183-c907-4f46-5cf8-08ddb0289e97 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?TfBK87mEFmQtlBvOFCb0Q5j94IKmNtlgARgfkKbTNQIzzTJX4a+vacDscdnL?= =?us-ascii?Q?2u3mw0Ux6SVMtzL8HkaFXq9rBoB2oAt5668hET1AQmS7e2u3bfP996odCcyx?= =?us-ascii?Q?9idS+umbhswHRXWzqXdHd/bxGyZlnJTPeQQJDRX+4nVFDyplOMaeRYxVdFQr?= =?us-ascii?Q?sFod2OkVuGlyShKVJ3XEPIOYXExTsrCWVptvLFHtQqWnLwYS/HExXDWamQum?= =?us-ascii?Q?ksHiomdVbNRATKM9fYa7ninLBuVtOXPaQD3Iun7AKsrsPWUy6Wt6h4MnmSdP?= =?us-ascii?Q?z5HdsoLKQ1j3vrb1VmGFz5kh+veeFDzZW+wYh9VvHd8OMiDPwR1j6hBidt7G?= =?us-ascii?Q?sc3irhczOr34BE5P+RH3hny5C3vEVmmdA6IT7NVABJ0EnK3fF4sM90l7wvi1?= =?us-ascii?Q?HDWD779Vj7PYj7/KDQfqveWL29qVKZXKxwRerLxU9FVfKXPvBQ8D0e+Pwfjs?= =?us-ascii?Q?orj18Xamw3NkF2t1rkDsSxEnj04y/CBA5N7k9Tk09j0QGzR144LRgEfV+oUc?= =?us-ascii?Q?B6PvfgNbuoKKy8gLGxgrpMRF1XvxXzVwn9Z0OYmW9sAnydMButJ6BELQbXRP?= =?us-ascii?Q?wYW+ZaBbc01umpPRA+ir9qNCUxhU81uuRq0E9JJfevKtDhPh2QfC5j9Dt8tU?= =?us-ascii?Q?d2Ty+VXBaYoBD0SHcbz+Bub3bNJL6n5wsTv4hMxhV2F8FRo/Jkql5I9e5rzM?= =?us-ascii?Q?J7dJLh6w8AImC2a01mrZrqTjNo0OIY9o+/s8wQlDBJHrHlbTmZ9htJXRN0N6?= =?us-ascii?Q?VqfWe/UecKl+DdGjZXEwy3WNuJmmfpkYiqa2uRK1o4Qu4NJYaGhb89VQ09Hm?= =?us-ascii?Q?n/cVcWnGcqEJAh8n1u8EW2abUBS/LVGITP22aypwG0PcYxof/GC/0oLVnw3D?= =?us-ascii?Q?JnLEM15AJnmVZTjMVkIxm/rbff3S5XtlQ8kTsWd/nByZdwDBaomZ/scdWgMw?= =?us-ascii?Q?3iZKdRIvj0OMPDdzgWvXIzU8RrdAhpy3fIECQILqbszjPgxrdQNt4eCUuJaA?= =?us-ascii?Q?tprWWphLb4J4sddHcM2v5WynsZ0hzRSBPoy82nAazD8uSDXo4mYhZErg8glG?= =?us-ascii?Q?5DXPKKq3PtUvoyfbFu/Bp8piXcDZ/wUih9GjJuG0i7Km5iFHc/Uy8MQJXOyL?= =?us-ascii?Q?luy5hHbr2tEoWw3meDaTpqUBGijZ38d/sU5p40Na6yrdYRuAoPkdtI+m/y6S?= =?us-ascii?Q?RuvpQo4fXvxbsq+C93b4kJazoNZvsGiao/CaJvm3PBYSysuLiRpM8mDQMfgk?= =?us-ascii?Q?rinVj3YV9v/dW1X51w0DQq9D8Mig3GIbx09mj+mlhAcPlreo/YlJWELEU1Ee?= =?us-ascii?Q?9Pii/w6/NKuxv/BpKM54Zks0ZuCe7ESvT3RtZutZvfc0brPOvEAYgMoVQhFz?= =?us-ascii?Q?WeuOvzOmWnGhkj494uiPyN1jAbEKgZ+aof4fNNxvRVtNiW/yH0MDSQgYY82c?= =?us-ascii?Q?vO13gh2sh8ILDZhQP113ZmeIkoQtYHjTJzX6Kzb5tZaFMhXxIJWxiUU/Xg3g?= =?us-ascii?Q?pGl3STkqJnins4O/l7193l9nhU10gMc8mJF1?= 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)(1800799024)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2025 18:31:06.1177 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2ce9a183-c907-4f46-5cf8-08ddb0289e97 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: BN1PEPF00005FFE.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB9130 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1750444877858116600 Content-Type: text/plain; charset="utf-8" device-tree.c stops requiring CONFIG_HAS_DEVICE_TREE_DISCOVERY and may function with DOM0LESS_BOOT. Without this, there's a clash with x86's definition of device_t. Because x86 doesn't discover devices in the DT it can simply skip the code to do so during the unflattening phase. Not a functional change on architectures that currently use these files, as they already select CONFIG_HAS_DEVICE_TREE_DISCOVERY. 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 725ff71646..741e2ce585 100644 --- a/xen/common/device-tree/device-tree.c +++ b/xen/common/device-tree/device-tree.c @@ -2029,9 +2029,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 b6d16756fc..ace7fc3274 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 Fri Oct 31 03:54:05 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=1750444910; cv=pass; d=zohomail.com; s=zohoarc; b=U6TVOClMH4HMcDnQ3JbwYcHlzUb0rzEBy1Hs0/2bIPU1veyJWMcXXxNQSQFbbF0rlQV7KNCJ+6K0EeFjoafq0j+QQ+Edw2D3mNLCZwzNLd68Ijj34r/l+E/MYMmbEd8GgfsgWkuA5G5E1Yi9rkKAHAhVBXNmpdWjCoIwqQgB+FA= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1750444910; 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=WdFpjspBLXF09Dh8dXIg7wVUrR+4cy9u7XozgkJTdVo=; b=lEp3irlS+krTdhrHE7Km4Bu3RIiMZerfVJJiLNQ1Tecj72YuKKZ6EZxd/gshNE0CsF0QoJ64ZDrNkcxmRnkeHGOHVPGErbPfJ82BXm4M9nctLu1VEdzFamFFi63FRduqMCCp1w0jg5cOvzQBg8JDAEnEkpprjfYsgzfIY75/DfI= 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 1750444910945708.9887472827907; Fri, 20 Jun 2025 11:41:50 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.1021175.1397228 (Exim 4.92) (envelope-from ) id 1uSggF-000557-12; Fri, 20 Jun 2025 18:41:39 +0000 Received: by outflank-mailman (output) from mailman id 1021175.1397228; Fri, 20 Jun 2025 18:41:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1uSggE-00054L-RE; Fri, 20 Jun 2025 18:41:38 +0000 Received: by outflank-mailman (input) for mailman id 1021175; Fri, 20 Jun 2025 18:41:37 +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 1uSgWB-00057I-Dx for xen-devel@lists.xenproject.org; Fri, 20 Jun 2025 18:31:15 +0000 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on20610.outbound.protection.outlook.com [2a01:111:f403:2407::610]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id bef0dc77-4e04-11f0-a30e-13f23c93f187; Fri, 20 Jun 2025 20:31:14 +0200 (CEST) Received: from BLAPR05CA0003.namprd05.prod.outlook.com (2603:10b6:208:36e::10) by PH7PR12MB5831.namprd12.prod.outlook.com (2603:10b6:510:1d6::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8835.29; Fri, 20 Jun 2025 18:31:11 +0000 Received: from BN1PEPF00005FFF.namprd05.prod.outlook.com (2603:10b6:208:36e:cafe::e1) by BLAPR05CA0003.outlook.office365.com (2603:10b6:208:36e::10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8880.13 via Frontend Transport; Fri, 20 Jun 2025 18:31:10 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by BN1PEPF00005FFF.mail.protection.outlook.com (10.167.243.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8857.21 via Frontend Transport; Fri, 20 Jun 2025 18:31:10 +0000 Received: from xcbagarciav01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 20 Jun 2025 13:31: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: bef0dc77-4e04-11f0-a30e-13f23c93f187 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iOuYhSWJzkdOQCjpsYOTL/Z4TtVTCF/m6u4Qs+T8DlNUNxXfkEu+QSyn9TwVYZUw3BTsLFqS5pynogxh+sYfIYX9FQRyoRyoYLFPlsJBD6eUdjsLzJi7xDPL9OKIQbHkg4B/+Httlyj7YVmZes4w5/vRYV+d1B9ts+hfcqvPi0EL6nqWo41X5HWgfb67kqkgWfrV6B6cwhlAXNSTmLEiPfha57XRarGROvdPXToEYPydHS0FdUshSf3HOa0lEA+rbfhdCbXUqTGOU6uG80ge5bFeZlHomqIxEQ2c3oQfNvw+meZuqNBDnQ/xpJ4Bhc1P4th0/tS1mqmJxhldpzhtsg== 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=WdFpjspBLXF09Dh8dXIg7wVUrR+4cy9u7XozgkJTdVo=; b=N8XLJsehOvwA0GFGe5oZn76SwEzxfsTBr98X+OAVVa5LUhNmeCRWYWxMI+VhjI8PHscUzoiicrkgajOHuXqKC7L2SPbT0CTaUOExj3etAtDLMY6Dx/AMfvgRsztDzKs9Ucr9i33kM9TgcEv9eHuIIVF45UtkNjNtCrrV//RWKa+1M6vUHfAG/AzInTDAcGcqmIksc8yytuWNwR9tTQuLiuMWfNxp/3lV7jab3jlJLajMIa32Nlkyybu5iiYlkVQ/eMnecD05TncFRv1rEeOZ10iu4m4TPFdj9cEdtUBvPLKHcwVPUOxv/frSJZViwUlplbay48HiPiKQ5zBTr2Lo8A== 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=WdFpjspBLXF09Dh8dXIg7wVUrR+4cy9u7XozgkJTdVo=; b=dB/ORJh1r3S35LnQ3ffHLEGTCkaqAMXWfqW4eWfEx8ik/LauvYGkEBacAnW1S3m5aKtsc29/dYFifw4jFAg7AhvpKTbAXiZTmoIMCNQeQYdCkhyYeliezGVj58Qt3NQeHPr4h54JQanp1eIM/grMSciQQWP9/gIXvpb4hidDfRg= 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" Subject: [PATCH v4 12/12] xen/dt: Remove DOM0LESS_BOOT's requirement on HAS_DEVICE_TREE_DISCOVERY Date: Fri, 20 Jun 2025 20:28:58 +0200 Message-ID: <20250620182859.23378-13-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250620182859.23378-1-agarciav@amd.com> References: <20250620182859.23378-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN1PEPF00005FFF:EE_|PH7PR12MB5831:EE_ X-MS-Office365-Filtering-Correlation-Id: fe7486d6-ee33-4b5c-1034-08ddb028a155 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ky2oK1WFKZBB83Xj4T617U2yS2c+uZYcT0dXbxo+YohCBeLdsopT9S55F28q?= =?us-ascii?Q?RMLMWOhltWgUuXLrUra3uf6OC0JVjCWhF22x7FuHLfVsrxkv87BGnphikGKY?= =?us-ascii?Q?W7E+PF1bSxTSjLnDh1fGeAQBB74eXO5By005wv2tERYJxilb2/5qOm9XJsLL?= =?us-ascii?Q?bUZXFSuczP0yxl6/BYOzHEdT5MreFHqOVdfKQ//9uicS6GgrUlZeZaHpeuDk?= =?us-ascii?Q?I8C2f6mfa/+x3fQ6bB4ppyxD2caGZ5yHFZQ7nT2fnLSm+NBFvgrwYBWx0b2D?= =?us-ascii?Q?dVmMVrTEFh5RudEpxf2qHw68y9CocStr+xq+yeLTVP4lJ62hRRUPEr2PBr+T?= =?us-ascii?Q?RVlVWg4jWC9PJD5kjXj5KmWQqGkFd+fMtd+i/AtqQnYtAoecrSRD2TQ6STRE?= =?us-ascii?Q?h5xzS2pV9pt3u7FyhoFet1xKeFSWa3zvhGdw7qhS+wHJwF6ahk2o/N6ksUZc?= =?us-ascii?Q?1SIKCVJkBZIaGt/Tns06vH60wo68fd8V0wnwCcm9hTDdwhPVnx+VDXV52gm9?= =?us-ascii?Q?Njq0RKK460oC75pSIN/xBm7SmeRUbyUAS1Cid474vyYKFn7xqGVxXvFHp3Lt?= =?us-ascii?Q?YM/lL18dDpoz8Gw1YrF0jx9rGXU62EldfRj3uLoQLfi7sNd9PFWYZK8EpKu9?= =?us-ascii?Q?7vV6zsZ8mjcSlq7Hz07OLgnYo32Ww/Ww1N/qnX3XkbHQHhSEPtTH2m+6sz5z?= =?us-ascii?Q?LHsDjf/LV7DhuFcYtgwNjHvDMy4l+nKkwU6T5L3koVljKOhpNNaPCKl94ecJ?= =?us-ascii?Q?59Hr39M+UXJl/omsk8szdV9iBAhLoyND0XSx7JnqavR5OcHh4PPO7Pr/sYpj?= =?us-ascii?Q?rHjCLRBrzF3elDNjrplzDo9fcSMN0E053CnjTdcukqOSYOOrjXflQ3otDgWi?= =?us-ascii?Q?jrwr2/0GnAAPqLeLI87qduexLGeWqkdQmtzj033yq/Frva+eYvjb8TCkTSrM?= =?us-ascii?Q?rzhpGn8yQpoZLp9AGXA2rab+9SxUsRZMIk41WQ5B2JdFYEcRw5lQwl6SzJr2?= =?us-ascii?Q?80XUNFuu+c9w2lFWc756gXohTI+0Ahs5b/5CRxUJxfDXYHuBqwVTLPgG+L5V?= =?us-ascii?Q?6uJLB03mgFcm5J0csdKir6TWJ8sNlQi+dVaGgd8+mohvPfLjnLY70whf43Td?= =?us-ascii?Q?EZNyzlNCszMx/s6QuUgNZI8RrazH/4AFSJt1Dbmsw9rF20o+VHJTX42NMFbQ?= =?us-ascii?Q?JXE1IABBTJ+0vruRJ8+lyvTcYLwaRmLU4x2V9rhYobf1jbECEJ8zTlDhjBYA?= =?us-ascii?Q?ma7ds4zEvlqu/dP34IctN7qGWkwshmcSFWIGROCdEaqF1roHw9U4MHwvlffP?= =?us-ascii?Q?XSvmZhwVZ5RdHa7+7/97wUlfPGs05BaNOnW24SVBJaUhPSm+MosjEOJkSOY+?= =?us-ascii?Q?NMkJncfpzT6O9OWpZjyFGK27raNVIc0xNAPjlKnuxKBWjsqmAbL1n4r3F7qm?= =?us-ascii?Q?ezzU1lxUrA6PktVBo5Qu4q8NWImz1iL0QRc5R14M90Uu2aaQ3+ckgrnZZr8F?= =?us-ascii?Q?eWTayfeaNlg+fL/2HuJ5Oo8ZEgIDh5MLEu0g?= 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)(1800799024)(82310400026)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Jun 2025 18:31:10.7951 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fe7486d6-ee33-4b5c-1034-08ddb028a155 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: BN1PEPF00005FFF.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5831 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1750444912343116600 Content-Type: text/plain; charset="utf-8" This effectively means that DOM0LESS_BOOT on platforms without HAS_DEVICE_TREE_DISCOVERY (i.e: x86) acts as a selector for a stripped-down version of DT code. Signed-off-by: Alejandro Vallejo Reviewed-by: Stefano Stabellini --- xen/Kconfig.debug | 2 +- xen/common/Kconfig | 3 ++- xen/common/Makefile | 1 + xen/common/device-tree/Makefile | 8 ++++---- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/xen/Kconfig.debug b/xen/Kconfig.debug index 9192d593a7..89b0af53a2 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_DISCOVERY + depends on DOM0LESS_BOOT || HAS_DEVICE_TREE_DISCOVERY help Device tree parsing and DOM0 device tree building messages are logged in the Xen ring buffer. diff --git a/xen/common/Kconfig b/xen/common/Kconfig index 6294cd7939..1ac28a4e78 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -14,7 +14,8 @@ config CORE_PARKING =20 config DOM0LESS_BOOT bool "Dom0less boot support" if EXPERT - depends on HAS_DOM0LESS && HAS_DEVICE_TREE_DISCOVERY && DOMAIN_BUILD_HELP= ERS + select LIBFDT + depends on HAS_DOM0LESS && DOMAIN_BUILD_HELPERS default y help Dom0less boot support enables Xen to create and start domU guests during diff --git a/xen/common/Makefile b/xen/common/Makefile index d541fbcf49..19d6ff7a90 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -9,6 +9,7 @@ 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_DOM0LESS_BOOT) +=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..4a10b0508f 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-y +=3D device-tree.o +obj-$(CONFIG_HAS_DEVICE_TREE_DISCOVERY) +=3D bootinfo-fdt.init.o +obj-$(CONFIG_HAS_DEVICE_TREE_DISCOVERY) +=3D bootinfo.init.o +obj-$(CONFIG_HAS_DEVICE_TREE_DISCOVERY) +=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