From nobody Fri Oct 31 23:30:14 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=1743457437; cv=pass; d=zohomail.com; s=zohoarc; b=bfhO5CYuvoqYt/GIkOawSIEUfrUlViT8EBuAVmRDb3MSS2NfhR+cQGTXc+bq70IUCOM1Ubo804AmQy4faGrEDfiqrMVXKDDYQvcA+IzUSfNHxjmrYqdck+vqTf9BBF2NEdIrGkmhpfe+sTE5E22sXTa05cQBCZLVMXHCS/F7v7g= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1743457437; 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=Q0hX3MCb+pXj1x8o06lhrPKBbpxKlpmGAl267NUETHw=; b=ayLjiHmXK2WW0DlJYBPPXwxyFevLx0EfYaEl18p7MEKJTFVnSTXQenQE+cAPeNRKU7D3nRbxvxCYErtrdHWB3PIGP8ibwqpRAmR9uNjDwgeridIxaX74b/3Utpv47NyyoHnEu1t3P8H/Z6OtbECBTUgGHYX34cm2b68SUnIBlxY= 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 1743457437820164.5882926466819; Mon, 31 Mar 2025 14:43:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.932996.1335046 (Exim 4.92) (envelope-from ) id 1tzMuv-0004k0-FB; Mon, 31 Mar 2025 21:43:37 +0000 Received: by outflank-mailman (output) from mailman id 932996.1335046; Mon, 31 Mar 2025 21:43:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tzMuv-0004js-Bt; Mon, 31 Mar 2025 21:43:37 +0000 Received: by outflank-mailman (input) for mailman id 932996; Mon, 31 Mar 2025 21:43:36 +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 1tzMuu-0004aC-PV for xen-devel@lists.xenproject.org; Mon, 31 Mar 2025 21:43:36 +0000 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2060c.outbound.protection.outlook.com [2a01:111:f403:2009::60c]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 31c8e539-0e79-11f0-9ea7-5ba50f476ded; Mon, 31 Mar 2025 23:43:34 +0200 (CEST) Received: from SJ0PR13CA0043.namprd13.prod.outlook.com (2603:10b6:a03:2c2::18) 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.8534.44; Mon, 31 Mar 2025 21:43:29 +0000 Received: from SJ1PEPF00002314.namprd03.prod.outlook.com (2603:10b6:a03:2c2:cafe::a7) by SJ0PR13CA0043.outlook.office365.com (2603:10b6:a03:2c2::18) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8606.20 via Frontend Transport; Mon, 31 Mar 2025 21:43:29 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00002314.mail.protection.outlook.com (10.167.242.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8606.22 via Frontend Transport; Mon, 31 Mar 2025 21:43:28 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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; Mon, 31 Mar 2025 16:43:27 -0500 Received: from fedora.mshome.net (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 31 Mar 2025 16:43:26 -0500 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 31c8e539-0e79-11f0-9ea7-5ba50f476ded ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nqq1WQU3eeueK8dcfyvh31KoJB/KwqrRA8bNDZJDYGnbFS0+cOsS6qm4eZUqJpXyIOtLu++HNeX3fG7+bXIEky7ITBs0mM+MsC2TQlQD9teI47AtxZ0QRqsAOJRBrO/jLLUIdYePTBK4mS4IOMB6kxqp8iFh+HhzeCp+lMoZ6qkm+3KjKnh/ybdaqWMZS1/8+UwSo7uSkDn9A81YmRCsuJ8GznL3BFasZgE16YE/vr4P9BZcTnqnJ4yd2CfK05/Luwpd70h4H4SXT5MDKwOMkqhhj4066kFEwdmrGTqzRXUUhKq0eLd5Wzz5+qLHNiT/mYdH6rGaUUGdQw1gNT27Dw== 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=Q0hX3MCb+pXj1x8o06lhrPKBbpxKlpmGAl267NUETHw=; b=QZkLbHDZroI64xHcr+LEXSCGUeM0zv5FmQRu/31riRTi/HJMA0Rh9N/jbSQ3W9sIDHKmKUHZzKq8gBnmzLyCU/O7YmeaspMz7x4Ba+zQX8Wywl+4p/9L5Hq7e1sBegCFk+CAWOLQsaDgPWaUAmMTKTtZYT6lQXKgpVaTECDkVqRVUazw29IxTSrI3DPSgAa2DMwOpocmiXqoYcfPxGl+Dzi6BdbVr7+2o3FMqo3OtUv51NWIlSasNOmd+8u4qumsVvhsnc7jt3d/kBENlK7PfJbn+eEH0DsV5AvOYZFatdGo2DiUR+IpqkRssnUaEWkjzDnNU50XnnJCIlLBLoReKA== 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=Q0hX3MCb+pXj1x8o06lhrPKBbpxKlpmGAl267NUETHw=; b=sxyzwyrZfoh03drI/ibdRS5Ozpb6mw0w+FA8TiE+iU00YaQSTg1DGV7WqLFXWBtq0PdCqocxLSXMAHe0GxzHZhgOpupOZeg0kznLvZAfNftATi8qNVVVKBRcdYiydF9mvlRovtUltEVTWFujRdYQFSrp/liDv3erecB8nLDrSrY= 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: Jason Andryuk To: CC: "Daniel P. Smith" , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , "Volodymyr Babchuk" , Andrew Cooper , Anthony PERARD , "Jan Beulich" , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Jason Andryuk Subject: [PATCH v2 1/6] xen: introduce hardware domain create flag Date: Mon, 31 Mar 2025 17:43:16 -0400 Message-ID: <20250331214321.205331-2-jason.andryuk@amd.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250331214321.205331-1-jason.andryuk@amd.com> References: <20250331214321.205331-1-jason.andryuk@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB04.amd.com: jason.andryuk@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002314:EE_|DS0PR12MB6608:EE_ X-MS-Office365-Filtering-Correlation-Id: 02aeb4d3-79d5-41b0-d0bd-08dd709d12eb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|34020700016|36860700013|7416014|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?hvZECFTcQVbns7mR5kGAgcKD1Pd/HNuUci6HIF18OJn20OokqNjMkioEkQrw?= =?us-ascii?Q?RWVvGF3fbcr7wdtsgjaWoqmU7qRyG8re6niitceYy4QQsASlnexURItFVnfo?= =?us-ascii?Q?Kv5mVu37srDEx+shE6siCjSDOtUB9Ko+NhpmydSCBfIotEMitqqtfbH6ytiz?= =?us-ascii?Q?2Dm416SCdTYlH5LhpXwxwHGVBmQsMcdk/0tS2XsjVEstmk8jfWkarA7Zy+d/?= =?us-ascii?Q?s5TqRoosuKqURZWc366+DwL0pMkJBMmCFWHXkdhdaoKquCe2NvrocGrlzyv8?= =?us-ascii?Q?X43LfIbSA5mVIjsenb2p69a8UMaJg96ZecRYkN6RPCoUMPEuRt1CPjTFY3vn?= =?us-ascii?Q?8U3Q6tjbzq2uNIniX/GGrvnCcwUCgOLq1pD2lVIQDhCo/dL6pzm8LYQnnj1b?= =?us-ascii?Q?Qg5ifw3YES7Cj+qBu5xQJxhvUG7mqTvgZjoSJU7088aP0NfSisMxZ5mdqGmu?= =?us-ascii?Q?sRopcrIhlC6AcjWPjC4pb7njtKSlQ61xuYWm0S4/qSCJY+nWmIy9Hiq1WPVR?= =?us-ascii?Q?XBfDbTXEJjdegrT93+LCeN1FmelVDvxghVn6wyHWX+6jVxlHxor8pivYgdpA?= =?us-ascii?Q?Xo0thh0bUXvnpsbNS02rI/ooX68dpTQsKxsIXW8PEVqB2c/AUci8tcFkhPOM?= =?us-ascii?Q?I1cdxUaPmnzOhqco74czQD7cPtDBbUH1giEhOy4WHHy8SiJLjCeTtqs+CXrd?= =?us-ascii?Q?XWvzSUJW5X5BbP1mhoKdBGCQ8dmoHfIcIJjzRM35/1Yvm9Pz/FDZewCZF8lo?= =?us-ascii?Q?zY00KG6l+eQGn/POSHN6/uhbanfdIAzEpZJIJvAK/jWxsvpiQppcq+7fc1d7?= =?us-ascii?Q?3mKNgUDK3kx9uVBeZ4GW09qTQ7gktC9EYQw+aMtVZAZepW0ZvLnQvU61iel3?= =?us-ascii?Q?7tsNRjg8VGjQFNuWw9TTdvhXfDFc7uNjs6GCAWpicnjssrBZYcyrnGNHrPXN?= =?us-ascii?Q?aGJwWaYIGbJSCehEmwTA76V95Bv17Jn+VxfoCs39wNYFb5ULUyjfBDUtXUo7?= =?us-ascii?Q?cAlOmMuqDeQbzT0+sSMdRN6YhkEo02mUmDys6SJE0TV820+gyNz3yq1R+EeQ?= =?us-ascii?Q?SJyne3hBZ+YBFcfaMo4XJ0fp+ylirOcwMMiU4cI0RlSsASBsOBIGCeWOYr0k?= =?us-ascii?Q?YKnBXeLotXTtiFvfImKdlwjTjM7gmsOcp9Vp8G4aWnlJRH5tkKoyiShWkNyw?= =?us-ascii?Q?RRzWIzOebBvmLjD+r8/YZOJZEUG4Q0S2uLcaaclCNRluBMAWzIlrwjok0QXV?= =?us-ascii?Q?PwRGbcUckY2w5sg9ryghLzGpDvqzKNN+hmYhfEOutK4Au8PmGQw0P4EpqraH?= =?us-ascii?Q?1fhUUm5Cu4Al4jKO1dQDE47nK9rgRhJcGzGIrs0zpU99+Hdcb2MjZyW9wVyz?= =?us-ascii?Q?yXC59RawDoryKj/dRqp0GFHN7DwqE/KID29jGdUpHcSf7WTUbeEsC/jpUOMc?= =?us-ascii?Q?mP/zJZeHPTLfBwZIEOlse6xI6Fl+NmnR/8G1HHR+KwSqcEXE8vVf9Q=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(34020700016)(36860700013)(7416014)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2025 21:43:28.4536 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 02aeb4d3-79d5-41b0-d0bd-08dd709d12eb 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: SJ1PEPF00002314.namprd03.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: 1743457439849019000 Content-Type: text/plain; charset="utf-8" From: "Daniel P. Smith" Add and use a new internal create domain flag to specify the hardware domain. This removes the hardcoding of domid 0 as the hardware domain. This allows more flexibility with domain creation. Signed-off-by: Daniel P. Smith Signed-off-by: Jason Andryuk Reviewed-by: Jan Beulich --- v2: () around binary & Only allow late_hwdom for dom0 --- xen/arch/arm/domain_build.c | 2 +- xen/arch/x86/setup.c | 3 ++- xen/common/domain.c | 6 +++++- xen/include/xen/domain.h | 2 ++ 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 2b5b433183..051c48329a 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2366,7 +2366,7 @@ void __init create_dom0(void) .max_maptrack_frames =3D -1, .grant_opts =3D XEN_DOMCTL_GRANT_version(opt_gnttab_max_version), }; - unsigned int flags =3D CDF_privileged; + unsigned int flags =3D CDF_privileged | CDF_hardware; int rc; =20 /* The vGIC for DOM0 is exactly emulating the hardware GIC */ diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c index d70abb7e0c..67d399c469 100644 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -1018,7 +1018,8 @@ static struct domain *__init create_dom0(struct boot_= info *bi) =20 /* Create initial domain. Not d0 for pvshim. */ domid =3D get_initial_domain_id(); - d =3D domain_create(domid, &dom0_cfg, pv_shim ? 0 : CDF_privileged); + d =3D domain_create(domid, &dom0_cfg, + pv_shim ? 0 : CDF_privileged | CDF_hardware); if ( IS_ERR(d) ) panic("Error creating d%u: %ld\n", domid, PTR_ERR(d)); =20 diff --git a/xen/common/domain.c b/xen/common/domain.c index 585fd726a9..b3eb589872 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -820,11 +820,15 @@ struct domain *domain_create(domid_t domid, d->is_privileged =3D flags & CDF_privileged; =20 /* Sort out our idea of is_hardware_domain(). */ - if ( domid =3D=3D 0 || domid =3D=3D hardware_domid ) + if ( (flags & CDF_hardware) || domid =3D=3D hardware_domid ) { if ( hardware_domid < 0 || hardware_domid >=3D DOMID_FIRST_RESERVE= D ) panic("The value of hardware_dom must be a valid domain ID\n"); =20 + /* late_hwdom is only allowed for dom0. */ + if ( hardware_domain && hardware_domain->domain_id ) + return ERR_PTR(-EINVAL); + old_hwdom =3D hardware_domain; hardware_domain =3D d; } diff --git a/xen/include/xen/domain.h b/xen/include/xen/domain.h index 83069de501..9be18d16b9 100644 --- a/xen/include/xen/domain.h +++ b/xen/include/xen/domain.h @@ -52,6 +52,8 @@ domid_t get_initial_domain_id(void); #else #define CDF_staticmem 0 #endif +/* This is the hardware domain. Only 1 allowed. */ +#define CDF_hardware (1U << 3) =20 #define is_domain_direct_mapped(d) ((d)->cdf & CDF_directmap) #define is_domain_using_staticmem(d) ((d)->cdf & CDF_staticmem) --=20 2.49.0 From nobody Fri Oct 31 23:30:14 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=1743457432; cv=pass; d=zohomail.com; s=zohoarc; b=CN4SnLuaxGSNZq7y7at2PcnisPBs9LpstdrdaOkNGL3fjYt+xXRR2wI42tRFVgxW7QqKRbSwwhWAUwHhiQhwQuJQbRHhHtaIAswB4nmKZ5hPiyi4lAqM8m8P2cqijBEh8nODGnsQ1uKIu/v5c61zEgCuZ5Xp2rgHdxTg7OAsiNE= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1743457432; 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=4vl8Wpz8L2rcI/9x1YYhQCkm3Y97kmSSKSN0YHgP/Xg=; b=f/fb1PgbEn5SiuP1q8FrvBXTyXJHKL3yckPq72XGLssWdvNPbUqJF62/5ydq7Qls3TH8xNTrF33ddPYj9A5imv4jEcR68P5OWhs0cfy69UCXAVBF/0VUMRfEqtNG7H9vzBHL30izV2RcLXy+E1/Hmnh5Q3sayRkF39A81aRQqAQ= 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 17434574328591007.0347757408475; Mon, 31 Mar 2025 14:43:52 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.932997.1335056 (Exim 4.92) (envelope-from ) id 1tzMuw-0004zG-RS; Mon, 31 Mar 2025 21:43:38 +0000 Received: by outflank-mailman (output) from mailman id 932997.1335056; Mon, 31 Mar 2025 21:43:38 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tzMuw-0004z3-OF; Mon, 31 Mar 2025 21:43:38 +0000 Received: by outflank-mailman (input) for mailman id 932997; Mon, 31 Mar 2025 21:43:37 +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 1tzMuv-0004Vr-CD for xen-devel@lists.xenproject.org; Mon, 31 Mar 2025 21:43:37 +0000 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on20616.outbound.protection.outlook.com [2a01:111:f403:2009::616]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3255c74c-0e79-11f0-9ffb-bf95429c2676; Mon, 31 Mar 2025 23:43:35 +0200 (CEST) Received: from SJ0PR13CA0045.namprd13.prod.outlook.com (2603:10b6:a03:2c2::20) by CH3PR12MB7618.namprd12.prod.outlook.com (2603:10b6:610:14c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.47; Mon, 31 Mar 2025 21:43:30 +0000 Received: from SJ1PEPF00002314.namprd03.prod.outlook.com (2603:10b6:a03:2c2:cafe::b9) by SJ0PR13CA0045.outlook.office365.com (2603:10b6:a03:2c2::20) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8606.20 via Frontend Transport; Mon, 31 Mar 2025 21:43:30 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00002314.mail.protection.outlook.com (10.167.242.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8606.22 via Frontend Transport; Mon, 31 Mar 2025 21:43:30 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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; Mon, 31 Mar 2025 16:43:29 -0500 Received: from fedora.mshome.net (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 31 Mar 2025 16:43:28 -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: 3255c74c-0e79-11f0-9ffb-bf95429c2676 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=OQk1v3sz2qJeiZigHQudTSnn6T6p3Edp2cYSHA+hO9jnlzuOQKrsRNS3pkWUCFNZsVxV+8DKJJ8PD5NXQlBWMMnO8DoUa4YsOnNMGXE85MXGHAgF4XGvgXPCYMk096nTiDizZHuYwEf4ibbQE7uMIGTQOniAcMJ24CmKoiHhdekhXnguFDmixh03CGaTe9E22+SwskSbQJULRK9bLR2X8tjWF8wPLdbEiJ1BTxTYcTwP1Waysd7MDJgUfXPQJzVerf431K0HAaSfES0fFcK/K1oOxCfE6AeDGctYUBDH0+dwa2cuLjQ4qbVH/wlGR9AMmXqRf0pDh4nTMESWkogWUA== 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=4vl8Wpz8L2rcI/9x1YYhQCkm3Y97kmSSKSN0YHgP/Xg=; b=qyXHnB7Es85tEHpUKRahEpa7RM7Y/WCtX/7nVwKoILTmQ1/bQTVyzo+z1P7FIIStAdBa3mBhIzRAQi4QVwbI14cNvzDl2uCwbgj1TDZXKwvRvJ8zElusV5YXuyORppRJBlJvd5PeFUgH/t3Wdw3wpFI7bNMIFQ67I12PelXywj+0Xb2u3ZzlZCp8Dth9cGRqDS5Z+IIOSnO3HdpcHjWiBtFiQwcA7JyRio23nmZcCUZTClajZz9ZQhTPIYWbVPJDcvOx1KMrdwjbvO4JsoRhjymu028thxaRYmcqARaYPzVB4evcrFFUGlhhu2Np7E0ThtFJTCybk2/7WqlujdGYvQ== 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=4vl8Wpz8L2rcI/9x1YYhQCkm3Y97kmSSKSN0YHgP/Xg=; b=3/9h10hMms6wBPtd+Tq4N0ihvbygJe6PikXmCTT35HpkoFAT9YaJtKy3Nm1kOLEVnCIoRl6YDVQzzQ1U+7/2PzmMWkTuL2zehLZHiVYa6ORGTOgapW1R1GrZXtxlVaxXtr5YLpIt19AqaU+nDWP0su7jS3EBbWGDm99mssYTaZ0= 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: Jason Andryuk To: CC: Jason Andryuk , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , "Volodymyr Babchuk" Subject: [PATCH v2 2/6] xen/arm: dom0less hwdom construction Date: Mon, 31 Mar 2025 17:43:17 -0400 Message-ID: <20250331214321.205331-3-jason.andryuk@amd.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250331214321.205331-1-jason.andryuk@amd.com> References: <20250331214321.205331-1-jason.andryuk@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB04.amd.com: jason.andryuk@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002314:EE_|CH3PR12MB7618:EE_ X-MS-Office365-Filtering-Correlation-Id: e227e2b6-b178-452f-8ae4-08dd709d13e8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|34020700016|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?IXbUr6XG58lRFs1ssTvJ9gu3U6jGdNCnbryQKQORAVJ1A5y3fx9cefcnz0vc?= =?us-ascii?Q?/nk2Szdmu3AWORSxNSUxnxN44/cNNMPKTbJeodlIkGCUzG4FkCcM8bCvKHxK?= =?us-ascii?Q?36maOm8ozG0SMFkIQFZVALQq4f8zBHVwRSGSVUlMeUbTVrWke/S/NSnntiTL?= =?us-ascii?Q?TCy4IdKUtuB+NJCXLttzWooQs+CPHXJ+TYDyCqCS7nNSNeD4s9IkczcWPPQ/?= =?us-ascii?Q?SpVRCeaO5C5HwkrCft5SJ7/CDh15DIZIleiSf+cPCG3xkJTOyEEQPla2ltVK?= =?us-ascii?Q?/4r7THubSpmaFXmVru8XDbHKyfUEEPfq8syID0yeZPqo4FSqQ0S1Yxx0eMEp?= =?us-ascii?Q?vGGr05juqApYa24rDvWu/SsyZtpBrcq3M8RS2C6qUXyd2Tzjrio9DJy0iJpk?= =?us-ascii?Q?hyNMa2tb+ufIW3UR4enWaI+ySae03FiuBOI58zfl0cvjUK2+AkCpKbRCgSgq?= =?us-ascii?Q?ZpTs0aR9IZDeo0ZFrXsPXrsLFn3q9D+1lOfPaoLSgAfRX/6vVVXQAIW6X9JA?= =?us-ascii?Q?Rr7zasXVnbHoAyfXaS2PyInVn3RLuHvQlfyxMx2Zk4x3e0BYytkezEQpEmMr?= =?us-ascii?Q?2kIvOpNKN1rCbWleaUQneuC5uirsYT81LG8ebYFgsHKFcrFVToSKF0PZsA6S?= =?us-ascii?Q?fdzCw6+3inTuW8VGJ+ZZijK5rdLQY4jPLmpEEFkz5mXQZ8MrrMbFJDZgKG6H?= =?us-ascii?Q?yimocVIxTFCUTL+9JWSeK9qbvkBjXAgm6fUVG1gy3CdaCPsfikb+vvxp3ejJ?= =?us-ascii?Q?MO2FO/KK7DlIDemn/pvWgAcgQPesRJybr+ntGrV4e0pMLGZOzmBWHRD6Q1ew?= =?us-ascii?Q?u2R7rEjMg0CzHfjcnwHfFaesLbNYOppi6d51OV+MM79ES7MePN0lD/w9Ccpd?= =?us-ascii?Q?cGDKQJqjkudZbicbh+SsEteGSshhiGp2DFYSy5yz1ywUtBWsZ7yPrL6N2L9j?= =?us-ascii?Q?sgsH6+Sg7ozPZ1xFSRhqPtu3+eBsgbGB/csttN0ogQBW8ti9AR2zp8Kzd3IT?= =?us-ascii?Q?x5nhneeZ1m53PSWrnw9k8NEpfsZPJhbxyaWrsxPzmlF4BzMnucdziSSmyI3/?= =?us-ascii?Q?fLkAlfvyDWMwzzl2ZYs5XPvheuRmZXEz3gfCdMWJhX6Bk6SI0CuPPBTOWDkd?= =?us-ascii?Q?Gcj3XUaBCSklNcIBLyJa9OyCAMGZmrMO2tV6Q4zRIiBSN0rzC+/Y0iWBAudc?= =?us-ascii?Q?z476iGUhOYvCo5rZ4uqI5Jw7GQhsskL3H3pzcWVFV41PiYwhGvvwdE6dW47c?= =?us-ascii?Q?y1nXlzPeqEzQR1vNoBlmykZuURdxpNP24bsk5pHKkWA6CKuW0pFU17H1PDq/?= =?us-ascii?Q?pxIabmuUOnrEKB704VL1gkgAwdCXWv2ckKdczsZg4VhYXO+iM4KPgzgX8GPE?= =?us-ascii?Q?LC7UsxKbvvHaxya2lctLF465oHjTns+mze8hGCcPDSFWObXIy1fyG+9mOuuk?= =?us-ascii?Q?6bEGRm4S6XXN5dEmlutzRkk4rvYoW2++n3Vbu2bqVbrho2sV6Ub2PSedG3EN?= =?us-ascii?Q?RnPhKixQ50kC59c11wjoip5EuJPLju7FQPXM?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(34020700016)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2025 21:43:30.1099 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e227e2b6-b178-452f-8ae4-08dd709d13e8 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: SJ1PEPF00002314.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB7618 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1743457435275019100 Content-Type: text/plain; charset="utf-8" When creating a hardware domain, have the dom0less code call construct_hwdom() which is shared with the dom0 code. The hardware domain requires building that best matches the dom0 build path. Re-use it to keep them in sync. The device tree node of the dom0less config is now passed into construct_hwdom(). dom0 uses /chosen for process_shm while a hwdom will use the value from its dom0less device tree node. Signed-off-by: Jason Andryuk --- xen/arch/arm/dom0less-build.c | 57 ++++++++++++++----------- xen/arch/arm/domain_build.c | 10 +++-- xen/arch/arm/include/asm/domain_build.h | 3 +- 3 files changed, 42 insertions(+), 28 deletions(-) diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c index 573b0d25ae..e25d7bd468 100644 --- a/xen/arch/arm/dom0less-build.c +++ b/xen/arch/arm/dom0less-build.c @@ -911,36 +911,45 @@ static int __init construct_domU(struct domain *d, /* type must be set before allocate memory */ d->arch.type =3D kinfo.type; #endif - if ( !dt_find_property(node, "xen,static-mem", NULL) ) - allocate_memory(d, &kinfo); - else if ( !is_domain_direct_mapped(d) ) - allocate_static_memory(d, &kinfo, node); - else - assign_static_memory_11(d, &kinfo, node); - - rc =3D process_shm(d, &kinfo, node); - if ( rc < 0 ) - return rc; - - /* - * Base address and irq number are needed when creating vpl011 device - * tree node in prepare_dtb_domU, so initialization on related variabl= es - * shall be done first. - */ - if ( kinfo.vpl011 ) + if ( is_hardware_domain(d) ) { - rc =3D domain_vpl011_init(d, NULL); + rc =3D construct_hwdom(&kinfo, node); if ( rc < 0 ) return rc; } + else + { + if ( !dt_find_property(node, "xen,static-mem", NULL) ) + allocate_memory(d, &kinfo); + else if ( !is_domain_direct_mapped(d) ) + allocate_static_memory(d, &kinfo, node); + else + assign_static_memory_11(d, &kinfo, node); =20 - rc =3D prepare_dtb_domU(d, &kinfo); - if ( rc < 0 ) - return rc; + rc =3D process_shm(d, &kinfo, node); + if ( rc < 0 ) + return rc; =20 - rc =3D construct_domain(d, &kinfo); - if ( rc < 0 ) - return rc; + /* + * Base address and irq number are needed when creating vpl011 dev= ice + * tree node in prepare_dtb_domU, so initialization on related var= iables + * shall be done first. + */ + if ( kinfo.vpl011 ) + { + rc =3D domain_vpl011_init(d, NULL); + if ( rc < 0 ) + return rc; + } + + rc =3D prepare_dtb_domU(d, &kinfo); + if ( rc < 0 ) + return rc; + + rc =3D construct_domain(d, &kinfo); + if ( rc < 0 ) + return rc; + } =20 domain_vcpu_affinity(d, node); =20 diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 051c48329a..b3a396c2fc 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2305,10 +2305,11 @@ static int __init construct_dom0(struct domain *d) if ( rc < 0 ) return rc; =20 - return construct_hwdom(&kinfo); + return construct_hwdom(&kinfo, NULL); } =20 -int __init construct_hwdom(struct kernel_info *kinfo) +int __init construct_hwdom(struct kernel_info *kinfo, + const struct dt_device_node *node) { struct domain *d =3D kinfo->d; int rc; @@ -2325,7 +2326,10 @@ int __init construct_hwdom(struct kernel_info *kinfo) else allocate_memory(d, kinfo); =20 - rc =3D process_shm_chosen(d, kinfo); + if ( node ) + rc =3D process_shm(d, kinfo, node); + else + rc =3D process_shm_chosen(d, kinfo); if ( rc < 0 ) return rc; =20 diff --git a/xen/arch/arm/include/asm/domain_build.h b/xen/arch/arm/include= /asm/domain_build.h index 134290853c..17619c875d 100644 --- a/xen/arch/arm/include/asm/domain_build.h +++ b/xen/arch/arm/include/asm/domain_build.h @@ -13,7 +13,8 @@ bool allocate_bank_memory(struct kernel_info *kinfo, gfn_= t sgfn, paddr_t tot_size); void allocate_memory(struct domain *d, struct kernel_info *kinfo); int construct_domain(struct domain *d, struct kernel_info *kinfo); -int construct_hwdom(struct kernel_info *kinfo); +int construct_hwdom(struct kernel_info *kinfo, + const struct dt_device_node *node); int domain_fdt_begin_node(void *fdt, const char *name, uint64_t unit); int make_chosen_node(const struct kernel_info *kinfo); int make_cpus_node(const struct domain *d, void *fdt); --=20 2.49.0 From nobody Fri Oct 31 23:30:14 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=1743457446; cv=pass; d=zohomail.com; s=zohoarc; b=jeXDPs2HptNpTrSysHp8lrqQg3MTrvtjmV770T4EEjwSUFo7UOakGII/Z+Vb9lOZkAvQb8QuHiZxHVRh3M6/OwLS3WruTa9u4xPGYLfHWjgowhEVk1WnVpb5if+YGsgK+xjwvV282TYwiMwEtEYP2cW32IBRm0m/ztmSsG3JPrs= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1743457446; 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=obPuKkWxG0z+mEVF9qf+2e+HKAoV+mglU8Qp/Nk6GDI=; b=A8BIkm+PY3lUh8M/Qdv34niYIuS50bZT44jRMtcIpdyvlRofb5zoFuhuy4o6FGazWfTT9IfQ8KnuWMwZ7dSqLbDZBb6ubbYAfErr+Ul7AyP9bQseMuT98hon/UBev7pk8ne3lbFYnhBnZRGEkzwHOiO7yVB+F+4T5A/T5bSzl6U= 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 1743457446829214.02369085538066; Mon, 31 Mar 2025 14:44:06 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.932999.1335066 (Exim 4.92) (envelope-from ) id 1tzMv1-0005I4-1X; Mon, 31 Mar 2025 21:43:43 +0000 Received: by outflank-mailman (output) from mailman id 932999.1335066; Mon, 31 Mar 2025 21:43:43 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tzMv0-0005Hv-Ur; Mon, 31 Mar 2025 21:43:42 +0000 Received: by outflank-mailman (input) for mailman id 932999; Mon, 31 Mar 2025 21:43:41 +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 1tzMuz-0004Vr-3d for xen-devel@lists.xenproject.org; Mon, 31 Mar 2025 21:43:41 +0000 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on20603.outbound.protection.outlook.com [2a01:111:f403:2415::603]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3444c228-0e79-11f0-9ffb-bf95429c2676; Mon, 31 Mar 2025 23:43:39 +0200 (CEST) Received: from BLAPR03CA0008.namprd03.prod.outlook.com (2603:10b6:208:32b::13) by PH0PR12MB8051.namprd12.prod.outlook.com (2603:10b6:510:26d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.44; Mon, 31 Mar 2025 21:43:33 +0000 Received: from BL6PEPF00022573.namprd02.prod.outlook.com (2603:10b6:208:32b:cafe::bc) by BLAPR03CA0008.outlook.office365.com (2603:10b6:208:32b::13) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.54 via Frontend Transport; Mon, 31 Mar 2025 21:43:32 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by BL6PEPF00022573.mail.protection.outlook.com (10.167.249.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8606.22 via Frontend Transport; Mon, 31 Mar 2025 21:43:32 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 31 Mar 2025 16:43:31 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 31 Mar 2025 16:43:31 -0500 Received: from fedora.mshome.net (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 31 Mar 2025 16:43:30 -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: 3444c228-0e79-11f0-9ffb-bf95429c2676 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Hqo1KS5nxhXXEPUvAE8o6FqElcZMM72DHlRXlYJlaQHRhfMjCpiUSOk2tO1QCZD+ZgONr6kDYysL9WDStrhhbHQu5tR9SZMgbnP1GrKbCdC7OYz54qTs/EDShVae7G9dwcaNR5UuouNCBg8+/tezNjb5cRpm/86aqeAJ3RPmQMngFOnrvX1BvBC2Vjne3/zXG2dSkKtEw2fBfA8dcfNhT3Tax0sGfJ4tJW1o4qzZlLrmSmd/I+1wVNu5sWucVBPYGtEM0IG24Tf9s/WMSEgK9UEgo75KqXKyy9Za2OPpwfclxqkRF55eNTCjHg8w52H6DQTeFSo6zSMj3kTmO5frJA== 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=obPuKkWxG0z+mEVF9qf+2e+HKAoV+mglU8Qp/Nk6GDI=; b=P4f7Ty00OWA/alaYaSpIYmqZZqVV/ZB8xdl8O4+7lWQymYKwFmdV/jrveO57IOSqqz2ohUI6S+IFIBLjZ9NeVVNeotoLE+Mz/EJ0VqFvKfcxQ8WJHYP93hnxASfL2jau5Dcobmf37IlKBNpy9sRH+iT99yPftM727ygE7OHgeBogI7VuzSabDLJ+pSU1FPbbSqSD0Cfjc4S8sIgEvZKtzheOxyQwqHG8LeHRycCZVDAj6NcCmqJ+jnhteoMusOyhawXdcKmh5ibYJTguBaGgsFul2RR7glaMYeftJRX37nu8ZZZBHmKxZDa0TKi/gnEEShnqxwPAqwNTRzyqHAX5JQ== 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=obPuKkWxG0z+mEVF9qf+2e+HKAoV+mglU8Qp/Nk6GDI=; b=hLt1WjO2+VpqZTbzzffcgxtzhjGxeJ3ZZ/3c0JA1kIlTKhhCmW/WHuY2yGm8nDyiw6GwjiNuvzJPEjtzgE8MrDMVnGpbr+TXtlfEWW6/c+ob6L3mwWwXUtyZb6i7MHjv87rGr5CKVtiw0UwM/lofRf5L/8oTu1iSTyx051YiR+o= 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=SATLEXMB03.amd.com; pr=C From: Jason Andryuk To: CC: Jason Andryuk , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , "Volodymyr Babchuk" Subject: [PATCH v2 3/6] xen/arm: dom0less delay xenstore initialization Date: Mon, 31 Mar 2025 17:43:18 -0400 Message-ID: <20250331214321.205331-4-jason.andryuk@amd.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250331214321.205331-1-jason.andryuk@amd.com> References: <20250331214321.205331-1-jason.andryuk@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00022573:EE_|PH0PR12MB8051:EE_ X-MS-Office365-Filtering-Correlation-Id: 4f280073-b276-4295-8b26-08dd709d1508 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|1800799024|34020700016|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?KHQdASEBlfybq4TDO0Ghhrx1EijTSmnkl3QjnEVkEhxXepQqvU5GGv3NLn69?= =?us-ascii?Q?fwp6mLgM62KIDdw5tV7uP3k8LhfuggBnlkPEAVH7aIZtov4eTFuio1atFe3l?= =?us-ascii?Q?BPZIznNpH8jpwv2SBqXPTkoHrUDmARGdzVVHCXg+QKhBkSwG3tdbRDO5LKXx?= =?us-ascii?Q?t+Sm0xn3SYBZSjdWSsKk5A3EdQNe3jVrFEgCuNDPf5VJnD4WinUJN5kh2g0A?= =?us-ascii?Q?0CZV4Aj5bO4f7HMsc2hunrraiBsUdaWUgErep/t33v3OxmzdOuj+xmmjiOOG?= =?us-ascii?Q?YhZ4pEX8LC3T8GXJvfa1q0mRdgxAw0TCwl52lq82IMxnhav1FcFX4CelSsdp?= =?us-ascii?Q?DTqzLkro4y2GfQKqV//FiCjyLBIldEbS0X/azbE06f/cy9cMXi7cIuvuU452?= =?us-ascii?Q?QuAzqV3Z1mXVBsDWZ2EobWyy15GfYWckoYHPm6X/5J7QXztb734wFJF/S9Bz?= =?us-ascii?Q?2ex1A5pxQYYSlvHstZyYtQq0C6Nmw7mb0QXXiKbO1xutHbjmermsDbPR5dsX?= =?us-ascii?Q?/QORwyf+dufAAKzJw6OLhHLiP8bdiKa3B4yHPeLifn2PAVgB/cGuz2nvEbKt?= =?us-ascii?Q?M1PpUuQms5uccsVcrKu1oWFLw11T00EVQZKT6Pgc2i5NY71uMeaQkLqEQDxe?= =?us-ascii?Q?lRfDbFJC0aM9kzgPDM6xC7RV0uEZdVM7nB/NYMSfIYuPWBFNxn7BJlYS8zhp?= =?us-ascii?Q?sFCDG0MTJz6vG0VV3uD99UfHL4eLjB5ouBOZPsjzKM5ZQK8TK3wSryI8wpuc?= =?us-ascii?Q?nPxS3W1/lVKKSZ13xZSQj6iJrfZs+If5sEg1SRJA3LtUM+77kPaBQdc614ob?= =?us-ascii?Q?154pAyZO/7aU6sqhfuvFVgD/iycOxga3rhK7wjobqo6vDVgzN0O2O50NwnuB?= =?us-ascii?Q?BM4MUJTVFIuWwDLm27+zq71Vj18+1DP3Iaek03jng1UozUlWv6z8oXZRacbZ?= =?us-ascii?Q?vxuc0mCGrZsCvYSw9emDmu0idBqdOS+aO30KGNWYfEQoY9/XkWOJ1nW+Gq2B?= =?us-ascii?Q?C8+dKreM80MU4xKCJC3z4ZKjBdg0mKu7bncREyiaYB8Nf2pjd9RZloITIvwx?= =?us-ascii?Q?mKpY6qWaSoE345AUDEFjl9Sq97rmrV7pCNpE8YG1MTpt4j+r58uk5k+aNiAI?= =?us-ascii?Q?jCjV49MIbDTKef0XffZWIKtQKU9vy/SUGJIiwaNZh3hm0qGosJ58YG4tETpG?= =?us-ascii?Q?sQNNwxyFWWCyYI9oJs06uOHGUW/IyxVqDswqQ+3eouSkg2P1Zs7DIbrciarP?= =?us-ascii?Q?UmzMtyims9uNxdQhxb1X4tl/CpFO7KO1/OIKZUh88aAJNH5jb6Fh3a/67Dob?= =?us-ascii?Q?K1ZFtnzqc+U2fkFyr1s/yuIoQg1IUBPUCT3x1sKqFOq+AcILZUcx5KDVx7Aa?= =?us-ascii?Q?GqUpaRh3Kk4sQ3WIR8oH3kFa4UBh6JsHXV9I6yB7cHQUy7zClItDRB5S6pYL?= =?us-ascii?Q?A/fb/LikTK7lt84g0e3fQVNgI/vHPjLqw5JhdesZ5xeKb6DHwzFJQgNbyp6H?= =?us-ascii?Q?5T283vbTjxLv9j4=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(1800799024)(34020700016)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2025 21:43:32.1067 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4f280073-b276-4295-8b26-08dd709d1508 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00022573.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB8051 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1743457448960019100 Content-Type: text/plain; charset="utf-8" To allocate the xenstore event channel and initialize the grant table entry, the xenstore domid is neeed. A dom0 is created before the domUs, so it is normally available through hardware_domain. With capabilities and dom0less, the xenstore domain may not be created first. Keep the population of the page and HVM_PARAM_STORE_PFN in the normal domain construction, but delay event channel creation and grant seeding to after all domUs are created. HVM_PARAM_STORE_PFN now serves as indication to setup xenstore since the device tree is no longer immediately available. 0 means no xenstore. ~0ULL means legacy so only the event channel needs setup, and any other value means to seed the page. dom0 needs to set xs_domid when it is serving as the xenstore domain. The domain running xenstored needs to be the handler for VIRQ_DOM_EXC, so set that as well - it otherwise defaults to hardware domain. Signed-off-by: Jason Andryuk Reviewed-by: Stefano Stabellini --- v2: Re-order ahead of seeding. Fix created type in commit message Change set_xs_domid to set_xs_domain Set xenstore domain as VIRQ_DOM_EXC handler Signed-off-by: Jason Andryuk --- xen/arch/arm/dom0less-build.c | 67 +++++++++++++++++------ xen/arch/arm/domain_build.c | 2 + xen/arch/arm/include/asm/dom0less-build.h | 2 + 3 files changed, 53 insertions(+), 18 deletions(-) diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c index e25d7bd468..a46f292c1f 100644 --- a/xen/arch/arm/dom0less-build.c +++ b/xen/arch/arm/dom0less-build.c @@ -20,6 +20,15 @@ #include #include =20 +static domid_t __initdata xs_domid =3D DOMID_INVALID; +static bool __initdata need_xenstore; + +void __init set_xs_domain(struct domain *d) +{ + xs_domid =3D d->domain_id; + set_global_virq_handler(d, VIRQ_DOM_EXC); +} + bool __init is_dom0less_mode(void) { struct bootmodules *mods =3D &bootinfo.modules; @@ -694,7 +703,7 @@ static int __init alloc_xenstore_evtchn(struct domain *= d) int rc; =20 alloc.dom =3D d->domain_id; - alloc.remote_dom =3D hardware_domain->domain_id; + alloc.remote_dom =3D xs_domid; rc =3D evtchn_alloc_unbound(&alloc, 0); if ( rc ) { @@ -760,16 +769,10 @@ static int __init alloc_xenstore_params(struct kernel= _info *kinfo) struct domain *d =3D kinfo->d; int rc =3D 0; =20 - if ( kinfo->dom0less_feature & (DOM0LESS_XENSTORE | DOM0LESS_XS_LEGACY= ) ) - { - ASSERT(hardware_domain); - rc =3D alloc_xenstore_evtchn(d); - if ( rc < 0 ) - return rc; + if ( (kinfo->dom0less_feature & (DOM0LESS_XENSTORE | DOM0LESS_XS_LEGAC= Y)) + =3D=3D (DOM0LESS_XENSTORE | DOM0LESS_XS_L= EGACY) ) d->arch.hvm.params[HVM_PARAM_STORE_PFN] =3D ~0ULL; - } - - if ( kinfo->dom0less_feature & DOM0LESS_XENSTORE ) + else if ( kinfo->dom0less_feature & DOM0LESS_XENSTORE ) { rc =3D alloc_xenstore_page(d); if ( rc < 0 ) @@ -841,6 +844,30 @@ static void __init domain_vcpu_affinity(struct domain = *d, } } =20 +static void __init initialize_domU_xenstore(void) +{ + struct domain *d; + + if ( xs_domid =3D=3D DOMID_INVALID ) + return; + + for_each_domain( d ) + { + unsigned long gfn =3D d->arch.hvm.params[HVM_PARAM_STORE_PFN]; + int rc; + + if ( gfn =3D=3D 0 ) + continue; + + if ( is_xenstore_domain(d) ) + continue; + + rc =3D alloc_xenstore_evtchn(d); + if ( rc < 0 ) + panic("%pd: Failed to allocate xenstore_evtchn\n", d); + } +} + static int __init construct_domU(struct domain *d, const struct dt_device_node *node) { @@ -881,17 +908,13 @@ static int __init construct_domU(struct domain *d, rc =3D=3D -ENODATA || (rc =3D=3D 0 && !strcmp(dom0less_enhanced, "enabled")) ) { - if ( hardware_domain ) - kinfo.dom0less_feature =3D DOM0LESS_ENHANCED; - else - panic("At the moment, Xenstore support requires dom0 to be pre= sent\n"); + need_xenstore =3D true; + kinfo.dom0less_feature =3D DOM0LESS_ENHANCED; } else if ( rc =3D=3D 0 && !strcmp(dom0less_enhanced, "legacy") ) { - if ( hardware_domain ) - kinfo.dom0less_feature =3D DOM0LESS_ENHANCED_LEGACY; - else - panic("At the moment, Xenstore support requires dom0 to be pre= sent\n"); + need_xenstore =3D true; + kinfo.dom0less_feature =3D DOM0LESS_ENHANCED_LEGACY; } else if ( rc =3D=3D 0 && !strcmp(dom0less_enhanced, "no-xenstore") ) kinfo.dom0less_feature =3D DOM0LESS_ENHANCED_NO_XS; @@ -1138,7 +1161,15 @@ void __init create_domUs(void) if ( rc ) panic("Could not set up domain %s (rc =3D %d)\n", dt_node_name(node), rc); + + if ( d_cfg.flags & XEN_DOMCTL_CDF_xs_domain ) + set_xs_domain(d); } + + if ( need_xenstore && xs_domid =3D=3D DOMID_INVALID ) + panic("xenstore requested, but xenstore domain not present\n"); + + initialize_domU_xenstore(); } =20 /* diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index b3a396c2fc..d99ca7b43f 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -2408,6 +2408,8 @@ void __init create_dom0(void) rc =3D construct_dom0(dom0); if ( rc ) panic("Could not set up DOM0 guest OS (rc =3D %d)\n", rc); + + set_xs_domain(dom0); } =20 /* diff --git a/xen/arch/arm/include/asm/dom0less-build.h b/xen/arch/arm/inclu= de/asm/dom0less-build.h index 5864944bda..b0e41a1954 100644 --- a/xen/arch/arm/include/asm/dom0less-build.h +++ b/xen/arch/arm/include/asm/dom0less-build.h @@ -9,6 +9,7 @@ =20 void create_domUs(void); bool is_dom0less_mode(void); +void set_xs_domain(struct domain *d); =20 #else /* !CONFIG_DOM0LESS_BOOT */ =20 @@ -17,6 +18,7 @@ static inline bool is_dom0less_mode(void) { return false; } +static inline void set_xs_domain(struct domain *d) {} =20 #endif /* CONFIG_DOM0LESS_BOOT */ =20 --=20 2.49.0 From nobody Fri Oct 31 23:30:14 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=1743457443; cv=pass; d=zohomail.com; s=zohoarc; b=XKp5d9JARtT88c7zVMJl08QfyFmU/nVLOjBlZfyl837W5aEx+je1yUCGQyrBFh0WwuYQd6VMVTJEvmQ+KOEgGmMopWMwmZJriA8eAE0cjKS+CTGkRluaxcpyBF1xunv+XBvXGsl5jI/n3BMjyp5CyzN+7ONrDi3E4knCoovKUWU= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1743457443; 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=PQhJHw7567ypHQ6EQlLWOtnRHhS4n0cVpMQbZjCkjSA=; b=WPQ4XiyGz7y/Kj1xCeTBEm2djqy254c0sMFIbWPmW3hDo4Gd0+wiLZpSIfbEcNNergSChNTICZD7yaylGFCrD9C63FIANVFOwSv/YV2grhJN1aVw5iRxRdPZ2unYNiby38tLLZ4N9SrtX8cFsL/Kcub59HXgnJBMNqu1Ut/AmcY= 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 1743457443815191.4379905978983; Mon, 31 Mar 2025 14:44:03 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.933001.1335076 (Exim 4.92) (envelope-from ) id 1tzMv2-0005Y5-CK; Mon, 31 Mar 2025 21:43:44 +0000 Received: by outflank-mailman (output) from mailman id 933001.1335076; Mon, 31 Mar 2025 21:43:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tzMv2-0005Xl-7s; Mon, 31 Mar 2025 21:43:44 +0000 Received: by outflank-mailman (input) for mailman id 933001; Mon, 31 Mar 2025 21:43:42 +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 1tzMv0-0004Vr-6T for xen-devel@lists.xenproject.org; Mon, 31 Mar 2025 21:43:42 +0000 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2062e.outbound.protection.outlook.com [2a01:111:f403:240a::62e]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 34dfc078-0e79-11f0-9ffb-bf95429c2676; Mon, 31 Mar 2025 23:43:40 +0200 (CEST) Received: from MW4PR04CA0207.namprd04.prod.outlook.com (2603:10b6:303:86::32) by DM4PR12MB7645.namprd12.prod.outlook.com (2603:10b6:8:107::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.46; Mon, 31 Mar 2025 21:43:35 +0000 Received: from SJ1PEPF00002313.namprd03.prod.outlook.com (2603:10b6:303:86:cafe::6f) by MW4PR04CA0207.outlook.office365.com (2603:10b6:303:86::32) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.50 via Frontend Transport; Mon, 31 Mar 2025 21:43:35 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00002313.mail.protection.outlook.com (10.167.242.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8606.22 via Frontend Transport; Mon, 31 Mar 2025 21:43:34 +0000 Received: from SATLEXMB04.amd.com (10.181.40.145) 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; Mon, 31 Mar 2025 16:43:33 -0500 Received: from fedora.mshome.net (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 31 Mar 2025 16:43:32 -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: 34dfc078-0e79-11f0-9ffb-bf95429c2676 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=U3gESWeJBZkRXprX9wo8pdSKhjAorlN1HNXGboptiCeNihwvX9bkJA4DDPVeJK7X76eUfAmjgyLlpXtA2ZuKVZ2juLgJG1FJHp1wZmSIAB+3tAocSrazG9w13a+9oH8Gppnduvs6ebOif3ebxCUsSPdG1g3qv4NVN/M3o7wlEdhxLG6usoVCA9EUv91MB+QliwUXcyg/qyjEZr1hFkY0rRk06OjHF6yn6iltKXosaTQNVf4g9F2c/GT9gjBS2bTQ3UEY/8bQx8CHtSOO0VRrdcylF9SgWKM9g6GHquTz3a3OZrtYZn+VUSCPgwi9J7uneQ2PCtr7ZvmP/AohZJWVLQ== 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=PQhJHw7567ypHQ6EQlLWOtnRHhS4n0cVpMQbZjCkjSA=; b=aB7p/9nf/XnIkVxVO63kWJJ8bZ4UdIt8/0AkHFyIgaUvFrqjP6Ok29j9D8E33ZTVTqR6QnbGPnGeVlXlCXwiG8McyEpET+gUSoyNmBrDXuS7Ulg5Mye0PD8HDW8Pq8uIoRnDABRjeSdmoeMWnEXp9Sp4bm3lDC1ApNay6jnz1QEmgjRmXkbh0KrSgXjNz5R5MQ6EnWV+qUI4Pummjvvw19Xo0+U+z25GvwCWgk7cY+EfX23/xV9kxSPUIzExTn61hkZUYcu2gGHe74Z2rtlP0sljOcXcCa2MqvgBlMYxhqaL10Cl78SiMaoNFrw7owkuRfCVFCGdesqlFpn3C2eLmA== 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=PQhJHw7567ypHQ6EQlLWOtnRHhS4n0cVpMQbZjCkjSA=; b=oj48K7/ieUMjXESgau6tFU3fl3X9ZIC95uEF3TFZsxKf9taJw4tI47Zm1HxY7+PlQCOLa74OKxJ4J+Xf6a5mWqDeq3YR1iktfW1SbJsrpiR5DUTDYSDsGwu3LFR3RT9JAWOujPMioIR8e9VFa42R9o3PXzsQMjnsj5Pb5scXzkA= 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: Jason Andryuk To: CC: Jason Andryuk , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , "Volodymyr Babchuk" , Andrew Cooper , Anthony PERARD , "Jan Beulich" , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v2 4/6] xen/arm: dom0less seed xenstore grant table entry Date: Mon, 31 Mar 2025 17:43:19 -0400 Message-ID: <20250331214321.205331-5-jason.andryuk@amd.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250331214321.205331-1-jason.andryuk@amd.com> References: <20250331214321.205331-1-jason.andryuk@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB04.amd.com: jason.andryuk@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002313:EE_|DM4PR12MB7645:EE_ X-MS-Office365-Filtering-Correlation-Id: 5fc3ddeb-cc61-4cb9-3ae1-08dd709d1670 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|34020700016|82310400026|1800799024|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?j3BLBTyuwp6uFeTJhOIc7dONKeSM5EQ562Nc9zDnPcK1fZwugBWCYLUfG9HA?= =?us-ascii?Q?YonQ4B7+VQIa7KujkGV8d7XCgwb397dVcd2lphMDW4FVXdJhFy0FhUHM0XNe?= =?us-ascii?Q?9HZYbmXycBhm9vhibIDxmRfDdErmJGHpUm6ieOOoZbHQT7ewGqsoATsxbVMp?= =?us-ascii?Q?WXw5tEnR6NEefNpbysNCNVHVk3Z+ZS7l8TT+4Pt5iQIL0ZQ2QkSoAwCntPxQ?= =?us-ascii?Q?O5V5YumHPbQXFj7iJ/72fipXdCflMd5W3apt3RkzVxdfO1YK4oCT3BYvsda/?= =?us-ascii?Q?YGNWVJSPPmXhzCL8ur6EFJ8a3Yy9eMrA/v9E1eC2u8Z0iGN1uwrkGmmWdQ2G?= =?us-ascii?Q?T1XVZ1T9Y0Kqsxj3CJDS7dvNXmIGZ0orjVkdW2PnKNalM5x93fUI/+3cXsCA?= =?us-ascii?Q?9ICiW7hjsXLxBMPDmIzcbeXLwA7Jlo6QsP4W9z6iT08G/bewyJUypMoaUbeu?= =?us-ascii?Q?Zi4fI0R80vgeSni164sgqZrYoqQuk3n2uFN3wjSi9TvIHapGV0Nbpzw7Xqzm?= =?us-ascii?Q?+q3wnhA78mCKRraSo3GZyDZlG3MQXYqoz+2KXyOvT2SVsi3gbEEXAqF/yQ8N?= =?us-ascii?Q?wEM4mQtMG0dqP/1ztZEdL6MbR7UQI6QqDaqyL0ZC/6DdgowO3ov+VbtVgJg6?= =?us-ascii?Q?VGNmP2wFljTLDOt3tNuBRkWBXIGbPNuOOmgRUo9KnUREerVceKGxd8AFqMCF?= =?us-ascii?Q?0u/57jaWZR10Gona4MY3DuP857IEHXQUqfx+R6XfUE1yLT0Frs79Ho6sAk1J?= =?us-ascii?Q?50OkXdcfGsemCeaLu7sN7mXwfFFU+IH4IObQaamUrT7ak86TuF/6ipNNuhu3?= =?us-ascii?Q?c0O2S2n/riw232ViYIs4OlV7CmS/DM19RvS4Q5SdQq5GotvDOJE88G9yJKDb?= =?us-ascii?Q?j4e7DjmP7ygEzJL59Eu2CPnb4LqKQpFolpqfPXBAH7Te89iApYTf6smLo9Cl?= =?us-ascii?Q?hloWIc9vW8MfAob3UychjzGnptmNsTVgr2brmmBFMFz1eVT3Vd4zeVCt4Hw+?= =?us-ascii?Q?biEP+QYgy92fm+nIWk8jL01y2/M841dco/y2w8uGHPodVFPc+73nZqWHt9Bu?= =?us-ascii?Q?ZuFqHAVFHjlbhhQL/n4JzEQfzboSm3Cx6FREgTYLJMS0UMIM+M0WH7h6qui7?= =?us-ascii?Q?3c9JkH/2WOGmy8Rhm3bEOlMgRjB2Dae8bbc6SEeEixmB0Q8eEI+D0JXlu3OT?= =?us-ascii?Q?8Gxh5kqbdmMZFqJAOYt3mwAakGnSQFMs1dluLVFGzVMyjwycRRNqhUPyUETt?= =?us-ascii?Q?+Iiu5GgWI9cYERUjNL3gGFyHxNXlxvv3SyN/A8aqey5jIGZq1jxCVKrnDhAJ?= =?us-ascii?Q?RlHTtOOhq7bjG6tqY1B3kjd6LpcrQZLxyM+rb2Cz9343tlJUqp7oYBa6ZDU+?= =?us-ascii?Q?P/F+v1IKWeMp7ei1pmJb/e6S03vwzRcc1suyHvjvOGDgFxqqcpBwMlgai/wf?= =?us-ascii?Q?YQDo3ipS6eKT+D4uV1KUcpkVx2KIjEGshHYgxeanA2yewu1sLuHOtQ=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(36860700013)(34020700016)(82310400026)(1800799024)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2025 21:43:34.3546 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5fc3ddeb-cc61-4cb9-3ae1-08dd709d1670 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: SJ1PEPF00002313.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7645 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1743457445804019000 Content-Type: text/plain; charset="utf-8" xenstored maps other domains' xenstore pages. Currently this relies on init-dom0less or xl to seed the grants from Dom0. With split hardware/control/xenstore domains, this is problematic since we don't want the hardware domain to be able to map other domains' resources without their permission. Instead have the hypervisor seed the grant table entry for every dom0less domain. The grant is then accessible as normal. This works with C xenstored. OCaml xenstored does not use grants and would fail to foreign map the page. Signed-off-by: Jason Andryuk --- v2: Tweak commit message Mark gnttab_seed_entry() __init and put inside CONFIG_DOM0LESS_BOOT Add ASSERT(!d->creation_finished) and ASSERT(gt->gt_version =3D=3D 1); const struct domain & struct grant_table --- xen/arch/arm/dom0less-build.c | 4 ++++ xen/common/grant_table.c | 15 +++++++++++++++ xen/include/xen/grant_table.h | 9 +++++++++ 3 files changed, 28 insertions(+) diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c index a46f292c1f..fc515c9852 100644 --- a/xen/arch/arm/dom0less-build.c +++ b/xen/arch/arm/dom0less-build.c @@ -865,6 +865,10 @@ static void __init initialize_domU_xenstore(void) rc =3D alloc_xenstore_evtchn(d); if ( rc < 0 ) panic("%pd: Failed to allocate xenstore_evtchn\n", d); + + if ( gfn !=3D ~0ULL ) + gnttab_seed_entry(d, GNTTAB_RESERVED_XENSTORE, xs_domid, + gfn, GTF_permit_access); } } =20 diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 6c77867f8c..2fb3679447 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -4346,6 +4346,21 @@ static void gnttab_usage_print(struct domain *rd) printk("no active grant table entries\n"); } =20 +#ifdef CONFIG_DOM0LESS_BOOT +void __init gnttab_seed_entry(const struct domain *d, unsigned int idx, + domid_t be_domid, uint64_t frame, + unsigned int flags) +{ + const struct grant_table *gt =3D d->grant_table; + + ASSERT(!d->creation_finished); + ASSERT(gt->gt_version =3D=3D 1); + shared_entry_v1(gt, idx).flags =3D flags; + shared_entry_v1(gt, idx).domid =3D be_domid; + shared_entry_v1(gt, idx).frame =3D frame; +} +#endif + static void cf_check gnttab_usage_print_all(unsigned char key) { struct domain *d; diff --git a/xen/include/xen/grant_table.h b/xen/include/xen/grant_table.h index 50edfecfb6..a17f1787da 100644 --- a/xen/include/xen/grant_table.h +++ b/xen/include/xen/grant_table.h @@ -45,6 +45,11 @@ void grant_table_destroy( struct domain *d); void grant_table_init_vcpu(struct vcpu *v); =20 +/* Seed a gnttab entry for Hyperlaunch/dom0less. */ +void __init gnttab_seed_entry(const struct domain *d, unsigned int idx, + domid_t be_domid, uint64_t frame, + unsigned int flags); + /* * Check if domain has active grants and log first 10 of them. */ @@ -85,6 +90,10 @@ static inline void grant_table_destroy(struct domain *d)= {} =20 static inline void grant_table_init_vcpu(struct vcpu *v) {} =20 +static inline void gnttab_seed_entry(struct domain *d, int idx, + domid_t be_domid, uint64_t frame, + unsigned int flags) {} + static inline void grant_table_warn_active_grants(struct domain *d) {} =20 static inline int gnttab_release_mappings(struct domain *d) { return 0; } --=20 2.49.0 From nobody Fri Oct 31 23:30:14 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=1743457453; cv=pass; d=zohomail.com; s=zohoarc; b=mHLAco2hx3UIofoYtfpit5dnXD3frkvH7mV0l0n3OAd6RZqW+9XDr1xz55DramhyGP5wXdweOfLsKcY9y/+kZh7PLrbTR/ZA2z9mkSYj29NzEAfFUIKggixkdwzifoNG+6+mH63AOMgPSilDy9+0gcrc5cAR0Oyp60UpuARmvFY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1743457453; 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=HIwhjfknntHy51daW0G7gVn2WkUksiIVEhJto7dMW3I=; b=MipRFmc9cNEt1ncvSjBstTX6cr3MdPCC78Ww9OseYOVIhutxQsrwpYsRHAQIsUDtGW5AaxOajkSck372UqcT576yuaVoDFyoP7Nc+8Mp429u/SOo2OsSE0GpFndVlGtEw7A5OjxLBrQgQ9yLnsrLPqpUEwG8tCWf7yrHGzeT5mI= 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 17434574534281.5242439782326755; Mon, 31 Mar 2025 14:44:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.933003.1335086 (Exim 4.92) (envelope-from ) id 1tzMv3-0005qH-Oy; Mon, 31 Mar 2025 21:43:45 +0000 Received: by outflank-mailman (output) from mailman id 933003.1335086; Mon, 31 Mar 2025 21:43:45 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tzMv3-0005q5-KU; Mon, 31 Mar 2025 21:43:45 +0000 Received: by outflank-mailman (input) for mailman id 933003; Mon, 31 Mar 2025 21:43:44 +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 1tzMv2-0004Vr-1m for xen-devel@lists.xenproject.org; Mon, 31 Mar 2025 21:43:44 +0000 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2060a.outbound.protection.outlook.com [2a01:111:f403:2416::60a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 35fccfc6-0e79-11f0-9ffb-bf95429c2676; Mon, 31 Mar 2025 23:43:42 +0200 (CEST) Received: from MW4PR04CA0197.namprd04.prod.outlook.com (2603:10b6:303:86::22) by DM4PR12MB6589.namprd12.prod.outlook.com (2603:10b6:8:b4::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.44; Mon, 31 Mar 2025 21:43:37 +0000 Received: from SJ1PEPF00002313.namprd03.prod.outlook.com (2603:10b6:303:86:cafe::88) by MW4PR04CA0197.outlook.office365.com (2603:10b6:303:86::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8534.52 via Frontend Transport; Mon, 31 Mar 2025 21:43:37 +0000 Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ1PEPF00002313.mail.protection.outlook.com (10.167.242.167) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8606.22 via Frontend Transport; Mon, 31 Mar 2025 21:43:36 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) 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; Mon, 31 Mar 2025 16:43:35 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 31 Mar 2025 16:43:35 -0500 Received: from fedora.mshome.net (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 31 Mar 2025 16:43:34 -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: 35fccfc6-0e79-11f0-9ffb-bf95429c2676 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=S8Bp+SbkC78F/OT2n6StEgGTYMSr1Ia5vfEZwVOtAHdiMadtJvqBnisQycjlAEMczVN/b2Dk3EjfdHOmaM5kH0NEjMFX9dQXtxQdpBPpT1Etoepvt+UmTe9zG7jUW/cNThzO/BCj3yf05i9rfrD1GsRcUzBWibKuTbmmhpOUYYBChTxNMfyruGW5+aEulRzeJT1i2V9XpeZfdFBNvOlL7BbEPGr2ibjQaqFEfThAavI8oPpX3wAbMNH/7xqCOIEglYSCdyOTbcBWTQuh/ZFLRgIWgvKr3tEqnMqA6YvyTWMfM8EJEWAKWQ7rFmCrnv85zC91g3fp79TTbCsPuMeSRQ== 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=HIwhjfknntHy51daW0G7gVn2WkUksiIVEhJto7dMW3I=; b=KV1z4hKEbfUKBf0h58ZlFmg36JAVekH17HDyqMBOV9OOy+oi57i9d6hTQpHFHBp1e9CqyCwZm5C35/P9JOPZl+CrXiqZmrO6iysu2RR7QmDYgNEzWCyGwc1D0L4ShCWVOTl19xvoXcHruIKDZ0nlOx7ejTZ59O3+iqEgued3BhrAhfxFYt16+0JQy4XROIrTRYn8jhjpllupZ/PkiblnCubU8xjCZ5yWAt8XvBH7ihD9RZDRQrplfdPpOfBhoHB2Fsk4iHeZxK+6HmTdCB0fDbsNIoriCoe2zBWgImFIINpjKOajJkro6a3Z+WdTsY8aLOwfwM/rE0Tqh2JHurj3+Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HIwhjfknntHy51daW0G7gVn2WkUksiIVEhJto7dMW3I=; b=W8T+hhcyUgok8FPwkPysexnWOhqTZlmIwt4TwhmlLWr+3EwvvwQHbktFQRQYZCU/cgytuz712yZ7f/VkcNu9IHO7kq8HdEfUBm6v1MDj99QabMpr+P83ANrppCMk55J74yJTED5+kyheO/zKi9Wr0L/Suw4W5LWgjKVjO6r9VWM= 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: Jason Andryuk To: CC: Jason Andryuk , Anthony PERARD Subject: [PATCH v2 5/6] tools/init-dom0less: Only seed legacy xenstore grants Date: Mon, 31 Mar 2025 17:43:20 -0400 Message-ID: <20250331214321.205331-6-jason.andryuk@amd.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250331214321.205331-1-jason.andryuk@amd.com> References: <20250331214321.205331-1-jason.andryuk@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ1PEPF00002313:EE_|DM4PR12MB6589:EE_ X-MS-Office365-Filtering-Correlation-Id: 7977a475-1e84-496b-0656-08dd709d179f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|34020700016|1800799024|36860700013|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?7nX9vEClksZZGT1Bx8VFl9gahrgM7f1odpCEVgZY2C0UXGPduDtP05g89WeV?= =?us-ascii?Q?0nOALs1dvHzH8JQxp2ChCRzZXaRsJJgGflytcy7HOJI1DO9gFqXuzYNKbZci?= =?us-ascii?Q?JyAZQBveetN30UfQleNIthzsF1zpouAak6uou2m9zxtwcv3i62mzLTWQPNwx?= =?us-ascii?Q?mFhuHP1ZC3w0blc5l8b3xHmlbZ37dPnvWLDHXi83haWJaL/PIbOWRJTfnKdf?= =?us-ascii?Q?kKgdz8TA+B/QJHI87Thwlr3MhWVzpQEw3e4rowV5vTSkrCIPIsBI6Dm/IXP5?= =?us-ascii?Q?uA+jDybv9kBsuR9/TMYNKtyHXQSYxpjH0skSGSdGkL9Bc5uG2QB1BWu5KE8s?= =?us-ascii?Q?NljW4jC+EJ2+RtdViavqmAD7mkeoXN408H+w9CZqWY743/hSp6sp2ryaVVWn?= =?us-ascii?Q?bpN5vUOHNteyuHUqut0MSu7939QJJk8yhZ47KHf3SAWKEvi6nyHsmrkr7iqx?= =?us-ascii?Q?6BIhB+6xdnaScBcjZW9dV2lDKT6RELopM530CWSOVD9M+VEnuBt/073JT/D8?= =?us-ascii?Q?ZJkQdZwKuUnIJ7DpX9dYxjPVlmDZKL9Gju2ByBse2iPjIlPUT8VcrF1Amf/U?= =?us-ascii?Q?rkRtG0SEgmTU4Hz088sA0YSpoRSYifeqyUJxo9eQBP+cK2z6GKzJGgXaAEHo?= =?us-ascii?Q?M30Mxc+2HX9SCKjjknuUg8STQ6VDZlZwAGgpNmQNMHl4q9vXrBU3rEp6dnTZ?= =?us-ascii?Q?fSL8qnTnfeteXoJmBB22RTze8t+plhJVAkRDk0kUCos0JkPZS1iPDwyMmWEA?= =?us-ascii?Q?nEHtT0qSJISVr8XAbhODSL9JqTV1EEmQm2ePpWPf0Rl6jeT0I3cLk6boeHso?= =?us-ascii?Q?4mqCAbtckabvWo7hCdlvLBdnVgNAYplwsHByavG6W+h2Kgt2V9ors9GKYcBQ?= =?us-ascii?Q?jCU/Cx8cdEd8HiKMNVludqlmJgvDZk3tdVzGkxPbZj3UyiiNkS8R7AmgUCCi?= =?us-ascii?Q?l8e5gvclmsT2OF6IHZUdvxmRS7p+WOE/EHLiX5TLUiOu4ly0/hBaQ2WWkisR?= =?us-ascii?Q?b35IchwPgXShvdch0KcCcOvJPuWKG80pFSCpb9gUP7hplT5EpvwsYz0D1OCv?= =?us-ascii?Q?VCQ9L9HUiK1GmfPpBYlx9KAil/kDFfuhlv4qiPRt0D3eJjlEZhIr82op7MPa?= =?us-ascii?Q?9ZERskrDhlWOoY3H9SuIqb04tyYibfBVdgCKLA38q143z3FYWsI0BbdQsrSA?= =?us-ascii?Q?Actx9bOrjqayHtRQMvGmXnv7fZPhMnPYIOpybld8rnoLrVRKnkrMzxF4hiJV?= =?us-ascii?Q?xFEjwYr+t5JoxPEKiHgaNAVoaQMjm9CEdutCLeMAo3Ab3RVZNZfbxnYShzPp?= =?us-ascii?Q?YYy8FhmJYX+1oCaCNRQuDlJISMqrR1f6TU1BjMz1Q08NqMq4zE/7sfxwhg7I?= =?us-ascii?Q?m5PrYnjnXkTJyC2MK5LjDIreszQWAw1Ol3Ws8bAFBVUHd5XS2z3wZZDaOygD?= =?us-ascii?Q?1OKcJxZFzROSCCqRZmJWceZeL/qYgs6XdizZT3mP6vvWylqto41nVkHu7elM?= =?us-ascii?Q?vi3YZLMOriYd9JY=3D?= 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)(34020700016)(1800799024)(36860700013)(82310400026)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2025 21:43:36.3546 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7977a475-1e84-496b-0656-08dd709d179f 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: SJ1PEPF00002313.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6589 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1743457453930019000 Content-Type: text/plain; charset="utf-8" The hardware domain is unable to seed a control domain, but we want the control domain to use xenstore. Rely on the hypervisor to seed dom0less grant table entries for Xenstore, so this seeding is unnecessary. However, that only works for the new xenstore late init. The legacy protocol which uses init-dom0less to populate the page still needs to seed the grant. Signed-off-by: Jason Andryuk --- tools/helpers/init-dom0less.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/helpers/init-dom0less.c b/tools/helpers/init-dom0less.c index 17579fe2e8..91edf17b6c 100644 --- a/tools/helpers/init-dom0less.c +++ b/tools/helpers/init-dom0less.c @@ -286,12 +286,12 @@ static int init_domain(struct xs_handle *xsh, xenstore_pfn); if (rc < 0) return rc; - } =20 - rc =3D xc_dom_gnttab_seed(xch, info->domid, true, - (xen_pfn_t)-1, xenstore_pfn, 0, 0); - if (rc) - err(1, "xc_dom_gnttab_seed"); + rc =3D xc_dom_gnttab_seed(xch, info->domid, true, + (xen_pfn_t)-1, xenstore_pfn, 0, 0); + if (rc) + err(1, "xc_dom_gnttab_seed"); + } =20 libxl_uuid_generate(&uuid); xc_domain_sethandle(xch, info->domid, libxl_uuid_bytearray(&uuid)); --=20 2.49.0 From nobody Fri Oct 31 23:30:14 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=1743457454; cv=pass; d=zohomail.com; s=zohoarc; b=W01NjARZGaKpbWO1wl3rn2J+b71cjaDex4m3k0WHd+8e5z+hc04MzY04bfPLbfTuWaT4TJ0mOIZuvyqB4cm7n3XuQMn30by5D+rHyFcef1wgwSn80O8Sf5Zi0rVWQmK8iLV2h7hbgi/3asp+VQ/bRcdtt2T0hCqtpYF6zSgbF5s= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1743457454; 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=fijYQspdfZFoThhaS1WIWMVtQUseoBzQfmLgz8dnLRI=; b=b84pkxj4uTacc3B7/wNiatBdoVpX36hE0V2glMjPmhwsyHHy+eeaM00AziX4pmP++WbitSnJCNOwie0tO5cgWGQspf5biaJaDVC3vRjYAmPwoFfIgxkAzd529zmzXfX5JlDOxuagyoV6P7bN1MV/8Li9sUNlJcTrK+Y5knhFLKk= 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 1743457454227809.7821424979737; Mon, 31 Mar 2025 14:44:14 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.933004.1335096 (Exim 4.92) (envelope-from ) id 1tzMv6-00069z-1Q; Mon, 31 Mar 2025 21:43:48 +0000 Received: by outflank-mailman (output) from mailman id 933004.1335096; Mon, 31 Mar 2025 21:43:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tzMv5-00069i-TI; Mon, 31 Mar 2025 21:43:47 +0000 Received: by outflank-mailman (input) for mailman id 933004; Mon, 31 Mar 2025 21:43:46 +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 1tzMv4-0004aC-9s for xen-devel@lists.xenproject.org; Mon, 31 Mar 2025 21:43:46 +0000 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on20607.outbound.protection.outlook.com [2a01:111:f403:200a::607]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 3790d7bf-0e79-11f0-9ea7-5ba50f476ded; Mon, 31 Mar 2025 23:43:45 +0200 (CEST) Received: from BN8PR15CA0009.namprd15.prod.outlook.com (2603:10b6:408:c0::22) by CH1PPF0316D269B.namprd12.prod.outlook.com (2603:10b6:61f:fc00::604) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8534.54; Mon, 31 Mar 2025 21:43:39 +0000 Received: from BL6PEPF00022571.namprd02.prod.outlook.com (2603:10b6:408:c0:cafe::2f) by BN8PR15CA0009.outlook.office365.com (2603:10b6:408:c0::22) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8583.39 via Frontend Transport; Mon, 31 Mar 2025 21:43:39 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by BL6PEPF00022571.mail.protection.outlook.com (10.167.249.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8606.22 via Frontend Transport; Mon, 31 Mar 2025 21:43:37 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 31 Mar 2025 16:43:37 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 31 Mar 2025 16:43:37 -0500 Received: from fedora.mshome.net (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Mon, 31 Mar 2025 16:43:36 -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: 3790d7bf-0e79-11f0-9ea7-5ba50f476ded ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=EEZW/IDiMen7Y7SuxTPCZ36jQxkhNKDNkqBd9GYuEDf/DfAea0cc7LdgYq1GpSMC1JFxL5l2mptk8VIBFGGejD4riRxpQCf0PZABx4rOJqR0eOk8KJ0sACMKuF/fdiCIcndyUwzuapf//1fB5xwoMGsGYAmoDJgHwgAKD7hylC0TvHjw7aL2UR4GpmUWov/nm2iUxBfy6p7letl0WjmhdroCjlGoBuskeTGaaF/Ly0Yha+dN1Xfmzm11yl1XUQqIbornqQ9KvhWFGLqxL+8t2HQqtqRwMK4P95wlDCBKEYZ+Wfyd0SUjISddh3WH/Lh5/UUnmCQBMCeDJuEh7jTSjQ== 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=fijYQspdfZFoThhaS1WIWMVtQUseoBzQfmLgz8dnLRI=; b=cee9CuueYi5vPoGosF6edylesJ7hSCxKllABUfGyyGNUMmukcWF114Zi+/SbbbdE9IDlpYTHBShuKRgTFTBe992S8nDFDDZdG5I3bmFwjZ9QD5OtxoWHdJPA28wzpnXChA9f3C7ET44pPQBGyHl+3h2Ig2WFggkXR3r3hXBwXq4zp21EopoX2cmmXZey2QggHTZzUQ2LwsGiqJfLv+TYO9W/6AWICMi5YXxwzGjqIzKbX1e+3bGUh1CWLvJVXbRw2EyBXh4GqiM9elTaq1K9SEfnRvVrOvela2PwWyB4ghMsbRQiC7t7vwXy1arqoTdTS6Df5pcMmd+o6NXUok7Ryw== 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=fijYQspdfZFoThhaS1WIWMVtQUseoBzQfmLgz8dnLRI=; b=churWQHjrUNOXAa5EJBikr8I4X2Y0nace2HidOaldfdbgKn/rjRm5+x2+t0QYF3Aa+JkYRxVH7oKHhIajvUZqiHu/DG6i9fw3cQG5PPWUFWdpcdyMmflZ+1rG91i8Iyqxo58PnEujIC+nQhvH8FGYcYE8bHhLr1+YlfZai/UcR0= 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=SATLEXMB03.amd.com; pr=C From: Jason Andryuk To: CC: Jason Andryuk , Stefano Stabellini , Julien Grall , Bertrand Marquis , Michal Orzel , "Volodymyr Babchuk" , Andrew Cooper , Anthony PERARD , "Jan Beulich" , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH v2 6/6] xen/arm: Add capabilities to dom0less Date: Mon, 31 Mar 2025 17:43:21 -0400 Message-ID: <20250331214321.205331-7-jason.andryuk@amd.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250331214321.205331-1-jason.andryuk@amd.com> References: <20250331214321.205331-1-jason.andryuk@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00022571:EE_|CH1PPF0316D269B:EE_ X-MS-Office365-Filtering-Correlation-Id: 28b1f1d1-62f0-4204-0c6a-08dd709d188c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|34020700016|82310400026|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?GrGLMk88tUv/ReFrs+v1f/KCTu7Nx2M/+bYZRhvrWrVGVmjV1i14i5tB1Kkd?= =?us-ascii?Q?mdODfD67oieEKodUQX5O10u7LDXRHLdVtjBWYYMfe0n6r6b34/OGTke8kRLE?= =?us-ascii?Q?0S8eppQLxdRm97xjyMm8NFp+p78uWpDsVhIP1D11CPgo152Xc8NqPX/HAlim?= =?us-ascii?Q?W68x9EDzZdwEV0tsr+BPDn/EW1eNsS0S2XB0duWWN7TUKMh/0CpbgMMx/InM?= =?us-ascii?Q?mbWJ+tWEwrKeKfC2CzxwCoxPJsP4WQV3aYob6apt8vo6hzfaokeigIgCwTFB?= =?us-ascii?Q?Ni1Z8KRloItHbO3RSQ1i4rIVLsYWukEsePnRn+bFFh/tKYd3vVHJ8qu2pbw1?= =?us-ascii?Q?P4A+UCWFIrqFLvph+74dNtHX5WkATr5W5YU3jKV9P33yxAelFO6lRhAFat+/?= =?us-ascii?Q?ANMAn8g8gmmOEPzdUec3LWaVQuJhxZeZZ+dXDh6rgtNMay/j5NOvfGb0COm9?= =?us-ascii?Q?fzRqcsjefU5eRhAUcbrH/24EOrBkfLl9hZEqgkWOhzmxMujpl+fHWQJJ+oLj?= =?us-ascii?Q?9ZFnMCg0Blo0chDedOGYVGAkFOjw+b7k+qMMDTzJISIeeXEPzrTbpjW+Sx84?= =?us-ascii?Q?HX07vP8+BABsJiWR208EzR2dTDRsiQQVDm11O6zKlKLS7f408JWaJRTBMLFZ?= =?us-ascii?Q?Q2zCyQKdtyqFAKfcCbZl06XPwB/KrJExt2k374zJ0imZK3aS59HacE/8V208?= =?us-ascii?Q?mqH+4gNRgQaKHoeb7yhrh6iyFXbzQrt1fv7NqhRj/3X3NGSnj+Z6O7rBanXU?= =?us-ascii?Q?yknrn26OSjm7i9FmeIno0ArU9Cs7CxG8dKje0T0e38NwlE6IEBaswzCLvAnW?= =?us-ascii?Q?TfDULY0amwO/RoV4PTO4L6dWw+JuYwF9MxWgnneic3/VW3gBS2nlmGDOlU/M?= =?us-ascii?Q?XEdAo/pzQTNdGP0PmEViCch08atA15F56fHrBIDX2hORQkystq5lk8qjDobt?= =?us-ascii?Q?ZSHE8glaFQGZGzWmqfR/SRHcAVYiSaAeVhPliPnenImmztmihuBmiaD0puBZ?= =?us-ascii?Q?EFXe4iFnqNMtSsDJnVqGZOuZJet0Ok0jqaQLpr7f1rtTvn3ITsLKnia4/Kxp?= =?us-ascii?Q?uf/K8rXxy53E9uUpenJnDjZWUQtTa4rODjJuEWF3QA+LDN/WKUiD/jXS9m9C?= =?us-ascii?Q?7iI/jxjMxkmCFuWeP2avVwUFqZ5EM9rle9Mae64wLimN7sIOPAnXWr62Fm6e?= =?us-ascii?Q?Xb8SaN1YqFrTXXIi8t8XjkN15mxQ1sevrVeCSGDVjqDyVZnYuHuuDeX3EJ3A?= =?us-ascii?Q?L0zeCor0aqEf5Bys1QWo4HT6iIPyUuA96/gg1G1qOoVoS7+fwPVKBBwCR30B?= =?us-ascii?Q?Qmp96V/qHvuyAIWllSAQQQbgdvTVLO0T/7avzBx9YVi6Y9j55/KNKOQsScaP?= =?us-ascii?Q?GJQdkwChBAJ4nM60kdbkqeC/nYeeHozgs59XiH2xS5SAER/bhYGyeQzqLz6F?= =?us-ascii?Q?SNeADNToHgqeDn3EB9EAROw0jvV3c2KQ2lxaOMQPGdHJiG735oKZyR3Ff2dP?= =?us-ascii?Q?WK2l2Cnq55o3N3w=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(34020700016)(82310400026)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2025 21:43:37.9236 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 28b1f1d1-62f0-4204-0c6a-08dd709d188c 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=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00022571.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH1PPF0316D269B X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1743457464645019100 Content-Type: text/plain; charset="utf-8" Add capabilities property to dom0less to allow building a disaggregated system. Only a single hardware domain and single xenstore domain can be specified. Multiple control domains are possible. Introduce bootfdt.h to contain these constants. When using the hardware or xenstore capabilities, adjust the grant and event channel limits similar to dom0. For a hardware domain, require an IOMMU and disallow specifying a vpl011 console or nr_spis. Signed-off-by: Jason Andryuk --- v2: Fix comment style Make DOMAIN_CAPS_* unsigned Remove forced directmap & iommu Require iommu with use of hardware domain Limit to a single xenstore domain There is overlap with hyperlaunch. The numeric values are the same. Hyperlaunch doesn't expose the values in a public header as done here. Is this to be expected for dom0less? It seems most of dom0less isn't in a header, but just in docs. Hyperlaunch uses BUILD_CAPS_, but I chose DOMAIN_CAPS_ since there are domain-level capabilities. Only a single xenstore and hardware domain make sense. Hardware domain receiving all hardware can only have a single domain. For Xenstore, the logic latches the single xs_domid and uses that for all domains. Also, only a single domain can register for VIRQ_DOM_EXC. --- docs/misc/arm/device-tree/booting.txt | 11 ++++++++ xen/arch/arm/dom0less-build.c | 39 +++++++++++++++++++++++++++ xen/arch/arm/domain.c | 3 ++- xen/include/public/bootfdt.h | 31 +++++++++++++++++++++ 4 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 xen/include/public/bootfdt.h diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-t= ree/booting.txt index ac781c9cc8..490c792ddf 100644 --- a/docs/misc/arm/device-tree/booting.txt +++ b/docs/misc/arm/device-tree/booting.txt @@ -167,6 +167,17 @@ with the following properties: Refer to docs/misc/cache_coloring.rst for syntax. This option is appli= cable only to Arm64 guests. =20 +- capabilities + Optional. A bit field of domain capabilities for a disaggregated + system. A traditional dom0 has all all of these capabilities, and a + domU has none of them. + + 0x1 DOMAIN_CAPS_CONTROL - A privileged, control domain + 0x2 DOMAIN_CAPS_HARDWARE - The hardware domain - there can be only 1 + 0x4 DOMAIN_CAPS_XENSTORE - The xenstore domain - there can be only 1 + + The default is no capabilities. + - vpl011 =20 An empty property to enable/disable a virtual pl011 for the guest to diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c index fc515c9852..1cb6c170a7 100644 --- a/xen/arch/arm/dom0less-build.c +++ b/xen/arch/arm/dom0less-build.c @@ -12,6 +12,7 @@ #include #include =20 +#include #include =20 #include @@ -906,6 +907,8 @@ static int __init construct_domU(struct domain *d, d->max_vcpus, mem); =20 kinfo.vpl011 =3D dt_property_read_bool(node, "vpl011"); + if ( kinfo.vpl011 && is_hardware_domain(d) ) + panic("hardware domain cannot specify vpl011\n"); =20 rc =3D dt_property_read_string(node, "xen,enhanced", &dom0less_enhance= d); if ( rc =3D=3D -EILSEQ || @@ -1020,6 +1023,40 @@ void __init create_domUs(void) if ( (max_init_domid + 1) >=3D DOMID_FIRST_RESERVED ) panic("No more domain IDs available\n"); =20 + if ( dt_property_read_u32(node, "capabilities", &val) ) + { + if ( val & ~DOMAIN_CAPS_MASK ) + panic("Invalid capabilities (%"PRIx32")\n", val); + + if ( val & DOMAIN_CAPS_CONTROL ) + flags |=3D CDF_privileged; + + if ( val & DOMAIN_CAPS_HARDWARE ) + { + if ( hardware_domain ) + panic("Only 1 hardware domain can be specified! (%pd)\= n", + hardware_domain); + + if ( !iommu_enabled ) + panic("iommu required for dom0less hardware domain\n"); + + d_cfg.max_grant_frames =3D gnttab_dom0_frames(); + d_cfg.max_evtchn_port =3D -1; + flags |=3D CDF_hardware; + iommu =3D true; + } + + if ( val & DOMAIN_CAPS_XENSTORE ) + { + if ( xs_domid !=3D DOMID_INVALID ) + panic("Only 1 xenstore domain can be specified! (%u)\n= ", + xs_domid); + + d_cfg.flags |=3D XEN_DOMCTL_CDF_xs_domain; + d_cfg.max_evtchn_port =3D -1; + } + } + if ( dt_find_property(node, "xen,static-mem", NULL) ) { if ( llc_coloring_enabled ) @@ -1082,6 +1119,8 @@ void __init create_domUs(void) d_cfg.arch.nr_spis =3D MAX(d_cfg.arch.nr_spis, vpl011_virq - 32 + 1); } + else if ( flags & CDF_hardware ) + panic("nr_spis cannot be specified for hardware domain\n"); =20 /* Get the optional property domain-cpupool */ cpupool_node =3D dt_parse_phandle(node, "domain-cpupool", 0); diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 3ba959f866..dc4b4e84c1 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -608,7 +608,8 @@ int arch_sanitise_domain_config(struct xen_domctl_creat= edomain *config) { unsigned int max_vcpus; unsigned int flags_required =3D (XEN_DOMCTL_CDF_hvm | XEN_DOMCTL_CDF_h= ap); - unsigned int flags_optional =3D (XEN_DOMCTL_CDF_iommu | XEN_DOMCTL_CDF= _vpmu); + unsigned int flags_optional =3D (XEN_DOMCTL_CDF_iommu | XEN_DOMCTL_CDF= _vpmu | + XEN_DOMCTL_CDF_xs_domain ); unsigned int sve_vl_bits =3D sve_decode_vl(config->arch.sve_vl); =20 if ( (config->flags & ~flags_optional) !=3D flags_required ) diff --git a/xen/include/public/bootfdt.h b/xen/include/public/bootfdt.h new file mode 100644 index 0000000000..86c46b42a9 --- /dev/null +++ b/xen/include/public/bootfdt.h @@ -0,0 +1,31 @@ +/* SPDX-License-Identifier: MIT */ +/* + * Xen Device Tree boot information + * + * Information for configuring Xen domains created at boot time. + */ + +#ifndef __XEN_PUBLIC_BOOTFDT_H__ +#define __XEN_PUBLIC_BOOTFDT_H__ + +/* + * Domain Capabilities specified in the "capabilities" property. Use of + * this property allows splitting up the monolithic dom0 into separate, + * less privileged components. A regular domU has no capabilities + * (which is the default if nothing is specified). A traditional dom0 + * has all three capabilities. + */ + +/* Control/Privileged domain capable of affecting other domains. */ +#define DOMAIN_CAPS_CONTROL (1U << 0) +/* + * Hardware domain controlling physical hardware. Typically providing + * backends to other domains. + */ +#define DOMAIN_CAPS_HARDWARE (1U << 1) +/* Xenstore domain. */ +#define DOMAIN_CAPS_XENSTORE (1U << 2) +#define DOMAIN_CAPS_MASK (DOMAIN_CAPS_CONTROL | DOMAIN_CAPS_HARDWARE |= \ + DOMAIN_CAPS_XENSTORE) + +#endif /* __XEN_PUBLIC_BOOTFDT_H__ */ --=20 2.49.0