From nobody Mon Apr 13 03:42:42 2026 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=1770989900; cv=pass; d=zohomail.com; s=zohoarc; b=Q8M7KlPx56Oug0B9jkPZwhpgykD/hCouCkmIU6lfhIlovqs08+Crs4KO+nizyBPHn5ebVMlmb1OxwMZoLCETJ3XcIE1qGH0zFaOvg4jTVvmSHEvlwyFGGVN5GH69XAIcYPWJT2mXDLPzam8fcZLoJRXfZXiZMfn+z0REXqsQVxY= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770989900; 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=OfExmNOBgyzV/W769nG2O1sMuHbppnbUF9pYKKsd9Bo=; b=lk3G0neNBn4D1zEd09ilgR+uDOogvps9M2CZQOEcr4ka12UVg0ZCga3oa8/gu3FwGh5N3VHuJipwr3N9Fr85xkz5yXPWgQxKAumsm8DVp9pEK06Xxl0jQ01l/MK2O9jFFezKy1UiCKVRMFnVNVqOIoFB09xgEIkA+D3S2Vj2dno= 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 1770989900598700.7170697415597; Fri, 13 Feb 2026 05:38:20 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1230931.1536302 (Exim 4.92) (envelope-from ) id 1vqtMw-0001fJ-8T; Fri, 13 Feb 2026 13:38:02 +0000 Received: by outflank-mailman (output) from mailman id 1230931.1536302; Fri, 13 Feb 2026 13:38:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vqtMw-0001fC-5I; Fri, 13 Feb 2026 13:38:02 +0000 Received: by outflank-mailman (input) for mailman id 1230931; Fri, 13 Feb 2026 13:38:01 +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 1vqtMv-0001dN-5H for xen-devel@lists.xenproject.org; Fri, 13 Feb 2026 13:38:01 +0000 Received: from CH4PR04CU002.outbound.protection.outlook.com (mail-northcentralusazlp170130007.outbound.protection.outlook.com [2a01:111:f403:c105::7]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 34f37f2d-08e1-11f1-9ccf-f158ae23cfc8; Fri, 13 Feb 2026 14:37:58 +0100 (CET) Received: from BYAPR07CA0057.namprd07.prod.outlook.com (2603:10b6:a03:60::34) by CY3PR12MB9678.namprd12.prod.outlook.com (2603:10b6:930:101::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9611.13; Fri, 13 Feb 2026 13:37:51 +0000 Received: from MWH0EPF000A672F.namprd04.prod.outlook.com (2603:10b6:a03:60:cafe::1e) by BYAPR07CA0057.outlook.office365.com (2603:10b6:a03:60::34) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9611.10 via Frontend Transport; Fri, 13 Feb 2026 13:37:51 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by MWH0EPF000A672F.mail.protection.outlook.com (10.167.249.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9611.8 via Frontend Transport; Fri, 13 Feb 2026 13:37:51 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Fri, 13 Feb 2026 07:37:49 -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: 34f37f2d-08e1-11f1-9ccf-f158ae23cfc8 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WhVkPyDXl7Z8VCbJjEt+oxoKIBCMT/ozco1rnnNTbQvAkFmFqVvOlw/8n6Bm2reZ6um6ZxLX5rgNxl8zvtwz2e5B32tgOwQwO4VXgz3eqn2IshZbRebgF2tYinB9nHhkjMv+fvT368/NlaiBjTpQTkpIC1bdRHEfAKnLy2GfPBzW+zyOL2R17Lv32Qylbr2ivhU+KrCfKg16SF7tSbFp2N2e/ikq/YhbRNkjRxmYtNePn/vh1FIYMBGqDgMaosyvXTDKX0neFHwRTGmyIdtZ0iO5qMWJqiHBqR7i+21oQU2L7f3vFGlUL6fEo2V/SqHUp9B4pl82YW7rhHTRito//g== 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=OfExmNOBgyzV/W769nG2O1sMuHbppnbUF9pYKKsd9Bo=; b=laFjq7VPZRpck3q47GM9cPx9kfKw+R0qtkcGemVGFkTqXVOHypkUfyqSGBkhJgzS5MqFrF7cD7Q7Pi2Yx73y/nSzIu3R/CEQshgj9+EIgSwu60LOz5R1G+l9MOyKlruQS4hEadjr6SSv9iBvniicSZNpmXsKr9D1BuvBkIeW2yXC0MZChnGahHDvDe08wyEIoNNZnvOjlSgQeW9m1Abuc/QjqV6kY6dtPs28OW3I2Y8A8nAZDodNxbRNGsBmwZ9Z5AUDpHSxWyL7soSaXL+QMKVoUgQo/2/b4cV2Ftjez9qJvUOx5YHgiX+n4getAPo5tetFcCmFfd4iYeF66gG4+g== 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=OfExmNOBgyzV/W769nG2O1sMuHbppnbUF9pYKKsd9Bo=; b=Fs9MNQdiED4wvPDtIhLLyY0vPadZBz/WjwvFEz/kL4wBO28p40BcsPzID6a9zvI3tWCj0YGgIIqR9uHmOd8VSwT9EVUHdWJRA7cyt4hwqLacQMU367DXrdATbxsOFye6aAdOxrrBBySoxIPNS517+C8g1foFXGQLq4WygtSp72g= 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=satlexmb07.amd.com; pr=C From: Alejandro Vallejo To: CC: Alejandro Vallejo , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [PATCH 1/2] x86: Make hvm_enabled a constant unless both PV and HVM are both compiled Date: Fri, 13 Feb 2026 14:37:29 +0100 Message-ID: <20260213133732.132326-2-alejandro.garciavallejo@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260213133732.132326-1-alejandro.garciavallejo@amd.com> References: <20260213133732.132326-1-alejandro.garciavallejo@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000A672F:EE_|CY3PR12MB9678:EE_ X-MS-Office365-Filtering-Correlation-Id: d3256332-3642-49f9-565a-08de6b051598 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Edc0dVF5fTqqm9QHL3dyyrnMBvysRlRMAZYG/vSoYOUC6n207G8/eJbqmczn?= =?us-ascii?Q?3EO6O0GasuFwpAZIIuFSEDYfCKHi1IaesqGzVTuV2xOpfLZ9TBJz43gjvz9X?= =?us-ascii?Q?9QqgBcG14ei+nUt88hDSb/xen+IY3fJhMPcLaQ86I9oIMY3xVu1QBvhMt0wm?= =?us-ascii?Q?hN7Z5nTH1dPbY1GTgd6gGwjCh3tXm0cD2x3v4tFRU0iZDBA7kiM+btW0EJww?= =?us-ascii?Q?Fo+nQz2qhGhOw6RT1T7S6jYpXCu70uT8T0V+3Ar8DYO8KD9LvFH+F1gB5aHY?= =?us-ascii?Q?C68+xoypE2TMnTGf/63y4BGXWE8b8eIJ5L3DIVmvbLyw9676GaFuv4ekVY95?= =?us-ascii?Q?/NfZogT64wnJfeRbT3GBYrQaibr5SOjxl+QcZJSZa+IJ6h6RIzeImr6GWBnq?= =?us-ascii?Q?LBNIf2q+FTld375A/WqnZppnaYZo/1EvpmIiVRYWu5Gn2db3J2thtrb1PvCw?= =?us-ascii?Q?AZtJ2X1iigYk0B0+0rvqBXlSaiSAs0vesEsUfg5n1yF/ykdaFBCNBxExhYD2?= =?us-ascii?Q?DKiL0CYuCWojFQx3U71BHlxp47sOF1D8iS38VJ+hkhhyMum0IgV2lZ+3NDox?= =?us-ascii?Q?nYjy9WkLVWUeDKChe63SDjXfkZZiXTyNklAy/Cmmv7mbgCSkKjxwUInXhfMJ?= =?us-ascii?Q?knMwauWyF4qWkuYI8Vcl/7BZ2+qtWeiwOEr2kcr/N9VpfAgr2ANIk+asBBgI?= =?us-ascii?Q?0r4h/56xMOS2UsFVQKTUbKZx48iLOGfo9aAGWJOUjYy5+hcR2AwQVOuSmxy3?= =?us-ascii?Q?ZWii88+GcE/waYNGtoyIuGlqUqsgxzsYGRoXQX6jyTVZtb6TPOJPZqdISZVp?= =?us-ascii?Q?H5kKDqYmTwo7LgODTh/gFxkShdvYs1I7p9t76NYTaTjNVLvi2X1aOJe0giA9?= =?us-ascii?Q?nYSca/1oTM6lBpBIGmSvIMDOBZd3IVJfMSMn4Vi/UJ3L5uoU+izk6kOLyJyt?= =?us-ascii?Q?2kSTrVY1I0pAdfS058DY8jUL/ss0L4tRO6kMKrI8NaQWivmAKhuZOSZp7RHG?= =?us-ascii?Q?1eUA0oG2u1BFqQ9oueU9n1Sij7rT34ETS9BtK6RUTTj0bAL/FJrv2eQkBFgC?= =?us-ascii?Q?SL1HD1aMkhs9tbxK5kQkHykk2IrotmRup39FDXpV6lSI85QfXVF8ygtFSTa9?= =?us-ascii?Q?dLvxPijLNqOSzry4ZjbNIOxqR3HmhbI8temuPzdyLMz5V9onu5smtL5+qeTC?= =?us-ascii?Q?F4bOWGPStV0Zme6PEH4DXHh7lmn6NG5sCSE80yC5gOspzUOoG5IF40GMa4hu?= =?us-ascii?Q?9IzhlHvKWMMA6lFT1yy+sGTxQcrQ6V9ZwrCWfvJKhkqWB0F7iPY1wxG5S+6S?= =?us-ascii?Q?REu3Ustg53MiakvXpZgOH0FRqVuykLioYl24fFD1DEAbs+UG6Bh/kz3KzFU3?= =?us-ascii?Q?YVyaF+Lcx5uHypTejjAFaa+plLkyx/nEFAGQ9ECIiB9wiPsjtGaJpZGjMvar?= =?us-ascii?Q?WcjuApMhaJwMh1dGwxYNAY9hvSn0rRe7ozBmo9kpv3FlqTExozWcSxM/Ux4a?= =?us-ascii?Q?dOYnax6BEMHpz57suRom+VgEtRJ1uQQ9HEYJlNLHW6GqPrtg6xdobC9CXTZG?= =?us-ascii?Q?pEezTAijZ44wElGaOyhP1OaEnSSwsQm83mOk+hyjmwQHJ2s/k44OfWG6wH/m?= =?us-ascii?Q?rxizI19X82w6+Fea+7KMwtyq3Jt2PRGf2GbI/+r4HK4NCn+4iUb7xK7UU4tt?= =?us-ascii?Q?HDAfHg=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7TwNE+HKVD7l5k2VWCJVXoRqRca5fcPyb2vsTcJ3VUdEqtzLsH5rcpOnGLho5oioYL0NlBugB5MwNbgvU49u3rW2cA/uPBT2TnMiDYlftndc43ImpFgztOSNxm5Ea6rPQ5uzDKNjind62RzjN6YdgDxfP/kN5sgpoentNTo+SdeanPgJ4mX2aI+lEpA/tUpOOpKoB+vMw7GErBpnIPMLkNp5xp7eUdN/3R2aKXfn01F8AN2gAMtVU8p53teRtuxB5f3nbjHsdJvq42W1ZyIRPLdVTirwH8gdzy2Z75s+FtzGdSoLUgg7cfCL4BZrAYshlEVTzVr2DK0iOJi32WJ+LFys+ztQkNwYzF3so1pIG2GClWHuUvIRWEXetAtidHLTlOzSkSVCnldjTU+YBsNkgYRTJTdGJNN7ZVhJbZAVFnqJS51apBuTXSFGsLls3cdo X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2026 13:37:51.3166 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d3256332-3642-49f9-565a-08de6b051598 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000A672F.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY3PR12MB9678 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1770989902089154100 Content-Type: text/plain; charset="utf-8" PV-shim already has hvm_enabled optimised to false, but there's no reason HVM-only builds can't benefit from the same optimisation as long as we add a boot-time panic in case HVM support is missed. Many branches go away, some in the potentially hot switch_cr3_cr4. HVM-only: add/remove: 0/1 grow/shrink: 1/9 up/down: 1/-162 (-161) Function old new delta arch_do_physinfo 79 80 +1 hvm_enabled 1 - -1 symbols_offsets 30732 30728 -4 symbols_names 108029 108022 -7 symbols_sorted_offsets 60656 60648 -8 flush_area_local 571 562 -9 switch_cr3_cr4 311 300 -11 init_xen_cap_info 62 43 -19 arch_sanitise_domain_config 885 863 -22 init_guest_cpu_policies 1270 1247 -23 hvm_domain_initialise 1127 1069 -58 Total: Before=3D3797004, After=3D3796843, chg -0.00% With hvm_enabled const-ified, it's fine to take hvm_flush_guest_tlbs() outside the CONFIG_HVM ifdef and remove the stub. They compile to the same code after DCE. Signed-off-by: Alejandro Vallejo --- xen/arch/x86/hvm/hvm.c | 9 +++++++++ xen/arch/x86/include/asm/hvm/hvm.h | 30 +++++++++++++++--------------- 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 4d37a93c57..da56944e74 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -72,7 +72,9 @@ =20 #include =20 +#ifdef CONFIG_PV bool __read_mostly hvm_enabled; +#endif /* CONFIG_PV */ =20 #ifdef DBG_LEVEL_0 unsigned int opt_hvm_debug_level __read_mostly; @@ -173,9 +175,16 @@ static int __init cf_check hvm_enable(void) svm_fill_funcs(); =20 if ( fns =3D=3D NULL ) + { + if ( !IS_ENABLED(CONFIG_PV) ) + panic("HVM support not detected and PV compiled-out\n"); + return 0; + } =20 +#ifdef CONFIG_PV hvm_enabled =3D 1; +#endif /* CONFIG_PV */ =20 printk("HVM: %s enabled\n", fns->name); if ( !hap_supported(&hvm_funcs) ) diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/= hvm/hvm.h index 7d9774df59..dc609bf4cb 100644 --- a/xen/arch/x86/include/asm/hvm/hvm.h +++ b/xen/arch/x86/include/asm/hvm/hvm.h @@ -261,7 +261,11 @@ struct hvm_function_table { }; =20 extern struct hvm_function_table hvm_funcs; +#if defined(CONFIG_PV) && defined(CONFIG_HVM) extern bool hvm_enabled; +#else +#define hvm_enabled IS_ENABLED(CONFIG_HVM) +#endif extern int8_t hvm_port80_allowed; =20 extern const struct hvm_function_table *start_svm(void); @@ -399,6 +403,17 @@ static inline bool using_svm(void) #define hvm_is_in_uc_mode(d) \ (using_vmx() && (d)->arch.hvm.vmx.in_uc_mode) =20 +/* + * Called to ensure than all guest-specific mappings in a tagged TLB are + * flushed; does *not* flush Xen's TLB entries, and on processors without a + * tagged TLB it will be a noop. + */ +static inline void hvm_flush_guest_tlbs(void) +{ + if ( hvm_enabled ) + hvm_asid_flush_core(); +} + #ifdef CONFIG_HVM =20 #define hvm_get_guest_tsc(v) hvm_get_guest_tsc_fixed(v, 0) @@ -498,17 +513,6 @@ static inline void hvm_set_tsc_offset(struct vcpu *v, = uint64_t offset) alternative_vcall(hvm_funcs.set_tsc_offset, v, offset); } =20 -/* - * Called to ensure than all guest-specific mappings in a tagged TLB are=20 - * flushed; does *not* flush Xen's TLB entries, and on processors without = a=20 - * tagged TLB it will be a noop. - */ -static inline void hvm_flush_guest_tlbs(void) -{ - if ( hvm_enabled ) - hvm_asid_flush_core(); -} - static inline unsigned int hvm_get_cpl(struct vcpu *v) { @@ -854,8 +858,6 @@ static inline void hvm_sync_pir_to_irr(struct vcpu *v) =20 #else /* CONFIG_HVM */ =20 -#define hvm_enabled false - /* * List of inline functions above, of which only declarations are * needed because DCE will kick in. @@ -902,8 +904,6 @@ static inline int hvm_cpu_up(void) =20 static inline void hvm_cpu_down(void) {} =20 -static inline void hvm_flush_guest_tlbs(void) {} - static inline void hvm_invlpg(const struct vcpu *v, unsigned long linear) { ASSERT_UNREACHABLE(); --=20 2.43.0 From nobody Mon Apr 13 03:42:42 2026 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=1770989901; cv=pass; d=zohomail.com; s=zohoarc; b=B8zdNXhUxAV6W4yVL4zBfgdG78VQz8tN4DaAqVvYj+alECekyi2WxZY1DlW21adFA03JAssVBe4v275pEpK94LblRlxobopZmqKNvfjD3o8rMEtzcgq1yz7kjt3MfEUUZRuzEDcpuJ9A+PrrcKZS1TTdIrP2xEddog/I/DGtObQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770989901; 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=nspe1jSCdTmM5bqpafVLqgeaSP53cHPgBiEN8kytCmM=; b=kE1shyDlsBz7vNLvJ60It+vQIWGq3VMAEnGrYRh4O9hqn5TLvJhIcN+REOdBEhF3tavubUwbbgCg+udPYeUCz0en7lkYSC6X3sLY66HEqHK59VmqfBnq7Hxbwis+Xi42/Im4Qo6/MvnfkNKjc9xr3vwIDmhG3Bw7X4DRIdjCMjo= 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 1770989901533965.0872498340353; Fri, 13 Feb 2026 05:38:21 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.1230932.1536306 (Exim 4.92) (envelope-from ) id 1vqtMw-0001iF-Hn; Fri, 13 Feb 2026 13:38:02 +0000 Received: by outflank-mailman (output) from mailman id 1230932.1536306; Fri, 13 Feb 2026 13:38:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1vqtMw-0001hh-DX; Fri, 13 Feb 2026 13:38:02 +0000 Received: by outflank-mailman (input) for mailman id 1230932; Fri, 13 Feb 2026 13:38:01 +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 1vqtMv-0001RI-5F for xen-devel@lists.xenproject.org; Fri, 13 Feb 2026 13:38:01 +0000 Received: from BL2PR02CU003.outbound.protection.outlook.com (mail-eastusazlp17011000f.outbound.protection.outlook.com [2a01:111:f403:c100::f]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 35fbde7a-08e1-11f1-b163-2bf370ae4941; Fri, 13 Feb 2026 14:37:59 +0100 (CET) Received: from SJ2PR07CA0015.namprd07.prod.outlook.com (2603:10b6:a03:505::28) by BN5PR12MB9509.namprd12.prod.outlook.com (2603:10b6:408:2a8::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9611.14; Fri, 13 Feb 2026 13:37:54 +0000 Received: from MWH0EPF000A6732.namprd04.prod.outlook.com (2603:10b6:a03:505:cafe::5b) by SJ2PR07CA0015.outlook.office365.com (2603:10b6:a03:505::28) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9611.13 via Frontend Transport; Fri, 13 Feb 2026 13:37:51 +0000 Received: from satlexmb07.amd.com (165.204.84.17) by MWH0EPF000A6732.mail.protection.outlook.com (10.167.249.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9611.8 via Frontend Transport; Fri, 13 Feb 2026 13:37:53 +0000 Received: from xcbagarciav01.xilinx.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Fri, 13 Feb 2026 07:37: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: 35fbde7a-08e1-11f1-b163-2bf370ae4941 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HQPLxOJuhKQ7jUkh9Fuv9rYSW1w6j/89ldl2VoudQl/bMyUY+GSnCsY59R8pe7X4Tfw7Tbh3FcuVawlveTd+NC/Amvuxr8X6AXcVDrp7DUNWdZ3exiU9lNygkQJFygN1N3S7IgO05pZvnXeA7t+xVzG98DZqRTIP1ysBQiG1s0o0ToNUzFRSaAOxZ/psb5qBUh3b19Xs+P9qm8lgUqV4iDt5wGkuGXNEMsVtFs0kGi7PnOqCitj04oHIMoGz76XQR+IQKPmYneSvoRAaRUNrS20e6aCH4maNt8R6fqzZwJzPkKxwEU5TnZ/h+dEIO88fA9ptZFU4wBCzEpU9MmOFvg== 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=nspe1jSCdTmM5bqpafVLqgeaSP53cHPgBiEN8kytCmM=; b=BfR6L+R02Vyhdoo7dzt4S+OacaGdUtYjSCJ92oXWNFfYhPgPeU0AhW6CUlyqMdyttBK1BxpqTRSvX7d5A6dl9JvR9WRF5wqiUfvAz8jYLJD40ltth94pg46ux92mhhem4Sf9ZRHiyOjgh9H+fjMOh9jOzNHXtf6RHbLrRgs8V++mLduzvBWf79spHLhqmS+cCjl1q6p4pRAh4QELNAIvPZRsn/E2fjLlDvqzxYqMGX0ImZCf5FyNi0766iqMIAeJHL9gpqzhJB6yInkTB9PtPgsZ45EzBxWS2tneOp9+WgJHnUM8u0lZE2HCgMPz7oh48NWT01ny3HbIgSFW+C982A== 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=nspe1jSCdTmM5bqpafVLqgeaSP53cHPgBiEN8kytCmM=; b=jroQIRs4SK1PrIdN2QRsTy4XMETmOdygUCEjrLvOJPeuA7BiOYCcUWE6QRzC7hIfS/uoItciXw+09HYWucz6A+tzx6re1ALclN/J0x+lvixjUgO4sTb0bRSTD5VvCOyfcKc+zh3U6AfvTxb2/HFxAhsqQH78oTXeVOUtjpX2gYs= 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=satlexmb07.amd.com; pr=C From: Alejandro Vallejo To: CC: Alejandro Vallejo , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Anthony PERARD , Michal Orzel , "Julien Grall" , Stefano Stabellini Subject: [PATCH 2/2] x86: Force HAP to be enabled when PV and shadow paging are compiled out Date: Fri, 13 Feb 2026 14:37:30 +0100 Message-ID: <20260213133732.132326-3-alejandro.garciavallejo@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260213133732.132326-1-alejandro.garciavallejo@amd.com> References: <20260213133732.132326-1-alejandro.garciavallejo@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWH0EPF000A6732:EE_|BN5PR12MB9509:EE_ X-MS-Office365-Filtering-Correlation-Id: d520c7f8-647e-4c30-cc99-08de6b051703 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|1800799024|36860700013|30052699003|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?BAp2tle0LRkosgeWQnm+HJWnyaq/hvBRdhVc3MwoGEpA+lWqZfG/OvGmQV/I?= =?us-ascii?Q?XO7f6jFvExtnN8ppdK+VTcoHNUaE+HwFLEtha+R61ZUK4y1J1FcPu3ehW+IE?= =?us-ascii?Q?nOST1z3N1dFnJ0gHpVclCYzasm7ZVpVvqx49mwpZrACLtHJYp/ydrnKcX0SM?= =?us-ascii?Q?e4Nv5hsEunFjpgSud6GG7Brtlf/ddOlhAxi4LcoykRMVTXRSeJQcocMOUDQt?= =?us-ascii?Q?1DqwmSWJGuBw+YLeFXVsDTCLr0CXyGpo5xxdrfALlTz7FsfuoyjQjumdaFYY?= =?us-ascii?Q?orLP8ksfbIdPMkiuCtm4Hxho1aC1HWTCpGJT/1QdPH5SBRRul3aCmGStKyMH?= =?us-ascii?Q?yHTIJwRNIM759M5QukWMcLxhLp063o2D7r1xeB1AEu9wQPHcmT6BhTUtH3lt?= =?us-ascii?Q?JqUb/HeDrUU4ZeFeK1FZXQkb3WcAVHJrSO04Dx2Fq7+4h3DQzIyMkB67N9iw?= =?us-ascii?Q?T8wX5ilmd+lJNwI3x3xS3Q7vbx5misThhioc2OhGnfJ/IBDOFCQNZ0aod38F?= =?us-ascii?Q?+R27lW18/htTrparI/SWa5MCuaCKCP4P1c6S7iKefeX3DrV30scq6+OQaSBx?= =?us-ascii?Q?+zQgFpYIP/RqBuIf94om/rBbgTGzZWTwBBWCghofJsjMZEl0TgE8zP731MVb?= =?us-ascii?Q?a/7VacoSrikYbsfi1qJRdmCI0cxIxX/c+LtdUyjvFAuklKZHQXstmqGnzSdX?= =?us-ascii?Q?c1xv+9TyKne98pcKUt4AcMMH+71oHS3lZuwRhVroq/Pu2l97bomoTFz33t1j?= =?us-ascii?Q?wQSfnNxBsY3YjwbMCJ8fOK+n/vvH+WLEAfvgPL0M92Q6VVyZktK5WbRhpSUp?= =?us-ascii?Q?CBt9QANIVi3drT9+Fl/jViZYdCBSg0xWQJJW+IbZOuWsZ0NXIRkDW/2Rme5S?= =?us-ascii?Q?CVLPjKTINcyAbjvsIubcLaLic2CaCS1oDb9H5sUCu8wjW2TLqfqaL2TzSNIW?= =?us-ascii?Q?fb3mYTRecp3ou9KKp3+yq+h7gseA1BQZZIcMatSquN9qS95nRZqeFIGaAwUR?= =?us-ascii?Q?DaL7fWHRK7u5mU6ZWfAkYXaOItu8hqoBoiVbcCcNCO5B7/XXoBeWE6BFuxZs?= =?us-ascii?Q?qghHXsKxVDxPq0xdikW1Xd5EdFCxPKj/U1RhUz5V29os4b5bKhjPXB7s1nPL?= =?us-ascii?Q?kSyrtT5LX1LODmZVT/gMviZxNIS2Dm2KpkmKUrRBjuzHDOQxhuXziO1lowdc?= =?us-ascii?Q?rS86faYjp1OkyWjfSLMh3rUW+591q/q3Ow6A4n9FDUIznqH86doC2x0EwrMZ?= =?us-ascii?Q?frA0WFCEqjzGPgfOrFFY37VfDusrAJS7aR3n+B02S6hrYol/wBam+p534tl9?= =?us-ascii?Q?NlNTRC3xObtr7SMhc5QpNsupvbyFTBNjvzHvBx7e/UBfuV2N1xQmr4jVWZkv?= =?us-ascii?Q?+tk1Q+33Sdcq8gZqh8NP7kx4Q94lDgNj/lYF0TBF8H1uBH0vqpeUf79GEWHc?= =?us-ascii?Q?x4ub4F/gtbXjE+5rAafqIFORCGAHjdWRFIYtwaM5k3RNJyKUmLwPx74aUBIJ?= =?us-ascii?Q?k8kr+fpkSspjjMfnBZDU3qWWEcuPOjhfRgYQuGCn6gp+X7ZLVyf4e+dZbg8/?= =?us-ascii?Q?o8R/VKU2JiPLW2usqjggSE8WFMN8MmmzjfAahZvALaqfQDr12z60FQkUfNay?= =?us-ascii?Q?HtMR1q36RPICRStFfDZYHUZyWMx2YkD14XMm1EANCDlTzcBUCCltyejXBVTb?= =?us-ascii?Q?8D4fcA=3D=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(376014)(1800799024)(36860700013)(30052699003)(82310400026);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YISXS2N8a2LybbW4zUTOiSZZvJvDYwMTRuLcGGPqqWiu8bkSLXMKyKzKHokULjHEn5c0jjnG2jPr0tXkFZEW8iAhauP7U9By4B6eaG08MOJYCQEpky+7io4UWG0jRHNiC2T3+aPIh/9LclZhMpRRTofB9/vz2xryzeLDhnHemCFHVLLFkPu36ukMhuGb7z3BS6N8hgaFErRX0Us1JoWwFLRqfWO3dJhFlEpGRwYyDkmQpvheMDxRsg46WEI76cZRU62XxglCYDl4ujW2wf7hky6eMyaktJt+Y5I6al647F22W8UqnDZkZPo9YFModrQrrxoMFmS51K0NcRokMyBG+8d+7ZbmEUOuhviz3Ym6m2zZunS/zbD6OFWPTt7VHT4sItnw86fNPLrL7Nf2fFyqnZyFzMoktDxANB0k0MiS5FClbLGaawbwAz6rM92cA9KS X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2026 13:37:53.6990 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d520c7f8-647e-4c30-cc99-08de6b051703 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=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: MWH0EPF000A6732.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN5PR12MB9509 X-ZohoMail-DKIM: pass (identity @amd.com) X-ZM-MESSAGEID: 1770989903184158500 Content-Type: text/plain; charset="utf-8" Makes hap_enabled() a compile-time constant. This removes a number of hooks that normally go reach onto shadow paging code, clears many branches in a number of places and generally improves codegen throughout. Take the chance to fully remove the shadow/ folder as it's now fully compiled out. Signed-off-by: Alejandro Vallejo --- bloat-o-meter against prior commit (defconfig:-pv,-shadow on both): add/remove: 0/12 grow/shrink: 2/31 up/down: 67/-1609 (-1542) Function old new delta unmap_mmio_regions 1340 1374 +34 map_mmio_regions 211 244 +33 opt_hap_enabled 1 - -1 shadow_vcpu_init 2 - -2 __setup_str_opt_hap_enabled 4 - -4 _update_paging_modes 6 - -6 _toggle_log_dirty 6 - -6 _clean_dirty_bitmap 6 - -6 cpuid_viridian_leaves 728 714 -14 iommu_domain_init 291 276 -15 p2m_pt_change_entry_type_global 214 198 -16 paging_teardown 91 74 -17 paging_set_allocation 384 367 -17 paging_enable 76 59 -17 p2m_init_one 295 278 -17 ept_sync_domain 201 184 -17 arch_set_paging_mempool_size 437 420 -17 p2m_free_one 78 59 -19 paging_vcpu_teardown 36 15 -21 p2m_pt_init 125 104 -21 p2m_pt_change_entry_type_range 218 197 -21 arch_do_physinfo 76 53 -23 sh_none_ops 24 - -24 paging_final_teardown 134 110 -24 __setup_opt_hap_enabled 24 - -24 paging_vcpu_init 41 15 -26 paging_domain_init 167 141 -26 p2m_mem_access_sanity_check 71 42 -29 hvm_enable 449 419 -30 init_guest_cpu_policies 1247 1213 -34 paging_domctl 3357 3318 -39 __start_xen 9456 9416 -40 arch_sanitise_domain_config 794 747 -47 symbols_offsets 29636 29588 -48 p2m_set_entry 305 247 -58 guest_cpuid 1919 1858 -61 ept_dump_p2m_table 817 751 -66 recalculate_cpuid_policy 874 806 -68 shadow_domain_init 71 - -71 mmio_order 73 - -73 hvm_shadow_max_featuremask 76 - -76 hvm_shadow_def_featuremask 76 - -76 dm_op 3594 3510 -84 symbols_sorted_offsets 58464 58368 -96 symbols_names 103425 103213 -212 Total: Before=3D3644618, After=3D3643076, chg -0.04% --- xen/arch/x86/Kconfig | 2 ++ xen/arch/x86/hvm/Kconfig | 3 +++ xen/arch/x86/hvm/hvm.c | 8 ++++++++ xen/arch/x86/include/asm/hvm/hvm.h | 2 +- xen/arch/x86/mm/Makefile | 2 +- xen/include/xen/sched.h | 3 +++ 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/Kconfig b/xen/arch/x86/Kconfig index 2ce4747f6e..190f419720 100644 --- a/xen/arch/x86/Kconfig +++ b/xen/arch/x86/Kconfig @@ -67,6 +67,7 @@ source "arch/Kconfig" config PV def_bool y prompt "PV support" + select OPT_HAP help Interfaces to support PV domains. These require guest kernel support to run as a PV guest, but don't require any specific hardware support. @@ -147,6 +148,7 @@ config SHADOW_PAGING bool "Shadow Paging" default !PV_SHIM_EXCLUSIVE depends on PV || HVM + select OPT_HAP help Shadow paging is a software alternative to hardware paging support (Intel EPT, AMD NPT). diff --git a/xen/arch/x86/hvm/Kconfig b/xen/arch/x86/hvm/Kconfig index f32bf5cbb7..310e09847b 100644 --- a/xen/arch/x86/hvm/Kconfig +++ b/xen/arch/x86/hvm/Kconfig @@ -92,4 +92,7 @@ config MEM_SHARING bool "Xen memory sharing support (UNSUPPORTED)" if UNSUPPORTED depends on INTEL_VMX =20 +config OPT_HAP + bool + endif diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index da56944e74..ce58632b02 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -91,9 +91,11 @@ struct hvm_function_table __ro_after_init hvm_funcs; unsigned long __section(".bss.page_aligned") __aligned(PAGE_SIZE) hvm_io_bitmap[HVM_IOBITMAP_SIZE / BYTES_PER_LONG]; =20 +#ifdef CONFIG_OPT_HAP /* Xen command-line option to enable HAP */ static bool __initdata opt_hap_enabled =3D true; boolean_param("hap", opt_hap_enabled); +#endif /* CONFIG_OPT_HAP */ =20 #ifndef opt_hvm_fep /* Permit use of the Forced Emulation Prefix in HVM guests */ @@ -144,15 +146,21 @@ static bool __init hap_supported(struct hvm_function_= table *fns) if ( !fns->caps.hap ) { printk("HVM: Hardware Assisted Paging (HAP) not detected\n"); + + if ( !IS_ENABLED(CONFIG_OPT_HAP) ) + panic("HAP is compile-time mandatory\n"); + return false; } =20 +#ifdef CONFIG_OPT_HAP if ( !opt_hap_enabled ) { fns->caps.hap =3D false; printk("HVM: Hardware Assisted Paging (HAP) detected but disabled\= n"); return false; } +#endif /* CONFIG_OPT_HAP */ =20 return true; } diff --git a/xen/arch/x86/include/asm/hvm/hvm.h b/xen/arch/x86/include/asm/= hvm/hvm.h index dc609bf4cb..b330d65d6d 100644 --- a/xen/arch/x86/include/asm/hvm/hvm.h +++ b/xen/arch/x86/include/asm/hvm/hvm.h @@ -703,7 +703,7 @@ static inline bool hvm_is_singlestep_supported(void) =20 static inline bool hvm_hap_supported(void) { - return hvm_funcs.caps.hap; + return !IS_ENABLED(CONFIG_OPT_HAP) ?: hvm_funcs.caps.hap; } =20 /* returns true if hardware supports alternate p2m's */ diff --git a/xen/arch/x86/mm/Makefile b/xen/arch/x86/mm/Makefile index 960f6e8409..64fde82c50 100644 --- a/xen/arch/x86/mm/Makefile +++ b/xen/arch/x86/mm/Makefile @@ -1,4 +1,4 @@ -obj-y +=3D shadow/ +obj-$(CONFIG_OPT_HAP) +=3D shadow/ obj-$(CONFIG_HVM) +=3D hap/ =20 obj-$(CONFIG_ALTP2M) +=3D altp2m.o diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 1268632344..0e317504f7 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -1220,6 +1220,9 @@ static always_inline bool is_hvm_vcpu(const struct vc= pu *v) =20 static always_inline bool hap_enabled(const struct domain *d) { + if ( !IS_ENABLED(CONFIG_OPT_HAP) ) + return true; + /* sanitise_domain_config() rejects HAP && !HVM */ return IS_ENABLED(CONFIG_HVM) && evaluate_nospec(d->options & XEN_DOMCTL_CDF_hap); --=20 2.43.0