Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1214699lqa; Mon, 29 Apr 2024 01:25:11 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXCCQuePTB9148SnYn0WGwFgxbnNiGXxBnI8mngLdqtUrNtYk9D2gfM5apgxXSamANZCrOBA4ouJFBSnYg7Y0rVc2mPPE8GzI2I2TbxFA== X-Google-Smtp-Source: AGHT+IF6eUcq68nVxy+8XSJwoSL7I9RwB/NZZkQxXv4aeP4M7Lekkx/bxJ/unHuFMxGFWfkRVCcl X-Received: by 2002:a17:902:7798:b0:1e7:8d21:7fd7 with SMTP id o24-20020a170902779800b001e78d217fd7mr6110270pll.28.1714379111684; Mon, 29 Apr 2024 01:25:11 -0700 (PDT) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e6-20020a170902ef4600b001eb7a959ed9si2879937plx.125.2024.04.29.01.25.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 01:25:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161904-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QcLweRUZ; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-161904-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161904-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 50320280DFF for ; Mon, 29 Apr 2024 08:25:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 78AD5175AD; Mon, 29 Apr 2024 08:24:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="QcLweRUZ" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A16FCC2C8; Mon, 29 Apr 2024 08:24:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.9 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714379098; cv=fail; b=JW3iRYOmTKONVnfwn925YLTIK4lBp4FsjfZESCaMGb6YhGxSFmdZPDQ7tA96AM3EOeTXVMNRbVZsBf5pxdUJundprMlzls1r2/9fscl9KWTUWqnNPiiiUqb2IcaKYZOEbwkovErAjHtvnb94NuU05CtKdLa61q+574jzFUlOo0k= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714379098; c=relaxed/simple; bh=m1BuMs8kjPXFyLZ8Nq3z0PPo0OhPoW4XWXlA3PrwVTQ=; h=Date:From:To:CC:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=izN557sK+RPMfHnLkwiwqpMbZoFBj/cZe7bRzNZiVX1vReSKpY9tRLSSkPk/n+u897SDZKjl2WktInXhkj5vlzUSmxH7ZaDak1pFyR0xFy7jHZNlJ05PYGhZsSvOVO8M4zk4NMZ9ex/e8MOwMMo2PhIswoiD8jkGmSK5KJuQaEY= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=QcLweRUZ; arc=fail smtp.client-ip=192.198.163.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714379097; x=1745915097; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=m1BuMs8kjPXFyLZ8Nq3z0PPo0OhPoW4XWXlA3PrwVTQ=; b=QcLweRUZR7Tsx0Iy3BPYVWBgrJqzfQwmSLZtUViXWf53Ijh3lk1V+axy aWIRyLui6P7MNXUM7MTlNP8azeDMvUb69KdcQVR8TbHgI0H1/CprvzcWk gd22i7M/UYYkyw3OxqLqe93NLotn6OXbzLS39xDN/tcabvkvHEoF0GjUE BPdJ5Q8pEkqTcJ7WeXH/uTMduJ11kAAQ7NJQFP7Oja7/qmALKAFmt396o M4A3eDltO2E51Ayl0qtr6rFNLnIRtffD9olSZTcgPC8xHWWglRLrY3SMl XvvttXjDKPABMTs9KQCsnZKGM/x2fCSFhfl6y/8MwNdUA3umOBQzvm8HH Q==; X-CSE-ConnectionGUID: N5/o0WyeRcSIegfp6Py4HQ== X-CSE-MsgGUID: K3ZY0M3zQNqqFFS6TZkJ4g== X-IronPort-AV: E=McAfee;i="6600,9927,11057"; a="20716508" X-IronPort-AV: E=Sophos;i="6.07,239,1708416000"; d="scan'208";a="20716508" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2024 01:24:56 -0700 X-CSE-ConnectionGUID: MJBUwL0TRI+KklCWBPY/Tg== X-CSE-MsgGUID: +R0rGF3WSxu181e4SqN22w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,239,1708416000"; d="scan'208";a="30498174" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmviesa003.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 29 Apr 2024 01:24:55 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 29 Apr 2024 01:24:55 -0700 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 29 Apr 2024 01:24:54 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Mon, 29 Apr 2024 01:24:54 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 29 Apr 2024 01:24:54 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XuzewmpIe2rFbmcy//Dp529EpT4pvRRI02aFfrNwL01FodTeKz+5k260eUCfoR/YJT8NNr/VXoD0YB/RTHHodrh8j9g6aFMYupc2eIqAuDaJeFVxeY8Edq2AghqUvQMSTI7Xhwg1NIs+rI5BMTcGkJTuHopxG8v55Gn7CmJVYCjEjOYHwSO4q+P+/ZjbvSy5XeTcOeJOKAtWecEAQPLTx1iw3d8eQHHefgRxaFIutwyYzBHmjQz+H311Dr/rfUwKqVsbB4aGb1UlHVmNShX+EjyWETk+g1zeer0/3S5WO3UAPbECVL8vrsda/JD8U+q8gwL9hDdW95yq+6N/Vso4og== 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=uT1t1K6STjEQnT+Bnu7JVmqsm8d5kwGplG875R5I34I=; b=FlDCyhPVFYmKa1cv/qb5eAWPxIY+nB2a7R/UuM+kDSjbX29mBlL6qjLMzj2SDog5ieVzyiSthE75mQKGAWz9HGnnTvz5jZdhUlb2LSp1HNgM5j4qoc7mDVhuHu4kA6ZhwhG2AGS50bMvW+vrltTeeqX8DUlEv/DJMeq/m9P/D2GhPuT/eRbNIFzjG3vRyg/0trHn81OtXjC6UuczalWw/x41H9jM1yUvbycl+uCIjqZTE79ghYpNMvqwAtYdhidQPxyndKMcQZxYCP2++xkjFsHCTyFCn1I+RXAYan17RKhM2OS3Ar05njd8NIAXVoCO1NDOwpch5Bk3LNv0zGgy8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from CH3PR11MB8660.namprd11.prod.outlook.com (2603:10b6:610:1ce::13) by SA1PR11MB8575.namprd11.prod.outlook.com (2603:10b6:806:3a9::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.35; Mon, 29 Apr 2024 08:24:52 +0000 Received: from CH3PR11MB8660.namprd11.prod.outlook.com ([fe80::5135:2255:52ba:c64e]) by CH3PR11MB8660.namprd11.prod.outlook.com ([fe80::5135:2255:52ba:c64e%4]) with mapi id 15.20.7519.031; Mon, 29 Apr 2024 08:24:52 +0000 Date: Mon, 29 Apr 2024 16:24:42 +0800 From: Chao Gao To: Xin Li CC: "linux-kernel@vger.kernel.org" , "kvm@vger.kernel.org" , "linux-doc@vger.kernel.org" , "linux-kselftest@vger.kernel.org" , "seanjc@google.com" , "pbonzini@redhat.com" , "corbet@lwn.net" , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "x86@kernel.org" , "hpa@zytor.com" , "shuah@kernel.org" , "vkuznets@redhat.com" , "peterz@infradead.org" , "Shankar, Ravi V" , "xin@zytor.com" Subject: Re: [PATCH v2 11/25] KVM: x86: Add kvm_is_fred_enabled() Message-ID: References: <20240207172646.3981-1-xin3.li@intel.com> <20240207172646.3981-12-xin3.li@intel.com> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20240207172646.3981-12-xin3.li@intel.com> X-ClientProxiedBy: TYCP286CA0252.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:456::10) To CH3PR11MB8660.namprd11.prod.outlook.com (2603:10b6:610:1ce::13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR11MB8660:EE_|SA1PR11MB8575:EE_ X-MS-Office365-Filtering-Correlation-Id: 1c341f85-7c94-48cf-3002-08dc6825d79f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|376005|366007|1800799015; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?hnRNzy0Qo5W5Oix0OdxvIrrjaW88PPliKgvkFoKowDSqV9waQbRzrO32rjUm?= =?us-ascii?Q?gO6qGsVnPcAtwhpoWFQ/6h+nfhRHojjc00dsHvIxpo9oz4bdTTbnVor0/SYB?= =?us-ascii?Q?Mh1CGzzp7nFAKjUFVkfDjkJl85ovd0TXEKmUG2hptI+kmrMcOk/UYExRLscy?= =?us-ascii?Q?rOAMV1KV7e/Zt49Bi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J4j7e9Y1c46R7UJRaW?= =?us-ascii?Q?ZkfTJxK+dTsUponHOEI+QBsfQxcK7kl6KSlkZXHOoYm/nwsHrswwU/3Fzx5x?= =?us-ascii?Q?ijfcMSMD2ce8bCNqaQY6TsjkEhIo5NeW44NaFXnUKNPu0FPr53P9UJXcoISJ?= =?us-ascii?Q?hRO70bxZkaWwzvj1D7RRRna/TevvV195Jayzj0lUI1XIL+qnLNWhvXTEu/PP?= =?us-ascii?Q?EhmUhY4e1PV8tY3RtGQ5gzZ250ZWIdbK1DqeNYYJ2Q=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH3PR11MB8660.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7416005)(376005)(366007)(1800799015);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?rIlJQ2kdfe1JKbZEtszZheabW/RLeJRdwmh3dcA3b9djtWBXY39wGz8XHhWK?= =?us-ascii?Q?vQMpvpCXJp+BdIWbB8GviRTpj2HjFCX70685DHiJ6VtSOqpe1rZZHmmWujoU?= =?us-ascii?Q?d8HxhLsO+cog71Lpw82f6GFYDtJPZTMHkZYbLyJ2CqLOyf30yvUeg6Q3H7P8?= =?us-ascii?Q?fpsF26kIBS8JpGO8MWk8DkCyoo6Bg4T6C7EthtVFrrdTmYm7cEUsKL2+56yM?= =?us-ascii?Q?L7/rsub9mA49pUy7xMj3I+ZnXQYlDsjQjtE7CtRzjWT3qHkPM88nbxf4FRyu?= =?us-ascii?Q?XYmfLQ8EuloqOqVh5NkKDi4tXAAXpkO4KObnN4756cG4f3tA5Q+vya7PXxfQ?= =?us-ascii?Q?o/u6pJ13ino/4zBR72JGEGfLcnsvH0N8WqwWbDLB7VXoXr4AG+/nkuE3LjxF?= =?us-ascii?Q?O43IsCBGR4ItigIX87Et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sJdE/or?= =?us-ascii?Q?8HcvSa5p94stVs+Vkk2Q1DbV4xiUpduJbZlPCoo8assEK0HdH2wlUlHTJ8hU?= =?us-ascii?Q?C0lgTHUBpoh04XdYZI73Ta8iOwWKWJXImlUFZ6p7puuazDxOG2aAzfCZFj7w?= =?us-ascii?Q?64BrhQJqc3XuRT+ISeErEGXRJOBOAlPoJkLJd9ETbMn+vXXbUJM1D7ABDWAM?= =?us-ascii?Q?/t1WG4txGUNKrsy2CVKl1HHtZqdUQqfJhJ1aEnr73cvWhgLGDZx6XMLD2NfL?= =?us-ascii?Q?op/Cb7rMeKW8S/5z7sLK0cyhz3waZblLa6hMS6q9?= X-MS-Exchange-CrossTenant-Network-Message-Id: 1c341f85-7c94-48cf-3002-08dc6825d79f X-MS-Exchange-CrossTenant-AuthSource: CH3PR11MB8660.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2024 08:24:52.3281 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Vg7SFE13iXj30A5gRtr6mUu3jAgADFfMDm2r2ZhKsafh9C2HeizjQ2v1WmV9LFgvZej8McTtVRk1BRvWspfvXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB8575 X-OriginatorOrg: intel.com On Thu, Feb 08, 2024 at 01:26:31AM +0800, Xin Li wrote: >Add kvm_is_fred_enabled() to get if FRED is enabled on a vCPU. > >Signed-off-by: Xin Li >Tested-by: Shan Kang >--- > >Change since v1: >* Explain why it is ok to only check CR4.FRED (Chao Gao). >--- > arch/x86/kvm/kvm_cache_regs.h | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > >diff --git a/arch/x86/kvm/kvm_cache_regs.h b/arch/x86/kvm/kvm_cache_regs.h >index 75eae9c4998a..1d431c703fdf 100644 >--- a/arch/x86/kvm/kvm_cache_regs.h >+++ b/arch/x86/kvm/kvm_cache_regs.h >@@ -187,6 +187,23 @@ static __always_inline bool kvm_is_cr4_bit_set(struct kvm_vcpu *vcpu, > return !!kvm_read_cr4_bits(vcpu, cr4_bit); > } > >+/* >+ * It's enough to check just CR4.FRED (X86_CR4_FRED) to tell if >+ * a vCPU is running with FRED enabled, because: >+ * 1) CR4.FRED can be set to 1 only _after_ IA32_EFER.LMA = 1. >+ * 2) To leave IA-32e mode, CR4.FRED must be cleared first. >+ * >+ * More details at FRED Spec 6.0 Section 4.2 Enabling in CR4. >+ */ I think we can give more context here, e.g., Although FRED architecture applies to 64-bit mode only, there is no need to check if the CPU is in 64-bit mode (i.e., IA32_EFER.LMA and CS.L) to tell if FRED is enabled because CR4.FRED=1 implies the CPU is in 64-bit mode. Specifically, 1) .. 2) ..