From nobody Fri Mar 14 13:20:53 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=1738804171; cv=pass; d=zohomail.com; s=zohoarc; b=Zy4EfwhGAdiJf+YYoaN+DdXEabn3X1Ac1Nfiwg+ghd4f8PE34c5LGL74UiE1ftn3N6WRizMkIZuCdgPBvEb3qDbz2Fb0Iho2/VJEls8UZQE/fPJO76KOy+w2H2zwNYabJ/LE9UMmu1QUg1Lrzpf7gGByS2UvHzNUbJpZNUE851E= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1738804171; 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=6yE3UkDG2JBxdiFE2UeD3PKz4jv0din3OBPUIrMyGvY=; b=nYpN26ULd5zXBI9MVLPc5jZ0trUxmHOBBMpMEm0x5MtRIKedPcMq52eZ9LukVft8LLiolBqDk87KqAHzmT9jdTbEuH2iFJgCCrNYzNA4C6ZWxEq4yRAKwk289bPCEGjcfuUoPSE/+RJ9146Oasv1yJHSWjBGHDy/10MP15k8e8A= 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 1738804171675926.9914923950137; Wed, 5 Feb 2025 17:09:31 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.882397.1292587 (Exim 4.92) (envelope-from ) id 1tfqO5-0000Xa-Sg; Thu, 06 Feb 2025 01:09:01 +0000 Received: by outflank-mailman (output) from mailman id 882397.1292587; Thu, 06 Feb 2025 01:09:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tfqO5-0000WO-Ds; Thu, 06 Feb 2025 01:09:01 +0000 Received: by outflank-mailman (input) for mailman id 882397; Thu, 06 Feb 2025 01:09:00 +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 1tfqO4-0007da-3v for xen-devel@lists.xenproject.org; Thu, 06 Feb 2025 01:09:00 +0000 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on20607.outbound.protection.outlook.com [2a01:111:f403:200a::607]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id f040869d-e426-11ef-99a4-01e77a169b0f; Thu, 06 Feb 2025 02:08:57 +0100 (CET) Received: from CH2PR11CA0005.namprd11.prod.outlook.com (2603:10b6:610:54::15) by SJ1PR12MB6339.namprd12.prod.outlook.com (2603:10b6:a03:454::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8422.10; Thu, 6 Feb 2025 01:08:52 +0000 Received: from CH1PEPF0000AD7A.namprd04.prod.outlook.com (2603:10b6:610:54:cafe::29) by CH2PR11CA0005.outlook.office365.com (2603:10b6:610:54::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8398.24 via Frontend Transport; Thu, 6 Feb 2025 01:08:52 +0000 Received: from SATLEXMB03.amd.com (165.204.84.17) by CH1PEPF0000AD7A.mail.protection.outlook.com (10.167.244.59) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8398.14 via Frontend Transport; Thu, 6 Feb 2025 01:08:52 +0000 Received: from SATLEXMB03.amd.com (10.181.40.144) 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; Wed, 5 Feb 2025 19:08:51 -0600 Received: from smtp.xilinx.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Wed, 5 Feb 2025 19:08:51 -0600 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: f040869d-e426-11ef-99a4-01e77a169b0f ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PD624XyZUe+0nx27efOKe5KE1uUdKd4hUTe+jWP15dOaDDk7xAyIW2VYjQr6BQRQ27I55QkQe2fTmgYXGFsD/w1K/TRHNJK7bndrxEWB87rCamY5vU+8TNodYt1iB73ULaG2mPeKAaUIKWRtk+yQK+BfsWndIayAmPFVxqhrQKrPqub6WaaqGbM84zdaxNTUuJ4bVT7xB8eW0ido740/oS/dga++J+SkV9eGUssYLOXxH9/CwxnW/ghm28HDq+qfZqqV+Kiw3pv5CjLqKBCumnM3Ug/pexHZZxIv9aeCNMgtNwmOl9MBqSPPF1hTkHuqhQw6P4gfnHCXqAO+/cdCZA== 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=6yE3UkDG2JBxdiFE2UeD3PKz4jv0din3OBPUIrMyGvY=; b=lr5duhwALWOUCXDof7xmlC6wkCav/i4Pp1VICXAAFJFzLIwqgoEFcjfpkmF5/skdiO9LjWvrV6Lohmq0ktlIj7myhceDriuiy6hCy3E+cxn7kG2F8PB9M+PAZB6HcmN3xys1umSL4kUCqgn4ineku8S2n8XHM+sgncHvYoeLYcBo5GRtCqspZt47Pj2FqzjuaxVenA7ZWH3cvN1qDa8cRDB3yM10G1ZN4GHUWuTLpu1frHDaR9Cb12DRRJULR3x1cDY9GE/2ktDXpF3Vxwj/3MNi4J5Y9TJycupeUTguorRetHHvdSRr+YN9Tl4sbVSqOIV3agtMA8SxFrBSaofLrA== 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=6yE3UkDG2JBxdiFE2UeD3PKz4jv0din3OBPUIrMyGvY=; b=43axQEV5GHwVqcd5z8MenVK952yY+MteaeQeEUmAAOFcfbOP0l9c1rpwBJt1A/3w1Gm7fCaoBwONt+GvM+2JnAUJnpXDMFSoyFm4Nx2NNpTL/uGgxZV/LpCYliutzdu/TkZ0zX+co6yZrNLPrYEXLRB1FfZ8hA0OVHIrGfhGDew= 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: Stefano Stabellini To: CC: , , , , , Stefano Stabellini Subject: [PATCH v5 8/9] xen/arm: introduce legacy dom0less option for xenstore allocation Date: Wed, 5 Feb 2025 17:08:42 -0800 Message-ID: <20250206010843.618280-8-stefano.stabellini@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: None (SATLEXMB03.amd.com: stefano.stabellini@amd.com does not designate permitted sender hosts) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH1PEPF0000AD7A:EE_|SJ1PR12MB6339:EE_ X-MS-Office365-Filtering-Correlation-Id: cf99e408-3981-46d8-19c7-08dd464ad26e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?woA6GVZzx7s7pQuVmsFSiclIgHsul2dDeL8znWdIVuQgELMxV3p8Ss4Lh7dv?= =?us-ascii?Q?dMU17bLKdNAnwsJgafgCc9o4WI3xPC649CpCBBpeiC3kNoyXBKZx/cWW5hDT?= =?us-ascii?Q?oeoorKcmmq0F9IxTnaU7QnfA4DvRxwK1WJUzp6xvkuBIQxuCnWlDdHUMmSC8?= =?us-ascii?Q?kuou3y1EgKLg52hJ0sWVDJoCdOD/FmPekPdyKj2NrRNaRX+mdidlHx/tyjxj?= =?us-ascii?Q?65QUqMh/UXRUtn6YyTXv2VaktkfR3GiUl+nmiW+uLFDwYm6JR/5GgQPzOeYI?= =?us-ascii?Q?NcAm9GxnPaa6EDPiBoaG4EYpSf3tgcmEB3WeknnaddgRYPVQlrMRmaHzhbqZ?= =?us-ascii?Q?+dow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gntWrg4sMnlZJHct/kgrPNjf?= =?us-ascii?Q?Rq97r8SCayVXXfHzDENcVRQoxlVppHYu3cXKEjG02yGe2dmvzhE78TTSTiYv?= =?us-ascii?Q?cjaa3xbOYNmaYNqbyAVuF6H6zsff3Sb7uX5TOhwdl+OY7KiHm7F4MCcLdOAY?= =?us-ascii?Q?mkrjP76YmPhTN7nR0/+H6iSXU8vubgfecH0q+5DWOAAXSJnVtBWUpLDt6kxF?= =?us-ascii?Q?O7w7X7KzvvIn432oVPxQ2gr+JToQY+v2c25IG/C6ACPXX60E9DFHp6IPXi1E?= =?us-ascii?Q?x0WWJ12H5kmrCio=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)(376014)(36860700013)(82310400026);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Feb 2025 01:08:52.7652 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cf99e408-3981-46d8-19c7-08dd464ad26e 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: CH1PEPF0000AD7A.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ1PR12MB6339 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1738804173071019100 Content-Type: text/plain; charset="utf-8" The new xenstore page allocation scheme might break older unpatches Linux kernels that do not check for the Xenstore connection status before proceeding with Xenstore initialization. Introduce a dom0less configuration option to retain the older behavior, which is not compatible with 1:1 mapped guests, but it will work with older legacy kernel versions. Signed-off-by: Stefano Stabellini --- docs/misc/arm/device-tree/booting.txt | 5 +++++ xen/arch/arm/dom0less-build.c | 13 ++++++++++++- xen/arch/arm/include/asm/kernel.h | 14 +++++++++++--- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-t= ree/booting.txt index ff70d44462..8fa3da95be 100644 --- a/docs/misc/arm/device-tree/booting.txt +++ b/docs/misc/arm/device-tree/booting.txt @@ -222,6 +222,11 @@ with the following properties: Xen PV interfaces, including grant-table and xenstore, will be enabled for the VM. =20 + - "legacy" + Same as above, but the way the xenstore page is allocated is not + compatible with 1:1 mapped guests. On the other hand, it works with + older Linux kernels. + - "disabled" Xen PV interfaces are disabled. =20 diff --git a/xen/arch/arm/dom0less-build.c b/xen/arch/arm/dom0less-build.c index 046439eb87..9afdbca8b8 100644 --- a/xen/arch/arm/dom0less-build.c +++ b/xen/arch/arm/dom0less-build.c @@ -799,6 +799,13 @@ static int __init construct_domU(struct domain *d, else panic("At the moment, Xenstore support requires dom0 to be pre= sent\n"); } + 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"); + } else if ( rc =3D=3D 0 && !strcmp(dom0less_enhanced, "no-xenstore") ) kinfo.dom0less_feature =3D DOM0LESS_ENHANCED_NO_XS; =20 @@ -848,13 +855,17 @@ static int __init construct_domU(struct domain *d, if ( rc < 0 ) return rc; =20 - if ( kinfo.dom0less_feature & DOM0LESS_XENSTORE ) + if ( kinfo.dom0less_feature & (DOM0LESS_XENSTORE|DOM0LESS_XS_LEGACY) ) { ASSERT(hardware_domain); rc =3D alloc_xenstore_evtchn(d); if ( rc < 0 ) return rc; + d->arch.hvm.params[HVM_PARAM_STORE_PFN] =3D ~0ULL; + } =20 + if ( kinfo.dom0less_feature & DOM0LESS_XENSTORE ) + { rc =3D alloc_xenstore_page(d); if ( rc < 0 ) return rc; diff --git a/xen/arch/arm/include/asm/kernel.h b/xen/arch/arm/include/asm/k= ernel.h index de3f945ae5..4c2ae0b32b 100644 --- a/xen/arch/arm/include/asm/kernel.h +++ b/xen/arch/arm/include/asm/kernel.h @@ -17,16 +17,24 @@ * default features (excluding Xenstore) will be * available. Note that an OS *must* not rely on = the * availability of Xen features if this is not se= t. - * DOM0LESS_XENSTORE: Xenstore will be enabled for the VM. This feat= ure - * can't be enabled without the - * DOM0LESS_ENHANCED_NO_XS. + * DOM0LESS_XENSTORE: Xenstore will be enabled for the VM. The + * xenstore page allocation is done by Xen at + * domain creation. This feature can't be + * enabled without the DOM0LESS_ENHANCED_NO_XS. + * DOM0LESS_XS_LEGACY Xenstore will be enabled for the VM, the + * xenstore page allocation will happen in + * init-dom0less. This feature can't be enabled + * without the DOM0LESS_ENHANCED_NO_XS. * DOM0LESS_ENHANCED: Notify the OS it is running on top of Xen. All= the * default features (including Xenstore) will be * available. Note that an OS *must* not rely on = the * availability of Xen features if this is not se= t. + * DOM0LESS_ENHANCED_LEGACY:Same as before, but using DOM0LESS_XS_LEGACY. */ #define DOM0LESS_ENHANCED_NO_XS BIT(0, U) #define DOM0LESS_XENSTORE BIT(1, U) +#define DOM0LESS_XS_LEGACY BIT(2, U) +#define DOM0LESS_ENHANCED_LEGACY (DOM0LESS_ENHANCED_NO_XS | DOM0LESS_XS_LE= GACY) #define DOM0LESS_ENHANCED (DOM0LESS_ENHANCED_NO_XS | DOM0LESS_XENST= ORE) =20 struct kernel_info { --=20 2.25.1