From nobody Mon Nov 17 12:54:31 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=1745930232; cv=pass; d=zohomail.com; s=zohoarc; b=XxKWnrFW/NccGi8Ym0W4H8StnHbtt26DGgusZa1LLZyTJ60k0JAjSrO04ry5Nfze8oNYamIqi1MCtqjoTeDnwkdnwk2VBd2LmNVNxlaNMwxYB2Blnk4GCsMHNookWi6FlZBeq0iQ7aWs5gIwM0oLTK7bd3DaGqaec7MNFS8uPLg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745930232; 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=jgu5x27Qay+e+Aam2Lc6rwal+aKJVBVdZe6PlDDiYms=; b=NoeeDHpl/f266dIqdncuzS3PkOE4LefqMSKn7iu/5DiaE7oeFVzFRWfXGVXfPBb02EPOnwezAe8FeYVp6gTW/KDIVw6isRmaKWul8mWWXzV10KVIfQEBTxvAIeQzveRaH+VjdZ2g9w7J3Xw+CbECpswY3gsP9AXTQO00lufcJok= 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 1745930232810910.2037613679923; Tue, 29 Apr 2025 05:37:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.972348.1360721 (Exim 4.92) (envelope-from ) id 1u9kCq-0007sN-S2; Tue, 29 Apr 2025 12:37:00 +0000 Received: by outflank-mailman (output) from mailman id 972348.1360721; Tue, 29 Apr 2025 12:37:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u9kCq-0007sG-Oy; Tue, 29 Apr 2025 12:37:00 +0000 Received: by outflank-mailman (input) for mailman id 972348; Tue, 29 Apr 2025 12:36:59 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u9kCp-0007KK-6X for xen-devel@lists.xenproject.org; Tue, 29 Apr 2025 12:36:59 +0000 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2062a.outbound.protection.outlook.com [2a01:111:f403:2414::62a]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id a4400458-24f6-11f0-9eb4-5ba50f476ded; Tue, 29 Apr 2025 14:36:58 +0200 (CEST) Received: from BL1PR13CA0305.namprd13.prod.outlook.com (2603:10b6:208:2c1::10) by CYYPR12MB8872.namprd12.prod.outlook.com (2603:10b6:930:c8::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8678.31; Tue, 29 Apr 2025 12:36:53 +0000 Received: from MN1PEPF0000ECD5.namprd02.prod.outlook.com (2603:10b6:208:2c1:cafe::8a) by BL1PR13CA0305.outlook.office365.com (2603:10b6:208:2c1::10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8699.17 via Frontend Transport; Tue, 29 Apr 2025 12:36:52 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000ECD5.mail.protection.outlook.com (10.167.242.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8699.20 via Frontend Transport; Tue, 29 Apr 2025 12:36:51 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 29 Apr 2025 07:36: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: a4400458-24f6-11f0-9eb4-5ba50f476ded ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sq+LJCWF7DZ8Bh0bneBWq9jqBaaVzk83Kk65C8kV6npkGXmLJJNYfZT7VYazrYHSbRNptaIGc8e15w+3ctQ3j6hVsyni/wwUrk888TlNcAGnTyXHACVHLSvQZnaNp9x5/1IGFU8P+1GaEGGNN3ltckZ+qhuiAWeHtIyv/6l6t0K5UeMoaPiM7/CtR+1fRfsZ3y9YEd+RHrBh1gwTs3dL2MFKA2nscPiB8LzgUM0dxLI1f8wRdVkotIohFONtm+slYtmpKouyQMn1lGqf0fcNS2zT+XjI7ixiyFkK7dsp7S1qmFeVTFZxcLCN59FUvJCz/V88sVIVUQ51t/SCwU4omQ== 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=jgu5x27Qay+e+Aam2Lc6rwal+aKJVBVdZe6PlDDiYms=; b=Q1ahSUBVoeiMrl96V2+YFFNDZeIRt0T217leaZC721l0FiKJDESw4Xki39AKk8z9VoTmEvYLRwDh8Ls1PmthPNQvV37tqcLQsBvDLjrv3eQrTU/IFYgCweNHJZMxtA/tvO2NPnSP7iATJkqW8kE3BNvgb4iylEsaIJ7SYHXbu/QFeLJWQVTpExEddpkPSDw3l9PBWe4GemUFSx+ISV4xaBWwwixSwitIBqMh7dFtEXFXBKv9cTNtPTP8I91n5JUnAJNiPz2DOfNr4pCVDN/Bq679rnjjeEDMNEz+8b9tn0axdwTzd2dSGTszbe2X/cn5+DRC5o+KJcBrUSR3oHvN5g== 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=jgu5x27Qay+e+Aam2Lc6rwal+aKJVBVdZe6PlDDiYms=; b=pYtbuTzeV2HqvsLBRZM5fiv/E3gG8XpblVjxIfwpV5YDcEf8oQKKhqFBe2/U9JNbF7ICb2ybr3Z1X8xmnA31DTo3EKG12fepSbsXo9dSfIcry3yw2eusMcIrJwHetzQlZwMFI7gECb6C9JvnfqgriwFGje+ry8ixiOrR6NXreAg= 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: "Daniel P. Smith" , Andrew Cooper , Anthony PERARD , Michal Orzel , Jan Beulich , "Julien Grall" , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , Alejandro Vallejo , Denis Mukhin , "Jason Andryuk" Subject: [PATCH v6 01/12] kconfig: introduce CONFIG_DOMAIN_BUILDER Date: Tue, 29 Apr 2025 13:36:12 +0100 Message-ID: <20250429123629.20839-2-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250429123629.20839-1-agarciav@amd.com> References: <20250429123629.20839-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD5:EE_|CYYPR12MB8872:EE_ X-MS-Office365-Filtering-Correlation-Id: 26c7a079-5d78-4454-bbdd-08dd871a8488 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?QqIFw1ez2hhEUNMppwSZo9npba0HNsihh6IXQfpzFDwwUUwTEAwJ3gSN67ZP?= =?us-ascii?Q?TNpwBnkdi9CKSI3LQSdxOUqW8m4NrAubjG6G9O5H6zACKvBF8u5OahVfxJtV?= =?us-ascii?Q?ZSe0rx7Wn+LmKx65OIBrH+5R5y7zDiHbId/gKqgPnNxlB9604NMlKmBVTmZC?= =?us-ascii?Q?vTnh3+NUcdmYM7JeymACQsEAV6W/QCVQP2+hlHxK1nou7qW3gH7vj0bWQjVm?= =?us-ascii?Q?5Scdji/XAgOaJ6RfX7jhnXsCRDZNJJhxGVydaivbNrROOr8E4EPhlUI+Njl6?= =?us-ascii?Q?wiH95woTPfdAfjN+nUYdOHWblQRKZvnVmUDM1IOTBPA7B9FecZ0CNE1dIEax?= =?us-ascii?Q?jrX0euM4ts6PSvfZ7JvjCiWrJKyd+hM8R1SbxFMx/iz/S++lb9f5cuHCDBCT?= =?us-ascii?Q?j9odgtSaHphynA01sEWtjFz9SgxYrYir7BLvqDa5+QqrIohOizWHVj4Yq08r?= =?us-ascii?Q?PvowjKZLxcOQlLofvl8YqZ+4anNRfVTUhH03KUrbH3anCaQF4c2clceWI/VT?= =?us-ascii?Q?Dv2mc4v131/8t0rHAwsn4mZ+6GBi6cNuyAEn84gt9Jy4oa7nK81j3ImI7guX?= =?us-ascii?Q?/10RGh5qw7ZF2gWAY8UWa2zS921JVTCAY5oO/fxzPCIhwCvwPlDlDtpoPoC0?= =?us-ascii?Q?rZII8l36NkhWdSaBcPowpX78lweHTeyx4aCFSdxApd0lAaaCKq4/AiX3QgoF?= =?us-ascii?Q?HOuPQdFJg4Fl2tnbjro9ABl9PCG0ZpAuxUdTSDelZmDa/UxTqIjkalOE83sk?= =?us-ascii?Q?YpSsL2FjzEIV3ujoUseblG4fgbg20rwNOQ454uyQFOBc/oiGy5xc5+DzGkCe?= =?us-ascii?Q?yPN7pH8NK9OvnPDnZ6h7uTfpGgFK+74gi0CwhQd0MNW+8uh4HzyoCqvIj8LK?= =?us-ascii?Q?7opkNx7Mk8XXEEJaSBqoQHcTeTrsi44feRHw0YKWyrydDlPqPXoQpAb6BIEq?= =?us-ascii?Q?yhM4W/pBbeupYIcN/tSm5kZnmgvaD2ohRbNpu5/bqfba9CEygnF6VW6EFATJ?= =?us-ascii?Q?ssmKS6HLn10aCI2hAUksberhlSBueTsIOUKqfwQn+GnPXpJlA7iwBNtcoJQ6?= =?us-ascii?Q?9E1O1+DK4Xp1SHt3ZpfStqmRpegrBQ7pcM5tjkmtW7A6cNQFVnub2PK8D/nu?= =?us-ascii?Q?eHoE74UzTMqe1L+GLVQo2JvEJwmUg2hsAb1IUs7IDhIv9RMQ4iCgWTcgWsx3?= =?us-ascii?Q?1XxQkYB+HMOtx7cuArGjmN16qIHeGZxPAO2+f0b+LyEy/d3ID0aMp8EfP8Ia?= =?us-ascii?Q?/wjY2agjoktQ5ZaxqGgcyuy0qp7r3TcYT1+uCayPPE8gvPoxYpRAOK8kCZ7i?= =?us-ascii?Q?xvubyIky1nJsXyL2eaHqeZp1SNZb2zdqByVWXdJreYRS3WgRDAGKS6XSmmSL?= =?us-ascii?Q?4vcqxzL+QiQVFp2uHoqYhrb3HMhx3UW7w3Ls42hyfrhpwUZmDIRhNpK9zNZQ?= =?us-ascii?Q?J0Z9ZTRwglKrxYqawhUh5fkG75vVHOPgdl1o7eamPTy+snvNb6tr6Dmctsn8?= =?us-ascii?Q?ei+q6lOztE329GpjvlMzqUX1QBM24JGF57Tz?= 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: 29 Apr 2025 12:36:51.8481 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 26c7a079-5d78-4454-bbdd-08dd871a8488 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: MN1PEPF0000ECD5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CYYPR12MB8872 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1745930234094019100 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Smith" Hyperlaunch domain builder will be the consolidated boot time domain building logic framework. Introduce the config option to enable this domain builder to eventually turn on the ability to load the domain configuration via a flattened device tree. Signed-off-by: Daniel P. Smith Signed-off-by: Alejandro Vallejo Reviewed-by: Denis Mukhin Reviewed-by: Jason Andryuk --- xen/common/Kconfig | 2 ++ xen/common/domain-builder/Kconfig | 15 +++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 xen/common/domain-builder/Kconfig diff --git a/xen/common/Kconfig b/xen/common/Kconfig index be28060716..e025fbe257 100644 --- a/xen/common/Kconfig +++ b/xen/common/Kconfig @@ -144,6 +144,8 @@ config STATIC_MEMORY =20 If unsure, say N. =20 +source "common/domain-builder/Kconfig" + menu "Speculative hardening" =20 config INDIRECT_THUNK diff --git a/xen/common/domain-builder/Kconfig b/xen/common/domain-builder/= Kconfig new file mode 100644 index 0000000000..44b8351af8 --- /dev/null +++ b/xen/common/domain-builder/Kconfig @@ -0,0 +1,15 @@ +menu "Domain Builder Features" + +config DOMAIN_BUILDER + bool "Domain builder (UNSUPPORTED)" if UNSUPPORTED && X86 + select LIBFDT + help + Support for constructing predefined domains described by a flattened + device tree. This allows constructing multiple domains at boot time + instead of being limited to a single dom0. + + This feature is currently experimental. + + If unsure, say N. + +endmenu --=20 2.43.0 From nobody Mon Nov 17 12:54:31 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=1745930237; cv=pass; d=zohomail.com; s=zohoarc; b=U0kJOV+OzFcB4V7h4vs90aMcG/aeTygWk04IfEq2BEVgeyPZEe0SMMRwT410JT5Wut54DzDXNs2A1LpYjKjVWHfGLUEGWZcyo3Ir2Pp6n77h5BX5ocyYsxVuJW/K6kwg5N0Za3yLFbayT9KNH68mJTdyt20XbIvxZ0qiVe9tkYM= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745930237; 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=T5SS7pgcQrdIr//vyH9w44IWF1ZtlLdCSEKlz/+agP0=; b=gSdRxaFmhpoveQsgsEoU3JkqvgkqCmivR9SlLfZYMpW71q+KNaMS18VRx1uhFYRA+ckg82vEPaFhOvK0HuGWQgNmUI9YPAKExHF3bvO55SepPr2aJ3bO0UdQM12W72IuAlJYV/cdtVuVeoczanMAMPb79RzpwytAweLOlIf/EAA= 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 1745930237586592.1274332789411; Tue, 29 Apr 2025 05:37:17 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.972351.1360731 (Exim 4.92) (envelope-from ) id 1u9kCw-0008DY-4M; Tue, 29 Apr 2025 12:37:06 +0000 Received: by outflank-mailman (output) from mailman id 972351.1360731; Tue, 29 Apr 2025 12:37: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 1u9kCv-0008DR-Vz; Tue, 29 Apr 2025 12:37:05 +0000 Received: by outflank-mailman (input) for mailman id 972351; Tue, 29 Apr 2025 12:37:04 +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 1u9kCu-0007L9-J3 for xen-devel@lists.xenproject.org; Tue, 29 Apr 2025 12:37:04 +0000 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on20630.outbound.protection.outlook.com [2a01:111:f403:2418::630]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a523b03c-24f6-11f0-9ffb-bf95429c2676; Tue, 29 Apr 2025 14:37:01 +0200 (CEST) Received: from BL1PR13CA0318.namprd13.prod.outlook.com (2603:10b6:208:2c1::23) by PH7PR12MB9150.namprd12.prod.outlook.com (2603:10b6:510:2eb::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8699.19; Tue, 29 Apr 2025 12:36:57 +0000 Received: from MN1PEPF0000ECD5.namprd02.prod.outlook.com (2603:10b6:208:2c1:cafe::22) by BL1PR13CA0318.outlook.office365.com (2603:10b6:208:2c1::23) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8655.34 via Frontend Transport; Tue, 29 Apr 2025 12:36:57 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000ECD5.mail.protection.outlook.com (10.167.242.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8699.20 via Frontend Transport; Tue, 29 Apr 2025 12:36:57 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 29 Apr 2025 07:36:51 -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: a523b03c-24f6-11f0-9ffb-bf95429c2676 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gclvPge5z79WCmTbvkkXjEvOiONJvxGOZxW9WnK8WK8Q4OWgfEB1RjQ5X9PA5en5onxt9BtcdTtEQST59VyWjNA7u+CeRnrwzuTXg/W4deIQ2oNOM6BQYpYi+wa90j5cWGwKz803wkodu0CvI6NPeYEmuOvNedlaKBfupayDzomW5eGo/H3TELjV5FYlLarBEWKCDcOhA1KLpoDjLGgZkpaLRh1wyCkOf2i47tM9SLW2YKoCV3nrBLbxb0U+OGUtn8fmwDMHCOMmakqWW43zN7QSRZlRwjhFC7I28CZtn3gikZ5UlupeINRhGO5D/2vn1HTnTEzlIOwuOFS1yKf5Rg== 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=T5SS7pgcQrdIr//vyH9w44IWF1ZtlLdCSEKlz/+agP0=; b=HmqMG9WAT1eo8/uuuGqJIIWnCZzSs16YINWr3Bj0LuNH+8MpXM/ygmGWUGGIyxBw55jhlNOYv43d2y1hNVVjc5ROG2/fHohZD6/I/DDmrhRlzC3RP4/ej6+ZjEMpCw5fXQzn3M+cg//EDislVDe20y3vQY4rHKqTAi+4ED0WSZa+muasvF9dEK/AOvIpvsPWR0IhQqP8/QRv/pPjpnrMqfFVcRxP82VCsceTubGzlC3sK7tCGIJ6mAdlDIhzilubsNDTHBOIwjSlH+we/nn/uHXSw78OdAPETuoaSU4GOHdWlnoTCIDkVsdQYKgm7oFpv6qJk+XloloOiTjJijenGQ== 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=T5SS7pgcQrdIr//vyH9w44IWF1ZtlLdCSEKlz/+agP0=; b=t1KNDnAvQFxXUUm1Y26D2xVWyps4vltqgjyglFIM74obuKCT+QzLfciznDgxarDzZDuF7b/fZFpNlE3oibImTQQZyg94rshGvA8ruZO90M/1PuTF+2ryOXLT3nsLm35aWJfJ6YsyJyN1StwRc7/mXZ1qWsAVVUnCIIPJn0St/no= 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: "Daniel P. Smith" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD , Michal Orzel , "Julien Grall" , Stefano Stabellini , "Jason Andryuk" , Alejandro Vallejo , "Denis Mukhin" Subject: [PATCH v6 02/12] common/hyperlaunch: introduce the domain builder Date: Tue, 29 Apr 2025 13:36:13 +0100 Message-ID: <20250429123629.20839-3-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250429123629.20839-1-agarciav@amd.com> References: <20250429123629.20839-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD5:EE_|PH7PR12MB9150:EE_ X-MS-Office365-Filtering-Correlation-Id: e1411532-8015-4d3c-c413-08dd871a87db X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?rrLs3QveamfIW0dE/u0KRMp6gVYG+zVhUGmc+Pd+MdhAutfj71XvmCVuvOwB?= =?us-ascii?Q?klNGkZJxnZkoh0iea/qFnfQdZmPIu9MGEXawejYNhbzi18FLwsSF/bngdQjx?= =?us-ascii?Q?BzSc549VwBJsFmN/ecKvD+nUjYc4bK5oyQkk43/oXQJXWE21t2026JCnhHsq?= =?us-ascii?Q?J9AIR/WDwpXdIahDe6C/q4pp/rW2CCUjTPYLd9WB4p8TLi6saBvFTIHZEIe5?= =?us-ascii?Q?BoUL3tbV9LGeO2iW8jWy17Useo+JX/LcAMxRz9nM1j1c3Jj7lNhkqh8AB9Gu?= =?us-ascii?Q?W3ypPs+TOGzsRWYb8Y4yGobC0rRRRV8ACO4zw6iDREpYqOsG/D0ekUgckSuK?= =?us-ascii?Q?Jjb3QEs85mSBLtBnmNgJytFC25L4g8B/fj/TA9+cR5BKtKCew3qgmhbldYmk?= =?us-ascii?Q?PjmyvLRf5K/J4RMG/liFtolyCbgRWAmD4dsMWhFSP0nSe8Co7su6I3zySqfD?= =?us-ascii?Q?B3AgyxkCIkJVaMnkCyIb7P6WWHJWgYqbewYNgS+/QgzBKnSVGn5iPQ3b02zV?= =?us-ascii?Q?L5PNP574GeTGpSQUWyS7oR2Jp66zOVDSdT8n9ZDIpmjFvF2PEadmp1mJS5pI?= =?us-ascii?Q?fdtFuoZhGIfieYOHfJqHWn32BbpQLnt31wJMwsazNvtNeQLymJMqVDZEciaI?= =?us-ascii?Q?k5EpRUjjx3dvyciQJgYK55YnWTWqTRoUPES8rscgRj7974wc8hvFOC6T+Zty?= =?us-ascii?Q?uUdg+7mMi0Vk5seQzA2fOa/ZzsT9pVSHK47EQdI8rcZ1DPRpqCUxc4o7jva2?= =?us-ascii?Q?0t3iL/mFBsWvS2OgxuEvueeme0a79QdEnzGX6ujfBT6glpFe2lXmbhKJD3zr?= =?us-ascii?Q?dZjpC/GHNT+1aFN4FoZuJJ/eMjluahKjS7nxDVzRLui1N7VPUMRtXcpTsErz?= =?us-ascii?Q?NqoHiX6UOjeFTahS7VAvRMcZ8gRsfMjxqUnVLkn9O0br+FTGk028RTvrpP9E?= =?us-ascii?Q?iDcKBPS90//UsM3oTPTA1j/sJtgDD6D7BV6mZq2hAQtyNe2PITwXWKR4o+dp?= =?us-ascii?Q?Lr8T32QF8CD8IUvA5T3ScsQiRwZ6ArCPxYUXgnU2w2KD6qq0YZ0p41z4x8p1?= =?us-ascii?Q?u8GEj6PTGny2LXkza1cqBRYJ8Zn+7qy2obPevkWnBVUSBDotKOHe79YQYb/K?= =?us-ascii?Q?sroq1D/wv9NHdWMFu4+XvXJricwiDQWm2VxCUgM0drxO9CTQBFMtb2BVOu8k?= =?us-ascii?Q?YY/JOs/4woG02hboMPr1aZ+aRRnmOfdNk9805AB8pICdtQqyYPq0GguNF4M3?= =?us-ascii?Q?f412tahuYhS6TI08tLFL0xEt6KPrWh6rjsfONkKHYOexf1i4hUCUcl8OcokC?= =?us-ascii?Q?mUsSbEbDADL0t4fPWW+qDa/DYFzFXPU7YMwIPrdG/ucehm429zYk4mm6IiK0?= =?us-ascii?Q?IWP7t4pu1jUpzEFqEr2XXmOjjNnpX468sUxhNo9gfjcwDBEtzPjEjeD6IOJe?= =?us-ascii?Q?3ADzrjNINjZ+oxeywZx0SdmXSV3EdfLZ51WqnxqAcab3Ll2MsLnapkIsNEiy?= =?us-ascii?Q?8c42f77TnGc2QEdpCzMXhGnNJ0jRDzntFJIK?= 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)(82310400026)(36860700013)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2025 12:36:57.4253 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e1411532-8015-4d3c-c413-08dd871a87db 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: MN1PEPF0000ECD5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB9150 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1745930240060019100 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Smith" Introduce the domain builder which is capable of consuming a device tree as= the first boot module. If it finds a device tree as the first boot module, it w= ill set its type to BOOTMOD_FDT. This change only detects the boot module and continues to boot with slight change to the boot convention that the dom0 kernel is no longer first boot module but is the second. No functional change intended. Signed-off-by: Daniel P. Smith Signed-off-by: Jason Andryuk Signed-off-by: Alejandro Vallejo Reviewed-by: Denis Mukhin --- xen/arch/x86/include/asm/bootinfo.h | 3 ++ xen/arch/x86/setup.c | 19 ++++++++---- xen/common/Makefile | 1 + xen/common/domain-builder/Makefile | 2 ++ xen/common/domain-builder/core.c | 45 +++++++++++++++++++++++++++++ xen/common/domain-builder/fdt.c | 39 +++++++++++++++++++++++++ xen/common/domain-builder/fdt.h | 14 +++++++++ xen/include/xen/domain-builder.h | 29 +++++++++++++++++++ 8 files changed, 146 insertions(+), 6 deletions(-) create mode 100644 xen/common/domain-builder/Makefile create mode 100644 xen/common/domain-builder/core.c create mode 100644 xen/common/domain-builder/fdt.c create mode 100644 xen/common/domain-builder/fdt.h create mode 100644 xen/include/xen/domain-builder.h diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 3afc214c17..82c2650fcf 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -27,6 +27,7 @@ enum bootmod_type { BOOTMOD_RAMDISK, BOOTMOD_MICROCODE, BOOTMOD_XSM_POLICY, + BOOTMOD_FDT, }; =20 struct boot_module { @@ -80,6 +81,8 @@ struct boot_info { paddr_t memmap_addr; size_t memmap_length; =20 + bool hyperlaunch_enabled; + unsigned int nr_modules; struct boot_module mods[MAX_NR_BOOTMODS + 1]; struct boot_domain domains[MAX_NR_BOOTDOMS]; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 2518954124..f3b5c83a3c 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -1284,9 +1285,14 @@ void asmlinkage __init noreturn __start_xen(void) bi->nr_modules); } =20 - /* Dom0 kernel is always first */ - bi->mods[0].type =3D BOOTMOD_KERNEL; - bi->domains[0].kernel =3D &bi->mods[0]; + if ( builder_init(bi) =3D=3D FDT_KIND_NONE ) + { + /* Find first unknown boot module to use as dom0 kernel */ + i =3D first_boot_module_index(bi, BOOTMOD_UNKNOWN); + bi->mods[i].type =3D BOOTMOD_KERNEL; + bi->domains[0].kernel =3D &bi->mods[i]; + bi->hyperlaunch_enabled =3D false; + } =20 if ( pvh_boot ) { @@ -1469,8 +1475,9 @@ void asmlinkage __init noreturn __start_xen(void) xen->size =3D __2M_rwdata_end - _stext; } =20 - bi->mods[0].headroom =3D - bzimage_headroom(bootstrap_map_bm(&bi->mods[0]), bi->mods[0].size); + bi->domains[0].kernel->headroom =3D + bzimage_headroom(bootstrap_map_bm(bi->domains[0].kernel), + bi->domains[0].kernel->size); bootstrap_unmap(); =20 #ifndef highmem_start @@ -1594,7 +1601,7 @@ void asmlinkage __init noreturn __start_xen(void) #endif } =20 - if ( bi->mods[0].headroom && !bi->mods[0].relocated ) + if ( bi->domains[0].kernel->headroom && !bi->domains[0].kernel->reloca= ted ) panic("Not enough memory to relocate the dom0 kernel image\n"); for ( i =3D 0; i < bi->nr_modules; ++i ) { diff --git a/xen/common/Makefile b/xen/common/Makefile index 98f0873056..e42af71e3f 100644 --- a/xen/common/Makefile +++ b/xen/common/Makefile @@ -11,6 +11,7 @@ obj-$(filter-out $(CONFIG_X86),$(CONFIG_ACPI)) +=3D devic= e.o obj-$(CONFIG_HAS_DEVICE_TREE) +=3D device-tree/ obj-$(CONFIG_IOREQ_SERVER) +=3D dm.o obj-y +=3D domain.o +obj-$(CONFIG_DOMAIN_BUILDER) +=3D domain-builder/ obj-y +=3D event_2l.o obj-y +=3D event_channel.o obj-$(CONFIG_EVTCHN_FIFO) +=3D event_fifo.o diff --git a/xen/common/domain-builder/Makefile b/xen/common/domain-builder= /Makefile new file mode 100644 index 0000000000..bfd2f6267e --- /dev/null +++ b/xen/common/domain-builder/Makefile @@ -0,0 +1,2 @@ +obj-y +=3D fdt.init.o +obj-y +=3D core.init.o diff --git a/xen/common/domain-builder/core.c b/xen/common/domain-builder/c= ore.c new file mode 100644 index 0000000000..97c92db571 --- /dev/null +++ b/xen/common/domain-builder/core.c @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2024, Apertus Solutions, LLC + */ +#include +#include +#include +#include +#include +#include + +#include + +#include "fdt.h" + +enum fdt_kind __init builder_init(struct boot_info *bi) +{ + enum fdt_kind kind; + + bi->hyperlaunch_enabled =3D false; + switch ( (kind =3D fdt_detect_kind(bi)) ) + { + case FDT_KIND_NONE: + /* No DT found */ + return kind; + + case FDT_KIND_UNKNOWN: + printk(XENLOG_DEBUG "DT found: non-hyperlaunch\n"); + bi->mods[0].type =3D BOOTMOD_FDT; + return kind; + + default: + BUG(); + } +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/common/domain-builder/fdt.c b/xen/common/domain-builder/fd= t.c new file mode 100644 index 0000000000..4b07bd22c8 --- /dev/null +++ b/xen/common/domain-builder/fdt.c @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (C) 2024, Apertus Solutions, LLC + */ +#include +#include +#include +#include + +#include +#include +#include + +#include "fdt.h" + +enum fdt_kind __init fdt_detect_kind(const struct boot_info *bi) +{ + enum fdt_kind kind; + const void *fdt =3D bootstrap_map_bm(&bi->mods[HYPERLAUNCH_MODULE_IDX]= ); + + if ( !fdt || fdt_check_header(fdt) < 0 ) + kind =3D FDT_KIND_NONE; + else + kind =3D FDT_KIND_UNKNOWN; + + bootstrap_unmap(); + + return kind; +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/xen/common/domain-builder/fdt.h b/xen/common/domain-builder/fd= t.h new file mode 100644 index 0000000000..ef897fc412 --- /dev/null +++ b/xen/common/domain-builder/fdt.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef __XEN_DOMAIN_BUILDER_FDT_H__ +#define __XEN_DOMAIN_BUILDER_FDT_H__ + +#include + +struct boot_info; + +/* hyperlaunch fdt is required to be module 0 */ +#define HYPERLAUNCH_MODULE_IDX 0 + +enum fdt_kind fdt_detect_kind(const struct boot_info *bi); + +#endif /* __XEN_DOMAIN_BUILDER_FDT_H__ */ diff --git a/xen/include/xen/domain-builder.h b/xen/include/xen/domain-buil= der.h new file mode 100644 index 0000000000..b9702db735 --- /dev/null +++ b/xen/include/xen/domain-builder.h @@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef __XEN_DOMAIN_BUILDER_H__ +#define __XEN_DOMAIN_BUILDER_H__ + +struct boot_info; + +/* Return status of builder_init(). Shows which boot mechanism was detecte= d */ +enum fdt_kind +{ + /* FDT not found. Skipped builder. */ + FDT_KIND_NONE, + /* Found an FDT that wasn't hyperlaunch. */ + FDT_KIND_UNKNOWN, +}; + +/* + * Initialises `bi` if it detects a compatible FDT. Otherwise returns + * FDT_KIND_NONE and leaves initialisation up to the caller. + */ +#if IS_ENABLED(CONFIG_DOMAIN_BUILDER) +enum fdt_kind builder_init(struct boot_info *bi); +#else +static inline enum fdt_kind builder_init(struct boot_info *bi) +{ + return FDT_KIND_NONE; +} +#endif /* !IS_ENABLED(CONFIG_DOMAIN_BUILDER) */ + +#endif /* __XEN_DOMAIN_BUILDER_H__ */ --=20 2.43.0 From nobody Mon Nov 17 12:54:31 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=1745930250; cv=pass; d=zohomail.com; s=zohoarc; b=B6lrB3zspC0St1mBOb0RPkuGFj/hgmSRylQDxqVjWKx4fTYPmN2bqwTP5loioeXymDGccPRjFGwkCPw27COpd5uzL+apQD3zEhRCOnvyPFuFMplT5hULdryRbT48p7883e07DJoi8sRwjkZfofMizI/eazF+u+reBTPWDBpyeaQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745930250; 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=kzlDcDxGuBna1NjqeyuBWXITlGSX+G2YYWsKMdoIvyU=; b=F3uxcBI55E2vVmr5p/UxoIhVG/7B1xp2slVt39Y0SO9YnykrMTS9+CgGQTX3nLMqPEuBVAAK/ck8DGKvPUZyFLO9Nc2KWqBt8CawscUuoC3djK/mnrZopEelspEgCCO+5uzMkTtdl01kURc3L+UCvxgVzn1my1wUrahy9s+NGhA= 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 1745930250372328.26124965513316; Tue, 29 Apr 2025 05:37:30 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.972364.1360741 (Exim 4.92) (envelope-from ) id 1u9kD7-0000Rt-KQ; Tue, 29 Apr 2025 12:37:17 +0000 Received: by outflank-mailman (output) from mailman id 972364.1360741; Tue, 29 Apr 2025 12:37:17 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u9kD7-0000Rk-Ha; Tue, 29 Apr 2025 12:37:17 +0000 Received: by outflank-mailman (input) for mailman id 972364; Tue, 29 Apr 2025 12:37:16 +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 1u9kD6-0007L9-40 for xen-devel@lists.xenproject.org; Tue, 29 Apr 2025 12:37:16 +0000 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on20602.outbound.protection.outlook.com [2a01:111:f403:2418::602]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id ac624906-24f6-11f0-9ffb-bf95429c2676; Tue, 29 Apr 2025 14:37:13 +0200 (CEST) Received: from BL1PR13CA0334.namprd13.prod.outlook.com (2603:10b6:208:2c6::9) by MW4PR12MB6683.namprd12.prod.outlook.com (2603:10b6:303:1e2::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8678.30; Tue, 29 Apr 2025 12:37:07 +0000 Received: from MN1PEPF0000ECD8.namprd02.prod.outlook.com (2603:10b6:208:2c6:cafe::1f) by BL1PR13CA0334.outlook.office365.com (2603:10b6:208:2c6::9) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8655.23 via Frontend Transport; Tue, 29 Apr 2025 12:37:07 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000ECD8.mail.protection.outlook.com (10.167.242.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8699.20 via Frontend Transport; Tue, 29 Apr 2025 12:37:06 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 29 Apr 2025 07:37:00 -0500 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: ac624906-24f6-11f0-9ffb-bf95429c2676 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ib40iy9n9pbR3M87Ho4i3sy0KfCOSqOt7KvVYec6+/SmThMfpOji27vqEHU7fatfErdqtt36/QPZqTgxiH0actPs9T3pXp2D/JfzAbsnF0lJw/Fs93MjqPHGtuI1yIgbb0SWBoNIub0eHHtgjCIjTSZhtM8APdFm7j0O34MJZdjJqJ9xInd3ooRbfl9vlKutcQ/6cZRjFIJiqiCqQ5AjYTQu6AcFuwOhjD7vHd0AymLZ432bE5i78N8rfFbUn/WBcdRQgN7pOGsVy89RDGcNC8Zr9+u8rFCxK9YRaggxpOVPRnbm+xRIwXYOQZp8m5M6QV4PxJC8ek8hkX+2GpyILg== 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=kzlDcDxGuBna1NjqeyuBWXITlGSX+G2YYWsKMdoIvyU=; b=xpbwj+g8LIEnbLeZIVBW/q4TYlXAmTlGzKRBPFrDJBDCJk6j8xAXuFyRmQwsspSF7Q9fr/NPPbqfoIlamE/hjXxf0nOs2Ng3aRkEfKGOESWSP9lEhxazzoBpTDBLfWt+uU6wg7zX2WvAz76Rqn/PCbYegNkn7uHqCkZW71Lvlx8aEVQ5+RFL70E2s6iYSh0jY8h/ft6MCHPm6iLCuGAP95QMJxRRBZZCx1cMDOq3jrHC3IZ6ZVO7rRNC2yn+BPFuANVEg2eqUSAMt4WFUHJSBB4srcokRU0n4UQrFzCMkGe9tKx64UeaFDoUfiu4lei1zANOuH5S51WS3EgW6Y3FrQ== 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=kzlDcDxGuBna1NjqeyuBWXITlGSX+G2YYWsKMdoIvyU=; b=3cRwrxbXpBaQa8RVHsbnrYvcydG7VQUld8VxZgNg7lHhXUE1AUTcZ0N53BhEOJl+yFGMGeKTilFBtAdvv7nV2XR8wENyjOuKEPFelg827i5twnBwF04nWIcpdkB2kOIx2YuFSY/khjv9AMTHv/QD6iGdyqbHT69k7k93OykOzSs= 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: "Daniel P. Smith" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD , Michal Orzel , "Julien Grall" , Stefano Stabellini , "Jason Andryuk" , Alejandro Vallejo , "Denis Mukhin" Subject: [PATCH v6 03/12] x86/hyperlaunch: initial support for hyperlaunch device tree Date: Tue, 29 Apr 2025 13:36:14 +0100 Message-ID: <20250429123629.20839-4-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250429123629.20839-1-agarciav@amd.com> References: <20250429123629.20839-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD8:EE_|MW4PR12MB6683:EE_ X-MS-Office365-Filtering-Correlation-Id: e0564233-3571-40ba-612e-08dd871a8d71 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?75Uj1T9g9GpXOMH0eujD0H+CJzvVxhV08wglyLMi3P4MdjUAJwsFeHUJd66a?= =?us-ascii?Q?DS3TygVfXRTW1Xc/H6fYsqjfaAlGE7D+JFoqK/j0Q4Nlaf8Jb2D67L43s2bq?= =?us-ascii?Q?EvicItJiQUyr4vAZniP+Ra2TovTfuesLlcFgMW8sbVbpCJxOAzaJ6mOOonWA?= =?us-ascii?Q?EwbCa0xD7AHMhaMJ5xpu144TUVRjmtdTD/aPrl+C34c3Ut80nwDc4NLqDlAi?= =?us-ascii?Q?V263WotQ+579fb0KVsP5l5Pak2ws9UsgaJRgZH7G8xvnV/LtEC6ItM++GZ9B?= =?us-ascii?Q?/PFtPsyO5Ee1vtA2CG3LY+JVZTme4NUbG8JK2XW6JbAHuLqWYHxWIBQYsr7q?= =?us-ascii?Q?QzJ+oSSF0uYs/7nUubPOUJg9og0Y2y9xGUjkU2BXH/yzRt3oO16uDsIdIa9j?= =?us-ascii?Q?JnzmBgzf3J9Wg7f+B9+0FRKkVWVd0YJB/l57Yf7wggdMFe+b7U5jFEJztZTi?= =?us-ascii?Q?QMk9dpN5W+EvRLbfL+RsmLOwaR1d1Ypz0yg8dPi/MQREHjvMP/5ABxioCx5B?= =?us-ascii?Q?zu/gIGFe3xQKFvMNNS0wZEAWPEVX8YA6Lj4pOcwt7tFS4J57LdxSNAR63mWA?= =?us-ascii?Q?OC4s9izvnYnvFVfkQd6eJ3kokFSgjRy9M25CJIte7UrndXB3c7yRE0bSs1za?= =?us-ascii?Q?oewkzlZbtR7H92p56iMWxxu6ig9l2YFUScy7Xcm6YlRwPFPl+95SDpmzLMfF?= =?us-ascii?Q?s8OlGVQUIraCXTc2RvzZIzp4ShP/RBABbdUGkwX7ys2g54y0XLl1psrjeFrq?= =?us-ascii?Q?lORWchk7ztTNXkR9O6hboGG+y+Q8v/18B/k5lEPSiMXZJkww6tntt1n1nUZa?= =?us-ascii?Q?8RiCnolPz0COXfHIj/KQcsIU0Y7yiJuXpKudGVvh2Guq7Sw+rN4D9qG3LEVc?= =?us-ascii?Q?4s3L5y3LQPigNJMIr2oiUfD6Cpu3CMMqh7pVyDYK/oPHmLeZMhLnZG4HuJr3?= =?us-ascii?Q?k+hZBwunPp4tiVyC4u8FrSfIljlhOT0DTghp5bu+5Iw1jZdUM5PhkwAE4pZA?= =?us-ascii?Q?5Dn3yoW/tQzdmzXzFZi19xnKcwemhnYWzZksNQ5UPT8JSP80RLCv1efvcb98?= =?us-ascii?Q?wC/DV6x3kx7i82qzCWqnm7YKNikcBDYDEcsKc2w7sOPv0wQadzMtPRUbpUis?= =?us-ascii?Q?9qAa4ele+SIUSCbAMs5w6LhXiseEn/9x1EdBn6IVmY7Hb8ZLKKjB44k4kjGa?= =?us-ascii?Q?JThCv3P8Weaq83iojocoDEyyo5s+RDMz79k1m3nI8nlppO6NSt7AD97NY92s?= =?us-ascii?Q?H3SqVjJRAfq+D15Geri3dUmm/BnJ+XuAPhgv0AbnMPnJK5USn2s/2XnuWT8i?= =?us-ascii?Q?J3NPayClj4rGDk7QyY1C9wnVaT5vFH4UD2rvXJfSLyHlfGyXAl2dupsMJw0E?= =?us-ascii?Q?E7sCnMrKQeq//d1fXlwU3/x+naeU+lJ7JS6stbHri6bR0YiHOtEJCGpk1FHu?= =?us-ascii?Q?hfpYOJJ9AXb6FG5j1iQZfHYNSW18Bn88CtxjlHDmYdbJr2UZomRO9IxzRl4j?= =?us-ascii?Q?lgD+TIGsw/E/h1D81QacJik8ReM7GR45zq51?= 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)(376014)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2025 12:37:06.7947 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e0564233-3571-40ba-612e-08dd871a8d71 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: MN1PEPF0000ECD8.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB6683 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1745930251243019000 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Smith" Add the ability to detect both a formal hyperlaunch device tree or a dom0le= ss device tree. If the hyperlaunch device tree is found, then count the number= of domain entries, reporting an error if more than one is found. Signed-off-by: Daniel P. Smith Signed-off-by: Jason Andryuk Signed-off-by: Alejandro Vallejo Reviewed-by: Denis Mukhin --- xen/arch/x86/include/asm/bootinfo.h | 1 + xen/common/domain-builder/core.c | 15 +++++++ xen/common/domain-builder/fdt.c | 62 +++++++++++++++++++++++++++++ xen/common/domain-builder/fdt.h | 1 + xen/include/xen/domain-builder.h | 2 + 5 files changed, 81 insertions(+) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 82c2650fcf..1e3d582e45 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -84,6 +84,7 @@ struct boot_info { bool hyperlaunch_enabled; =20 unsigned int nr_modules; + unsigned int nr_domains; struct boot_module mods[MAX_NR_BOOTMODS + 1]; struct boot_domain domains[MAX_NR_BOOTDOMS]; }; diff --git a/xen/common/domain-builder/core.c b/xen/common/domain-builder/c= ore.c index 97c92db571..c6917532be 100644 --- a/xen/common/domain-builder/core.c +++ b/xen/common/domain-builder/core.c @@ -16,10 +16,17 @@ enum fdt_kind __init builder_init(struct boot_info *bi) { enum fdt_kind kind; + int ret; =20 bi->hyperlaunch_enabled =3D false; switch ( (kind =3D fdt_detect_kind(bi)) ) { + case FDT_KIND_HYPERLAUNCH: + printk(XENLOG_DEBUG "DT found: hyperlaunch\n"); + bi->hyperlaunch_enabled =3D true; + bi->mods[0].type =3D BOOTMOD_FDT; + break; + case FDT_KIND_NONE: /* No DT found */ return kind; @@ -32,6 +39,14 @@ enum fdt_kind __init builder_init(struct boot_info *bi) default: BUG(); } + + printk(XENLOG_INFO "Hyperlaunch configuration:\n"); + if ( (ret =3D fdt_walk_hyperlaunch(bi)) < 0 ) + panic("Walk of device tree failed (%d)\n", ret); + + printk(XENLOG_INFO " number of domains: %u\n", bi->nr_domains); + + return FDT_KIND_HYPERLAUNCH; } =20 /* diff --git a/xen/common/domain-builder/fdt.c b/xen/common/domain-builder/fd= t.c index 4b07bd22c8..94ccff61e2 100644 --- a/xen/common/domain-builder/fdt.c +++ b/xen/common/domain-builder/fdt.c @@ -13,6 +13,36 @@ =20 #include "fdt.h" =20 +static int __init find_hyperlaunch_node(const void *fdt) +{ + int hv_node =3D fdt_path_offset(fdt, "/chosen/hypervisor"); + + if ( hv_node >=3D 0 ) + { + /* Anything other than zero indicates no match */ + if ( fdt_node_check_compatible(fdt, hv_node, "hypervisor,xen") ) + return -ENODATA; + + return hv_node; + } + else + { + /* Look for dom0less config */ + int node, chosen_node =3D fdt_path_offset(fdt, "/chosen"); + + if ( chosen_node < 0 ) + return -ENOENT; + + fdt_for_each_subnode(node, fdt, chosen_node) + { + if ( !fdt_node_check_compatible(fdt, node, "xen,domain") ) + return chosen_node; + } + } + + return -ENODATA; +} + enum fdt_kind __init fdt_detect_kind(const struct boot_info *bi) { enum fdt_kind kind; @@ -20,6 +50,8 @@ enum fdt_kind __init fdt_detect_kind(const struct boot_in= fo *bi) =20 if ( !fdt || fdt_check_header(fdt) < 0 ) kind =3D FDT_KIND_NONE; + else if ( find_hyperlaunch_node(fdt) >=3D 0 ) + kind =3D FDT_KIND_HYPERLAUNCH; else kind =3D FDT_KIND_UNKNOWN; =20 @@ -28,6 +60,36 @@ enum fdt_kind __init fdt_detect_kind(const struct boot_i= nfo *bi) return kind; } =20 +int __init fdt_walk_hyperlaunch(struct boot_info *bi) +{ + int ret =3D 0, hv_node, node; + const void *fdt =3D bootstrap_map_bm(&bi->mods[HYPERLAUNCH_MODULE_IDX]= ); + + BUG_ON(!fdt); + + hv_node =3D find_hyperlaunch_node(fdt); + if ( hv_node < 0 ) + { + ret =3D hv_node; + goto err_out; + } + + fdt_for_each_subnode(node, fdt, hv_node) + { + if ( !fdt_node_check_compatible(fdt, node, "xen,domain") ) + bi->nr_domains++; + } + + /* Until multi-domain construction is added, throw an error */ + if ( bi->nr_domains !=3D 1 ) + printk(XENLOG_ERR "hyperlaunch only supports dom0 construction\n"); + + err_out: + bootstrap_unmap(); + + return ret; +} + /* * Local variables: * mode: C diff --git a/xen/common/domain-builder/fdt.h b/xen/common/domain-builder/fd= t.h index ef897fc412..d1bcc23fa2 100644 --- a/xen/common/domain-builder/fdt.h +++ b/xen/common/domain-builder/fdt.h @@ -10,5 +10,6 @@ struct boot_info; #define HYPERLAUNCH_MODULE_IDX 0 =20 enum fdt_kind fdt_detect_kind(const struct boot_info *bi); +int fdt_walk_hyperlaunch(struct boot_info *bi); =20 #endif /* __XEN_DOMAIN_BUILDER_FDT_H__ */ diff --git a/xen/include/xen/domain-builder.h b/xen/include/xen/domain-buil= der.h index b9702db735..cbb3cbea7c 100644 --- a/xen/include/xen/domain-builder.h +++ b/xen/include/xen/domain-builder.h @@ -9,6 +9,8 @@ enum fdt_kind { /* FDT not found. Skipped builder. */ FDT_KIND_NONE, + /* Found Hyperlaunch FDT */ + FDT_KIND_HYPERLAUNCH, /* Found an FDT that wasn't hyperlaunch. */ FDT_KIND_UNKNOWN, }; --=20 2.43.0 From nobody Mon Nov 17 12:54:31 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=1745930255; cv=pass; d=zohomail.com; s=zohoarc; b=kBsvEuXEDUB2tpl7Yr3Mtx+WnS4ZYkF8vrf+mnF4HxcNx85vTVQbKB84Bay5rALtTpAU6HQBmhR0Pz4bdwke+n/kH0brsHJ8gwjbbxPm6ZlQWhsYHZb8+vHs/vEtXptkwXIQ3OHIhY6U1NTekAw0HGFYliF3Hsltw1VBVAHNc+A= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745930255; 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=iGykJQZXA0HQnaAnFulQBRBoOR4WtonCUdL5Fcu7eLY=; b=Tqaa18KLcrqzhTI/XAaDsZ6REwz0mWYvCV1X9L1dLmroDnKlJX2nJ1ZE30tn5lgaAxqdeVprfeh2VNQ9RzBxytkK5yXPEy77CfZNw6BDoV4SI9pWdVTZHnAKKlxcZvzBiXKNDmdG3xZTtgm4ZU0+mlL9hIr2FcJXQiteX1SiCw4= 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 1745930255308803.5850654544183; Tue, 29 Apr 2025 05:37:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.972369.1360751 (Exim 4.92) (envelope-from ) id 1u9kDE-0000wI-Sp; Tue, 29 Apr 2025 12:37:24 +0000 Received: by outflank-mailman (output) from mailman id 972369.1360751; Tue, 29 Apr 2025 12:37:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u9kDE-0000wB-Os; Tue, 29 Apr 2025 12:37:24 +0000 Received: by outflank-mailman (input) for mailman id 972369; Tue, 29 Apr 2025 12:37:22 +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 1u9kDC-0007L9-Nd for xen-devel@lists.xenproject.org; Tue, 29 Apr 2025 12:37:22 +0000 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on20629.outbound.protection.outlook.com [2a01:111:f403:2416::629]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id afeee676-24f6-11f0-9ffb-bf95429c2676; Tue, 29 Apr 2025 14:37:19 +0200 (CEST) Received: from BL1PR13CA0307.namprd13.prod.outlook.com (2603:10b6:208:2c1::12) by SN7PR12MB6716.namprd12.prod.outlook.com (2603:10b6:806:270::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8678.31; Tue, 29 Apr 2025 12:37:13 +0000 Received: from MN1PEPF0000ECD5.namprd02.prod.outlook.com (2603:10b6:208:2c1:cafe::1d) by BL1PR13CA0307.outlook.office365.com (2603:10b6:208:2c1::12) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8655.25 via Frontend Transport; Tue, 29 Apr 2025 12:37:12 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000ECD5.mail.protection.outlook.com (10.167.242.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8699.20 via Frontend Transport; Tue, 29 Apr 2025 12:37:12 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 29 Apr 2025 07:37:06 -0500 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: afeee676-24f6-11f0-9ffb-bf95429c2676 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jxX4f/TIxoU+7wN/2speL4gTXowFpKB+url1kZBGoGFbhQABEeyiFZx2W76hbDfHpxSHBAKrYjm2TSWDkRVZf/SObXKRYWzhj+oZ9eXZnIv+7q2Zp/bqecJOlpo9g7GohpR31Y+pzY9LXQ1kGSwdPwQLCbxyoqaFHz2Rl5pyb/03fNqVmuQY+RVqNSsakmdYG3zjgavU358Mtjwpe2sKzz3Q81gQeY0vNtgVAwsLGgGTI5uulqOO8WqSmgqTsn3XVKeIffFLMKPbAzJkhBIZ4Dwp2U2FmynO7F79Z2K1OPx0wjk9UupfR5rgJ8QJJ4weJqs3Vwp/z0DVtRV2A3gzwg== 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=iGykJQZXA0HQnaAnFulQBRBoOR4WtonCUdL5Fcu7eLY=; b=to0pDMyR5anAa3BKTM8D8zUbIE5Pibc5vcHf5ol4YJuFkJ6DUKpibcdu/3hAtV2KqPGU8Ab3zeV3VleiY1Hrr8NHkQt0h2lK3w6w4v+rDrOa97eVGnbQosAnoLi5CPgm3wXrIh0qcPDvPH6i9Z/0TnUhDtf6KDh9z5ERProF+yrg729BMonqH7AspqR4fq1zwz8t3eD5pO/M0X1avEm5hC79LAORH4KIY7Tq1amYX7kje3RaUnbtnBwCw5u1ce7oLikD94n1KwmYD6XTq5yrtGmavWz3n06X9PQ8WBjugzxwkKI/DQg5BjAc3/z2DSuEEU/bfcUq9MSy4aY+iZuH5Q== 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=iGykJQZXA0HQnaAnFulQBRBoOR4WtonCUdL5Fcu7eLY=; b=VJ19/Kmt05W+xmYJwwNntqXPmY47+/5Oireookxw0zha6rIWvpbs67gsEvk3BhIaBmL4Ov3sOvkrpzBDKbndoZ/+HEY0RVOwQBHxQ+lpPn+BFRqILquimK4ge0d+qUJ6T7c9CyLwEbHiSRVKZ+Yi9z0q4/+nuXMt3VwqqngJbKI= 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 , "Jason Andryuk" , Denis Mukhin Subject: [PATCH v6 04/12] x86/hyperlaunch: Add helpers to locate multiboot modules Date: Tue, 29 Apr 2025 13:36:15 +0100 Message-ID: <20250429123629.20839-5-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250429123629.20839-1-agarciav@amd.com> References: <20250429123629.20839-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD5:EE_|SN7PR12MB6716:EE_ X-MS-Office365-Filtering-Correlation-Id: 633be678-8083-4dc2-4a89-08dd871a9104 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?EqkAaI7bxKQSI0Vq3StOWNmqaCvttiX4LzfcpghTtJGMUxV56en21dNV44X3?= =?us-ascii?Q?O1ru2GzjU7qqsjux7jjrRTBXzPUMScKHsIzx2Di2tmRROl7o6mGOiIYCrOPw?= =?us-ascii?Q?VwRReiZ3QoEx7Uc3rBcQrXGCa8kcGctq+duUkmBmYVYUz7Zm4pKKf/skS/Lj?= =?us-ascii?Q?Se2SCcUFy7EHlBr9OYPxOa6u71K03QZhBaqeb6v/0oI95WmWtNFeRr5fiF5L?= =?us-ascii?Q?GhaT5G9NQFSn7fj2c8RxR5AXJG3EhvW/eZQcEIq4UMTHLhkQzbvAM8xZDffS?= =?us-ascii?Q?wx5ghKyvJU8uBad5PMbjCaKCZyltXX9T0+/oxT8SYlcC08kz4OljWnEsYP7Q?= =?us-ascii?Q?ofyEdoKRbp2VTQd1sXZ7OamgvVyXBXr8Z5w5264Wh/WbRVUwBVT0J+f/JhCX?= =?us-ascii?Q?1q+PeD4aOOxDb2ohukolVGmF1zeqbkKDUDPBtS+8QW7OgItggB+1lcktb/De?= =?us-ascii?Q?bNfW5GgamVWtqA2gu/c6NNq+Ei1doa6m4IyJavzKt2a6hjzQs1uyr0tvHUsZ?= =?us-ascii?Q?BFi+iw/zIkiw1g64Eqa97bQC86njyUDWOFdu4aJOn3/vuWIAb829tdovSmuy?= =?us-ascii?Q?2g+Hfg52I6MlAN8/qpZmzcQKiSblNO1Y7HoNy+YYagx3f41P8fRuhxsvYgL6?= =?us-ascii?Q?PdunDIi/es82+TozIrDHUsa4NTQwT9WLldPTv/FuXKrQja44ijhGW3EjGPqo?= =?us-ascii?Q?g0mTERRECYve0Gu6MkfbEMsY50eYNDn6SSxJN5RTqG32j1dWbu9J5hWOdVGB?= =?us-ascii?Q?ChuoQxs3FsTOeERiGtS9FM1tg6JT2I4vMpMCOKFkoWJ/2SsRmH63yTqClJ8e?= =?us-ascii?Q?Xa4WtkUMKGb1VLooqf++SKBum8rxo893+ULSO7KJeJME3iVmXcpSteR6102Q?= =?us-ascii?Q?AEIs7FDCHQUTI2sMkQ99ZNyeVJAfIJ8yy4BrG9u84aFeYofT2KAj7N1Nqv/P?= =?us-ascii?Q?i/rjZM7FiHdjYzI+8CvFhoHg8uAeO5eXZAgsul7MIkUdHvRtHC6X43vWwYHE?= =?us-ascii?Q?zbzExuis7anCF1fb3UaT8MXOd/jPrBwl25uMfRwK9YbY0/LUyRnK5GxA5laY?= =?us-ascii?Q?MzkPqaY8VmEB/CV4Ls8NwQYf1+ZZUNH2NJ5c0LKHt3MnQ2gg72cflKOPz2V/?= =?us-ascii?Q?rIrcqYofEwFcM0bCTxHtcqiw7Y0Uo3WH6NwKhcEqPRwhIRBkWAsqL2iYo8ZC?= =?us-ascii?Q?B6FZs3dqIly/fNXQ1HGGGg30t0+v0h74GlC1hfxiqopcpK5gQNp+GB938ZZj?= =?us-ascii?Q?AzS9Ti4uMQ4bsBJY9rntUzWvo8KdDjd97ew8V511ahrnaz26jm+q/1WzvPpo?= =?us-ascii?Q?PqL3CejELNpGGrJ5Ag8VY33MDg+pby6YtD/71qyffmT1y8QWhnKtN23Fu6lG?= =?us-ascii?Q?RSkJwWPoFqZxpII7F3bUNOovNH8Vy21wXCNng2kz8mhxW+DAthIV3+YTa8zM?= =?us-ascii?Q?+cSko2PPKJGAdesF6/pSRxtjClOMwstXlosQaVIcHZGgBvEVlMqTU12WQR9K?= =?us-ascii?Q?lheRLz0eCwA5xNthgxV5oP9r7d1FRM/yOKbV?= 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)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2025 12:37:12.7927 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 633be678-8083-4dc2-4a89-08dd871a9104 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: MN1PEPF0000ECD5.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB6716 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1745930256101019100 Content-Type: text/plain; charset="utf-8" Hyperlaunch mandates either a reg or module-index DT prop on nodes that contain `multiboot,module" under their "compatible" prop. This patch introduces a helper to generically find such index, appending the module to the list of modules if it wasn't already (i.e: because it's given via the "reg" prop). Signed-off-by: Jason Andryuk Signed-off-by: Alejandro Vallejo Reviewed-by: Denis Mukhin --- xen/common/domain-builder/fdt.c | 172 +++++++++++++++++++++++++++++++ xen/common/domain-builder/fdt.h | 1 + xen/include/xen/domain-builder.h | 4 + 3 files changed, 177 insertions(+) diff --git a/xen/common/domain-builder/fdt.c b/xen/common/domain-builder/fd= t.c index 94ccff61e2..05ac3647cf 100644 --- a/xen/common/domain-builder/fdt.c +++ b/xen/common/domain-builder/fdt.c @@ -13,6 +13,178 @@ =20 #include "fdt.h" =20 +static int __init fdt_prop_as_u32(const struct fdt_property *prop, + uint32_t *val) +{ + if ( !prop || fdt32_to_cpu(prop->len) < sizeof(u32) ) + return -EINVAL; + + *val =3D fdt32_to_cpu(*(const fdt32_t *)prop->data); + return 0; +} + +/* + * Unpacks a "reg" property into its address and size constituents. + * + * @param prop Pointer to an FDT "reg" property. + * @param address_cells Number of 4-octet cells that make up an "address". + * @param size_cells Number of 4-octet cells that make up a "size". + * @param p_addr[out] Address encoded in the property. + * @param p_size[out] Size encoded in the property. + * @returns -EINVAL on malformed property, 0 otherwise. + */ +static int __init fdt_prop_as_reg(const struct fdt_property *prop, + int address_cells, int size_cells, + uint64_t *p_addr, uint64_t *p_size) +{ + const fdt32_t *cell =3D (const fdt32_t *)prop->data; + uint64_t addr, size; + + if ( fdt32_to_cpu(prop->len) !=3D + (address_cells + size_cells) * sizeof(*cell) ) + { + printk(XENLOG_ERR " cannot read reg %lu+%lu from prop len %u\n", + address_cells * sizeof(*cell), size_cells * sizeof(*cell), + fdt32_to_cpu(prop->len)); + return -EINVAL; + } + + switch ( address_cells ) + { + case 1: + addr =3D fdt32_to_cpu(*cell); + break; + case 2: + addr =3D fdt64_to_cpu(*(const fdt64_t *)cell); + break; + default: + printk(XENLOG_ERR " unsupported address_cells=3D%d\n", address_ce= lls); + return -EINVAL; + } + + cell +=3D address_cells; + switch ( size_cells ) + { + case 1: + size =3D fdt32_to_cpu(*cell); + break; + case 2: + size =3D fdt64_to_cpu(*(const fdt64_t *)cell); + break; + default: + printk(XENLOG_ERR " unsupported size_cells=3D%d\n", size_cells); + return -EINVAL; + } + + *p_addr =3D addr; + *p_size =3D size; + + return 0; +} + +/* + * Locate a multiboot module given its node offset in the FDT. + * + * The module location may be given via either FDT property: + * * reg =3D + * * Mutates `bi` to append the module. + * * module-index =3D + * * Leaves `bi` unchanged. + * + * @param fdt Pointer to the full FDT. + * @param node Offset for the module node. + * @param address_cells Number of 4-octet cells that make up an "address". + * @param size_cells Number of 4-octet cells that make up a "size". + * @param bi[inout] Xen's representation of the boot parameters. + * @return -EINVAL on malformed nodes, otherwise + * index inside `bi->mods` + */ +int __init fdt_read_multiboot_module(const void *fdt, int node, + int address_cells, int size_cells, + struct boot_info *bi) +{ + const struct fdt_property *prop; + uint64_t addr, size; + int ret; + uint32_t idx; + + if ( fdt_node_check_compatible(fdt, node, "multiboot,module") ) + { + printk(XENLOG_ERR " bad module. multiboot,module not found"); + return -ENODATA; + } + + /* Location given as a `module-index` property. */ + if ( (prop =3D fdt_get_property(fdt, node, "module-index", NULL)) ) + { + if ( fdt_get_property(fdt, node, "reg", NULL) ) + { + printk(XENLOG_ERR " found both reg and module-index for modul= e\n"); + return -EINVAL; + } + if ( (ret =3D fdt_prop_as_u32(prop, &idx)) ) + { + printk(XENLOG_ERR " bad module-index prop\n"); + return ret; + } + if ( idx >=3D MAX_NR_BOOTMODS ) + { + printk(XENLOG_ERR " module-index overflow. %s=3D%u\n", + STR(MAX_NR_BOOTMODS), MAX_NR_BOOTMODS); + return -EINVAL; + } + + return idx; + } + + /* Otherwise location given as a `reg` property. */ + if ( !(prop =3D fdt_get_property(fdt, node, "reg", NULL)) ) + { + printk(XENLOG_ERR " no location for multiboot,module\n"); + return -EINVAL; + } + if ( fdt_get_property(fdt, node, "module-index", NULL) ) + { + printk(XENLOG_ERR " found both reg and module-index for module\n"= ); + return -EINVAL; + } + + ret =3D fdt_prop_as_reg(prop, address_cells, size_cells, &addr, &size); + if ( ret < 0 ) + { + printk(XENLOG_ERR " failed reading reg for multiboot,module\n"); + return -EINVAL; + } + + idx =3D bi->nr_modules; + if ( idx > MAX_NR_BOOTMODS ) + { + /* + * MAX_NR_BOOTMODS must fit in 31 bits so it's representable in the + * positive side of an int; for the return value. + */ + BUILD_BUG_ON(MAX_NR_BOOTMODS > (uint64_t)INT_MAX); + printk(XENLOG_ERR " idx=3D%u exceeds len=3D%u\n", idx, MAX_NR_BOO= TMODS); + return -EINVAL; + } + + /* + * Append new module to the existing list + * + * Note that bi->nr_modules points to Xen itself, so we must shift it = first + */ + bi->nr_modules++; + bi->mods[bi->nr_modules] =3D bi->mods[idx]; + bi->mods[idx] =3D (struct boot_module){ + .start =3D addr, + .size =3D size, + }; + + printk(XENLOG_INFO " module[%u]: addr %lx size %lx\n", idx, addr, siz= e); + + return idx; +} + static int __init find_hyperlaunch_node(const void *fdt) { int hv_node =3D fdt_path_offset(fdt, "/chosen/hypervisor"); diff --git a/xen/common/domain-builder/fdt.h b/xen/common/domain-builder/fd= t.h index d1bcc23fa2..5570fb7a9c 100644 --- a/xen/common/domain-builder/fdt.h +++ b/xen/common/domain-builder/fdt.h @@ -3,6 +3,7 @@ #define __XEN_DOMAIN_BUILDER_FDT_H__ =20 #include +#include =20 struct boot_info; =20 diff --git a/xen/include/xen/domain-builder.h b/xen/include/xen/domain-buil= der.h index cbb3cbea7c..3ac3a0ab84 100644 --- a/xen/include/xen/domain-builder.h +++ b/xen/include/xen/domain-builder.h @@ -28,4 +28,8 @@ static inline enum fdt_kind builder_init(struct boot_info= *bi) } #endif /* !IS_ENABLED(CONFIG_DOMAIN_BUILDER) */ =20 +int fdt_read_multiboot_module(const void *fdt, int node, + int address_cells, int size_cells, + struct boot_info *bi) + #endif /* __XEN_DOMAIN_BUILDER_H__ */ --=20 2.43.0 From nobody Mon Nov 17 12:54:31 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=1745930548; cv=pass; d=zohomail.com; s=zohoarc; b=HWbla59RBIkP36b+xGB/og0nKS8PewB7u9+Vr+txdnam1p1cZYg5xEN0rhwzykDFLjEzeskrtuJaKHjFDbLB5yyhDTnFUkf3Jarv4uOcd+U2wFY+aFnIjehALtMoBdsEq20GzrTZ0+Fdy0aV2uHYZWhHfkBA3H6WEAVYfvCEFnY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745930548; 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=EE4YsDHXTzpV3ycmzVUl1WwygqCvp1QDjKtcwqrOQCs=; b=VN86RiGP+ZC4h8Rcxzy5wpbuBoRJfwA5MMGPFw68ZcNHPG0F8c6LXeaeN/dqcyUgLDLGG8r3PM6EbNEETZHa+ufJ7mRn2X6HWp2n43ltlY+L/vcUf7N5O/Fvo9vATvTr9TdCFIZ54gioldpVQIP6R6+IO6vMfhnIUzsX3TQ9/aQ= 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 1745930548879843.6638465809655; Tue, 29 Apr 2025 05:42:28 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.972446.1360801 (Exim 4.92) (envelope-from ) id 1u9kHs-0005eM-HE; Tue, 29 Apr 2025 12:42:12 +0000 Received: by outflank-mailman (output) from mailman id 972446.1360801; Tue, 29 Apr 2025 12:42:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u9kHs-0005eE-CZ; Tue, 29 Apr 2025 12:42:12 +0000 Received: by outflank-mailman (input) for mailman id 972446; Tue, 29 Apr 2025 12:42:11 +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 1u9kDC-0007KK-KZ for xen-devel@lists.xenproject.org; Tue, 29 Apr 2025 12:37:22 +0000 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on20625.outbound.protection.outlook.com [2a01:111:f403:2009::625]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b1b183d3-24f6-11f0-9eb4-5ba50f476ded; Tue, 29 Apr 2025 14:37:21 +0200 (CEST) Received: from BL1PR13CA0349.namprd13.prod.outlook.com (2603:10b6:208:2c6::24) by LV8PR12MB9110.namprd12.prod.outlook.com (2603:10b6:408:18b::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8678.33; Tue, 29 Apr 2025 12:37:17 +0000 Received: from MN1PEPF0000ECD8.namprd02.prod.outlook.com (2603:10b6:208:2c6:cafe::9) by BL1PR13CA0349.outlook.office365.com (2603:10b6:208:2c6::24) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8678.23 via Frontend Transport; Tue, 29 Apr 2025 12:37:16 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000ECD8.mail.protection.outlook.com (10.167.242.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8699.20 via Frontend Transport; Tue, 29 Apr 2025 12:37:16 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 29 Apr 2025 07:37:12 -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: b1b183d3-24f6-11f0-9eb4-5ba50f476ded ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gBGEbhvg/2H+IYmF5bWjNdNFl+MMNng4bogNLFCCuTa38DdbKDlw9gpHrAd87vtgZdsZBF8PhB4ivmyGSPYZpRxzOhE0AH66KnLCOmFaLg70j4yrs1c7cP1I+eKKoadm97J9fRk+f0ALZdi+HodH7VtaFWvjNOziLVnciFCqyNlChk7t9+LzoCGDJvJh5oz9Sa9FAW/8RhmECLrA23gC4Zf82T1xJ6r9y+Gz32/XkDHHLJ4l7Srpq+NSQC/Ttgv8Ca9Oa8xgqmrxSysNB6o3LE1Ta0VvAiHG46gVX3kGCCNNcZ85AL0EAGuDBy/Mlu8X1gUpzqotXjMJC2JspgHJhA== 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=EE4YsDHXTzpV3ycmzVUl1WwygqCvp1QDjKtcwqrOQCs=; b=V21je4UlVU/DRWLZmcRi5g/ydf9v6k+uGvysQBi0XE24ugnfeGUyBuPGxzmTFj3tf0jMbLWN0LyRUkqInun4R7TRpdmkkEvn7P4YojvjhlIFohKsCETA9X1jA60SXJCAgWCnuQ7+O04fV3fAsSXy/DuWr6d3eRrxsPq0N/jA0pFHLCnQPE430NKWfkWxUIfr4OTWBXGFU59MHevQ6KwHek3BGdMP8sLA39UeMEIUpXlqCaO4EoNWQ6oLg13gIHRGbP9t9kXrI7wfBxnFM70ossKg9vWn/Fzo/LpAHNVzyC+YkXHY/kOHe64gMbZnZE0ZB6OMjAiEjZkc2RNTTn+4pQ== 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=EE4YsDHXTzpV3ycmzVUl1WwygqCvp1QDjKtcwqrOQCs=; b=J62f2rptCbxkzGRlEN/UAEVIUbzoLC8qn30m7FTHzOK04gaQ+XhH2FP9GweLupQPBmozXQSzi2YvVtQ2+y0Wx8fDhV/HExVL1SWRbqjJlt0EvXIgFPdTJkojSpIHqQG2CIoAtlGg4eCRpUeRxL4UzDw5Sbz8pKgIA66OOQl7f2c= 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: "Daniel P. Smith" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD , Michal Orzel , "Julien Grall" , Stefano Stabellini , "Jason Andryuk" , Alejandro Vallejo , "Denis Mukhin" Subject: [PATCH v6 05/12] x86/hyperlaunch: locate dom0 kernel with hyperlaunch Date: Tue, 29 Apr 2025 13:36:16 +0100 Message-ID: <20250429123629.20839-6-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250429123629.20839-1-agarciav@amd.com> References: <20250429123629.20839-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD8:EE_|LV8PR12MB9110:EE_ X-MS-Office365-Filtering-Correlation-Id: 204d6e0c-e199-41ad-9312-08dd871a9377 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|82310400026|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ZiHQ2J0lqCvTECYYb5Td88Kz3nMSog65+dgdzATxy9Vjnu+e6gueaYCiBDqb?= =?us-ascii?Q?d++2kuSN/STI6hNUC9f0lMSH3+9iTAVelMEKwb1BC9X6u72XkquuV78RhP6G?= =?us-ascii?Q?qP++ne7UmjpKr/81FYAJJGXJvKL1RcT5gVVWIYmVQExWeqD702eSKAD+Q2jO?= =?us-ascii?Q?sKOVr/2jFVRDN+KU1QvUtyPHtuEE2SDcFXmAsdWDxVD1p3BE7NsXb5IjqSWs?= =?us-ascii?Q?V9BegJz5hpsRrgt247GZm74SqRv4fRUWXqg6snHd0Bwbxs0knRU9cvrheci1?= =?us-ascii?Q?5pu83aCWfU1OvyPBX2HGsE23dyMYa9l7g8zXJB6vESgaX2v42JhmGJto/BL0?= =?us-ascii?Q?FqlMre34M4mlguBc6JjAyi81fCghpohiPn8PRl1GnxQ7ElRcyDrcE6UJNClI?= =?us-ascii?Q?39Rt9qBLB91HOopEaOFw9/hM1Ht1BsrwX1QgAgxFL7PRjhOw9jqW5YG5PayJ?= =?us-ascii?Q?ARwK3aTJX+sju1U+/RGH3pKratWJD4zZs8RdJKPfyeimn/mxL2XIP1jx88zv?= =?us-ascii?Q?RHLik/M+ORPE39GkuRp4V7jiTiQEy2ETjHkE0zmn/WdIRC5FuCOG4Y9i+BsL?= =?us-ascii?Q?5ULDlEv+XJDKGQV34bHJ1RigK9ecwfPC5aJ5rSDJGoQsMQs5CyccXHFWIMbx?= =?us-ascii?Q?Tt7X6WyrICXWlgwL8jm/0uNJ7677jHjSq2uamass4OFf61MBfw1ASyfpMWyA?= =?us-ascii?Q?DquLNSk2MZuseGu6mAQ3zGLAsML+gz1HQj8xLRg7xxgI1VtQQm6Q2MTH1UMD?= =?us-ascii?Q?Il2LiZ56tTDI7b1hUsIOGPXeN3lPVv8luGEHmsxe4elQIXSM8jmF7rC9EHY0?= =?us-ascii?Q?fZZNnNkXQg2rdky54yZpz4LqhO1Zw3L8rTOyTLfLu3kCWxMjnQ16EQ4KNAvJ?= =?us-ascii?Q?T4GanJiU2P0cL9N4maFmS4WNNImkORUzNLkQErk6dkS62SdTlV3TK2XdiGgp?= =?us-ascii?Q?vZBk0ZluPBPatXzBH5IW8T8VhQH8FfUL1PrsJzyC+Uk3TSzsaq9msGNbEYad?= =?us-ascii?Q?uhqir3TGKS07b7KRSuliZKRNz/he/kd4UFo/NMxbc1UwrG6/NLqEQtCh1HjX?= =?us-ascii?Q?44IQzGnoYD7effxwXer/eedegr+xI7/NuuFS2uz503uUJDpdmNbF/0eLZA8R?= =?us-ascii?Q?CCC1s67LnWetBKCrxG1P7u2WBj45X+7z1lBWdCOiVZer8y3AHpzmfm0yOd4A?= =?us-ascii?Q?uPfr4hf6mZAEcNL9pYIHPUeAoJnhBIlqJUGYRQLQ08iQGWpiVIm/mV+CDUYh?= =?us-ascii?Q?K8kG2ETezxLyuSV9CZG74Cf4XSXId0Nm1pghIl+N5wtP6iEG4t0Ln1+HMUYT?= =?us-ascii?Q?aPUoa3XQx5jwhIgFEePMtokoNQKMA4pUoJuKmY0RLqC+cUXFagisZsprfaaZ?= =?us-ascii?Q?qoBIiuviukVNdc2WPGl1aqvO+tfTmuBdkWMnmYXL26kG9rp0XZ54/mS6D/0m?= =?us-ascii?Q?PJ0ShGqRMUNef7iBZIbs2zqLizecby9+pxbP1mTX3nT4K1Rgo87eszY5NHXU?= =?us-ascii?Q?4y8uCu+Aw0bx1wkXQmuJTI062MC1UgVTSNyd?= 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)(82310400026)(1800799024)(36860700013);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2025 12:37:16.9029 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 204d6e0c-e199-41ad-9312-08dd871a9377 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: MN1PEPF0000ECD8.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV8PR12MB9110 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1745930550692019000 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Smith" Look for a subnode of type `multiboot,kernel` within a domain node. If found, locate it using the multiboot module helper to generically ensure it lives in the module list. If the bootargs property is present and there was not an MB1 string, then use the command line from the device tree definition. Signed-off-by: Daniel P. Smith Signed-off-by: Jason Andryuk Signed-off-by: Alejandro Vallejo Reviewed-by: Denis Mukhin --- xen/arch/x86/setup.c | 1 + xen/common/domain-builder/fdt.c | 64 +++++++++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index f3b5c83a3c..f8193f2c1c 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1291,6 +1291,7 @@ void asmlinkage __init noreturn __start_xen(void) i =3D first_boot_module_index(bi, BOOTMOD_UNKNOWN); bi->mods[i].type =3D BOOTMOD_KERNEL; bi->domains[0].kernel =3D &bi->mods[i]; + bi->nr_domains =3D 1; bi->hyperlaunch_enabled =3D false; } =20 diff --git a/xen/common/domain-builder/fdt.c b/xen/common/domain-builder/fd= t.c index 05ac3647cf..cbb0ed30a2 100644 --- a/xen/common/domain-builder/fdt.c +++ b/xen/common/domain-builder/fdt.c @@ -99,9 +99,9 @@ static int __init fdt_prop_as_reg(const struct fdt_proper= ty *prop, * @return -EINVAL on malformed nodes, otherwise * index inside `bi->mods` */ -int __init fdt_read_multiboot_module(const void *fdt, int node, - int address_cells, int size_cells, - struct boot_info *bi) +static int __init fdt_read_multiboot_module(const void *fdt, int node, + int address_cells, int size_ce= lls, + struct boot_info *bi) { const struct fdt_property *prop; uint64_t addr, size; @@ -185,6 +185,52 @@ int __init fdt_read_multiboot_module(const void *fdt, = int node, return idx; } =20 +static int __init fdt_process_domain_node( + struct boot_info *bi, const void *fdt, int dom_node) +{ + int node; + struct boot_domain *bd =3D &bi->domains[bi->nr_domains]; + const char *name =3D fdt_get_name(fdt, dom_node, NULL) ?: "unknown"; + int address_cells =3D fdt_address_cells(fdt, dom_node); + int size_cells =3D fdt_size_cells(fdt, dom_node); + + fdt_for_each_subnode(node, fdt, dom_node) + { + if ( !fdt_node_check_compatible(fdt, node, "multiboot,kernel") ) + { + int idx; + + if ( bd->kernel ) + { + printk(XENLOG_WARNING + " duplicate kernel for domain %s\n", name); + continue; + } + + idx =3D fdt_read_multiboot_module(fdt, node, address_cells, + size_cells, bi); + if ( idx < 0 ) + { + printk(XENLOG_ERR + " failed processing kernel for domain %s\n", name); + return idx; + } + + printk(XENLOG_INFO " kernel: multiboot-index=3D%d\n", idx); + bi->mods[idx].type =3D BOOTMOD_KERNEL; + bd->kernel =3D &bi->mods[idx]; + } + } + + if ( !bd->kernel ) + { + printk(XENLOG_ERR "error: no kernel assigned to domain %s\n", name= ); + return -ENODATA; + } + + return 0; +} + static int __init find_hyperlaunch_node(const void *fdt) { int hv_node =3D fdt_path_offset(fdt, "/chosen/hypervisor"); @@ -248,8 +294,20 @@ int __init fdt_walk_hyperlaunch(struct boot_info *bi) =20 fdt_for_each_subnode(node, fdt, hv_node) { + if ( bi->nr_domains >=3D MAX_NR_BOOTDOMS ) + { + printk(XENLOG_WARNING "warning: only creating first %u domains= \n", + MAX_NR_BOOTDOMS); + break; + } + if ( !fdt_node_check_compatible(fdt, node, "xen,domain") ) + { + if ( (ret =3D fdt_process_domain_node(bi, fdt, node)) < 0 ) + break; + bi->nr_domains++; + } } =20 /* Until multi-domain construction is added, throw an error */ --=20 2.43.0 From nobody Mon Nov 17 12:54:31 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=1745930545; cv=pass; d=zohomail.com; s=zohoarc; b=ciikeEeoKCRNbEK8u8c7JFaIwYgA1iRIQBkrHTke9hWrIR4X81wXYa2lsqn5W7bQj8sOb3zTHYOgsC2v7NwAPyNuvTP5Vu1Pk02m+ahL5H+YxmPSaxLqTzkbcjfi3DGbhwb47NUJ7OHjzVycJD+d2kYPgN7/CiOMUnF4dAkc5jc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745930545; 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=2pwwrn+w0PJVnEiP+Trq+bIH21nPCkOjD9aybGcH0RE=; b=Hk5HvHcwjKFSEpGvkIBhxvBWCRU+D1EnxWjvEUbjC7P3LBnIZDrfQ70c6pOoZCXucuapbTBIPK5oIKjPwEUmtmJtVyF+VS0t6iq5gVeB1eZCPA9WMR7AG1rTZPJ9OrFQ+fFkYAyxt+CamLJ22MRNfeYFBoCEaJzbajhGLMrzYgE= 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 1745930545591122.33744308852158; Tue, 29 Apr 2025 05:42:25 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.972449.1360811 (Exim 4.92) (envelope-from ) id 1u9kHt-0005lf-5U; Tue, 29 Apr 2025 12:42:13 +0000 Received: by outflank-mailman (output) from mailman id 972449.1360811; Tue, 29 Apr 2025 12:42:13 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u9kHs-0005js-Ty; Tue, 29 Apr 2025 12:42:12 +0000 Received: by outflank-mailman (input) for mailman id 972449; Tue, 29 Apr 2025 12:42:11 +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 1u9kDO-0007L9-OV for xen-devel@lists.xenproject.org; Tue, 29 Apr 2025 12:37:34 +0000 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on20623.outbound.protection.outlook.com [2a01:111:f403:2418::623]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id b82aef14-24f6-11f0-9ffb-bf95429c2676; Tue, 29 Apr 2025 14:37:32 +0200 (CEST) Received: from BN9PR03CA0720.namprd03.prod.outlook.com (2603:10b6:408:ef::35) by PH7PR12MB6666.namprd12.prod.outlook.com (2603:10b6:510:1a8::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8699.19; Tue, 29 Apr 2025 12:37:29 +0000 Received: from MN1PEPF0000ECD7.namprd02.prod.outlook.com (2603:10b6:408:ef:cafe::b4) by BN9PR03CA0720.outlook.office365.com (2603:10b6:408:ef::35) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8655.37 via Frontend Transport; Tue, 29 Apr 2025 12:37:29 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000ECD7.mail.protection.outlook.com (10.167.242.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8699.20 via Frontend Transport; Tue, 29 Apr 2025 12:37:29 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 29 Apr 2025 07:37:16 -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: b82aef14-24f6-11f0-9ffb-bf95429c2676 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=azYy27eo3ea0QS4BdXr0jKlFQ+WTKlyHJLSgCVbzBq/dO42plEpy6EAo4T150aSLByMNfwslYCfPvRtjDhCMBMplIr/npzfoDXAJtpGSjIKP56uGhLmJlxzTTqVCfbAmhSya2WksUKprdQ7QV3RUnNrD2ghAh/D2vSROGnZUc+23p2eG3Vkz35Dkkb+rAR5b2iVg3yb2+DDvJHUhIbif2vzHNvIs5QgsInfooax8hkZhBgXihI6gxcWuQCUJBGvKTgKDOfApU6lYHEJJXrV58uum/Rqrncx58lQMNyx3Ev5lo9qqlJESP9P8sf4+PJ7ghojmg/J/YzMON95FkL5ifQ== 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=2pwwrn+w0PJVnEiP+Trq+bIH21nPCkOjD9aybGcH0RE=; b=Tx1gWkVZobOaobM0AnZe/OjJvfbQd0HWoMu2sTs3ZhmgsZRfwCkDuTmTmYBH/gysO+Yy/oyZJ16IsJfd9LJjRLjCLySi15qv8bhiYYKU2NtRIVcYnWhf6oODaAHjIgIu6ZzCBqHERSP2mEVGNxcvipp02dGyKiQ7ZlangZZxklspe5I24yoRt8FP0b15C7maM+S+71WaRE8Dd/hVGVpiPPJsQMzFOPp1bAlnqzC4Eev0Wcg9m7y8CB7XOZTFoo5QEZAyBUqksjuDml7OC5AxqbbdG4OSFfTIFzMAyv2M7DzrEjfVYBsoIoO+sz7nU6CqkbUFxmbrTIs7XMGNTFxQvA== 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=2pwwrn+w0PJVnEiP+Trq+bIH21nPCkOjD9aybGcH0RE=; b=ISiMhyphyTmGwqHrBIfH6x3aPYuU0GwulrQOYtIJtamTrSUsFMrSbckmMbYkQQxcoK0u5El8pzLvzU/8ss8HRyUvKL+DHEoKrrFXnlqhiZrYyZ74mSY7V7G7AI+Zx3BnWVVgskOuW5Ggvr1MiaUfy+YUCsr85CFppKO/qTAk0wY= 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: "Daniel P. Smith" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD , Michal Orzel , "Julien Grall" , Stefano Stabellini , "Bertrand Marquis" , Jason Andryuk , Alejandro Vallejo , Denis Mukhin Subject: [PATCH v6 06/12] x86/hyperlaunch: obtain cmdline from device tree Date: Tue, 29 Apr 2025 13:36:17 +0100 Message-ID: <20250429123629.20839-7-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250429123629.20839-1-agarciav@amd.com> References: <20250429123629.20839-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD7:EE_|PH7PR12MB6666:EE_ X-MS-Office365-Filtering-Correlation-Id: f7375450-34f9-4b47-c3a9-08dd871a9b02 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?K1RsAPPAzAuRe7FRVFSsnO5dbQ06TYATC5wSfo4ovhtEp3w6HwYO2Obi1SOE?= =?us-ascii?Q?RgxAcmRMAaEQPGz9AEIOQqVVEDeHjFrC911Zna5sy7AWKgRhTVoLXS2BtyYq?= =?us-ascii?Q?JGxbeP91V7mHJ5wAIfabh0bjGIAPydl+3yhEO0uXx70X40oLoT+WRMHg0tlh?= =?us-ascii?Q?jzmg8zBtjbV667nAQX+i8oChBiUw4yi1UMVd95bvP3v2eMwkaRa4UVJLdZjp?= =?us-ascii?Q?G30++ZVG8jw7kpMXsL7evJbjiKSFVIw9SzJcHm0BXAH/o3raJlfWidfEwoXO?= =?us-ascii?Q?p/JXLp68ERzvb3I25VD6o3G5RQgi+Bti9XHuiigdcemEz12QWDr2nGUhMmYQ?= =?us-ascii?Q?HDhsqhYST1UjdIL6NJZWNRoneuoS6yySApnjx508ZYtkBUszTT/lclkt8x+G?= =?us-ascii?Q?oot5cRtnICXomOzWjl9ifWtbGFHIrOpBe5HKDw2/0KBHHBVnvsOXjd0ptHUc?= =?us-ascii?Q?5R2AJYT5a+ZHEV2i6YAZh8+QbJ9fumqaffvehc84tsymYzYDx1BV/Wr6W8zK?= =?us-ascii?Q?symw7mV+sdYwZJqu7soD1JF/MnYDzktqC5Fi1oom5+0+mhFP8zeaOcxT3N5i?= =?us-ascii?Q?mkeGRUp6p5VveV5NGRZnFDW+iGcC8FDP5WgPXvZ82Er8jkqbikdM50eWkzZv?= =?us-ascii?Q?Rcgvp6O4exQ/tzqy3qJtHrFdH08BQBytigfeCo89+ZpM8ETey87vGG1TLdn9?= =?us-ascii?Q?UdXFfrVGURPgzJpzu0NzTwfx2esWT9m9bCi9rmtrjFxiRGLy1Nh8GpoxTBeR?= =?us-ascii?Q?2nqmH/Z2pR/gTxGkGxTBthEV5mDBRwkVS6qRvWd3SZlw245yw7AM9WQRNSiz?= =?us-ascii?Q?g4c0glFBfgJrloJcyX1AVg6U0GcfSsqHl812kcMUcVC7OqI+lFtJPE342jJw?= =?us-ascii?Q?5jxtq5LaRhD8180FOzWS9NXiVEo/LbNOTYPAKf1TboG/5PSUNlk0ziKT+3O1?= =?us-ascii?Q?LoLJKitxmORyBkkeRm1NTewp1clXxb22xTsKX9Jhlx2xI1UKrTteYRFHTgQX?= =?us-ascii?Q?NGxequix+8iWvfZvKG27Cvr1+wRUJWAzmPsG/lUUn8oexsXmorr2BYB5jD9n?= =?us-ascii?Q?PO8mkRbZhXfm/puV92p6nadRfZwKcxoVSha6cGynx9edZByfI5kaAre7w988?= =?us-ascii?Q?Os5M7SLIuECegqtUzHMCB87GHTtGR8sRJssXhLwDnKpTLkyIbUiqDm+rGyW1?= =?us-ascii?Q?A9eWmhSBDK/VbfZTe6uPZiHe8A0vG+fjNuQP09OWKsOUan5avqSgD/Z3EbTA?= =?us-ascii?Q?73+es4XLpEuF97Ux+Y/0F0W9705vqDqd2qzd/BkR9/FyGqy1MogpMDo6zhJL?= =?us-ascii?Q?VYelndI2/MuZP+RAYMysThb+wXpNZxSeffpuz1caj9TThKAYF/TgAxJCjr08?= =?us-ascii?Q?Np3crcU6/kdT/ckbo8G8kq/kl6sgc1GtsrGuODlVohzyBv0cXOPjrGlwhHjG?= =?us-ascii?Q?Z0h6rd3ncPhYX/34EsuQp9rsGnc6DKMeOWk5RnMMBivZ8q9jfbVtUDkAtxJe?= =?us-ascii?Q?sAPQa/lYHtpNPoAfaWEgnFv9U1FIUT4nuqkP?= 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)(7416014)(376014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2025 12:37:29.5582 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f7375450-34f9-4b47-c3a9-08dd871a9b02 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: MN1PEPF0000ECD7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6666 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1745930548874019100 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Smith" Add support to read the command line from the hyperlaunch device tree. The device tree command line is located in the "bootargs" property of the "multiboot,kernel" node. A boot loader command line, e.g. a grub module string field, takes precendence over the device tree one since it is easier to modify. Signed-off-by: Daniel P. Smith Signed-off-by: Jason Andryuk Signed-off-by: Alejandro Vallejo Reviewed-by: Denis Mukhin --- xen/arch/x86/include/asm/bootinfo.h | 6 ++++-- xen/arch/x86/setup.c | 22 ++++++++++++++++++++-- xen/common/domain-builder/core.c | 26 ++++++++++++++++++++++++++ xen/common/domain-builder/fdt.c | 6 ++++++ xen/common/domain-builder/fdt.h | 24 ++++++++++++++++++++++++ xen/include/xen/domain-builder.h | 8 +++++--- xen/include/xen/libfdt/libfdt-xen.h | 23 +++++++++++++++++++++++ 7 files changed, 108 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/include/asm/bootinfo.h b/xen/arch/x86/include/asm= /bootinfo.h index 1e3d582e45..5b2c93b1ef 100644 --- a/xen/arch/x86/include/asm/bootinfo.h +++ b/xen/arch/x86/include/asm/bootinfo.h @@ -35,11 +35,13 @@ struct boot_module { =20 /* * Module State Flags: - * relocated: indicates module has been relocated in memory. - * released: indicates module's pages have been freed. + * relocated: indicates module has been relocated in memory. + * released: indicates module's pages have been freed. + * fdt_cmdline: indicates module's cmdline is in the FDT. */ bool relocated:1; bool released:1; + bool fdt_cmdline:1; =20 /* * A boot module may need decompressing by Xen. Headroom is an estima= te of diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index f8193f2c1c..765b690c41 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -985,7 +985,19 @@ static size_t __init domain_cmdline_size(const struct = boot_info *bi, { size_t s =3D bi->kextra ? strlen(bi->kextra) : 0; =20 - s +=3D bd->kernel->cmdline_pa ? strlen(__va(bd->kernel->cmdline_pa)) := 0; + + /* + * Bootloader cmdline takes precedence and replaces the DT provided on= e. + * + * In that case, fdt_cmdline is not be populated at all. + */ + if ( bd->kernel->fdt_cmdline ) + { + BUG_ON(!IS_ENABLED(CONFIG_DOMAIN_BUILDER)); + s +=3D builder_get_cmdline_size(bi, bd->kernel->cmdline_pa); + } + else if ( bd->kernel->cmdline_pa ) + s +=3D strlen(__va(bd->kernel->cmdline_pa)); =20 if ( s =3D=3D 0 ) return s; @@ -1049,7 +1061,13 @@ 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->fdt_cmdline ) + { + BUG_ON(!IS_ENABLED(CONFIG_DOMAIN_BUILDER)); + builder_get_cmdline( + bi, bd->kernel->cmdline_pa, cmdline, cmdline_size); + } + else if ( bd->kernel->cmdline_pa ) strlcpy(cmdline, cmdline_cook(__va(bd->kernel->cmdline_pa), bi->loader), cmdline_size); diff --git a/xen/common/domain-builder/core.c b/xen/common/domain-builder/c= ore.c index c6917532be..b2f49bb17b 100644 --- a/xen/common/domain-builder/core.c +++ b/xen/common/domain-builder/core.c @@ -10,9 +10,35 @@ #include =20 #include +#include =20 #include "fdt.h" =20 +size_t __init builder_get_cmdline_size(const struct boot_info *bi, int off= set) +{ + const void *fdt; + int size; + + fdt =3D bootstrap_map_bm(&bi->mods[HYPERLAUNCH_MODULE_IDX]); + size =3D fdt_cmdline_prop_size(fdt, offset); + bootstrap_unmap(); + + return max(0, size); +} + +int __init builder_get_cmdline(const struct boot_info *bi, + int offset, char *cmdline, size_t size) +{ + const void *fdt; + int ret; + + fdt =3D bootstrap_map_bm(&bi->mods[HYPERLAUNCH_MODULE_IDX]); + ret =3D fdt_cmdline_prop_copy(fdt, offset, cmdline, size); + bootstrap_unmap(); + + return ret; +} + enum fdt_kind __init builder_init(struct boot_info *bi) { enum fdt_kind kind; diff --git a/xen/common/domain-builder/fdt.c b/xen/common/domain-builder/fd= t.c index cbb0ed30a2..dabe201b04 100644 --- a/xen/common/domain-builder/fdt.c +++ b/xen/common/domain-builder/fdt.c @@ -219,6 +219,12 @@ static int __init fdt_process_domain_node( printk(XENLOG_INFO " kernel: multiboot-index=3D%d\n", idx); bi->mods[idx].type =3D BOOTMOD_KERNEL; bd->kernel =3D &bi->mods[idx]; + + /* If bootloader didn't set cmdline, see if FDT provides one. = */ + if ( bd->kernel->cmdline_pa && + !((char *)__va(bd->kernel->cmdline_pa))[0] ) + bd->kernel->fdt_cmdline =3D fdt_get_prop_offset( + fdt, node, "bootargs", &bd->kernel->cmdline_pa); } } =20 diff --git a/xen/common/domain-builder/fdt.h b/xen/common/domain-builder/fd= t.h index 5570fb7a9c..68cbc42674 100644 --- a/xen/common/domain-builder/fdt.h +++ b/xen/common/domain-builder/fdt.h @@ -10,6 +10,30 @@ struct boot_info; /* hyperlaunch fdt is required to be module 0 */ #define HYPERLAUNCH_MODULE_IDX 0 =20 +static inline int __init fdt_cmdline_prop_size(const void *fdt, int offset) +{ + int ret; + + fdt_get_property_by_offset(fdt, offset, &ret); + + return ret; +} + +static inline int __init fdt_cmdline_prop_copy( + const void *fdt, int offset, char *cmdline, size_t size) +{ + int ret; + const struct fdt_property *prop =3D + fdt_get_property_by_offset(fdt, offset, &ret); + + if ( ret < 0 ) + return ret; + + ASSERT(size > ret); + + return strlcpy(cmdline, prop->data, ret); +} + enum fdt_kind fdt_detect_kind(const struct boot_info *bi); int fdt_walk_hyperlaunch(struct boot_info *bi); =20 diff --git a/xen/include/xen/domain-builder.h b/xen/include/xen/domain-buil= der.h index 3ac3a0ab84..350e2eb2af 100644 --- a/xen/include/xen/domain-builder.h +++ b/xen/include/xen/domain-builder.h @@ -2,6 +2,8 @@ #ifndef __XEN_DOMAIN_BUILDER_H__ #define __XEN_DOMAIN_BUILDER_H__ =20 +#include + struct boot_info; =20 /* Return status of builder_init(). Shows which boot mechanism was detecte= d */ @@ -28,8 +30,8 @@ static inline enum fdt_kind builder_init(struct boot_info= *bi) } #endif /* !IS_ENABLED(CONFIG_DOMAIN_BUILDER) */ =20 -int fdt_read_multiboot_module(const void *fdt, int node, - int address_cells, int size_cells, - struct boot_info *bi) +size_t builder_get_cmdline_size(const struct boot_info *bi, int offset); +int builder_get_cmdline(const struct boot_info *bi, int offset, + char *cmdline, size_t size); =20 #endif /* __XEN_DOMAIN_BUILDER_H__ */ diff --git a/xen/include/xen/libfdt/libfdt-xen.h b/xen/include/xen/libfdt/l= ibfdt-xen.h index a5340bc9f4..9c20a26a35 100644 --- a/xen/include/xen/libfdt/libfdt-xen.h +++ b/xen/include/xen/libfdt/libfdt-xen.h @@ -13,6 +13,29 @@ =20 #include =20 +static inline bool __init fdt_get_prop_offset( + const void *fdt, int node, const char *pname, unsigned long *poffset) +{ + int ret, offset; + const char *name; + + fdt_for_each_property_offset(offset, fdt, node) + { + fdt_getprop_by_offset(fdt, offset, &name, &ret); + + if ( ret < 0 ) + continue; + + if ( !strcmp(name, pname) ) + { + *poffset =3D offset; + return true; + } + } + + return false; +} + static inline int fdt_get_mem_rsv_paddr(const void *fdt, int n, paddr_t *address, paddr_t *size) --=20 2.43.0 From nobody Mon Nov 17 12:54:31 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=1745930479; cv=pass; d=zohomail.com; s=zohoarc; b=U/pTVcldDt1o8gXil/YmKsRJn9mmlVN7pofTldlnmz6LEtTFNVmSiavOP+hl2z/XmVSxUTKklFtEt9NHhr9rzDybLiW6PE2X/a3K5CfkqSO0/qZxk0N7UW4zVsr9noUXh0HIQbX5DVeVQMaQOf0RyVCZTlf+6g6zJrg9+ATUURc= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745930479; 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=xDrFG98ghx3Lb9O56CXpByERjFCHM6cxhmOuzmZVC7s=; b=SW8cv3SbJpes5vjnoDjLH9E9mYCfNHfDfzrJiVJeOHAGc1KIwE1JGNn5WMm//FIY8WoxozkcxlEaAVqBYJkzgreNmeMh+4s98ibfrcPF9709e3JYQvYyi6XWrfwEpweTGuyXDF6+UThako2bJM+DOssWRye8H5/1IC0ANQtN7vM= 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 1745930479748987.2967436488499; Tue, 29 Apr 2025 05:41:19 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.972396.1360771 (Exim 4.92) (envelope-from ) id 1u9kGs-0003ho-Lz; Tue, 29 Apr 2025 12:41:10 +0000 Received: by outflank-mailman (output) from mailman id 972396.1360771; Tue, 29 Apr 2025 12: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 1u9kGs-0003hf-Ia; Tue, 29 Apr 2025 12:41:10 +0000 Received: by outflank-mailman (input) for mailman id 972396; Tue, 29 Apr 2025 12:41:09 +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 1u9kDV-0007L9-1s for xen-devel@lists.xenproject.org; Tue, 29 Apr 2025 12:37:41 +0000 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on20614.outbound.protection.outlook.com [2a01:111:f403:2416::614]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id bb26705b-24f6-11f0-9ffb-bf95429c2676; Tue, 29 Apr 2025 14:37:38 +0200 (CEST) Received: from BN0PR03CA0040.namprd03.prod.outlook.com (2603:10b6:408:e7::15) by SA3PR12MB7999.namprd12.prod.outlook.com (2603:10b6:806:312::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8699.19; Tue, 29 Apr 2025 12:37:33 +0000 Received: from MN1PEPF0000ECDA.namprd02.prod.outlook.com (2603:10b6:408:e7:cafe::83) by BN0PR03CA0040.outlook.office365.com (2603:10b6:408:e7::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8655.37 via Frontend Transport; Tue, 29 Apr 2025 12:37:33 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000ECDA.mail.protection.outlook.com (10.167.242.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8699.20 via Frontend Transport; Tue, 29 Apr 2025 12:37:33 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 29 Apr 2025 07:37:29 -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: bb26705b-24f6-11f0-9ffb-bf95429c2676 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=m9e8D8gpduj48qds7TjH9dOPn8ZgbAZN+R++qowLZ0cydbgbp11dBKUYy2f1KmOZ43A7MfLX7i1C2V1Mx243wOsdfJrH/iYvLG1zNmSBvIIitDwbtlxqvaR4KdIf4z0Hz0axiWaVuT6+mdQKnrl7QVLrtnOykyUquy2HbacWO+5JkSTDdRQTdGQ1eVhb1XzFe6RMPz67z8RJ91fwIQ3BVQ9C1Q9rgxvJL4n48rxfklMYc7fFbDXY/dOXO5PMl8HucNJIZVYOmQHmN3jBxkj+qmYitGtYhpI9Z4Ox265epHqHpwZknG97lBvBps+AWbXN0B4bJln/ZfUCUrazz0g0UA== 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=xDrFG98ghx3Lb9O56CXpByERjFCHM6cxhmOuzmZVC7s=; b=pPfuc3cYrLFuvJue9vocA455JOec3CKRX8ATNYkg5OIQg0o8ClrxeB3q2tP3+4pSpWVssmlgtAmt+9UuhBFO/IwqHfN2qJbrutP/EzLGpWO4aTfFf3R7SJ2gUCZm2HckX6sGwunLCdDcWK0MgjXPrHBnVqDhfLbF+9IOsxLAJVFE+EZkeYVO8HpWoezHjRaZBI887cn4F5UTWZDZ36KxdD18tc/ma8KGXs2N7MmxzO4ain9WW9NVPDxGIz3EOYXOAEwg+eKMq7eRLf1u/IKzuejPdk5x6hvtnlTmS85ZfBLkWTpVuGtPxQJv+Q9pYsE++i1oIYJYsz8BpY7zBJHJZg== 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=xDrFG98ghx3Lb9O56CXpByERjFCHM6cxhmOuzmZVC7s=; b=fIPzAOqgOwM+tlIoXYbBQc7pG+74Z5MmOakPImu0dNsPva3tYqrLjBmzGqVMZ1EvJjdrmEu/+XbiKGq2ztvw9U6n/sDe6S0WGSrAFPdSgEzEbOIu7DuIPAmEBOnSh4KoLj9cQnXv3+1D1ULb8waitPvymxuNFbabskGtHbEDiAo= 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: "Daniel P. Smith" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD , Michal Orzel , "Julien Grall" , Stefano Stabellini , "Jason Andryuk" , Alejandro Vallejo , "Denis Mukhin" Subject: [PATCH v6 07/12] x86/hyperlaunch: locate dom0 initrd with hyperlaunch Date: Tue, 29 Apr 2025 13:36:18 +0100 Message-ID: <20250429123629.20839-8-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250429123629.20839-1-agarciav@amd.com> References: <20250429123629.20839-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECDA:EE_|SA3PR12MB7999:EE_ X-MS-Office365-Filtering-Correlation-Id: 2900730e-0f8a-4ce0-3d73-08dd871a9d30 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?cuXTN9+ozAk+/y+9Y0Mn7+e41jQNNu6AjVeO4xkQnQWnytv6hrplu+ZxTi61?= =?us-ascii?Q?bHXQbYwLDDCcH/EgSmT9P6C+L7CDyvvWgwheAc8ZYgtw9rouHui1V31tdENR?= =?us-ascii?Q?pvjMhDRYA3FCMeZ1pjwO8jGU1gTIaunyXelPiZhznoTVJAYRIOJbo8qgJWqR?= =?us-ascii?Q?umLCFd4HpiFumAzXqxtqbP6QerOSy7rIplqfWvencGk7d+WK/+2OPsIfzovm?= =?us-ascii?Q?YvkIZMPU2YRlgpFRCv99rI6GH7RWw5r71z9mPT3KxAJOa14BCmuR6Ed+9pTA?= =?us-ascii?Q?GyWnhtx+ks+sUOat3d6ppzGI/c3PiPNJhaLFu/49HKBojX1aIgFXkCOvyB6e?= =?us-ascii?Q?vKEQzxw5IB7jNOzliTMAtkvfRJuVLd9/d8zLed/OpcrVPHHgQdJe3FgQIfsM?= =?us-ascii?Q?NTeBfPeOVabssfH9H7jdDQiZNSq/RYynJJK488adr5gb9u1gPqC6pXWanswa?= =?us-ascii?Q?yFJBTBKE09SPTcvSw6onUwUkFGJBip5A6qYcVtMKLIVrb+djf+/M2/nfWyPs?= =?us-ascii?Q?I40glzER5NsSXXYwJopT6mLDDAMRbOZBNOcoYOCKSddVspHYEd5Y9NWe2HTo?= =?us-ascii?Q?hN7dGYfqf0TBDTCjgi30CUbccuRlrMwk2AK0DuQwOoCMLOMTBVJ86B1oYUn9?= =?us-ascii?Q?NlpXkUMp949Cmu/EW3Usji0kruEiJ1jII65JGFyUYAMPfDxODdDaGn9Yd1JU?= =?us-ascii?Q?0wRoDNg/6Z+DQ0fmliomt5fmn0WZhotdS0Jo5rjeTnpBqt6zN40QJgt9g7GB?= =?us-ascii?Q?kJAM3c4hcCfdoFlRhL6jOUH+FUxlXchMCc+oiqxThwvFZiI/obYevMv+RBW8?= =?us-ascii?Q?GcR1PPjzKumjDKMVeQFjNhcQ24BsCbATgurp+c/XFvn8J1KQuhuavxHNXrnP?= =?us-ascii?Q?cbXlxjO5uljdEo2yATM9z4iI+cLXvfD7o2wmXHm9gKGSBYGO7ZpXbpzP4RPD?= =?us-ascii?Q?8103XfSmYK0pXC6IXOO4w8UVAgdKmw0y/UOSFA75y7O81WqP+USZpqsYeiuI?= =?us-ascii?Q?jvQsgGCgsSY7aToU7CIh8/DrD/66OclIVj2x4QwTBb/dTtFuJRZjml8GbDDy?= =?us-ascii?Q?US8y7OOPaLPlmig5MFlW1DNxQbYDnjtE656/Q+Ggw9FEBf7L/3nM18flAYsG?= =?us-ascii?Q?hxMM7BOc4bg4y+jBG7iY6x1vFIk+Am3BvHXor27+VtfR5P63roSqEUY64h/Q?= =?us-ascii?Q?tgwvKt3gWQYttnx6Q8Fu13X43KoeW3biu4pJSVK0jNgejXBUu2lWq3gKSXa3?= =?us-ascii?Q?riQMEKs0ZrCb0UZ85W1nAPC9ACHbZNYCvtmdy1jvV2CG1EhzN17Ph4SUAkev?= =?us-ascii?Q?sbbSx0CyqvYIbQFx/vpmbi6cKCsanfmucVnBSFHJmg6pdbYta4dz82CAMijT?= =?us-ascii?Q?zx1h7Jxkr+0LpNfBT/1GDuMn0hqkYJLxsM/hcKJz1xfzD5u6K/NIJFjBEm8L?= =?us-ascii?Q?sD5gbjB1OZ8kc4BDYcmL8/MnKijiQ2r5vXtIacTgwZQNC7+ZvgVSKTkf1dvn?= =?us-ascii?Q?mOvEzUXhAM9hgy0UGqpvS4UR+gQ0vyeAmEvt?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2025 12:37:33.2122 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2900730e-0f8a-4ce0-3d73-08dd871a9d30 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: MN1PEPF0000ECDA.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA3PR12MB7999 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1745930480371019000 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Smith" Look for a subnode of type `multiboot,ramdisk` within a domain node and parse via the fdt_read_multiboot_module() helper. After a successful helper call, the module index is returned and the module is guaranteed to be in the module list. Fix unused typo in adjacent comment. Signed-off-by: Daniel P. Smith Signed-off-by: Jason Andryuk Signed-off-by: Alejandro Vallejo Reviewed-by: Denis Mukhin --- xen/arch/x86/setup.c | 4 ++-- xen/common/domain-builder/fdt.c | 24 ++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 765b690c41..c8de028439 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -2172,11 +2172,11 @@ void asmlinkage __init noreturn __start_xen(void) * At this point all capabilities that consume boot modules should have * claimed their boot modules. Find the first unclaimed boot module and * claim it as the initrd ramdisk. Do a second search to see if there = are - * any remaining unclaimed boot modules, and report them as unusued in= itrd + * any remaining unclaimed boot modules, and report them as unused ini= trd * candidates. */ initrdidx =3D first_boot_module_index(bi, BOOTMOD_UNKNOWN); - if ( initrdidx < MAX_NR_BOOTMODS ) + if ( !bi->hyperlaunch_enabled && initrdidx < MAX_NR_BOOTMODS ) { bi->mods[initrdidx].type =3D BOOTMOD_RAMDISK; bi->domains[0].module =3D &bi->mods[initrdidx]; diff --git a/xen/common/domain-builder/fdt.c b/xen/common/domain-builder/fd= t.c index dabe201b04..507f383f8e 100644 --- a/xen/common/domain-builder/fdt.c +++ b/xen/common/domain-builder/fdt.c @@ -226,6 +226,30 @@ static int __init fdt_process_domain_node( bd->kernel->fdt_cmdline =3D fdt_get_prop_offset( fdt, node, "bootargs", &bd->kernel->cmdline_pa); } + else if ( !fdt_node_check_compatible(fdt, node, "multiboot,ramdisk= ") ) + { + int idx; + + if ( bd->module ) + { + printk(XENLOG_WARNING + "Duplicate module for domain %s\n", name); + continue; + } + + idx =3D fdt_read_multiboot_module(fdt, node, address_cells, + size_cells, bi); + if ( idx < 0 ) + { + printk(XENLOG_ERR " failed processing module for domain %= s\n", + name); + return idx; + } + + printk(XENLOG_INFO " module: multiboot-index=3D%d\n", idx); + bi->mods[idx].type =3D BOOTMOD_RAMDISK; + bd->module =3D &bi->mods[idx]; + } } =20 if ( !bd->kernel ) --=20 2.43.0 From nobody Mon Nov 17 12:54:31 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=1745930545; cv=pass; d=zohomail.com; s=zohoarc; b=OmS94iH1He0W5NldrYu36giMG8HGezTCpGtNDBRpxYsKeOtQadztmYsSScKyXo16SFLGLlOU34lnc161ycgg+5M45sw6PpiGhX9WdwDcEWu2p2soXbe05I8hi/F9srFNXw+1pDfxqdW759qg+CAri4RliWTxR7/JL7/jQSHvorU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745930545; 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=tCIp0SvGgKMTJckyMieSwQqF1Ax5pTMnvlnYTe9ZbcM=; b=LoZXtRk99d54LLQ3vqDicDnoGhSxTJ2/dPwmmjHrQz/SEx93k8aW7cGA31tTyMPspxu+Ovrz1PhccnH0VW+3J7/umnGsg2DCDxd381zZk0EGYrzsxex2DLLNb3UdQlAwW7iCy1PRFBYr/osmcMCslGlcG24Z2Y9HcxopBmGQZuY= 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 1745930545135393.67532415707797; Tue, 29 Apr 2025 05:42:25 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.972448.1360806 (Exim 4.92) (envelope-from ) id 1u9kHs-0005gc-Qc; Tue, 29 Apr 2025 12:42:12 +0000 Received: by outflank-mailman (output) from mailman id 972448.1360806; Tue, 29 Apr 2025 12:42:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u9kHs-0005fw-Kl; Tue, 29 Apr 2025 12:42:12 +0000 Received: by outflank-mailman (input) for mailman id 972448; Tue, 29 Apr 2025 12:42:11 +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 1u9kDe-0007KK-Lg for xen-devel@lists.xenproject.org; Tue, 29 Apr 2025 12:37:50 +0000 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20602.outbound.protection.outlook.com [2a01:111:f403:2414::602]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c1fdbeb4-24f6-11f0-9eb4-5ba50f476ded; Tue, 29 Apr 2025 14:37:50 +0200 (CEST) Received: from BN9PR03CA0353.namprd03.prod.outlook.com (2603:10b6:408:f6::28) by LV3PR12MB9410.namprd12.prod.outlook.com (2603:10b6:408:212::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8678.33; Tue, 29 Apr 2025 12:37:39 +0000 Received: from MN1PEPF0000ECD6.namprd02.prod.outlook.com (2603:10b6:408:f6:cafe::8b) by BN9PR03CA0353.outlook.office365.com (2603:10b6:408:f6::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8655.36 via Frontend Transport; Tue, 29 Apr 2025 12:37:39 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000ECD6.mail.protection.outlook.com (10.167.242.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8699.20 via Frontend Transport; Tue, 29 Apr 2025 12:37:38 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 29 Apr 2025 07:37:33 -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: c1fdbeb4-24f6-11f0-9eb4-5ba50f476ded ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=AANoegKma5VKluTCMCNgIW07SLA3uV6GgMAXQWPqEm0plsXiuhacSJIaRFlKBHCCPbMHckP0Qs9a1muIdqhltofOC3BtA9kUJYYGnEool2Q5fZvD9TqvWT4guplU1NTUaLCyDL7NqoqAaB3rkKT9D/pUu3jdcUsWlGla6lvSrd5kaAoLL9eRdvUQv17DFpjjrj/FTD3m8+N6hWTOAmk3Nbd4G36HO3etySgoqiIzM/NO2hbiM4+3n6N83qgXb17sEsuaGStj0LmtKukiVOVEIberhXoN3hBYXm9jn0xp0bry4uGxkorYU555/pQgU39842441+eK4XXkfin6GPTuPA== 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=tCIp0SvGgKMTJckyMieSwQqF1Ax5pTMnvlnYTe9ZbcM=; b=lCPtiVw1qFiHmn+2Q54B/wr6php7K2jdbxwlV2L0dsMiwwev2g3ou1BR/ZG4PadamZWvS+tODsTCR1sOHY1+ZL7SBbzisPrG2DXH1NoIPUHOTrlX+bRMtQNT4vES4Kew6HASdg+XZzzJx3QDK2sP7CnHtZy7dnmAk2IOMXH/UQxaA2S41t/giqN+v/ujpcH9RdqlIlfIcQiEdS+wq3j0SYPiI5ixBuXy6UDYvTVLH3M3pJ1kjDY1+YJWnOkOawrLRVpKrFaC64L3XwecVGJ1uZgaonPlyasjqbPi9s5fYqDQboPmWkgGHzgEzjCbTZMsQjWccZwy3a8IzOThIz+4PQ== 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=tCIp0SvGgKMTJckyMieSwQqF1Ax5pTMnvlnYTe9ZbcM=; b=5F+OS8w4G1Q40tT+TFpPTfKV7UiA2eLHbNLJk0vdyV6yeXOCCAO0q5pFFdtt/aSIIJVuGycb/8EUIYq/C5R1Qyk0p1qlT0S6qAa03UBSnQtd5stYcW80Z/5W0bagSqYMeZmHq/agT7mGhUU0vhuVLt2crmdPcetWv2jRt/iCPrY= 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: "Daniel P. Smith" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD , Michal Orzel , "Julien Grall" , Stefano Stabellini , Alejandro Vallejo , Denis Mukhin , "Jason Andryuk" Subject: [PATCH v6 08/12] x86/hyperlaunch: add domain id parsing to domain config Date: Tue, 29 Apr 2025 13:36:19 +0100 Message-ID: <20250429123629.20839-9-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250429123629.20839-1-agarciav@amd.com> References: <20250429123629.20839-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD6:EE_|LV3PR12MB9410:EE_ X-MS-Office365-Filtering-Correlation-Id: df1abd05-6c69-4c5c-1764-08dd871aa09c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?t3R6lYRxqbajRvIeY+OZdEze7LqvI+4PlWYeU2B/NLlQkO/hQ/GeKl7nLjKY?= =?us-ascii?Q?2AXmExKAFXsHq/el3VEG23ZV3bKOJQDQvmi3udX+WG3v3S4zJSi7BQMg3R9Z?= =?us-ascii?Q?CxOI1GbvOfVa+9Qr3pxd+R6pPfw/5ORL895w+gc2ohj9e139pC1rYQ6jjgQw?= =?us-ascii?Q?ESPw1NIzMihkHH0DJcIOJFhCSQeKSxT0W290+YrzI2zYNqAVet2DPcVuIV6u?= =?us-ascii?Q?IbOUO6hHg86XipKx9LFoPs6JDYulwVIXxAQqgeWveCOHeYzPnCPoN80R3D+T?= =?us-ascii?Q?oHs5XLY8OdISyxpp5rwqwE5hp1hB61c5vV41t5Ttjgf9ZEU0aO/ju7xt6zmw?= =?us-ascii?Q?1O6sL1rGM0bTXuZaYxPCIM2svjplQ69QMpgQzV6WdRRv0DkyMYlzoPzQa7AG?= =?us-ascii?Q?OsoJdZ4p7rQpnyXxnqv+XZh6jHPpKFNhEHd7G+sNfOuDNFcampaZLraHUoIm?= =?us-ascii?Q?anQcWxWS7wwE6wTkD+OXdhe1+kqK16nUI90kQ/7DN6k8yBbs49YAA+aUtSiz?= =?us-ascii?Q?2Xy3gtQurP/z9BCk/iR65gQRpqk+WAvAupvrV9MEsH+/eXYazMLiNVWMh2kz?= =?us-ascii?Q?lfnyGzeukIolJFyDUhevKLXl9fDoAF6DR5o1gGtTMDipl5q/bq7HqmK7wEpi?= =?us-ascii?Q?8bzC5TkkoyA6KV+qzCjDDQVG2wOlaf72jKRQdVHRJ3QivXOxtEKjmtxsjIpb?= =?us-ascii?Q?vq5W6dz9hCsFe6C/qCT82V1lY7R96lKyDvTAkLpHpyXzkBZAzGxvA1mqd+pB?= =?us-ascii?Q?5Bb/AYQHFm7SOFctONm5KWDeaQ1wb4QA1k1W1bAozcpwgURb75uZ6Awq4hnT?= =?us-ascii?Q?mTzUxe8HtTDiqFgl4BtwYlHKysgKBVZQ1iKjGAAhOIdKYVj8fZ1RLgJiUvQr?= =?us-ascii?Q?xhfA/91J6j0qL9usUZOStFlFgcvWtGNX2f3rA9lGkmPLM95xwzDo0nZhaiM7?= =?us-ascii?Q?tIe6jCaCXtfwSyeulbh9CgMCS9KgbpxoSxTkfSuXFIjHhu+xPqaAUkghzIKA?= =?us-ascii?Q?IcJDylPOjuQhJ/fQGcb4wPvhGv9DNsPHQ2P8bnoLUsf96UTUBIPrbuhW1kzd?= =?us-ascii?Q?+HiBvR2OIxJ/h8mqbw/4diIwmhfKHIfdLgPXxNgTYclexLmeEoCk6YR5VQeV?= =?us-ascii?Q?/xOPUm5a/JwJe1GmKY9yRWqxbSmFZ5OkUwPlFJcI8FbubRPJhKgWNZG8Qsti?= =?us-ascii?Q?3RaMao3pw1auzuin+U/Dr7ALifkxxDHUGakNcznbQWjjZ7ei5ScBiuzErRwx?= =?us-ascii?Q?INfAOSaId2VatLa+OvhwpVtFbwStC67FBXWNfQJJJUecQAX/VG7cTf02aevl?= =?us-ascii?Q?A2bXi0+phyYbI4DoW9TZFqJO8KcYxuM85q7/+3RPTk+V2YPKq3qJocBI8h4D?= =?us-ascii?Q?vsT97q4FyUNj3WjIFzZpKwzXF7mDF47jL1QC45xde+soAOl0LDWpBjSRxL98?= =?us-ascii?Q?36VvhSIuMKjU+c9YaT//8qaNu/llcZLz1xQ7H0grgH5vyYK5f3RK/ex/iMU/?= =?us-ascii?Q?2k3my97ohGdrFFhBEPlotsL/sOfj5HuGcoH9?= 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)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2025 12:37:38.9521 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df1abd05-6c69-4c5c-1764-08dd871aa09c 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: MN1PEPF0000ECD6.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9410 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1745930546844019100 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Smith" Introduce the ability to specify the desired domain id for the domain definition. The domain id will be populated in the domid property of the domain node in the device tree configuration. Signed-off-by: Daniel P. Smith Signed-off-by: Alejandro Vallejo Reviewed-by: Denis Mukhin Reviewed-by: Jason Andryuk --- xen/arch/x86/setup.c | 5 ++-- xen/common/domain-builder/fdt.c | 52 ++++++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index c8de028439..10ff67ac37 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1043,8 +1043,9 @@ static struct domain *__init create_dom0(struct boot_= info *bi) if ( iommu_enabled ) dom0_cfg.flags |=3D XEN_DOMCTL_CDF_iommu; =20 - /* Create initial domain. Not d0 for pvshim. */ - bd->domid =3D get_initial_domain_id(); + if ( bd->domid =3D=3D DOMID_INVALID ) + /* Create initial domain. Not d0 for pvshim. */ + bd->domid =3D get_initial_domain_id(); d =3D domain_create(bd->domid, &dom0_cfg, pv_shim ? 0 : CDF_privileged | CDF_hardware); if ( IS_ERR(d) ) diff --git a/xen/common/domain-builder/fdt.c b/xen/common/domain-builder/fd= t.c index 507f383f8e..2c05b0a22d 100644 --- a/xen/common/domain-builder/fdt.c +++ b/xen/common/domain-builder/fdt.c @@ -2,6 +2,7 @@ /* * Copyright (C) 2024, Apertus Solutions, LLC */ +#include #include #include #include @@ -188,12 +189,54 @@ static int __init fdt_read_multiboot_module(const voi= d *fdt, int node, static int __init fdt_process_domain_node( struct boot_info *bi, const void *fdt, int dom_node) { - int node; + int node, property; struct boot_domain *bd =3D &bi->domains[bi->nr_domains]; const char *name =3D fdt_get_name(fdt, dom_node, NULL) ?: "unknown"; int address_cells =3D fdt_address_cells(fdt, dom_node); int size_cells =3D fdt_size_cells(fdt, dom_node); =20 + fdt_for_each_property_offset(property, fdt, dom_node) + { + const struct fdt_property *prop; + const char *prop_name; + int name_len, rc; + + prop =3D fdt_get_property_by_offset(fdt, property, NULL); + if ( !prop ) + continue; /* silently skip */ + + prop_name =3D fdt_get_string(fdt, fdt32_to_cpu(prop->nameoff), &na= me_len); + if ( !strncmp(prop_name, "domid", name_len) ) + { + uint32_t val =3D DOMID_INVALID; + + if ( (rc =3D fdt_prop_as_u32(prop, &val)) ) + { + printk(XENLOG_ERR + " failed processing domain id for domain %s\n", na= me); + return rc; + } + + if ( val >=3D DOMID_FIRST_RESERVED ) + { + printk(XENLOG_ERR " invalid domain id for domain %s\n", n= ame); + return -EINVAL; + } + + for ( unsigned int i =3D 0; i < bi->nr_domains; i++ ) + { + if ( bi->domains[i].domid =3D=3D val ) + { + printk(XENLOG_ERR " duplicate id for domain %s\n", na= me); + return -EINVAL; + } + } + + bd->domid =3D val; + printk(XENLOG_INFO " domid: %d\n", bd->domid); + } + } + fdt_for_each_subnode(node, fdt, dom_node) { if ( !fdt_node_check_compatible(fdt, node, "multiboot,kernel") ) @@ -258,6 +301,13 @@ static int __init fdt_process_domain_node( return -ENODATA; } =20 + if ( bd->domid =3D=3D DOMID_INVALID ) + bd->domid =3D get_initial_domain_id(); + else if ( bd->domid !=3D get_initial_domain_id() ) + printk(XENLOG_WARNING + "warning: d%u is not the expected initial domain (d%u)\n", + bd->domid, get_initial_domain_id()); + return 0; } =20 --=20 2.43.0 From nobody Mon Nov 17 12:54:31 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=1745930503; cv=pass; d=zohomail.com; s=zohoarc; b=WeYT8u/paIija0o5mAMecZbTe9AesM0iYOL7u5Ezf7uw2nUFQOCIhJBlwQlvzJAroTafy4r0Ove60HVlX/rvi1JYZz6kwQWSTwqZ7GaMkCRpnxYVBHddvbhDgqMZdZ3eL7BsPh0prKiqPuSM4SitRabfcT56rwqVl7j6pQj4Yd4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745930503; 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=OWJmF8J3I0L8/d+4QMX42T2JCCUmBXzaxaMVzbsl3mk=; b=B1r3HjBFQTgZf/InZ+YvnG95403iw53nFU7GKhYE7cMS39jCWfxU7zpQ0aUxxmXkCaW2I8CiaEoJDR+rEFxDiZZdmzcCju8DQriMeGRTFysp5cU9VGr+kD2z8ZGuH3Qv8OQyzNiSZhJcf68LpPnw1wRcgodBXy4O5Vj16nHWKSM= 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 1745930503771364.6868897358712; Tue, 29 Apr 2025 05:41:43 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.972418.1360781 (Exim 4.92) (envelope-from ) id 1u9kHD-0004NJ-Ub; Tue, 29 Apr 2025 12:41:31 +0000 Received: by outflank-mailman (output) from mailman id 972418.1360781; Tue, 29 Apr 2025 12:41:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u9kHD-0004NC-RF; Tue, 29 Apr 2025 12:41:31 +0000 Received: by outflank-mailman (input) for mailman id 972418; Tue, 29 Apr 2025 12:41:31 +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 1u9kDi-0007L9-6U for xen-devel@lists.xenproject.org; Tue, 29 Apr 2025 12:37:54 +0000 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on20624.outbound.protection.outlook.com [2a01:111:f403:2413::624]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id c15bbb54-24f6-11f0-9ffb-bf95429c2676; Tue, 29 Apr 2025 14:37:48 +0200 (CEST) Received: from MN2PR14CA0009.namprd14.prod.outlook.com (2603:10b6:208:23e::14) by SA1PR12MB8844.namprd12.prod.outlook.com (2603:10b6:806:378::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8678.34; Tue, 29 Apr 2025 12:37:45 +0000 Received: from MN1PEPF0000ECD9.namprd02.prod.outlook.com (2603:10b6:208:23e:cafe::8d) by MN2PR14CA0009.outlook.office365.com (2603:10b6:208:23e::14) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8655.37 via Frontend Transport; Tue, 29 Apr 2025 12:37:44 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000ECD9.mail.protection.outlook.com (10.167.242.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8699.20 via Frontend Transport; Tue, 29 Apr 2025 12:37:44 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 29 Apr 2025 07:37:38 -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: c15bbb54-24f6-11f0-9ffb-bf95429c2676 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qKY6d7qUdjWCXXp4sPcMpQn+ypy1VohlOBGabRj97oHZdXEJCgIQqmQXdY0ADfF8tEcdQvczoTXv9iHBQfy6Zbir19yEkvbgZR74Buk49KdRpKeGTKUNM2LmO4QLW3qpMVFscH4546HKQwQjdnLMq0wzBQ6a06iCUwYKp6si1eskN/YJ398hSNno9UUANZBxYf39qj9fX+buP1z7o323cksgdxd0HjijV0jh5z4eON0Lv/q8E6I7YPrVFHWHZQ5JKB3ntom2leNUwBwp/9Cxj0MDh24yiNdJx/jW61maE8YEr8olix5OTmoTtiN4fn7RSqKaXxOtyLAqSzdulJkD3g== 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=OWJmF8J3I0L8/d+4QMX42T2JCCUmBXzaxaMVzbsl3mk=; b=Gr4U4qEXs2iPbBD+5sBco5uXW68DSq2n7jkcXyUpckuGbAv2XBWwdO6+7V1zaGbk0bQtB4RLCuuBcPdrrEvSqFVp/20ZnBdOu45mxFtir4ZmNcsWoqhmEyi4g1RFVBido6dRIJxHxjWmFRTAKpIZCOeSDeDcCMQLOHagluTRrqFpvbBFh/WFZsxhSfPalx7bCACGxV4iNTzHqSCPdp7nHDF3fayEVlBRnd0NbvBab1dsT3T1lrCidCnbT4YAaG0O878TIya7qY4iHONWfLWNcdIfxN5mDH+q9TiBzQByj13UyBLCRev3G+Y0h5cf71dXc+Jlt99boEm9flpqVMbqvA== 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=OWJmF8J3I0L8/d+4QMX42T2JCCUmBXzaxaMVzbsl3mk=; b=Gf8f8Nod3SC2lLGSnD/pkP1bsOurYSEBsC8ZmEhiRFNZL1Pq6DYnO7KbmJAM9H5tPr5OZSzesQn7iHjjb5Vaj2zx/SLbtDqsFugibZ9fNk6U8zGJwpDzayIhof1ln322oT0Ez6+0zUKbk3rH2uYsXWvzaMS9IGycbBF7MdmzNVw= 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: "Daniel P. Smith" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD , Michal Orzel , "Julien Grall" , Stefano Stabellini , "Jason Andryuk" , Alejandro Vallejo , "Denis Mukhin" Subject: [PATCH v6 09/12] x86/hyperlaunch: specify dom0 mode with device tree Date: Tue, 29 Apr 2025 13:36:20 +0100 Message-ID: <20250429123629.20839-10-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250429123629.20839-1-agarciav@amd.com> References: <20250429123629.20839-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD9:EE_|SA1PR12MB8844:EE_ X-MS-Office365-Filtering-Correlation-Id: 551c868e-1a01-42e0-77f6-08dd871aa411 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?AKwx6ZHWVZUgbJxSO2TeTuSDoN+7M1Nfs7AjTdpL7uIppYS6wPwCREyFU9BZ?= =?us-ascii?Q?BLMHikTWLb1bGCPAJW9Bj9QApR3XvtPpCBFcZQpb1ynP/NeN8wFZGtL1ORoi?= =?us-ascii?Q?V+qvEjWOupTw5o2NF5yHPwUeO6FnskTC7CAEmvbRpsl2cVXSEEZ+kzihjONr?= =?us-ascii?Q?S0AQFkjxkHpmaGPj+QA6fsb3MFpz0gbLFXEmbvJOe5jbmeg0rF92CuQWJl7U?= =?us-ascii?Q?hJovHr9rnt8MR4rdm2sUjMyXJiFHi/5RjugrdByVwOnXOE2AK5wWe99buQh8?= =?us-ascii?Q?XqwZeeFB2s42EUG6sMYwL4GJVOmGWgl/2cHrRqHZlUzK1qiWM2mvB0D8t9aR?= =?us-ascii?Q?KLxF5Q2VrflcAj4bzsbBXo05kIqb9Ay+nGF5MS5P9alLuBEL0ZfjhRPZxhR9?= =?us-ascii?Q?tnClwXwWZLby6hlkjknEndiH/ZtWznNWAt3Cf2epXnlG3TGEQbOdD0+xW+Iq?= =?us-ascii?Q?JpbDl1OEw0wv79oqv88TiWWsANaXvmFb7oiaziOgLMpeC9rn4pHzWFA1YBrp?= =?us-ascii?Q?Z3n9dsLTb6Cz/QIjs7NF5DMunaMk0VVCsBqlxix0NNyrtbURvh6jhyPmKoVQ?= =?us-ascii?Q?EasqZeDzVdFjG9t2KU9zLVMOf4TQh+diZwyLYzBhnHLyCdT78B3Qi7K7o8lS?= =?us-ascii?Q?FXJ181ntv53HwqmkikxhRBZ6/cMm+U9ojqdqbcFpgt/gRNXTCdx8+wsOTP1D?= =?us-ascii?Q?I3OhZuN9QAKqV+O8RmfT4gCQVMiiaPUXs1+NTyblpECUkJ836mKMxJBX7TQy?= =?us-ascii?Q?ebr7DD+e0iP/Ex5ckpk+Jgh7wtEB+bNqnB3ytwDJqAlLpbXEKpu7PkxYOYAn?= =?us-ascii?Q?X2RwBmGy44LcL1FD421GNeCq/KoIxIesTS0F1qNIZa3l5ekLWq516Pvt1dVa?= =?us-ascii?Q?gP8Kkqo7ws+7l5Q3/0tjJ6LDzxl77hYoVT7G94Bj+d6bTBmRdp0YZ/qSqzpp?= =?us-ascii?Q?iMX8BD4VqpjHTxvdBbgNgejXMOEXor33dnG1/M1j8ejctvmxxan9B8NA/Tp/?= =?us-ascii?Q?NBFeb14GEaCsn6tlSVPsfvcFgcgi723sPcLYtm3SYU+bckXPM43V7dUuiwDa?= =?us-ascii?Q?rD73Wt2y/Umcry/qlyrqTO3aG8AsP5nzWfe6qRrA3e6LA8gqiMnUfcQg2oAB?= =?us-ascii?Q?ZvINcjG8UDp6c4xNhjdzLx2dUsagdBza/IjB4b3a9VOMA9rcenyE96VPV73v?= =?us-ascii?Q?ElsqIEXx+ufQ+8I9yxTj1JdKnBuPrz0Alf2CebaldAf8dGB34TYtMZm44Buj?= =?us-ascii?Q?4rLjqttXs1HVZQxXLtutwVcU51ira3gdJegdwffA+BsSlQ7laozM6zflEqx8?= =?us-ascii?Q?YLzmA2Sy9KCryzW4ZNzECZxwSnjrFm6YrsX4o2+SwEDroD4KfiNJDGiinJxb?= =?us-ascii?Q?noabOCvXrw/XceRNSoIfAwONn3SYAQu6c8bTer8YeaLWy/JHWwYMUjxjYfCO?= =?us-ascii?Q?V5zR6Q6SfLZ+ytI26q8CjmlRF53mazyvZrb/pTQGiwxwVH9S3esH6tJAOlK2?= =?us-ascii?Q?SANHydmW8xv/yJk45dmX3LZQVVwKPZjgiKAc?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2025 12:37:44.7150 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 551c868e-1a01-42e0-77f6-08dd871aa411 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: MN1PEPF0000ECD9.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB8844 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1745930504497019000 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Smith" Enable selecting the mode in which the domain will be built and ran. This includes: - whether it will be either a 32/64 bit domain - if it will be run as a PV or HVM domain - and if it will require a device model (not applicable for dom0) In the device tree, this will be represented as a bit map that will be carr= ied through into struct boot_domain. Signed-off-by: Daniel P. Smith Reviewed-by: Jason Andryuk Signed-off-by: Alejandro Vallejo Reviewed-by: Denis Mukhin --- xen/arch/x86/include/asm/boot-domain.h | 5 +++++ xen/arch/x86/setup.c | 3 ++- xen/common/domain-builder/fdt.c | 21 +++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/include/asm/boot-domain.h b/xen/arch/x86/include/= asm/boot-domain.h index d7c6042e25..e316d4bcde 100644 --- a/xen/arch/x86/include/asm/boot-domain.h +++ b/xen/arch/x86/include/asm/boot-domain.h @@ -13,6 +13,11 @@ struct boot_domain { domid_t domid; =20 + /* On | Off */ +#define BUILD_MODE_PARAVIRT (1 << 0) /* PV | PVH/HVM */ +#define BUILD_MODE_ENABLE_DM (1 << 1) /* HVM | PVH */ + uint32_t mode; + struct boot_module *kernel; struct boot_module *module; const char *cmdline; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 10ff67ac37..343f87ee9d 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1030,7 +1030,8 @@ static struct domain *__init create_dom0(struct boot_= info *bi) struct boot_domain *bd =3D &bi->domains[0]; struct domain *d; =20 - if ( opt_dom0_pvh ) + if ( opt_dom0_pvh || + (bi->hyperlaunch_enabled && !(bd->mode & BUILD_MODE_PARAVIRT)) ) { dom0_cfg.flags |=3D (XEN_DOMCTL_CDF_hvm | ((hvm_hap_supported() && !opt_dom0_shadow) ? diff --git a/xen/common/domain-builder/fdt.c b/xen/common/domain-builder/fd= t.c index 2c05b0a22d..aadca11dfa 100644 --- a/xen/common/domain-builder/fdt.c +++ b/xen/common/domain-builder/fdt.c @@ -235,6 +235,27 @@ static int __init fdt_process_domain_node( bd->domid =3D val; printk(XENLOG_INFO " domid: %d\n", bd->domid); } + else if ( !strncmp(prop_name, "mode", name_len) ) + { + if ( (rc =3D fdt_prop_as_u32(prop, &bd->mode)) ) + { + printk(XENLOG_ERR + " failed processing mode for domain %s\n", name); + return rc; + } + + if ( (bd->mode & BUILD_MODE_PARAVIRT) && + (bd->mode & BUILD_MODE_ENABLE_DM) ) + { + printk(XENLOG_ERR " mode: invalid (pv+hvm)\n"); + return -EINVAL; + } + + printk(XENLOG_INFO " mode: %s\n", + (bd->mode & BUILD_MODE_PARAVIRT) ? "pv" : + (bd->mode & BUILD_MODE_ENABLE_DM) ? "hvm" : + "pvh"); + } } =20 fdt_for_each_subnode(node, fdt, dom_node) --=20 2.43.0 From nobody Mon Nov 17 12:54:31 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=1745930468; cv=pass; d=zohomail.com; s=zohoarc; b=XCwlYjqNYRw8CngJJBa9Xymsh+DTkZ/4ixRF5BNRY0QNwyHkmduLHGaMdgLF4RhBxtsrZGBi4w3UTB+zdAtx5T4Pz7tGWAD2/s4129mbbGToU92slosxUDV4wZh1FCa5ZV/4l+JW+WiqWxSjmoq2ULynIVS3Yvp5+cRnTVDR/SY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745930468; 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=Pk+0cuFaL4PjlqZuXO8kAMll1JDmXXUosf54xaUN2m0=; b=UETdZO4YF4GdYvnV5cqLKAbghcd4oIEtzSUjfKVPSjDznuPidaY+db3GpRQx55+u7M7Tf8vfOQ1clqFPoiyYOELHFadnjrNwEN9ePAg+icRm4S09ZGWl1UbqGBGqbOex5QOZr51A3SCUGW5NA+RRMBxI3apgJ5eB+usLQvpWqfU= 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 1745930468272632.6688718834293; Tue, 29 Apr 2025 05:41:08 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.972392.1360760 (Exim 4.92) (envelope-from ) id 1u9kGY-00038e-EK; Tue, 29 Apr 2025 12:40:50 +0000 Received: by outflank-mailman (output) from mailman id 972392.1360760; Tue, 29 Apr 2025 12:40:50 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u9kGY-00038X-Bi; Tue, 29 Apr 2025 12:40:50 +0000 Received: by outflank-mailman (input) for mailman id 972392; Tue, 29 Apr 2025 12:40:49 +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 1u9kDj-0007KK-9v for xen-devel@lists.xenproject.org; Tue, 29 Apr 2025 12:37:55 +0000 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2061e.outbound.protection.outlook.com [2a01:111:f403:2415::61e]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c5076f2d-24f6-11f0-9eb4-5ba50f476ded; Tue, 29 Apr 2025 14:37:54 +0200 (CEST) Received: from BN0PR03CA0057.namprd03.prod.outlook.com (2603:10b6:408:e7::32) by SJ2PR12MB8158.namprd12.prod.outlook.com (2603:10b6:a03:4f7::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8699.19; Tue, 29 Apr 2025 12:37:51 +0000 Received: from MN1PEPF0000ECDA.namprd02.prod.outlook.com (2603:10b6:408:e7:cafe::23) by BN0PR03CA0057.outlook.office365.com (2603:10b6:408:e7::32) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8655.41 via Frontend Transport; Tue, 29 Apr 2025 12:37:51 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000ECDA.mail.protection.outlook.com (10.167.242.134) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8699.20 via Frontend Transport; Tue, 29 Apr 2025 12:37:51 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 29 Apr 2025 07:37: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: c5076f2d-24f6-11f0-9eb4-5ba50f476ded ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XsbgbhUkv5vsQD2xtrpUjKMtb9yDj6Im4oTD/xEZSRflUI2Xpnl+BQYeqviTNKSnlkGe4ux2715QgvI8iZYwxqrPbCJ5xb+bPEWwoKxRtSdvfNsFb+sWfLOXhtAccQP5dMTneYjch/9DrXMNs98Fg80TaU/ThxczwYHmkY//nKlTkrR0xp9up2/OZOwsRQ8lf5akFBff6skL+jZ3pGyi1otUQUhFCsDjVNJAaM9Og6ouhhRlh6EXOXkNgqyBMJ7so9XOuaDaJyUa2Zo/L7hVphv7jWxA/H9tUZZ9tj+dNLchoLM8GGFcwkoNnrCU8rKS++AMZz1PwFBFHHFUf14r4w== 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=Pk+0cuFaL4PjlqZuXO8kAMll1JDmXXUosf54xaUN2m0=; b=VOGqBqzl7TmKDHSYlY4JrWb1pCdxGxOspayJHZhLFaKP3r6+7VHf9Thv8GKl7YPv1+TRGzF0FNNj6Q4i59tArFwiixRPutvVVEc4eC4GJH8EkOPFrDhl/pIPcZnZFrfTk5l/xMp6M5M3zsF7xie+skK8qwOlZQNN9vd8erMyu/zftFsdTGHpaDDGaV7aWoXq371MqJQ7tQEDPlnGctJkDkkrGdWe6iSLaoWZ8uG+StGXqU0xzHfYuA9uI5TlFLj9N0uu8uGEUnFnmyL3BpdN4lSfnT+jWQO8BaJfP1KWntcIFRrDCiw7MbgrRuQvNWz92Ia4gEWNAtlWCTqGpI3amw== 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=Pk+0cuFaL4PjlqZuXO8kAMll1JDmXXUosf54xaUN2m0=; b=MwrzTOV1SHVFiiC7YZWudKG2pwjEleoOe9ptqNyHEp8DKxn/TLoqS6vLgqGr5jQOfFYcS5SX20hG+Sei1/MpHgClcsIbXFFfEYmmME0rSsf6+0YRozzlZ2RI8e3PRIBe8L1JOs7qH9Z6p9rraeyWz5Bogb8ABC37ANW3LUNt8UI= 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: "Daniel P. Smith" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD , Michal Orzel , "Julien Grall" , Stefano Stabellini , "Jason Andryuk" , Alejandro Vallejo , "Denis Mukhin" Subject: [PATCH v6 10/12] x86/hyperlaunch: add memory parsing to domain config Date: Tue, 29 Apr 2025 13:36:21 +0100 Message-ID: <20250429123629.20839-11-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250429123629.20839-1-agarciav@amd.com> References: <20250429123629.20839-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECDA:EE_|SJ2PR12MB8158:EE_ X-MS-Office365-Filtering-Correlation-Id: b9882f07-ffc9-454f-5147-08dd871aa7de X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?mNGGpBFI/t7n3Hydf9kVCo3j26iQqfl5Q5uT/FctcnUnj7IQV95e3xDhNJM5?= =?us-ascii?Q?RgTRLgRExM6m9khvNBTc70iH7TGAdJ7AWPP5Vypr531iO/Fig2v1z9PW1Hus?= =?us-ascii?Q?RtjNy34i2kZ0iJ3FRC5NwF//MajMtke5OpR50oaIbknm3w42DxgKIqLinvAE?= =?us-ascii?Q?+rhk7LYWrTjIUaf/pEAJnGBj9RWaHgH95fH8G7YhcpJbdYqf7ASDiXgDEYQx?= =?us-ascii?Q?G4uWK0OxEd/KOyANCYwTrgGqViPQRt8/oa91DZ4bseakHjaH3Lmymc+DrA00?= =?us-ascii?Q?wODj7+yCmlNZ/hMZL/Lwx1tTxu2tlWqapXSVT2L3QTsPBSNszSj5r1InRMzJ?= =?us-ascii?Q?HDQLKW3Gp+SwLD4mGVEhnYh+OufOVG6t9DWfBYHvgWZzLygRVMO4YeyXsCbO?= =?us-ascii?Q?5r5NpajGw4di2EVyi+JUs7vT6X+HE0zXGLC5zbfy/laV4sfEBw/ddjasGOeL?= =?us-ascii?Q?1b8Ilzi7DeWD8KNKHeGFh78Fp87BCGoAXoGqOZmgeyd25wOPIZujpjKp0lss?= =?us-ascii?Q?DoEBF8R+5FiKmHQ1zP43WpF9mpV32JhkEU0giJd8eP1n4T5KlmQwd6IH+4RH?= =?us-ascii?Q?sAzq+BA/6gRcaK3SW728zitJ18WzP4HhPSmeWSMKuxa+5SCTRRui8B8U4k3z?= =?us-ascii?Q?hFUqOxhpjDPuqB/bkGCRw7DrJ0sGQKW/OaA30sAYOkYSL993cpoWnyp+yD1F?= =?us-ascii?Q?zjNV5LUQVy6GzPpxNr3cTZSo7b3uL5gCqqoBuaac73WbB44Y9oRfPWT+haJi?= =?us-ascii?Q?S/VySYQfaMbLlu4QuNhyfzz130Nsc3lJ0akSr3nmY1+HfpMmIDsIowG0nf0L?= =?us-ascii?Q?efZ8uWLDv/G/ZlTLbLMQ+0DHrGuCwtnrvGhaPkbVR00WXo4FvZcT2I0updJm?= =?us-ascii?Q?LJnYieGn1pF2wETXaPcGHYgJeWcKvPa9WupYN8s/UBm39dwzNFt6/6QWES3g?= =?us-ascii?Q?sszygl1kD2yrd3wvMDkpuI4Koprc1/QXhRmi/3Bu1aSY33YBr/ly47ovf8yc?= =?us-ascii?Q?2IgU378lEk2vUGpsulnwTvuIqIjNgZE8mhgqpF7D83JPDDFDUyJKY+VUSoX/?= =?us-ascii?Q?oOL3P+TH4GFkp/uA1dWwnsJtluLqvxU0arANbJxsFxSEwkkXmbosv11X6lTT?= =?us-ascii?Q?7Y6uBuG2FFwAaiD2ZWE/UwZk2jOBTWqB9uIAKTrYH6X0kakL+6GcefB5rmcX?= =?us-ascii?Q?XjuiVjEeatoHJTJ2wEva+bKwVJnEYPw7wJMPE/TIKflhs7ekQCw+aUozAyWS?= =?us-ascii?Q?m6Q2uCet01sia3qaCDH0fYMessBm94zd1LvSZ0q4dHe0Qt8tJhrSpgHr19Ne?= =?us-ascii?Q?ZOjL8b+fv+ti52vPphIazRh7LCrHobH1G/K6IPFp5xF4VhMuhyXBrbyoql3F?= =?us-ascii?Q?MGAh+8xwzp938if8ZleE0TVmN5ZodGDvNLnsET0KOuTBlO5ja37qozngigdJ?= =?us-ascii?Q?zDjffE0W/aet1P1WmN/0D4IVjW/xdDef0F0MLyLSNYh7fd+7DrwD04r2Turm?= =?us-ascii?Q?OJ/guqS0NoFWAC+1dm2BUeHp7x0g1y0QnQjG?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2025 12:37:51.1290 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b9882f07-ffc9-454f-5147-08dd871aa7de 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: MN1PEPF0000ECDA.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8158 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1745930470272019000 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Smith" Add three properties, memory, mem-min, and mem-max, to the domain node devi= ce tree parsing to define the memory allocation for a domain. All three fields= are expressed in kb and written as a u64 in the device tree entries. Signed-off-by: Daniel P. Smith Reviewed-by: Jason Andryuk Signed-off-by: Alejandro Vallejo Reviewed-by: Denis Mukhin --- xen/arch/x86/dom0_build.c | 8 +++++ xen/arch/x86/include/asm/boot-domain.h | 4 +++ xen/arch/x86/setup.c | 5 ++- xen/common/domain-builder/fdt.c | 46 ++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 0b467fd4a4..8db24dbc0a 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -627,6 +627,14 @@ int __init construct_dom0(const struct boot_domain *bd) =20 process_pending_softirqs(); =20 + /* If param dom0_size was not set and HL config provided memory size */ + if ( !get_memsize(&dom0_size, ULONG_MAX) && bd->mem_pages ) + dom0_size.nr_pages =3D bd->mem_pages; + if ( !get_memsize(&dom0_min_size, ULONG_MAX) && bd->min_pages ) + dom0_min_size.nr_pages =3D bd->min_pages; + if ( !get_memsize(&dom0_max_size, ULONG_MAX) && bd->max_pages ) + dom0_max_size.nr_pages =3D bd->max_pages; + if ( is_hvm_domain(d) ) rc =3D dom0_construct_pvh(bd); else if ( is_pv_domain(d) ) diff --git a/xen/arch/x86/include/asm/boot-domain.h b/xen/arch/x86/include/= asm/boot-domain.h index e316d4bcde..fa8ea1cc66 100644 --- a/xen/arch/x86/include/asm/boot-domain.h +++ b/xen/arch/x86/include/asm/boot-domain.h @@ -18,6 +18,10 @@ struct boot_domain { #define BUILD_MODE_ENABLE_DM (1 << 1) /* HVM | PVH */ uint32_t mode; =20 + unsigned long mem_pages; + unsigned long min_pages; + unsigned long max_pages; + struct boot_module *kernel; struct boot_module *module; const char *cmdline; diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 343f87ee9d..4a3c41ad71 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -297,7 +297,10 @@ static const char *cmdline_cook(const char *p, const c= har *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 { + .domid =3D DOMID_INVALID, + .max_pages =3D ULONG_MAX, + }}, }; =20 static struct boot_info *__init multiboot_fill_boot_info( diff --git a/xen/common/domain-builder/fdt.c b/xen/common/domain-builder/fd= t.c index aadca11dfa..d9babe9d56 100644 --- a/xen/common/domain-builder/fdt.c +++ b/xen/common/domain-builder/fdt.c @@ -7,6 +7,7 @@ #include #include #include +#include =20 #include #include @@ -24,6 +25,16 @@ static int __init fdt_prop_as_u32(const struct fdt_prope= rty *prop, return 0; } =20 +static int __init fdt_prop_as_u64(const struct fdt_property *prop, + uint64_t *val) +{ + if ( !prop || fdt32_to_cpu(prop->len) < sizeof(uint64_t) ) + return -EINVAL; + + *val =3D fdt64_to_cpu(*(const fdt64_t *)prop->data); + return 0; +} + /* * Unpacks a "reg" property into its address and size constituents. * @@ -256,6 +267,41 @@ static int __init fdt_process_domain_node( (bd->mode & BUILD_MODE_ENABLE_DM) ? "hvm" : "pvh"); } + else if ( !strncmp(prop_name, "memory", name_len) ) + { + uint64_t kb; + if ( (rc =3D fdt_prop_as_u64(prop, &kb)) ) + { + printk(XENLOG_ERR " bad \"memory\" prop on domain %s\n", = name); + return rc; + } + bd->mem_pages =3D PFN_DOWN(kb * SZ_1K); + printk(XENLOG_ERR " memory: %lu KiB\n", kb); + } + else if ( !strncmp(prop_name, "mem-min", name_len) ) + { + uint64_t kb; + if ( (rc =3D fdt_prop_as_u64(prop, &kb)) ) + { + printk(XENLOG_ERR + " bad \"mem-min\" prop on domain %s\n", name); + return rc; + } + bd->min_pages =3D PFN_DOWN(kb * SZ_1K); + printk(XENLOG_INFO " min memory: %lu kb\n", kb); + } + else if ( !strncmp(prop_name, "mem-max", name_len) ) + { + uint64_t kb; + if ( (rc =3D fdt_prop_as_u64(prop, &kb)) ) + { + printk(XENLOG_ERR + " bad \"mem-max\" prop on domain %s\n", name); + return rc; + } + bd->max_pages =3D PFN_DOWN(kb * SZ_1K); + printk(XENLOG_INFO " max memory: %lu KiB\n", kb); + } } =20 fdt_for_each_subnode(node, fdt, dom_node) --=20 2.43.0 From nobody Mon Nov 17 12:54:31 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=1745930534; cv=pass; d=zohomail.com; s=zohoarc; b=moGbxfQtccTsuWGUJkEkWW3zeV1SH6yuICxCUSB9bTN73cCvJDx0VeP6zxxmfxjuH219BZMA2KXrvgTt710aRo2fmiBFwm6QNDeEyCSmmUq11S6HNmZGF9WoSRI8+8de/u00DKNoJQ82fnCmEX/xUW12h8qXCXJeuKe+vfYHpe4= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745930534; 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=/ohQ5gUwvFY4l0X5A4KS0w190NIPE0tD/1TucyppGhs=; b=jxO01bmHJ0hyiBj0JWFeeOAQ9OL8t0NvQwmrghZJliudzvuU5FdzFj/0QvyqrX55uB5zSU5uYhTynO5VhWK5B6pxjsa1bIcRhZg9pbyzm2mse+FvuW0X0FX8LlYzoIN3pV1I050ZBgz56bTm/C0k7EZEhXka9/MGQe2oyhip7w0= 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 1745930534779632.258141701715; Tue, 29 Apr 2025 05:42:14 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.972437.1360791 (Exim 4.92) (envelope-from ) id 1u9kHk-0005HL-8q; Tue, 29 Apr 2025 12:42:04 +0000 Received: by outflank-mailman (output) from mailman id 972437.1360791; Tue, 29 Apr 2025 12:42:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u9kHk-0005HE-69; Tue, 29 Apr 2025 12:42:04 +0000 Received: by outflank-mailman (input) for mailman id 972437; Tue, 29 Apr 2025 12:42: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 1u9kDr-0007KK-HX for xen-devel@lists.xenproject.org; Tue, 29 Apr 2025 12:38:03 +0000 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2060c.outbound.protection.outlook.com [2a01:111:f403:200a::60c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id c9608161-24f6-11f0-9eb4-5ba50f476ded; Tue, 29 Apr 2025 14:38:02 +0200 (CEST) Received: from BN9PR03CA0710.namprd03.prod.outlook.com (2603:10b6:408:ef::25) by IA0PR12MB7776.namprd12.prod.outlook.com (2603:10b6:208:430::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8678.33; Tue, 29 Apr 2025 12:37:55 +0000 Received: from MN1PEPF0000ECD7.namprd02.prod.outlook.com (2603:10b6:408:ef:cafe::b5) by BN9PR03CA0710.outlook.office365.com (2603:10b6:408:ef::25) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8655.37 via Frontend Transport; Tue, 29 Apr 2025 12:37:55 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000ECD7.mail.protection.outlook.com (10.167.242.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8699.20 via Frontend Transport; Tue, 29 Apr 2025 12:37:55 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 29 Apr 2025 07:37:51 -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: c9608161-24f6-11f0-9eb4-5ba50f476ded ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kTHqwIOhPC0UkysD4e4F4bzbQoYqlfwaE78RmKwAZ7yEE61Wk5AKRL63VAZgyt2Ud+ifwtURbSF0ux54OM86iSlr3fPvkA94LOW5rTFZQ3mybc8bxoOuiZL3H+w2O7ABJXvD9CH6hbijuWsMrcysZacrefmYMeuoOe4UyMBF6rFjDkG85J29a25tWUy+b59yugbqPJ05pBn6Llu4no762p58kJ1IhTlLnvQ0Ww5yrEbwCaoY+xD8HuT2LpFBwqHXt5IFmfmwvQbxUFH4jpFzjbu/DAekwAN+nnTYX0nWQ6C3BA5oK3UVW2J68jNkQOAjRsmVySuPQuO1fSIqBHEoxg== 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=/ohQ5gUwvFY4l0X5A4KS0w190NIPE0tD/1TucyppGhs=; b=F1mOHv3nWNnK/5zyaopk9gBgJ2PdYGxiAGO0ZNte4vh6uUkCsmQ1PjFOGW8ZpJ7ngwb3ISyw/TLk47es45O9mS1zmxV9l7Xu19rQXitbwxBykLkBwy+Ef0vS3XEU7jYxd1qK2a0pUlaWSaZve8P9qJS/7xod7Tq7Q0vLZJ+MO3Alvz0cRk5qub5oZopeJdXq9uhJLlA2qJhrDe63HI0EVTPU6JtFoL/ZYm8pjxim7HDniLzTgctLlr3QI411aSy1UzpBNr+xvQ3RTaOZoZ825V9T+bbJJG4KXFEQbEd1f434N/rxpreF0XjLe8xMqMIQv2W2U+r6YjwY8sAd1ks0bw== 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=/ohQ5gUwvFY4l0X5A4KS0w190NIPE0tD/1TucyppGhs=; b=1gkawsEwHaB7AMAQ4JnDNu3RZyOobYaEncIzZjxd3J1g2clZsZCtfSQdwKzz2KivmDxKXgYpHs7retSJ+sdSJgkDkDlfOTPX292Qb+dePusjxRHmzbv0uVLfKq2gHZU8zywSsYP7fQF+dfe5x0vwdAsV9w34M9Or2aZw1ISwChg= 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: "Daniel P. Smith" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD , Michal Orzel , "Julien Grall" , Stefano Stabellini , "Jason Andryuk" , Alejandro Vallejo , "Denis Mukhin" Subject: [PATCH v6 11/12] x86/hyperlaunch: add max vcpu parsing of hyperlaunch device tree Date: Tue, 29 Apr 2025 13:36:22 +0100 Message-ID: <20250429123629.20839-12-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250429123629.20839-1-agarciav@amd.com> References: <20250429123629.20839-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD7:EE_|IA0PR12MB7776:EE_ X-MS-Office365-Filtering-Correlation-Id: 6bc510ad-5d17-4a9f-af65-08dd871aaa71 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?32lbXCbMnPXdxiXOweGvN1k6BOhaH5ijsJQYqoTB02YpDpOLiSAMGs8dsTi9?= =?us-ascii?Q?qBoJb2xfJcctAZtaEym+diOp2INXuNQ+7KABeP2c2gXLG7is+zmYcKKDQkMe?= =?us-ascii?Q?9G+NabSm3pWAt3oumFn3YVIL50pyfsEKNWPjBITybKpQRwEsyCOISSXTlwYE?= =?us-ascii?Q?Dm9BAPm5iWdgN2ri5UlooUzRH4A3KrC0eBnjb7J49m08recuczb0cAkYRDXl?= =?us-ascii?Q?VOXDgel/ZylLOB6/+7qDIi8NPKG44HURABRxUdlK2w7Zalpq8zlHk8cz6NlR?= =?us-ascii?Q?xaO5I43nSvJI2k4uqTpMwnQxcc37qG2AlZV3ogrq6dmPyZIRCfiw5aDIA2ZJ?= =?us-ascii?Q?/XsUyZiLv27hAdbVmVkALOGKhQOzFfSkoj2DaYCtenyf0xEPz31ibxxa8fyX?= =?us-ascii?Q?JrLPulOgdWuyNjCPpM6u3jYX8ow34hxFdkLl0XeDAYDvr7B7h5vOFJA/hQtS?= =?us-ascii?Q?Avt5SpWrLU+KrUVsn8AnBwQ8nhEjW5WeXWdivboWShZbQXWsi5OqxFaAOXQ8?= =?us-ascii?Q?4V1FoGgryqUudR5N0z4R3xBjt2aC/RBmnH+EUw4s/SUSBHgMBTjXW4+jPcQ8?= =?us-ascii?Q?m+PYK/K9U7IzE+E2TCczGwbX2TGbw/i2rLCXt5PLOZoY5yYGnfuZ33Lz2nOT?= =?us-ascii?Q?5lKEJD/I3basDB1JgyY+VXYStF/Vnbaex4Rl2YanHpxP69AQGEXRXt3Pfp2a?= =?us-ascii?Q?miaQdMwmqhLPBcwXF55ahXChAm9Y01eRBRUeGr5wbJzkqf4jIl3ffvuMupVR?= =?us-ascii?Q?vGz6oejnp8DShygBRRUjqtDncNKJrOxI2fin6ZBU3Per98tp2otB7fdVANcp?= =?us-ascii?Q?yjHCIy6LNyr9gMS5MA3MSG3JV/pP0A8mwNrRjRvOrLLfsVR2TFLJlW80XOY2?= =?us-ascii?Q?ZJZXQ7afSU3j4Z6dHcJv6oFCk5a68dZbTfJPi5lVqQj+3w+QVWt7eIu+5eVr?= =?us-ascii?Q?u58Hm7qjgsm4QPvdqfUIHzkZ6zhKKgjUP2Wp64M3U8eZhUuvknwsHHzNMkJV?= =?us-ascii?Q?LBAZRWqAUSGuEgv3dx9DS7HQ6EjuMXn+Sf5IZlpHVHyMySbSTkwIc0cE5Z/x?= =?us-ascii?Q?npvq4VN2Vg3OYLWhmVT9LwF3FQMMir9oNGWGJEhF9SGNFHBy3vQ6AJA+nCVq?= =?us-ascii?Q?vTU3KhRXXj+0mlmmI8WRQvZUzoGKF1uXjrsbnt0d/n4q5EDbMqdn17VfA297?= =?us-ascii?Q?bU3WB2u030ztkfO71vkCJDOVcD2BxES9ay07vdy5gYl2Kqcm30/DQ4CHc8zI?= =?us-ascii?Q?1AKmLYndvxRDdX7QnXtsBHVuxZsiBCRiS/ZljgYmWHhrfEY9p40Nbd2MPLAF?= =?us-ascii?Q?X/C+MV1nkAgqNoyKy4MIp3y2np5nZPsqF1GIzsMEWgtUwUheD3iEckjnIkxH?= =?us-ascii?Q?fgyaGFJwZN0PFpM5RM8FxygpzlXfnZyf/Xqx9w5TvKqbe2L3mDby9hQ05q0e?= =?us-ascii?Q?O1zY79nKebm6EViSdI7Jeg4Ck6ZHg7+i1Hvqrec++bHCju/CiMNux7j6ql9F?= =?us-ascii?Q?c/IDWHyoo6b9SMvIQnz+PD12Up3lEBe8+0Xg?= 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)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2025 12:37:55.4516 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6bc510ad-5d17-4a9f-af65-08dd871aaa71 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: MN1PEPF0000ECD7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7776 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1745930536599019000 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Smith" Introduce the `cpus` property, named as such for dom0less compatibility, th= at represents the maximum number of vcpus to allocate for a domain. In the dev= ice tree, it will be encoded as a u32 value. Signed-off-by: Daniel P. Smith Reviewed-by: Jason Andryuk Signed-off-by: Alejandro Vallejo Reviewed-by: Denis Mukhin --- xen/arch/x86/dom0_build.c | 3 +++ xen/arch/x86/include/asm/boot-domain.h | 2 ++ xen/common/domain-builder/fdt.c | 11 +++++++++++ 3 files changed, 16 insertions(+) diff --git a/xen/arch/x86/dom0_build.c b/xen/arch/x86/dom0_build.c index 8db24dbc0a..f734104c74 100644 --- a/xen/arch/x86/dom0_build.c +++ b/xen/arch/x86/dom0_build.c @@ -635,6 +635,9 @@ int __init construct_dom0(const struct boot_domain *bd) if ( !get_memsize(&dom0_max_size, ULONG_MAX) && bd->max_pages ) dom0_max_size.nr_pages =3D bd->max_pages; =20 + if ( opt_dom0_max_vcpus_max =3D=3D UINT_MAX && bd->max_vcpus ) + opt_dom0_max_vcpus_max =3D bd->max_vcpus; + if ( is_hvm_domain(d) ) rc =3D dom0_construct_pvh(bd); else if ( is_pv_domain(d) ) diff --git a/xen/arch/x86/include/asm/boot-domain.h b/xen/arch/x86/include/= asm/boot-domain.h index fa8ea1cc66..969c02a6ea 100644 --- a/xen/arch/x86/include/asm/boot-domain.h +++ b/xen/arch/x86/include/asm/boot-domain.h @@ -22,6 +22,8 @@ struct boot_domain { unsigned long min_pages; unsigned long max_pages; =20 + unsigned int max_vcpus; + struct boot_module *kernel; struct boot_module *module; const char *cmdline; diff --git a/xen/common/domain-builder/fdt.c b/xen/common/domain-builder/fd= t.c index d9babe9d56..02cfe8085d 100644 --- a/xen/common/domain-builder/fdt.c +++ b/xen/common/domain-builder/fdt.c @@ -302,6 +302,17 @@ static int __init fdt_process_domain_node( bd->max_pages =3D PFN_DOWN(kb * SZ_1K); printk(XENLOG_INFO " max memory: %lu KiB\n", kb); } + else if ( !strncmp(prop_name, "cpus", name_len) ) + { + uint32_t val =3D UINT32_MAX; + if ( (rc =3D fdt_prop_as_u32(prop, &val)) ) + { + printk(XENLOG_ERR " bad \"cpus\" prop on domain %s\n", na= me); + return rc; + } + bd->max_vcpus =3D val; + printk(XENLOG_INFO " cpus: %d\n", bd->max_vcpus); + } } =20 fdt_for_each_subnode(node, fdt, dom_node) --=20 2.43.0 From nobody Mon Nov 17 12:54:31 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=1745930560; cv=pass; d=zohomail.com; s=zohoarc; b=J9zeZ9opqB8jgc1IfQI44uS+qpf9wgx9rDlwSc2Jg6/Esf9oSk4cCqQfS/J6zk/c14xYjvJCX8yHbP6n2yhGe+ypIxjjikRGEM9iaVlbZ98IS4ysUYPs5rAGv/l5v5wUucRO8ZtVxDT7dp3VQTztfNiKDgM4G7TDp5+huT1LKF0= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1745930560; 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=bdrPcd9zoT/BI4gBU0jIi7gC5wzisujq/d8JbDCHFRU=; b=VPKB7RK4v4CIIldHeNpsduuHoHEcGXf7wGqNz17v6b61Jg6fC50/SIv0loS1k5Xqub4QQ7X11qjL1uPofDIXDe+U4htd3sqgUAbO8ijsQmMcAP+ioygwx3AWb01oKjEpvx71u71BWrBo0CMmGB7qsk8alyaoxBIuoVjUxmXOjnw= 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 1745930560350953.156432507954; Tue, 29 Apr 2025 05:42:40 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.972458.1360831 (Exim 4.92) (envelope-from ) id 1u9kI9-0006x0-Gg; Tue, 29 Apr 2025 12:42:29 +0000 Received: by outflank-mailman (output) from mailman id 972458.1360831; Tue, 29 Apr 2025 12:42:29 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u9kI9-0006wr-Dp; Tue, 29 Apr 2025 12:42:29 +0000 Received: by outflank-mailman (input) for mailman id 972458; Tue, 29 Apr 2025 12:42:28 +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 1u9kE0-0007L9-Rk for xen-devel@lists.xenproject.org; Tue, 29 Apr 2025 12:38:12 +0000 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on20631.outbound.protection.outlook.com [2a01:111:f403:2413::631]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id cef6e47f-24f6-11f0-9ffb-bf95429c2676; Tue, 29 Apr 2025 14:38:10 +0200 (CEST) Received: from BN9PR03CA0695.namprd03.prod.outlook.com (2603:10b6:408:ef::10) by DS0PR12MB6608.namprd12.prod.outlook.com (2603:10b6:8:d0::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8678.32; Tue, 29 Apr 2025 12:38:02 +0000 Received: from MN1PEPF0000ECD7.namprd02.prod.outlook.com (2603:10b6:408:ef:cafe::20) by BN9PR03CA0695.outlook.office365.com (2603:10b6:408:ef::10) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8655.37 via Frontend Transport; Tue, 29 Apr 2025 12:38:02 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by MN1PEPF0000ECD7.mail.protection.outlook.com (10.167.242.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8699.20 via Frontend Transport; Tue, 29 Apr 2025 12:38:02 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 29 Apr 2025 07:37:55 -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: cef6e47f-24f6-11f0-9ffb-bf95429c2676 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Oe/2NEjmfmHomz83XHK0zJVSu4ZQ7WXuIjnJWiZgQEDieBBv8oQyQ7Rg4cpgUOHfGkdKf4w6MbCQFSBjXj/j754KH6GkQewUwx7ozA/AG3ZncKfX8ndFmIzkZuLt1EowXtfKDV2WS1C4XFUgMwn7aT8l8aiLxAhu8S6ykjNLa2GLjP8rN/xrQJsRJij6S0cSh1DECQCqshvj55qvX607uDJ8ueESzelTg6ELSEepWdJgFgzaDym+2Q8tXDylHtDcaDLGkrN65IwtHzZdn81kYxV+S4uzxue1VCzEdlv6DA0mNPvMTdy8Qd3g68qfdL7qTtX1smYb82NickxkorO2Ag== 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=bdrPcd9zoT/BI4gBU0jIi7gC5wzisujq/d8JbDCHFRU=; b=Hn5gzArXqE8lMrkJkPn+XG6XJtWeHnel5IVA2Yf4cPzs3IhSAZL+QW2ES+3oSXUnot/N5EZK3BKXbuhhShwafn3nKR56b8pGUoCLVpSwB3kqH0HynSe7OuR0RDBNeSVL19ON2iuUC9m+FzeKYMjpkSIlS+ptA7JWDhuo1jB26pjQKUH8I3DgviVpZAwN26bcIZdfDThYOeJig0KjpKhO+J7wyEt3DUVj3o72fn5Up42KarfP62/LM0a5mrfvYn7Z7PlYejWepYOLMfUeqxFQAQvDfEjJ+Pwpmv6B3S00eM4oFrMuDcpLekNteL4UuQVlF5+05lLv6tpR1r42CYBxUw== 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=bdrPcd9zoT/BI4gBU0jIi7gC5wzisujq/d8JbDCHFRU=; b=Wgj61LudpQdUMZtjz3/qmMF+3KNlgzVhroi7nlhPkQAGJaS2vIL3tSQAjf915jEEc9yCbW+DXK68W3tn+SzSC/zy232yC2lZ6KcSkjGV0bViF0x4dqBxV4rwrsDS/bTygr19wMBlQwMXDF6Dmc1URS6Tn4sUfe9f/RC8DexxFtY= 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: "Daniel P. Smith" , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD , Michal Orzel , "Julien Grall" , Stefano Stabellini , "Jason Andryuk" , Alejandro Vallejo , "Denis Mukhin" Subject: [PATCH v6 12/12] x86/hyperlaunch: add capabilities to boot domain Date: Tue, 29 Apr 2025 13:36:23 +0100 Message-ID: <20250429123629.20839-13-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250429123629.20839-1-agarciav@amd.com> References: <20250429123629.20839-1-agarciav@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN1PEPF0000ECD7:EE_|DS0PR12MB6608:EE_ X-MS-Office365-Filtering-Correlation-Id: af00c7bb-24b6-4137-1092-08dd871aaebb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?jVSdnhJkxZWgGakZn0rvXHBy3lGgw7KMi99+07pIhDSMFLDDbANsVADi7TcI?= =?us-ascii?Q?kS5eJA1Erp/s4mvFKLldTCEzFWBPikUtuVhWKFRNCliCYp4DOqjuKWlbfC3U?= =?us-ascii?Q?dYGUUXZL9g/A2j5FPGvOkNNDOOuKeVCwrcFTC0winI+OeL3YIX5CVvz5zDSg?= =?us-ascii?Q?8LUskrfQovlLUn7w8QOcsUo9++brUCpmrn3IS1MJcDUP2UDM1vhhy7zrQLX7?= =?us-ascii?Q?EOez2zlyzHh5EghqE9ZsYDdk3Q/uk6Up/jwYE4O9tDxrax81NrIH7ezwGZRI?= =?us-ascii?Q?ESLW8590E6cuWMSrgsZCwyNXfjph0oZ1RBJbBnrjHI3/ie0Tj9en5OJuewNm?= =?us-ascii?Q?ybbgjPCS+BySo2ep8AFWsk6k4UG5OeTe68zZMZMwwRucMG0cyt+X58/2W96p?= =?us-ascii?Q?oZys8bR2GrgLL8X6n8ktSLeUM4QcjqMBE87rQvM2/gzjMxzD0FEVbWXl5d3G?= =?us-ascii?Q?eFPZ5BQXRnkXYVsyq9SojzZSMLVjA+UXELCwWZQI+kikDlPXRxqadt5FPQLB?= =?us-ascii?Q?PxSXB5ExBFloAHDxjIYj6Usik1NMEdsi419pZNhxs1aBZqauBUComxqYz4SF?= =?us-ascii?Q?0/plLRup+q7zfMvpbdUOAdOhZ9TBVILxXzab3BKzuktIz5Yy0IiHXTaflyye?= =?us-ascii?Q?ZS7H/z0Hm/umQHLfvzQOZIwJXTmyr+uxP6tM1t0BJ6nacwQ6enc4FyshpkdN?= =?us-ascii?Q?r/Dp0Ila+Pb5hM1H7I45aGlTzLbJrX1vcdz0xIYghUCN1nzwBTB+A6LcNaTV?= =?us-ascii?Q?Fb9Z0b5Qw+4VvDbkMXXcJbWxuMmTy7XcBO5dzXCN20oF1LTT8ZaW380ZDkSW?= =?us-ascii?Q?RSS8hrv7HxFzBX4xbSkuFWujYdFSd5d9gUXz35CqTiVR041VU01RW8XyC5Ne?= =?us-ascii?Q?I1m4gtHkKw4R+cg63sxWVlTvHtcBNxqXPgTwGNjMxZk+53PEriS/b218LQoc?= =?us-ascii?Q?Slx8Sui8Zd0qGJPH73xo7r0+YZ96c3VGlZffudUpkpec6XX/6g98x4Uj32/6?= =?us-ascii?Q?j+tqkmsQyBrS+N5Vblh9Jm6eero9Buj1TO9WDFl0KNO9xB1YjvhrCp1E8EMW?= =?us-ascii?Q?/Exj7Dyz9C2h6QT3FvGO1nFccOeEiQnxhLOm03S1fePW6vpoVLBynh5P5dx5?= =?us-ascii?Q?8vMCBlcGJat7LHZVOUafsPJitB+sCsQWwi/njvDn03wSkQCzxAVnimur6A+C?= =?us-ascii?Q?qncuch+UkchAldkMfaKY9ogqYqMZLOCdBNe+fOXNovdReftCaVDadAKTpVTu?= =?us-ascii?Q?qNfFCfHcDEkt97Tbt9bCjg+T+qwFInQFqvcnBrIs4L15itd5pHObWfyLsV5i?= =?us-ascii?Q?Xi0PGpgpFFaC3NsQxIDr+PYyWnr9dFx9GT7SBtWd9CQqfkIQ2YTdCTvNCTpu?= =?us-ascii?Q?iZ7qGeiUG+DMJXG+TYfQXuaBEFChV21AwffCemi92PMCt00OActZlEb7iowr?= =?us-ascii?Q?UAYbHiVQQss+Jy1DWCxZq7/ZLVmEvBJ95w1PbcIfEJXPMxt3MXGfS+hqf4Eu?= =?us-ascii?Q?1BWmTBT5febpw+z3Ky6RJuADTR7zSabKtnPs?= 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)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2025 12:38:02.6428 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: af00c7bb-24b6-4137-1092-08dd871aaebb 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: MN1PEPF0000ECD7.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB6608 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1745930562567019100 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Smith" Introduce the ability to assign capabilities to a domain via its definition= in device tree. The capability property is a bitfield in both the device tree = and `struct boot_domain`. Signed-off-by: Daniel P. Smith Signed-off-by: Jason Andryuk Signed-off-by: Alejandro Vallejo Reviewed-by: Denis Mukhin --- v6: * Reworded the commit message to reflect the fact that the DOMAIN_CAPS_HARDWARE is also done here. * Conditionalise setting CDF_iommu to DOMAIN_CAPS_HARDWARE being set. --- xen/arch/x86/include/asm/boot-domain.h | 3 +++ xen/arch/x86/setup.c | 7 +++++-- xen/common/domain-builder/fdt.c | 23 +++++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/include/asm/boot-domain.h b/xen/arch/x86/include/= asm/boot-domain.h index 969c02a6ea..cb5351241a 100644 --- a/xen/arch/x86/include/asm/boot-domain.h +++ b/xen/arch/x86/include/asm/boot-domain.h @@ -13,6 +13,9 @@ struct boot_domain { domid_t domid; =20 + /* Bitmap. See DOMAIN_CAPS_MASK for a list */ + uint32_t capabilities; + /* On | Off */ #define BUILD_MODE_PARAVIRT (1 << 0) /* PV | PVH/HVM */ #define BUILD_MODE_ENABLE_DM (1 << 1) /* HVM | PVH */ diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 4a3c41ad71..6a1e874b2e 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -62,6 +62,7 @@ =20 #include =20 +#include #include #ifdef CONFIG_COMPAT #include @@ -1044,14 +1045,15 @@ static struct domain *__init create_dom0(struct boo= t_info *bi) XEN_X86_EMU_LAPIC | XEN_X86_EMU_IOAPIC | XEN_X86_EMU_VPCI; } =20 - if ( iommu_enabled ) + if ( iommu_enabled && (bd->capabilities & DOMAIN_CAPS_HARDWARE) ) dom0_cfg.flags |=3D XEN_DOMCTL_CDF_iommu; =20 if ( bd->domid =3D=3D DOMID_INVALID ) /* Create initial domain. Not d0 for pvshim. */ bd->domid =3D get_initial_domain_id(); d =3D domain_create(bd->domid, &dom0_cfg, - pv_shim ? 0 : CDF_privileged | CDF_hardware); + ((bd->capabilities & DOMAIN_CAPS_CONTROL) ? CDF_privileged : = 0) | + ((bd->capabilities & DOMAIN_CAPS_HARDWARE) ? CDF_hardware : = 0)); if ( IS_ERR(d) ) panic("Error creating d%u: %ld\n", bd->domid, PTR_ERR(d)); =20 @@ -1314,6 +1316,7 @@ void asmlinkage __init noreturn __start_xen(void) i =3D first_boot_module_index(bi, BOOTMOD_UNKNOWN); bi->mods[i].type =3D BOOTMOD_KERNEL; bi->domains[0].kernel =3D &bi->mods[i]; + bi->domains[0].capabilities =3D pv_shim ? 0 : DOMAIN_CAPS_MASK; bi->nr_domains =3D 1; bi->hyperlaunch_enabled =3D false; } diff --git a/xen/common/domain-builder/fdt.c b/xen/common/domain-builder/fd= t.c index 02cfe8085d..232621ae46 100644 --- a/xen/common/domain-builder/fdt.c +++ b/xen/common/domain-builder/fdt.c @@ -7,6 +7,7 @@ #include #include #include +#include #include =20 #include @@ -313,6 +314,28 @@ static int __init fdt_process_domain_node( bd->max_vcpus =3D val; printk(XENLOG_INFO " cpus: %d\n", bd->max_vcpus); } + else if ( !strncmp(prop_name, "capabilities", name_len) ) + { + if ( (rc =3D fdt_prop_as_u32(prop, &bd->capabilities)) ) + { + printk(XENLOG_ERR + " bad \"capabilities\" on domain %s\n", name); + return rc; + } + + if ( bd->capabilities & ~DOMAIN_CAPS_MASK ) + { + printk(XENLOG_WARNING " unknown capabilities: %#x\n", + bd->capabilities & ~DOMAIN_CAPS_MASK); + + bd->capabilities &=3D DOMAIN_CAPS_MASK; + } + + printk(XENLOG_INFO " caps: %s%s%s\n", + (bd->capabilities & DOMAIN_CAPS_CONTROL) ? "c" : "", + (bd->capabilities & DOMAIN_CAPS_HARDWARE) ? "h" : "", + (bd->capabilities & DOMAIN_CAPS_XENSTORE) ? "x" : ""); + } } =20 fdt_for_each_subnode(node, fdt, dom_node) --=20 2.43.0