From patchwork Mon Nov 25 15:07:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13885078 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 E715AD58D5A for ; Mon, 25 Nov 2024 15:18:35 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.842824.1258495 (Exim 4.92) (envelope-from ) id 1tFaqu-0002FZ-EN; Mon, 25 Nov 2024 15:18:16 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 842824.1258495; Mon, 25 Nov 2024 15:18:16 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1tFaqu-0002FS-BU; Mon, 25 Nov 2024 15:18:16 +0000 Received: by outflank-mailman (input) for mailman id 842824; Mon, 25 Nov 2024 15:18:14 +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 1tFagM-0003aM-Nd for xen-devel@lists.xenproject.org; Mon, 25 Nov 2024 15:07:22 +0000 Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [2a00:1450:4864:20::535]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f789e8a3-ab3e-11ef-a0cd-8be0dac302b0; Mon, 25 Nov 2024 16:07:20 +0100 (CET) Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5ceb03aadb1so6230989a12.0 for ; Mon, 25 Nov 2024 07:07:20 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d01d3b88a7sm4211936a12.31.2024.11.25.07.07.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Nov 2024 07:07:18 -0800 (PST) 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: f789e8a3-ab3e-11ef-a0cd-8be0dac302b0 X-Custom-Connection: eyJyZW1vdGVpcCI6IjJhMDA6MTQ1MDo0ODY0OjIwOjo1MzUiLCJoZWxvIjoibWFpbC1lZDEteDUzNS5nb29nbGUuY29tIn0= X-Custom-Transaction: eyJpZCI6ImY3ODllOGEzLWFiM2UtMTFlZi1hMGNkLThiZTBkYWMzMDJiMCIsInRzIjoxNzMyNTQ3MjQwLjI3NDc1NCwic2VuZGVyIjoiamJldWxpY2hAc3VzZS5jb20iLCJyZWNpcGllbnQiOiJ4ZW4tZGV2ZWxAbGlzdHMueGVucHJvamVjdC5vcmcifQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1732547240; x=1733152040; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=k+1d1eHTAbN7qx8eZxxGuToNd+oa2jtDcMn6UWnYD5k=; b=Bl44DEnHcf2inRdL5baHlRuyPMVfm+ebTM0EQ/I6xwvyHGIQfAdnbO+QZaW+Jo6rOu glhsjr31a2UMNZ3rj/xQuv73TTQvhkqGQVLlu/I04szdYuVYIqGQqtAXSmAq80w+xccX cwbz9hJGP2L6mWnXDC6+99JRbCJ9bMomRvzN5BxsXsHW6RUJX9GcOeZunV9x7dHdWGTc 8iau9xSvQX4eQVP1h70/VvUYuzGNXt/xXpszTUn932d2zR4GGTTruOJlWUJ/JTrkTxc2 rhThZJdnBQnzrOcNvmGo2ijp4YBeFeLqEbsXu54bC5txKJQQgUQj075q4EBqyNlDaOXL GnAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732547240; x=1733152040; h=content-transfer-encoding:in-reply-to:autocrypt:content-language :references:cc:to:from:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=k+1d1eHTAbN7qx8eZxxGuToNd+oa2jtDcMn6UWnYD5k=; b=K9lra+f0Nj5N3q5eFBQwp1t/+4mAVmOzvAwOuxmw7LiL4lF9WroSTtFVzSRAsOzF9o Mb3iovEqDwvBc1viqcUOzhvn7z8VgmLar4gerMYJ3b50EtoHi/N4In+o/yv8HAEDWJQ6 4jBjiB1gslrrqnQ7o2S+If/pm8pvFbDsoxAZbAslrHJu01gabE8Y90Ag//Vf+/Z2VWMM GLw6iXFrGO3SgzE09WQZnU6XKjEFdcfqt0Y2eQ+Hna0MDz5EerfZHsK+hocn3HDOCApS x1FI6BtyznqtSpHd7uzCI6TAq8lX1BxRrhlGqeSwSzTqBeo5ml049GDyjiX0C0K7SCsI 3NhA== X-Gm-Message-State: AOJu0YzPo94wNKPLQD3LA+ZjZyM9oe/LHp/DBfTtW+BLyqr5CYG7YVN2 MoU4KTyPZeox1m7gbHPLciBKKni9Q0WUVj53B92IcKNfBPmrkTMYIfeSVQqyzM3rr6O3G+daH1s = X-Gm-Gg: ASbGnctIymFQtTDy8Kxll4GSXmFl7DZyPFMNn6ttAOYtGh9yIiy5z+dc1vHuam430fm G1OLFHaJ0NE0AgXlpAjFDqPRJI2of9JHDBc+O45etm1yt2OBsCPSPjE4dqbAuWk2VYZ02ATU5nL o6BzhgGExIKW5w31vHZeLo39bTMQNR2Ex/eB8nJba2mzOi9ttCYo+gSyX6ZLWFWaTnVKi2dENp9 UomPJqjE5La95B4j8SXmujAJoVrmGOnz0ZAnKPXdww7+jwJYuq33EIPGmMWRrR3+enxvRKqFPt9 M+c9xJFFtOxH9hUL7dtOiOp62C3kbkPgPTk= X-Google-Smtp-Source: AGHT+IHbPhNiogIELLJ6cjXrvcWfeM5Il4LLgbQ3SkT0Fk+63R+PZDTuXBm6j3vc+bR/y0Wh5uomdw== X-Received: by 2002:a05:6402:27c8:b0:5cf:657b:bf0 with SMTP id 4fb4d7f45d1cf-5d0207c1530mr9370345a12.29.1732547238555; Mon, 25 Nov 2024 07:07:18 -0800 (PST) Message-ID: Date: Mon, 25 Nov 2024 16:07:17 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v7 4/7] x86/cpu-policy: re-arrange no-VMX logic From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , =?utf-8?q?Roger_Pau_Monn?= =?utf-8?q?=C3=A9?= References: <3a25cd59-e1cb-4bfc-b868-fb11599d22f5@suse.com> Content-Language: en-US Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiu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fb11599d22f5@suse.com> Move the PKS check into an "else" for the corresponding "if()", such that further adjustments (like for USER_MSR) can easily be put there as well. Signed-off-by: Jan Beulich --- v5: Re-base. v4: New. --- a/xen/arch/x86/cpu-policy.c +++ b/xen/arch/x86/cpu-policy.c @@ -756,19 +756,20 @@ static void __init calculate_hvm_max_pol if ( !cpu_has_vmx_xsaves ) __clear_bit(X86_FEATURE_XSAVES, fs); } + else + { + /* + * Xen doesn't use PKS, so the guest support for it has opted to not use + * the VMCS load/save controls for efficiency reasons. This depends on + * the exact vmentry/exit behaviour, so don't expose PKS in other + * situations until someone has cross-checked the behaviour for safety. + */ + __clear_bit(X86_FEATURE_PKS, fs); + } if ( !cpu_has_vmx_msrlist ) __clear_bit(X86_FEATURE_MSRLIST, fs); - /* - * Xen doesn't use PKS, so the guest support for it has opted to not use - * the VMCS load/save controls for efficiency reasons. This depends on - * the exact vmentry/exit behaviour, so don't expose PKS in other - * situations until someone has cross-checked the behaviour for safety. - */ - if ( !cpu_has_vmx ) - __clear_bit(X86_FEATURE_PKS, fs); - /* * Make adjustments to possible (nested) virtualization features exposed * to the guest