From nobody Fri Oct 31 23:21:32 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=1744894183; cv=pass; d=zohomail.com; s=zohoarc; b=caOmSNZgMQuG6YKEtnX0gL2iRAphGIoDO/L5zkSiWci4D2+cTEpeuBsic4nM11r43SbMvy2I5EAtAQysxbctKQc8j1av9OmcoGw0Gol7fZ6LMezc2oi/rfarGtY6aRXyDnVNTgdt16Q4is83GWUVOnGVIk7ch73m67N7IIK5VXQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1744894183; 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=m817Z8mbAQ6qi2tIdrjmLnKGXqF4Yyr5waBB1b3EjGc=; b=U+sK35nniX5kzPBn1oGkMyFyGm4scafMPn4WSCinIe1fFn8KdZvVifwFPO37wmtpl/NcEe4TBzpmulPpa9eaIHDJ79ZIdeAeJbwDPVBFR4O70/rAir1jlLq6ox7h7gdEUYWX1y+mfAg0eUXI7DzuBwzer63KW5+LmpEmZPeGyhI= 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 1744894183701718.4515431928785; Thu, 17 Apr 2025 05:49:43 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.957521.1350691 (Exim 4.92) (envelope-from ) id 1u5OgM-00073J-QE; Thu, 17 Apr 2025 12:49:30 +0000 Received: by outflank-mailman (output) from mailman id 957521.1350691; Thu, 17 Apr 2025 12:49:30 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1u5OgM-00072Y-MA; Thu, 17 Apr 2025 12:49:30 +0000 Received: by outflank-mailman (input) for mailman id 957521; Thu, 17 Apr 2025 12:49:29 +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 1u5OgL-0004z9-4n for xen-devel@lists.xenproject.org; Thu, 17 Apr 2025 12:49:29 +0000 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on20628.outbound.protection.outlook.com [2a01:111:f403:2406::628]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 65bcd473-1b8a-11f0-9eb0-5ba50f476ded; Thu, 17 Apr 2025 14:49:28 +0200 (CEST) Received: from CH5P221CA0020.NAMP221.PROD.OUTLOOK.COM (2603:10b6:610:1f2::11) by IA0PR12MB7603.namprd12.prod.outlook.com (2603:10b6:208:439::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8632.36; Thu, 17 Apr 2025 12:49:24 +0000 Received: from CH2PEPF0000013C.namprd02.prod.outlook.com (2603:10b6:610:1f2:cafe::4f) by CH5P221CA0020.outlook.office365.com (2603:10b6:610:1f2::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8655.15 via Frontend Transport; Thu, 17 Apr 2025 12:49:24 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by CH2PEPF0000013C.mail.protection.outlook.com (10.167.244.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8655.12 via Frontend Transport; Thu, 17 Apr 2025 12:49:23 +0000 Received: from xcbagarciav01.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 17 Apr 2025 07:49:22 -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: 65bcd473-1b8a-11f0-9eb0-5ba50f476ded ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vHPlcpwvFKLLU6jznuSwnBDoa0O6eRXR40KZ0CA6fA7RVbse/ntZ7g6NdwRy7nMyZtJ6UnUbDIz7ecT6p7HjcEJjMFJ0q4JVV6F32q1WgHQ0veBVMB/MFmuLTtuUvM2/ZuEHF9x7daQsgMRoiD8njvSYBDtaCYntj7xfMslijgIzOCiipiA2J3ZEEU1lVBmCSH3py3dIjezN3vLxVX90NgaKGxGGJUJqhNOA3BulL+vtjm6qxmf9mzN3c2F5PMC5tkb6CaMJzAniUZlpxpnRVKrGT0ORmK29fdZtORxuMVJkivJU/0GU8h6EeivLt/Tt2oKN7TR33VoTRfVqxKxhFA== 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=m817Z8mbAQ6qi2tIdrjmLnKGXqF4Yyr5waBB1b3EjGc=; b=KKf9xXLmKx2hrLyD1A5lZni9rZc0lX7kOgtyRU4VfDeOMk0G/k4fPJA5zRIvwBMMbfMlkJgGUwW3lwEcLzuhlxrVXzj5yrhAu62hr643NJ/KnYG54mnAaJr89SHfsBRQxyXoSpDtvAO+wcTv0BXUnAvFhGgzG9kAtoll6Hk0ZboiIRjSeptS+PcBzFmffD/3Q2n9S3hk/5zizqZ4H/7ff5rQ0Gqtnz1pEE7N3xTQ7sqtaJJuS1YPVEcgo2bBtICvTK4FgGsVUNtE3zNHTv5fD79lBipD227AdVmFC5A0fW5acShU3/iNGuyBS4WF558vYxGvUQXFPvgCXgfL28mhag== 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=m817Z8mbAQ6qi2tIdrjmLnKGXqF4Yyr5waBB1b3EjGc=; b=pR3VH1D/veZm4y00LImEciU6PwlfTvvU5Uya3sjZ0QfccVSw3zcWIoopUoKsoegVqCbCuJ16KUX1EVE/+Rw8A+Etn6E9C3j72GqeRJnxqRWpGtpCq2pyIUSODZB5fltN7uJ5LZNKz6+LYamCISKYOb7KLbBrVKgrjYP7w09EPwg= 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 Subject: [PATCH v4 09/13] x86/hyperlaunch: add domain id parsing to domain config Date: Thu, 17 Apr 2025 13:48:31 +0100 Message-ID: <20250417124844.11143-10-agarciav@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250417124844.11143-1-agarciav@amd.com> References: <20250417124844.11143-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: CH2PEPF0000013C:EE_|IA0PR12MB7603:EE_ X-MS-Office365-Filtering-Correlation-Id: 31aa6957-a103-4e5a-088e-08dd7dae47bd 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?uBpcaXgDQ9GsVpY8VIjvBqeApBNHu15oiT3YtmvIy1IXhmjKNXvuyuaECnaV?= =?us-ascii?Q?E+YBlgUOUKzWXxwpfRLRtWN53nrZ33kdrY+2iqz06eP5FeHpj+YqEyoTf5Vh?= =?us-ascii?Q?oTI5d3wyQ4ewK4NrBZumFHxJBlkIp/E3cbKCKYHKqtdbFlCp5bKgJg98IfOf?= =?us-ascii?Q?UR0vqchi89EZiba+q8gcn4xLjWaeU7kTPUx3XQqczK3Im6BpZ3ANlw4JDsPh?= =?us-ascii?Q?orMZQTjetJ3VuxGgWK1AwUVknXqPTripUqZ/YLxsArjt47rQZzO+t4WOoi3F?= =?us-ascii?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7ZnPSIGzKS9eNGTOA5Fs4HID?= =?us-ascii?Q?L8+0AGkRYXvwXqL/hLRfKN6idgFc2XWOrmWonFkcAgauxuCXTLYoQNbrUo4s?= =?us-ascii?Q?ciM/ESZMdzJpoQqnCFtePQUkin56RJgtmWmsGo4GSvJwm0IltiF7/18RlX0t?= =?us-ascii?Q?u5Duh418urBvdRXGfX3HEa309+5F6n1IUaKLRzX7ooN+eV+eBmGhf4z5NTjB?= =?us-ascii?Q?nyA2OcN+A/N829LZIeyfdUCzoLdms27eMUqU/0mVCGIy8GMxU94Drx2CEEqH?= =?us-ascii?Q?ibckgooc6W1B5gZ07cfZ8eOf1511fypM6CnLpdEjllrEJ+cV00f8Z1awI7Rh?= =?us-ascii?Q?KkEdI4oYfAGB3vnmLXTP4ENAP1XBZFvLiSRx?= 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: 17 Apr 2025 12:49:23.7168 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 31aa6957-a103-4e5a-088e-08dd7dae47bd 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: CH2PEPF0000013C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7603 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1744894185562019000 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 --- v4: * Add missing newline * Adjusted printks * Checked domid node against list of outstanding domids. --- xen/arch/x86/setup.c | 5 ++-- xen/common/domain-builder/fdt.c | 51 ++++++++++++++++++++++++++++++++- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index 76ceb5221f..04ad2d0937 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1033,8 +1033,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= ); if ( IS_ERR(d) ) panic("Error creating d%u: %ld\n", bd->domid, PTR_ERR(d)); diff --git a/xen/common/domain-builder/fdt.c b/xen/common/domain-builder/fd= t.c index c0f526a4ce..0d3c713041 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 @@ -178,12 +179,54 @@ static int __init fdt_read_multiboot_module(const voi= d *fdt, int node, static int __init 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") ) @@ -249,6 +292,12 @@ static int __init 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: Unsuported boot with missing initial domid\n"); + return 0; } =20 --=20 2.43.0