From patchwork Thu Nov 16 13:30:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13457909 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7E0C6C197A0 for ; Thu, 16 Nov 2023 13:30:59 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.634210.989550 (Exim 4.92) (envelope-from ) id 1r3cSG-0005av-JK; Thu, 16 Nov 2023 13:30:48 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 634210.989550; Thu, 16 Nov 2023 13:30:48 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r3cSG-0005ao-Gf; Thu, 16 Nov 2023 13:30:48 +0000 Received: by outflank-mailman (input) for mailman id 634210; Thu, 16 Nov 2023 13:30:46 +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 1r3cSE-0005TT-QA for xen-devel@lists.xenproject.org; Thu, 16 Nov 2023 13:30:46 +0000 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on2062a.outbound.protection.outlook.com [2a01:111:f400:fe13::62a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 5865ffb7-8484-11ee-9b0e-b553b5be7939; Thu, 16 Nov 2023 14:30:45 +0100 (CET) Received: from DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) by DB9PR04MB8140.eurprd04.prod.outlook.com (2603:10a6:10:249::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.8; Thu, 16 Nov 2023 13:30:42 +0000 Received: from DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::eb8e:fa24:44c1:5d44]) by DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::eb8e:fa24:44c1:5d44%3]) with mapi id 15.20.7002.019; Thu, 16 Nov 2023 13:30:42 +0000 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: 5865ffb7-8484-11ee-9b0e-b553b5be7939 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Wn3nRCmCEs61VWr52m4tDcEkOaobKUyKymTF8Ty7mlGDnTJJP5aYyJJXaPTHW2Q+qAT3pR3Oskq2A/qaoZDAlcX0g2oYrEtzpxCzudqXFeQH976scPLBAoQ+rcS5Y3OmtUCUk2V2cm8c6Q8+j1fLkHOCYIq+h6tEGdHTkxsZUjARn6/7pRTJ+B53V+2Um8OHPcqwAqzsErCdpUoIgn/x87y6Y4j/kfxEkURFnA9+t3tdCjl1lrOWhrP8UFwzr5mDE7eOBvkUf1X6UzBnV9VLjoSJ6y6PRcidKkSZ0WAKizMqcrHHW7gwFgNiw1oPOCQxuJ1HnZ2h651xMq/YzNSYEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=VdKtcSr8M9eXHCSqSFrd/lo0ZHHHdKLLAqWgHdGZwDM=; b=SDM83vyblz0x8KohuYknEzaoiBcAkGSl+pHYBoMexhw/CD+QWsUP1ufMIhUbc20v1+HiM2B88oMFGF/KF1nkTpR5QG844VkhHjdF5J/2fUX2cNaDlth+Z08xI6ogElGMjfp+Kt9jlfJGSD8ZN0k5GNeLDvR1CDBAQOwPF5XbsO79Mjdo0b6UV4BOxrqlaP3EUaHISusZ3EU843ZmOb4OJBXMYwFIgrcuIaxjGPytD5PgNJHg9hUI9SZqXwepLgNoAoaKE3flPKmStMM+AlkEYys9SPL1lzvULqT+UaCVMIIowDkCYYzJUY2eVaWT6JkdCayzNt5JJIfjURgtEQyqOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=VdKtcSr8M9eXHCSqSFrd/lo0ZHHHdKLLAqWgHdGZwDM=; b=yN7tOlqKZH5lYTgKqxINPhdZU3AWSl5iwe7J7OaxpApdYhCS2FW0rUg4+04M1U6s3iAu2iL3b6PA9UsYek0bRa7PQoe0m+HKimpWNec9mzWret3XwRFxwVKlBoErcgFJOMBHEiCcAaanPVEl/9DHfJL3FxaUvdAGFY8gcZ3uibdL/U5DqqCaXRJ1uo8QlP7ckQLcRkX7ffiSh59ttzWXjUSmzWa1qQNsgPWAdWUkrqXzZyd2tQJamH8G9+o9gJl5y0WjSGUMns9y6O0n+L4jVsmpN4zqQSY42Nm6fU3koBlq6JrFbrPloYQY6+n3XlB3iYcLNuKiW2jIULEB3BH9VA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: Date: Thu, 16 Nov 2023 14:30:41 +0100 User-Agent: Mozilla Thunderbird Subject: [PATCH 1/5] VMX: drop vmx_virt_exception and make vmx_vmfunc static Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Kevin Tian , Jun Nakajima References: <791a9f45-2bed-48f9-af6a-9fbde65bcc71@suse.com> Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <791a9f45-2bed-48f9-af6a-9fbde65bcc71@suse.com> X-ClientProxiedBy: FR4P281CA0106.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:bb::10) To DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8790:EE_|DB9PR04MB8140:EE_ X-MS-Office365-Filtering-Correlation-Id: 12a3734d-e63c-4db6-0404-08dbe6a83b19 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YJEYnXAtvxkRsQuLRv4zyXHjpSWlJsXSq8TvNih6wiMdxcGq0sOPWjuRhU01OiUNlzFBqGs62fq4LrPkjiaeXmSGsR905MQuf0Kz+AjLvEkmwdvraB3Z1Tg/7J06ZM45DkdjUaK7qNP8dHmtnB7MufUHHN9mT/5zpjcIJEZ6HZE1XEbs4l95HHl2IC3HjWWTuIRmcgpKu1U7C0AZUrk+QKle2a05e35hEVoVBzd3VntqKrjOFTF+8c3jqE0PSAY0hY3PkU/Be5koYYtyLiUYPB17Uwd2EYnBtBHkoUg22nLqzl9If9ksTns3yEvYr7TrnQvvbzMUMOtnbJkHNITShiBNsuG6TdGh2fmb9MqHGL1Y9HyTbOMB07sQlV2gkFG9ODUuebGy1SJUM2PSI+aREpfXmG7k+DwJHVHDT7amBAWxinX0UCtZMTpVjjIuS7N7KAP3S2nfLD11Ao6/nV0gx+HwU8y+Nsd4GxAUxFbI1bccpFefr3MtoqB34+SFEfohVRSgFwLOrkYZfMAiFCm3Pf+K04uJRHGLeFt0eF4SjCoO4dIlD+Gh5074xh+LNqIqR8GR7Gcn5OZJL+nUE4/5I4kLH8JYgAykk17s3MjNodmOi//ZyeWvhSyQQ8X2f21XmRkQHXyqTLSyuo3iUBR7fQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8790.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(366004)(376002)(396003)(39860400002)(346002)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(6916009)(54906003)(6512007)(316002)(36756003)(66946007)(66556008)(66476007)(26005)(2616005)(6486002)(478600001)(6506007)(31696002)(5660300002)(86362001)(38100700002)(2906002)(31686004)(83380400001)(41300700001)(8936002)(4326008)(8676002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?0v9LGZa8LkPy9ZhfCxVnN6RBo2QK?= =?utf-8?q?8MjOFVlMtMhUrF0O25pG9u4LpxCTJ0GwxUYQzWuiZefQKIS9J1YCYGEUX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vAk8pyTt2er3ja132w0lxHXATeuhyK5n3+uaDk+TPvmmJz1AtlLTCtUX5Qc?= =?utf-8?q?FslWrsXDneYDeJc1IMKRhPLtls8YgP3//7pla2NGP+wf4GCQr3dx2rosDWjPOFVYg?= =?utf-8?q?4sqsmzphuHJxFLStlIqah1LxfpwmoPQv2LLg4lJuOygNdOTdCd3bycNWAKw6GcN2q?= =?utf-8?q?MpURBe4y9K5htCtDP3qqu+CvXf5uoLIssikS3YLhCiQ9K5+YgmEieESPWnNaMe07W?= =?utf-8?q?Iv8EJN0yhu0vu14tGnKG3k82ARLRw43sDic/RpS3DnAAJFuxyScgfS5yE4+PihTX7?= =?utf-8?q?Urge9PZH92VzzyFhNetyn78JR1imIRu+LlFFJ0uJ2f2nimrkDz4Li8vLcPDOKJ232?= =?utf-8?q?b6AKtwtsrGwZIcrv1C5gFeWwXRmCYRN+PXmx3SID0gu2qz+jvMrCW+2HCz2zNSWRp?= =?utf-8?q?7PWM6PNZ8KuJHwXCqwDbtONg2xdnQhFgpQwELUwTzOOIcnY4pRGFdV4vrv6mtyXiz?= =?utf-8?q?Jm2nolArQSMgOvgq76qFlU6FUYhO69BoPzOvvotJvDdqbuUkjvu0hMLesxmaSEgJG?= =?utf-8?q?LEG5TxxpO8gF?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 12a3734d-e63c-4db6-0404-08dbe6a83b19 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8790.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2023 13:30:42.5049 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wU7hfdgAQ+yjACfZWL98Eg8mRb1oGGhX23ClscEkmoemNL8uZ2LazJRSBFSD4hW9y/dHWW6b7aR3bL5DrG6NZA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8140 The variable was introduced by 69b830e5ffb4 ("VMX: VMFUNC and #VE definitions and detection") without any use and - violating Misra C:2012 rule 8.4 - without a declaration. Since no use has appeared, drop it. For vmx_vmfunc the situation is similar, but not identical: It at least has one use. Convert it to be static (and make style adjustments while there). Signed-off-by: Jan Beulich Acked-by: Roger Pau Monné --- In how far the sole vmx_vmfunc use is actually meaningful (on its own) I'm not really sure. --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -167,8 +167,7 @@ u32 vmx_secondary_exec_control __read_mo u32 vmx_vmexit_control __read_mostly; u32 vmx_vmentry_control __read_mostly; u64 vmx_ept_vpid_cap __read_mostly; -u64 vmx_vmfunc __read_mostly; -bool_t vmx_virt_exception __read_mostly; +static uint64_t __read_mostly vmx_vmfunc; static DEFINE_PER_CPU_READ_MOSTLY(paddr_t, vmxon_region); static DEFINE_PER_CPU(paddr_t, current_vmcs); @@ -475,8 +474,7 @@ static int vmx_init_vmcs_config(bool bsp vmx_basic_msr = ((u64)vmx_basic_msr_high << 32) | vmx_basic_msr_low; vmx_vmfunc = _vmx_vmfunc; - vmx_virt_exception = !!(_vmx_secondary_exec_control & - SECONDARY_EXEC_ENABLE_VIRT_EXCEPTIONS); + vmx_display_features(); /* IA-32 SDM Vol 3B: VMCS size is never greater than 4kB. */ From patchwork Thu Nov 16 13:31:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13457910 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6CB3FC197A0 for ; Thu, 16 Nov 2023 13:31:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.634212.989559 (Exim 4.92) (envelope-from ) id 1r3cSd-00061T-Qs; Thu, 16 Nov 2023 13:31:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 634212.989559; Thu, 16 Nov 2023 13:31:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r3cSd-00060N-O2; Thu, 16 Nov 2023 13:31:11 +0000 Received: by outflank-mailman (input) for mailman id 634212; Thu, 16 Nov 2023 13:31:10 +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 1r3cSc-0005TT-EY for xen-devel@lists.xenproject.org; Thu, 16 Nov 2023 13:31:10 +0000 Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-db3eur04on0611.outbound.protection.outlook.com [2a01:111:f400:fe0c::611]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 667b2455-8484-11ee-9b0e-b553b5be7939; Thu, 16 Nov 2023 14:31:08 +0100 (CET) Received: from DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) by AS8PR04MB8499.eurprd04.prod.outlook.com (2603:10a6:20b:342::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.9; Thu, 16 Nov 2023 13:31:06 +0000 Received: from DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::eb8e:fa24:44c1:5d44]) by DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::eb8e:fa24:44c1:5d44%3]) with mapi id 15.20.7002.019; Thu, 16 Nov 2023 13:31:06 +0000 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: 667b2455-8484-11ee-9b0e-b553b5be7939 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M+qT3qKFT4xI5Fa5EbGBacr7u/6O/4gheezH0nQsCcY7V7KpSRsM5S0JsIxveS/JGlbgWbbwC4RegUgZDf0jy86GdCmESmtEZJk/mTV1rj1Mdfb8S6xa41tZ7p8Mj2BOEVimbjVIzgLY7FclDtvvJTDroPDQgpNp0OvkTNKUhyuiTFq5p9bIxtqDBVtltgGdC+NGaG4I6RCp6EbDgm699zmq0hqb5L8LVtvJJSVXt5iGB+e+02LSlMoa/wBPSynTzpJwV+X2CkjXLws5Y8Pnjd49pJvnPPK367Ai/+18p9b7UHQWhWhblq54e85S+NdFXaR00q8qYnM4sbL1g5OoEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=xpmbzUYWRrR5ZbwtWXyVrKKEOLtrtSL96BWfS0R0oPQ=; b=PI58vr+BVyiFmBiN5viT13bG71XVj2UH0EQ3S+I3EmJ7c8/Ys01w5UWa25mPVdUp/zSdgPSAEvPIIhG1Zu3jKjTsdACP6a0+BlNt5qWWwFDDhK1Sqjykfuwa83cbUf4ebm1f/8PwYCIwPoBf6fKRfpo8xGx0KoaJQMkreys2eBgiGY4bOoiEZZj4TrItBycnaaFbr9aDo7BvPSA/Y734qpVAE+njpOQlCrDNJmo9H+8TJg5pgbfTMsMNOsVNZY+gp9LlzFmQINQpp9RyYyms4uTsqL8bEMCW982wYtn4KxnqKkfncXt/74I6l72JaJtPy75wSAeFmSbu34l++EFzpA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xpmbzUYWRrR5ZbwtWXyVrKKEOLtrtSL96BWfS0R0oPQ=; b=vDouL9Dky6AwkWgmxhxE0dpXjJIKv+EdEx7b7zg7ByxELNMvK4Ia6CYOQD9SMYf+6zLC/bnO+pH72WZunsSTA61aKQQ18LpKtZNY9Fhvo+WoQERSjXeqbiEd+KCaKkov/JxoQY4IChnNIfueirVxGU3oMi+Z7X2NPQf+wPymazH+V/MTPK8SDy2EOjIxNgHW3av1LzfcVtVVgliydM7mgBlDobrMf4poTpUktFCvQFePU19LG/GUXG157d+FXA6C55kV9/h8KtbeYubwwH8wio8PUMFF/qtwuFF/UzuTeTd8urRkVGIhJC7DsVZLoatsXLkvNNzmJEr8e6qREl1Txw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: Date: Thu, 16 Nov 2023 14:31:05 +0100 User-Agent: Mozilla Thunderbird Subject: [PATCH 2/5] x86/HVM: hide SVM/VMX when their enabling is prohibited by firmware Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Kevin Tian , Jun Nakajima References: <791a9f45-2bed-48f9-af6a-9fbde65bcc71@suse.com> Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1e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fDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <791a9f45-2bed-48f9-af6a-9fbde65bcc71@suse.com> X-ClientProxiedBy: FR4P281CA0106.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:bb::10) To DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8790:EE_|AS8PR04MB8499:EE_ X-MS-Office365-Filtering-Correlation-Id: eaed8d4e-8bc6-4d61-123b-08dbe6a8493a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: V1gWjRotTyF6/VNLNc42dhoMqtdx2ezKzQo1F4PsyfCucuED4bYo766KFtse8DfR3WkjbR3E6ktyL6x13Es4Q30MbaJyL4t8iAcYQt/YE/nr6mSICtySIoyMyZQiRCdaAagO+lPGLgQbRbYedPzjjX7zz8x8QDt73b6aX/ZBp27H0h5KRxos+aMwF5XyzTtVCWG8EEwgwj1GcpJIbPu80Nl4XM6tn7L281V6O2D2bRrAsrZl2NvKlMnA8vs7+3g6F+cqnr+OXEBIc88DNPxe12SxCmR/NvaLg4R4cpciDkH5XbNna2IUY3MZIdHQh/oRDw5axXLXKXqYNdCw557P1HpJIrpL8i4zspIRSPVjn+O50iq+914OoG5VIfmTdMANpoiCIiLijZkxl3vpXoUcAJJvhG7TjBSD4McR/H4FEOhd1NoCwZ7iNqLRX7qhg+85DMYPv1VaqYT2IqhWiylgVx6wktnARbajbg++zolgMBsy8F/C+imML4ukPLeCdxsOX4Yj5O3BKX4nhZbQus30cBPJ84CmqyJDzzMfT08yT8iF9KfInD0Pa5De+7aR2Q2mNJ8Bf0JBN4HfC4CaNM3QHSWdp9RXbV6olO7Xd88PUUGdMASfJWIE9WtMyc4paz99CYdfRW8syemvYAsP6MFXEQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8790.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(396003)(346002)(39860400002)(366004)(136003)(230922051799003)(64100799003)(1800799009)(186009)(451199024)(2906002)(31686004)(38100700002)(31696002)(86362001)(5660300002)(41300700001)(8936002)(8676002)(4326008)(6486002)(2616005)(6916009)(54906003)(36756003)(6512007)(66476007)(66556008)(316002)(26005)(66946007)(6506007)(966005)(478600001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?GfBJLgqS/MJ680fMU48YD3lznshH?= =?utf-8?q?ovbHH2ZGa+Uh+j9vNv6gvblIWp597DWBGd2sn9OXY2RVh4ph3nAfDiGosJ2jxEs69?= =?utf-8?q?IRyySYEIpq+nMJULCI4hhNxx9mIJ98H+Nc9dLBABZkQtL0FL29mHvjpzTVppvyuZa?= =?utf-8?q?bzHrSjEACXtJMC55kLx5WJKIntoWRdAg3NPZI/g/dX6Z/VmvQsjdbpGj0p9VwWHUX?= =?utf-8?q?w+nBA4A9ECNqLY8Oi5TTJdexlCaU62xo6Lf1bjZPY0IqtoayZriPnHkFbv8cztTzl?= =?utf-8?q?7b9tfP56YB412tFW2ZVH+XV8WeZzkXCYYqCxs8UsrCqem4CLgC8Zj3Zk9ZCEMW8Vv?=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utf-8?q?9Zm180SCQ96DP4mYJRtO18opKO37KLszvARn+M2EzRq4Ptfut7X73Je2N/mqcbWva?= =?utf-8?q?ToAsjjNoJdIrcmZ0Pelkesjy2VBf8qfQOxpQPIU4Sw1D0g1PrRpXyL4AhjVJtlJAo?= =?utf-8?q?aFoeqglc9nMw9RRndR7d1/5N2L23W69PkJ5I2Z33K30wjtJ7eZlzsb/MBg+MDqBkV?= =?utf-8?q?NFGqUEvF28ewrB2FAVrItqC9yU9zddON4/ygwkS5MsAzOwEBdIFfIec7SWRBnn3+6?= =?utf-8?q?ip3cVBOqtpuQDZnv5ERvMLax7MY86emXG21dEvB//VWceBmsWJVcJ+GMJyl8rYVIC?= =?utf-8?q?drW4emqbP+BK?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: eaed8d4e-8bc6-4d61-123b-08dbe6a8493a X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8790.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2023 13:31:06.2234 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: XvAeL1PH6+KGnl1LuUullXxE7e8Wbs1upMgo7sVHISegCeZy/f+GLBPu6MDYS0hU9ZFApneTeFeNZ0GP4xmHVw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8499 ... or we fail to enable the functionality on the BSP for other reasons. The only place where hardware announcing the feature is recorded is the raw CPU policy/featureset. Inspired by https://lore.kernel.org/all/20230921114940.957141-1-pbonzini@redhat.com/. Signed-off-by: Jan Beulich Acked-by: Roger Pau Monné --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -2543,6 +2543,7 @@ const struct hvm_function_table * __init if ( _svm_cpu_up(true) ) { + setup_clear_cpu_cap(X86_FEATURE_SVM); printk("SVM: failed to initialise.\n"); return NULL; } --- a/xen/arch/x86/hvm/vmx/vmcs.c +++ b/xen/arch/x86/hvm/vmx/vmcs.c @@ -2163,6 +2163,23 @@ int __init vmx_vmcs_init(void) if ( !ret ) register_keyhandler('v', vmcs_dump, "dump VT-x VMCSs", 1); + else + { + setup_clear_cpu_cap(X86_FEATURE_VMX); + + /* + * _vmx_vcpu_up() may have made it past feature identification. + * Make sure all dependent features are off as well. + */ + vmx_basic_msr = 0; + vmx_pin_based_exec_control = 0; + vmx_cpu_based_exec_control = 0; + vmx_secondary_exec_control = 0; + vmx_vmexit_control = 0; + vmx_vmentry_control = 0; + vmx_ept_vpid_cap = 0; + vmx_vmfunc = 0; + } return ret; } From patchwork Thu Nov 16 13:32:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13457911 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B0229C197A0 for ; Thu, 16 Nov 2023 13:32:25 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.634215.989569 (Exim 4.92) (envelope-from ) id 1r3cTc-0006lN-8I; Thu, 16 Nov 2023 13:32:12 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 634215.989569; Thu, 16 Nov 2023 13:32:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r3cTc-0006lG-59; Thu, 16 Nov 2023 13:32:12 +0000 Received: by outflank-mailman (input) for mailman id 634215; Thu, 16 Nov 2023 13:32:10 +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 1r3cTa-0006l8-UZ for xen-devel@lists.xenproject.org; Thu, 16 Nov 2023 13:32:10 +0000 Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02on20617.outbound.protection.outlook.com [2a01:111:f400:fe13::617]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 8b0efd9a-8484-11ee-98db-6d05b1d4d9a1; Thu, 16 Nov 2023 14:32:10 +0100 (CET) Received: from DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) by AS8PR04MB8499.eurprd04.prod.outlook.com (2603:10a6:20b:342::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.9; Thu, 16 Nov 2023 13:32:08 +0000 Received: from DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::eb8e:fa24:44c1:5d44]) by DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::eb8e:fa24:44c1:5d44%3]) with mapi id 15.20.7002.019; Thu, 16 Nov 2023 13:32:08 +0000 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: 8b0efd9a-8484-11ee-98db-6d05b1d4d9a1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SMJyj/DHv/ISSgs5UP8EAZ9C8xzUxb1yBeemLwloN1gJGENNb+QPGWCPbY1JjajNe1GndZPqE25+yQKo7jwBskSy6fIFbHedE/TMdPQ1JFLwPec2rPPKw23d/O9YWwotJg6T/gF/3wrv/h2hkdTk3Ff/zt24rcYdQFYysl/2wpjeVZIRheOv0nORIZC/aDykuAqsxrcMrI4x3a4qED5AZDmwmF7A8wwCtiWHysOaR3YvfpxS2isUzLmOHHBgv+sS/RwwyS0PyNc82drcVrFarPOV0mOBy1MJcxnjHizZSayhBaDlv/Njr9m4SyGf6Ex5qW+tfA8YBtgHDwYsovROuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=BH2ili1cHCQHt6/Qmlk6IQSHtN0pbcv6mxMT7/SbihE=; b=grbl9di9HveNzE8N7YuO73ibRPm0rEx2hHmQU/HrMxvUrvtv+b2XSYo31HZU/p/vayKyaCA6qJas+4nfrNAtl39XwPqAK49Z6mEwpaAEl8hf1vb8V5f7VvtN8OwzB2F5FawI8RKV3NMnPmM2CcAnwoiWK5uNf5zJkEH3axsghod7b91VkJ+Ik+FUzEwSnqgQt+eCwBGm/M3dFWFFUGYgFLuWu7fQI8lSehTx1lyKCnyMeg6o6bQMNlRn5LT1tr+nwMMjPZFT7/5ZRh9JujsO2SJZVI97R2x/g71qzqFrrFIi7Yz8ZjuEwTOLSzZR9Pr4vCwUSuXlcyBGxys49zr8ug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BH2ili1cHCQHt6/Qmlk6IQSHtN0pbcv6mxMT7/SbihE=; b=GfRzTWpioodqGdrh1XMSiSmMT9yuZzLLSwyTjkczfpGExyPx26WZ/R+GJbyQBQHNKZov+4jZjyHiPtP8aMtbfGSW4glOcu7X7kMNDm7fvAb40bXO0ARhXfC374Yi13g59WR+6B7vbb8osU2nYvTbwYHHkl/pY7O/EOtrsTMcDcfNxX8ntr9so/aacPb7tz2j6tdFuBxw2Sb1htOZKnFcUhPk5puFgQUYJ9UG1+RvZNRKbQgxuPoZQsr86N1hMo3AmrtnKCDIjDkP++tv0OgKS6VXSGMUyhQm4ZytbvBLF6sJhlxTR9O0UaRHm9jRauV08L5QpVRjtJsBBIhOchrQkw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: Date: Thu, 16 Nov 2023 14:32:07 +0100 User-Agent: Mozilla Thunderbird Subject: [PATCH 3/5] VMX: don't run with CR4.VMXE set when VMX could not be enabled Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Kevin Tian , Jun Nakajima References: <791a9f45-2bed-48f9-af6a-9fbde65bcc71@suse.com> Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 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71@suse.com> X-ClientProxiedBy: FR4P281CA0106.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:bb::10) To DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8790:EE_|AS8PR04MB8499:EE_ X-MS-Office365-Filtering-Correlation-Id: d1e03b6e-c3db-4966-2615-08dbe6a86e8c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Z/m0ZwrQKWPRYCIervUkuTpFB2KG3PPmAyTFSlm+mW0XKMoUl+En9VieeebWo5HSj0b8Cs0MjX+WpkwXQACM8nCOrfK+Jg926zJ3V7qXVDbTMjVecjez4odpRll4aYumRn83ADbc4/fIO4Xjn7ThZi+VIN7I2KiseQfHCY2JkTqDu0Tgf/gWiIZIp4uJc627x+4+wJz9uS+jZlBMyTA3Md1faPDau/Dm2Vh7TbDowVfuKFAlufKoEqrHNbLhvvJcSUesgnru3QKBQGKY3xl7yCOmTbEW/xcQmMuJfnGKqy49UUb7kwEs6W/WVkhM2qPTBFBknmHOuwmesN5Bp57CKq4MCm+8fWvv4Mil5iZt183BdP6qfBlDxh49tKvSAfSEd1M8hPmow3D2LdmgZNtQyt1B2FFmCA5egA5DSr3E7U9+sx+RrvY40B5CT4KlkNPnVD4Y8sni81V6NGWnVcbwm1Romsgc5Y7rdsBPqYBEYemrIIvWNF8KoY5GxewTIzlcqksDS4z/AtlYOXh7ExTPfRAGoTNgwXnWpZvY8bLh8hFPuvj7o51zNbPO/ecf0NJW2ZHDJbUHBY6ArlsYy0GVLQgOqPmSofvHwBLtji0NiMw1ZAah2KoZaQglxC80OPWnsXamveUtiUxd9VQCjJF2zw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8790.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(396003)(346002)(39860400002)(366004)(136003)(230922051799003)(64100799003)(1800799009)(186009)(451199024)(2906002)(31686004)(38100700002)(4744005)(31696002)(86362001)(5660300002)(41300700001)(8936002)(8676002)(4326008)(83380400001)(6486002)(2616005)(6916009)(54906003)(36756003)(6512007)(66476007)(66556008)(316002)(26005)(66946007)(6506007)(478600001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?L4zY7V/kp0WPDilUCxKjhrX7XThx?= =?utf-8?q?0eqiCVe2reNIcTfu9AwhHFCBxhZdm/+2kz8ffvHVq1p/JF6Jd+W1Al21so38Xku9v?= =?utf-8?q?K7Y/zKNzyJlicEpOYHpruKFqqQupggpSVHf9QRid/KGHrRcZ5GjdZWCJxZFHcgBFs?= =?utf-8?q?Jq7T5f9VlUzisyvFVMIP2/9PRUDPSvMsAyYri/n75dwhKKNOMrgN/G/3k7GLS8//z?= =?utf-8?q?lZ4ByjjyO/oAYSSPrTjVGCkuX3eWeXCVrThKhpZ0ZQ28+iUb1Mt6zi39bB01vythq?= =?utf-8?q?rM+cjh/PC5rk5XRxznh3xjAPfHVOl0YcyEQJYEzHxLWZd/LvXTDjdXHTVAnxbSrah?= =?utf-8?q?or0GJLymKKuRaYluI9QjUUtzgZGqSA0pmcp1H5OVmQ2VZJFPvy8RzmxjiGcS5KUho?= =?utf-8?q?FnmfeSzeTN7cs31dvl4cJKDzr/oHxlBHnWoZvb7Lx9jeeL+tH+2kZdbQcVEvtGBaD?= =?utf-8?q?UMucvG1rbRQyrIEbMF3G2HDLOg+DXxN1PmdFz4lUJ7MhYEtiWJOcWj89o7cxhc8BZ?= =?utf-8?q?mUo+T1UFM6jG11bsAOp7GrkF3P6Oxj0Ek2O76E0yMNH20loEsWz4jU5J0zC+EGGX7?= =?utf-8?q?Ucr1POj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pbIC9jlX+0YEsznWHfqq1dNIrd+KcmMzJkg2ELdPmeVce7eS9fisE?= =?utf-8?q?moKmgZr9ywsF?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1e03b6e-c3db-4966-2615-08dbe6a86e8c X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8790.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2023 13:32:08.7717 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 14LtYr3c/r92tFAZdPwmyAO+Onrrky59gNh+wpZ/R8zJs0gm+Thdtj5C8V8frepGqnqCO8/8QpjkKEJ8sdd0mQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8499 While generally benign, doing so is still at best misleading. Signed-off-by: Jan Beulich --- Using set_in_cr4() seems favorable over updating mmu_cr4_features despite the resulting redundant CR4 update. But I certainly could be talked into going the alternative route. --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -2959,7 +2959,7 @@ static bool __init has_if_pschange_mc(vo const struct hvm_function_table * __init start_vmx(void) { - set_in_cr4(X86_CR4_VMXE); + write_cr4(read_cr4() | X86_CR4_VMXE); if ( vmx_vmcs_init() ) { @@ -2967,6 +2967,9 @@ const struct hvm_function_table * __init return NULL; } + /* Arrange for APs to have CR4.VMXE set early on. */ + set_in_cr4(X86_CR4_VMXE); + vmx_function_table.singlestep_supported = cpu_has_monitor_trap_flag; if ( cpu_has_vmx_dt_exiting ) From patchwork Thu Nov 16 13:32:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13457912 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 85553C54FB9 for ; Thu, 16 Nov 2023 13:33:01 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.634217.989580 (Exim 4.92) (envelope-from ) id 1r3cUH-0007Ie-Hk; Thu, 16 Nov 2023 13:32:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 634217.989580; Thu, 16 Nov 2023 13:32:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r3cUH-0007IX-EM; Thu, 16 Nov 2023 13:32:53 +0000 Received: by outflank-mailman (input) for mailman id 634217; Thu, 16 Nov 2023 13:32:52 +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 1r3cUG-0007DF-JP for xen-devel@lists.xenproject.org; Thu, 16 Nov 2023 13:32:52 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2062f.outbound.protection.outlook.com [2a01:111:f400:7d00::62f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id a35deb2f-8484-11ee-9b0e-b553b5be7939; Thu, 16 Nov 2023 14:32:51 +0100 (CET) Received: from DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) by AS1PR04MB9333.eurprd04.prod.outlook.com (2603:10a6:20b:4df::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.18; Thu, 16 Nov 2023 13:32:48 +0000 Received: from DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::eb8e:fa24:44c1:5d44]) by DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::eb8e:fa24:44c1:5d44%3]) with mapi id 15.20.7002.019; Thu, 16 Nov 2023 13:32:48 +0000 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: a35deb2f-8484-11ee-9b0e-b553b5be7939 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fgG/t5S8cqu9/92dBpqjmwC1a1PCcdMTGsyo9ye+tnQhntm9QeN4JbbD3FgBC64jLX1EuGQSFIEHP5mxskI0XZSJmMZIg3RKpLxPr5C5q852YZaty/0kxj8uNCJ/bppvW7Cs2Z9eRSzd/fL6/HSvQuaWwbdz5xx7jAqM3XBWe0h2Q+upKIc17ylBXv+HERLSlitvnECqN3gt6rhUVlhRDZyhzLHxlRgij/IMgUDkGLKTxyg0lXHFh4XEXRWLZMx1HQrhDhCva8LEIbvHj37afEB8iJE3yXY0kq5VFcCpSSFQ1CZqW3ceCFEk+0JZZJ/i/qORDBmBCO5Okze0bHZ2Ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=bIKEOf7RPr2XJINaMBbAxC+M/xeaOf3qKmLgganWrro=; b=ZMWhybTBRpdojieaW2+PxucipcRqEOuIRzJOYtNhip5i5S0O57PSY6KXii72RDnWpXiNN+sPvccRn+NVMJKBxHB3KPyOWUR5VLjmhc7AyXfFk+BgZBmtKTjMYvLxQZEe1kD42QO1ZOIyZFRv9jVbCrk5Z1PB1DZmGePyo88sNzt6CqYGrw/OP38L6FnVwkg/N0j341pjxQC9zbd9bC2Ivty3Zas8rkIOLeiDNs8gT1f6LG0+ZQNI+8BNLfXJhbBqyUKK60WSUrzGc71kcpEL89MshGwsSc1Dnrhfe+NM5ZqL5MFUbUxoVHIOGyxTmEhZnXQVyZWjOtV1QuqNjJJu5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=bIKEOf7RPr2XJINaMBbAxC+M/xeaOf3qKmLgganWrro=; b=GNztj4NdwmDqLIBjY3LytSHzqJD+4HjBZL84gi7IkHzjfLI5fibD2B/+Wwb5NlokvUeu6iva69WW07jO0YO+OgqUoKIagqld2Jy883YyojXJsNe0iyZj1nr0R0KYAhQNcErZdXzhXP5Yph2CR0gANNh5uYGB7w9b3lwTELItjr7KXY5rwmLCwVNY+s2N4RjoTm20sfJzGpioxfgCwPhRP1pQQrrXZU+GQbPS6HU4ILg08ZFHv0TP9AkYvt58Oo4lClwF+/L1uWvulXIdYYpML1Xp0OStHGOmzoQ2MMQmzvCX74UXgOmUobj1lBMik4W9cWD5tDR0uBamNUZ6QM2qAA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: Date: Thu, 16 Nov 2023 14:32:47 +0100 User-Agent: Mozilla Thunderbird Subject: [PATCH 4/5] x86/HVM: drop tsc_scaling.setup() hook Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Kevin Tian , Jun Nakajima References: <791a9f45-2bed-48f9-af6a-9fbde65bcc71@suse.com> Autocrypt: addr=jbe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kxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <791a9f45-2bed-48f9-af6a-9fbde65bcc71@suse.com> X-ClientProxiedBy: FR4P281CA0106.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:bb::10) To DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8790:EE_|AS1PR04MB9333:EE_ X-MS-Office365-Filtering-Correlation-Id: 841e1965-fa3d-4183-c65d-08dbe6a88636 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AnVvb76jNq8lPPTcLdqcoKUb+HjP5g5eqO9NsRSInNHCFIkg6uLB7lT1/WW+4xbYjeZqRAZT0Rn8xDd1g5FVbMBIvOpyYP65mZ71gTQ208ckIOMrqyb/Neh5+hZlx6BFqQLxSub9/d7dm01ZEX4sGHjLkNS93v9nyxW9f4ij0ZKygdfd9skMFK4ykiG+P2wfSEc0Ih85AMmMMYN+5omnnjwcEXDxVeEAfbjxlYwIdOvwUCgUl2qQAiebXpJHw5j3pxa+kABGuuvbI8H4krqd/DTRmlDGErdh4L1/NuPQMQzzuXEJPncnAwU8o37jeXtsi5Fp0MNShGKuh4Qf30I3tu3ocONoJ8CMQHAeRIn8oelowTWxqjGUfzqIbcajZ6Hrc/6W6g++4o9ExA3A43vtJS2J7ynQrw0NyIEFpcdesMoNPEaMqqYctfgAxDVI6+aBpVRp302XdbMdiR6vNMfZcw2VtwXdeoNGwBx6ksguwaDxwJZhqO05N7JnjR5oollkOMnIBm7b33R/LklSQAjheWEeNexDLus2e2DgWSylIoS+dH3pHMpfTLttsQC89xGEFafSSED0WzV63Hsw4ZYFpLII/vFU9nw01AYQggId105uYdcTBSJyo+V60Sc8p1Jz8YQHCAUle0rCxUMVSY+IeA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8790.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(396003)(39860400002)(346002)(366004)(136003)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(8676002)(86362001)(4326008)(8936002)(6506007)(31696002)(26005)(41300700001)(2616005)(2906002)(31686004)(66946007)(66556008)(5660300002)(6512007)(54906003)(6486002)(478600001)(66476007)(316002)(6916009)(83380400001)(38100700002)(36756003)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?dpQctItTdMBLvpKh1zWsUPrD0YpO?= =?utf-8?q?VfNXxG8H3JZzxo1IwGCgV025I19tyQeKei5kFt3b2/4V8/JvNwZ11RgRIIK74KUtT?= =?utf-8?q?bSnfJcwSHsQMxepaqLec0hCNU9UIiBaR/2hPlRnmPxAqr9wRc9S6Aw3SGp02dCZeM?= =?utf-8?q?YkbdC8/RQBzzifoJGy7OABvMKxKprZw/O4HMWb4H4Zs7r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AYQz32FA?= =?utf-8?q?ww9/XhKm30CqeelgLsWgS1IYpTf2OErvQ8QITeM5QU23pXM3+fVqSRzevRLnWAl/C?= =?utf-8?q?zk0knIOsOZ8bWqXFPR43vTuUMb6/yONk8OEP5xgAMTo6rnGjXbF5Utv80vsDwOydL?= =?utf-8?q?NbbxsSuw+4gDXxlB1Wp8c9gzRqRpWRaS7UMB7Ws2q2kNOf2o5EDtGBnhufoLgGmc8?= =?utf-8?q?TqnOrDc3LZCUQNQ4tRIpJekrDgxlKPTCPzXURIn8ynEGKc6BSu0N9P6TFGi4/ycp1?= =?utf-8?q?mnWq9aIfpfcfietUSC4pBs6FynAc9FyUTgSmYXLcStVA6Dmn/VYbSSDIbNz1WwzS7?= =?utf-8?q?OZjoEAmFNqtbd5GaozUSw7ajqtsQDbHtNw9T0cu3Rzw23P00eR8GYsByFTrB3dpvf?= =?utf-8?q?IHVktOOiAdDjyW+uSKkECoU8AvQ6scL6VenySCef/86TW0bJdELZH2w+qwjj9Zj9X?= =?utf-8?q?eja3bmZuerI6?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 841e1965-fa3d-4183-c65d-08dbe6a88636 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8790.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2023 13:32:48.5119 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: hnATFyoVvGC67MADXogEyYhpEo3hd8XdM3TzUNMOi7pz9NdM/ycr64B6apIUYDQVuKRFp0lt7o1iZSdPZyHv8Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9333 This was used by VMX only, and the intended VMCS write can as well happen from vmx_set_tsc_offset(), invoked (directly or indirectly) almost immediately after the present call sites of the hook. vmx_set_tsc_offset() isn't invoked frequently elsewhere, so the extra VMCS write shouldn't raise performance concerns. Signed-off-by: Jan Beulich Acked-by: Roger Pau Monné --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -1086,9 +1086,6 @@ static int cf_check hvm_load_cpu_ctxt(st v->arch.hvm.guest_cr[2] = ctxt.cr2; hvm_update_guest_cr(v, 2); - if ( hvm_funcs.tsc_scaling.setup ) - alternative_vcall(hvm_funcs.tsc_scaling.setup, v); - v->arch.msrs->tsc_aux = ctxt.msr_tsc_aux; hvm_set_guest_tsc_fixed(v, ctxt.tsc, d->arch.hvm.sync_tsc); @@ -4033,9 +4030,6 @@ void hvm_vcpu_reset_state(struct vcpu *v hvm_set_segment_register(v, x86_seg_gdtr, ®); hvm_set_segment_register(v, x86_seg_idtr, ®); - if ( hvm_funcs.tsc_scaling.setup ) - alternative_vcall(hvm_funcs.tsc_scaling.setup, v); - /* Sync AP's TSC with BSP's. */ v->arch.hvm.cache_tsc_offset = v->domain->vcpu[0]->arch.hvm.cache_tsc_offset; --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -1454,20 +1454,13 @@ static void cf_check vmx_handle_cd(struc } } -static void cf_check vmx_setup_tsc_scaling(struct vcpu *v) -{ - if ( v->domain->arch.vtsc ) - return; - - vmx_vmcs_enter(v); - __vmwrite(TSC_MULTIPLIER, hvm_tsc_scaling_ratio(v->domain)); - vmx_vmcs_exit(v); -} - static void cf_check vmx_set_tsc_offset(struct vcpu *v, u64 offset, u64 at_tsc) { vmx_vmcs_enter(v); + if ( !v->domain->arch.vtsc && cpu_has_vmx_tsc_scaling ) + __vmwrite(TSC_MULTIPLIER, hvm_tsc_scaling_ratio(v->domain)); + if ( nestedhvm_vcpu_in_guestmode(v) ) offset += nvmx_get_tsc_offset(v); @@ -3030,10 +3023,7 @@ const struct hvm_function_table * __init } if ( cpu_has_vmx_tsc_scaling ) - { vmx_function_table.tsc_scaling.ratio_frac_bits = 48; - vmx_function_table.tsc_scaling.setup = vmx_setup_tsc_scaling; - } model_specific_lbr = get_model_specific_lbr(); lbr_tsx_fixup_check(); --- a/xen/arch/x86/include/asm/hvm/hvm.h +++ b/xen/arch/x86/include/asm/hvm/hvm.h @@ -240,9 +240,6 @@ struct hvm_function_table { uint8_t ratio_frac_bits; /* maximum-allowed TSC scaling ratio */ uint64_t max_ratio; - - /* Architecture function to setup TSC scaling ratio */ - void (*setup)(struct vcpu *v); } tsc_scaling; }; From patchwork Thu Nov 16 13:33:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13457913 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AC90FC54FB9 for ; Thu, 16 Nov 2023 13:33:32 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.634219.989590 (Exim 4.92) (envelope-from ) id 1r3cUh-0007mg-QN; Thu, 16 Nov 2023 13:33:19 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 634219.989590; Thu, 16 Nov 2023 13:33:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r3cUh-0007mZ-Mx; Thu, 16 Nov 2023 13:33:19 +0000 Received: by outflank-mailman (input) for mailman id 634219; Thu, 16 Nov 2023 13:33:18 +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 1r3cUg-0007gH-80 for xen-devel@lists.xenproject.org; Thu, 16 Nov 2023 13:33:18 +0000 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on20626.outbound.protection.outlook.com [2a01:111:f400:7d00::626]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id b36d4a09-8484-11ee-98db-6d05b1d4d9a1; Thu, 16 Nov 2023 14:33:17 +0100 (CET) Received: from DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) by AS1PR04MB9333.eurprd04.prod.outlook.com (2603:10a6:20b:4df::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7002.18; Thu, 16 Nov 2023 13:33:15 +0000 Received: from DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::eb8e:fa24:44c1:5d44]) by DU2PR04MB8790.eurprd04.prod.outlook.com ([fe80::eb8e:fa24:44c1:5d44%3]) with mapi id 15.20.7002.019; Thu, 16 Nov 2023 13:33:15 +0000 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: b36d4a09-8484-11ee-98db-6d05b1d4d9a1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YkDe1RIdNRswCTdrjm+GYR/+oxTqJYeNxkhOTLBaQXolbrzvwG9hGkCotCChOuXNIH2iUB1QQgoKJh3mA/wJchnqXCd7ZUM7DDx57B+LwJGXXFs8yi1mfUSyLNP6/eZXLAUULaRJIQQOnbvCQ/wUtL7TBl2IwuSFpBW0/TyPhbtlViaj8p4+F+WHYtGtyF8pRavUxZdD9XwjiAmGa2PqXrxLvrufg9xDVZPcVhhRUgjwkChXwuE3G/Eqcwh378jN7B6BlPzKB9ZlcdKTK/+oWlrUjGEp31V1S24BzNE6nuY7mnKcABYuhlBZMMEgvmVQcKIC9f1XCrB7q9v9seIzVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=WstOM6kSQiRatyCSXLVmuSOk8VucCyz+eoVm0OagzGo=; b=mZCCYcaIwwn1Z8iwQwM95axqSycKoHemK9G1n/qPm2ZpQZdz7eq/WcRWB6dy+h0FBb4TdlXi15BDL8XJzp8Z3lZDKm4OgmdtZKkAq0LDukC26HE/I5cV8jMLoOZoiQghhYxlyFsfYDR5KevM/680161DWl3lnkGGfXtMXHG7801TR4pqjRkBT3J0yWHRvAkVhmjnEaL3b1lDfBd8GqmJvhbNM1PYqbYCjZIUIIi8jimyGrCze3YZP7ZdPKmdMvy/TDMGSPo/TsWMkHfzf17OfwlO6VniH8mvsGJcX8KxWnBNWL72/UH4MRD9be4gsW3Ro5eZN9BZT8ca/nKlm/Fh5g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WstOM6kSQiRatyCSXLVmuSOk8VucCyz+eoVm0OagzGo=; b=NT+pGiZ0cB+MS90Q0W/VOKgPbIAv1LMNovDqECPgp1kpYZliQmKSSUvLpl7ESNyiY00GznYJBEOqDkwhrHx3slq0q9ECRSHzsNKlUe6XVVuG4jf/Z4ueZvakcNJ71/DYo/XvuQnJSs6e+evkM61PzKufYa4Y9NbOQhATRV+o0+lfyB2n2jaLTKHRW/8ivWQjfbKhowjOB9Y6NDYkojYVIojPu9iIEt5oQDJQQ9/+OZNoWzFAwOfmABi7ywHOl79VY4N1SQlY6SdAc67jqeBQzmsUhSPCYrYDc76og7a2FK3rMBMMTDAdPOxvPNbICOv2Vm5mDi3pSxB0rK5n0ne/kw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com; Message-ID: <40585213-99ac-43b4-9432-03d739ec452c@suse.com> Date: Thu, 16 Nov 2023 14:33:14 +0100 User-Agent: Mozilla Thunderbird Subject: [PATCH 5/5] x86/HVM: improve CET-IBT pruning of ENDBR Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= , Kevin Tian , Jun Nakajima References: <791a9f45-2bed-48f9-af6a-9fbde65bcc71@suse.com> Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <791a9f45-2bed-48f9-af6a-9fbde65bcc71@suse.com> X-ClientProxiedBy: FR4P281CA0106.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:bb::10) To DU2PR04MB8790.eurprd04.prod.outlook.com (2603:10a6:10:2e1::23) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PR04MB8790:EE_|AS1PR04MB9333:EE_ X-MS-Office365-Filtering-Correlation-Id: 18cd985f-33dc-4429-76d8-08dbe6a89658 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eu00glJxmeQi9cLSD35JpcbhvJhDs+580y8xAE88diDNrkYLZRYcrOuRTSWWyhgW3xdwFwEH0k91TkItrnZj2wAxp2Bg1+eQR/QRJy/CVgygRLwF+JaCt5VvHt7l+2LoRkWvxx2/C19JZFQweGqOmPXeDcPaBcaHX01gNA43bK9H/CT5mTAPg0Xdf0fjk9+ik6mSKP1mE78jzRK45ZH1nvO4djBNk+QFfA0JUsJ0AmSZb7t5ERlRva1Zw5OIVticIp+j0sb0emvV6g4DqbPrT1AY1+ChXNr2HZfThV7esjZp3USlPcrRTxNT7qxw09RpibTwv8kVmmkfSzQMbLxg0HKZJ9aquG5ek9pxiUcjulOd4IjDq34yStK10CV15zDmA+wSCTpX1+RHx27IZ0NWkIQ6hWeQLy2hsDLz5YVWD/8pR40wqjRZeQxHixG5wbWqKqYM641W1jacwMyR9byH7BX4NLmFhgj0m2kYqRe1eXd1o/Mr5F6OCmDKeMo4BcNysiC2Do0L1O5Mh0m2EiJvmUWQAmDKQCi/EcWgP/ADgntSzyqG1KQFdMCjlbwm9+nA0I9drUkUEt4uK6+1RF57o3nHo4SGqhiMOlqpJ7O4W7vPUIOwM7mPSEuL7XCnu0RuMgl8I2kv0Z7TI5odlUohH7sGzwJPVwtSVu/Z8r5cbpc= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DU2PR04MB8790.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376002)(396003)(39860400002)(346002)(366004)(136003)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(8676002)(86362001)(4326008)(8936002)(6506007)(31696002)(26005)(41300700001)(2616005)(2906002)(31686004)(66946007)(66556008)(5660300002)(6512007)(54906003)(6486002)(478600001)(66476007)(316002)(6916009)(83380400001)(38100700002)(36756003)(87944015)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?U4Vn0PDOwIcNRXniUf3B00DRkJ3b?= =?utf-8?q?9i6hZQnYQS68mIXRCvrEK8uY2jZDcl4y8zOOjR3xNs+n96WQoCkqrbb9sreZvAKqF?= =?utf-8?q?vusW72tZKztKMaxeOvgOBjAB35Cy4urpXQtL02OCV5XVe/jG3XbiokUPG6PEtPRJc?= =?utf-8?q?u1Kkjl89Dz9PmIjjfIWyqp8Q5VkemTtbZ+MOO546wQF9C34VT9+sQk2dIrKHRoYgb?= =?utf-8?q?lN/Aar1B0hwy0md0BONttd8q9Rkrh7PIeXWdjKOdSPsRE/z2IMRP8QBMZzs4jhFIa?= =?utf-8?q?J68jDtVXD7HUIzANC/WlVoELrlIQqJkRS6wUErbX4LDHxR5P713LblcppO2ILmL1x?= =?utf-8?q?ID4W9U8oj0K9cto7Gt+bxozZzWW90gmQZHJiCEPyvjCspLVnKCBzLRZK/rlBnmioX?= =?utf-8?q?szt2OO/ysPiN5pUEhdhtcD1TKD+bsyCs/0xmICXYhS9/R8Z7n7DNu6CSumxh89WT7?= =?utf-8?q?kUQGhfM2muD4Rn26EfPHPWKX9CFUP3UmOPuqKLrfdd1qzTbmOikxIoFdiYX93doAV?= =?utf-8?q?58VHsS+/IhtLMJxe8x4j5lMw+ZxrzGsFD+KMSBD0F/TFJZfE5Bd6mz6jHQsZjP00P?= =?utf-8?q?3JG6+RWiMjtBwP4gsrv0E10dnbaQz9zMfMdAsBhQ4lRZCiRY0JHNufmIeSKbtH0D1?= =?utf-8?q?AJewlnbKCKw05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X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 18cd985f-33dc-4429-76d8-08dbe6a89658 X-MS-Exchange-CrossTenant-AuthSource: DU2PR04MB8790.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Nov 2023 13:33:15.5907 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: GFOGWneO+XVUD2GRqu3Xzq3X2q+wuyF4gKg7e+TmrfJmwX9Pmj9uj/DP+hf7l4kGJrTDywVs89/XArcsi1lNjA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9333 __init{const,data}_cf_clobber can have an effect only for pointers actually populated in the respective tables. While not the case for SVM right now, VMX installs a number of pointers only under certain conditions. Hence the respective functions would have their ENDBR purged only when those conditions are met. Invoke "pruning" functions after having copied the respective tables, for them to install any "missing" pointers. Signed-off-by: Jan Beulich --- This is largely cosmetic for present hardware, which when supporting CET-IBT likely also supports all of the advanced VMX features for which hook pointers are installed conditionally. The only case this would make a difference there is when use of respective features was suppressed via command line option (where available). For future hooks it may end up relevant even by default, and it also would be if AMD started supporting CET-IBT; right now it matters only for .pi_update_irte, as iommu_intpost continues to default to off. Originally I had meant to put the SVM and VMX functions in presmp- initcalls, but hvm/{svm,vmx}/built_in.o are linked into hvm/built_in.o before hvm/hvm.o. And I don't think I want to fiddle with link order here. --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -161,10 +161,15 @@ static int __init cf_check hvm_enable(vo else if ( cpu_has_svm ) fns = start_svm(); + if ( fns ) + hvm_funcs = *fns; + + prune_vmx(); + prune_svm(); + if ( fns == NULL ) return 0; - hvm_funcs = *fns; hvm_enabled = 1; printk("HVM: %s enabled\n", fns->name); --- a/xen/arch/x86/hvm/svm/svm.c +++ b/xen/arch/x86/hvm/svm/svm.c @@ -2587,6 +2587,19 @@ const struct hvm_function_table * __init return &svm_function_table; } +void __init prune_svm(void) +{ + /* + * Now that svm_function_table was copied, populate all function pointers + * which may have been left at NULL, for __initdata_cf_clobber to have as + * much of an effect as possible. + */ + if ( !IS_ENABLED(CONFIG_XEN_IBT) ) + return; + + /* Nothing at present. */ +} + void svm_vmexit_handler(void) { struct cpu_user_regs *regs = guest_cpu_user_regs(); --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -3032,6 +3032,30 @@ const struct hvm_function_table * __init return &vmx_function_table; } +void __init prune_vmx(void) +{ + /* + * Now that vmx_function_table was copied, populate all function pointers + * which may have been left at NULL, for __initdata_cf_clobber to have as + * much of an effect as possible. + */ + if ( !IS_ENABLED(CONFIG_XEN_IBT) ) + return; + + vmx_function_table.set_descriptor_access_exiting = + vmx_set_descriptor_access_exiting; + + vmx_function_table.update_eoi_exit_bitmap = vmx_update_eoi_exit_bitmap; + vmx_function_table.process_isr = vmx_process_isr; + vmx_function_table.handle_eoi = vmx_handle_eoi; + + vmx_function_table.pi_update_irte = vmx_pi_update_irte; + + vmx_function_table.deliver_posted_intr = vmx_deliver_posted_intr; + vmx_function_table.sync_pir_to_irr = vmx_sync_pir_to_irr; + vmx_function_table.test_pir = vmx_test_pir; +} + /* * Not all cases receive valid value in the VM-exit instruction length field. * Callers must know what they're doing! --- a/xen/arch/x86/include/asm/hvm/hvm.h +++ b/xen/arch/x86/include/asm/hvm/hvm.h @@ -250,6 +250,9 @@ extern s8 hvm_port80_allowed; extern const struct hvm_function_table *start_svm(void); extern const struct hvm_function_table *start_vmx(void); +void prune_svm(void); +void prune_vmx(void); + int hvm_domain_initialise(struct domain *d, const struct xen_domctl_createdomain *config); void hvm_domain_relinquish_resources(struct domain *d);