Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp847763lqo; Fri, 10 May 2024 18:24:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX3rJDTFPew9DuuRuBTrhI5Y8dnN7H/QBnPMFZs0MCL7oziHfni+uUpVTB816QyIoyoPliR3XrteO938oCnXUTVApocMaIxdue/b6fVRw== X-Google-Smtp-Source: AGHT+IHyRs3RElQo3LrsnkRn7rbLcf2KOX7lWHKlmKo46TGjZD5V05d2Lm+v1/soSMBPLcM0w1yx X-Received: by 2002:a05:6e02:219b:b0:36c:4d8b:b712 with SMTP id e9e14a558f8ab-36cc1468bc5mr47003935ab.6.1715390683408; Fri, 10 May 2024 18:24:43 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-63412a4debfsi4424334a12.756.2024.05.10.18.24.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 18:24:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-176359-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=HNKOhaa0; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-176359-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-176359-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 64457B231EC for ; Sat, 11 May 2024 01:24:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1DFF412B82; Sat, 11 May 2024 01:24:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="HNKOhaa0" 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 1EA7F8F5E; Sat, 11 May 2024 01:24:20 +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=1715390662; cv=fail; b=SO3aFG2Ac924SM7pwEyRne6RhartqB7a4kCYGBPqdGQLlJEnXHBoHp9q1Aj2VUxkv9dxjZRdDWTksaQRF42j7l0D5KMW5k+6m9lGZS4lihChfQfXp9xrrNBW11vFE3Cdis8s5+2hRgQroU2Ft4V6MW8Spm94ZzM2tps6jWFQNMw= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715390662; c=relaxed/simple; bh=KSIWB4MS4RicdIIZSlGAYAZZoQ+NUScC+TEewIRaPDY=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=T9FFsBhiKzgUEmTxfj6DR77Zt0hUChY83k0uiT0/z8M1leT7zRvIQb51Qm7fzwqrcTS7saXOAYsN+M/mu6XyxDqAvGfnDLjujbVVJeiyXr064Qn0azVif1aSWMaOQBzW51wpnDpYs9/jJcGpFsqsKT339nsVBLrM5wTancMPuVs= 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=HNKOhaa0; 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=1715390661; x=1746926661; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=KSIWB4MS4RicdIIZSlGAYAZZoQ+NUScC+TEewIRaPDY=; b=HNKOhaa0ds4k/8vxv6zD4AAVaZ6khXPoPhyL/D+1ORIxbiqXobmcmYDQ +1M+9vHkNpN29g0JfhuGOrOz+J8gjUwfpRVFwF4T8CaLeS8+366NMxGpy KPaDN9OC2Bix+9YZgNbRoGkafJj+V1T2nM+d+NVvsJzF+O8LOCN03hlPv hd51hVxWMt4tDhvfc40lYCWYphJUIBNCobt03Sgm4ZnmWCYofywDDuH96 i78MFkcyuG5MyvvAEfk6XWoonO0z5Z2FBZ2uvJo750d1m4Oy0HO9Rd3o9 /E0Xpifg6HXIlq5LfJDcb8sZX8WDP9M4IG+XteatgIx0/n0uT8QRor34w g==; X-CSE-ConnectionGUID: eNUSen/9R62GNImjMSa4Ww== X-CSE-MsgGUID: ILaSB0X8RO6V9i6wY7XJFA== X-IronPort-AV: E=McAfee;i="6600,9927,11069"; a="22066648" X-IronPort-AV: E=Sophos;i="6.08,152,1712646000"; d="scan'208";a="22066648" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 May 2024 18:24:20 -0700 X-CSE-ConnectionGUID: hCYiEumTSYeCVC0nqvP5uQ== X-CSE-MsgGUID: DPGtEqgUStK1KxKVLBvAOg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,152,1712646000"; d="scan'208";a="30178066" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by orviesa006.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 10 May 2024 18:24:20 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 10 May 2024 18:24:19 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Fri, 10 May 2024 18:24:19 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.101) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 10 May 2024 18:24:19 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ldcwn/oT/KzXMzyeormdaoOIalEaN6EYgX/sGIkmBCxLjnV+FydKutQIVrrZLWryNR34OdPbJm490BA9pECiZ0oK73BXndvVj7dVfWc7g+dgP0r+Px1anXLFOEFDuqFzf6dyUn4d3dHdYV+BaKioUqBQZSFcaHynM0d+vvaOcGmT61+eIR4eD4xfL4oQwKdLa7AYbiXoaSSdB3Grj/aSNcAmdRsMDVWzbhBIvivzXrwZt6b5QswHDe5BOEnHVyxIBcU+S6vP9sFR2/XKhhMz0780OZ9C8fJPXAq5ag8IjSYzEDxdtriqiHuDKD3lm2OsPOUgtbKCHj+ei8IToyovEw== 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=KSIWB4MS4RicdIIZSlGAYAZZoQ+NUScC+TEewIRaPDY=; b=f5eumb6ZRoh+adtjU6M+3dUr88nAD1D7Uv+ZNe5tFqT/XhcmnhHvFDo9UOVbM4o90vDM3fRGrh3R/gsOJF3pGDABPqATUI571L6gCDPGmgtM+SDlxEBbKCyIbS1eA7MzoqGoZVzjy25XtpDoxmKQHDpQ+QWrvVIdb5+lQSNrSv8boEHB2uxF4QCjmmpuRtC6tF3J+Spe8RmLFyfhrBUCu/hQMu10oTu+/5drIo5I1F/p6c/KYxIdWoL4uwbu7D++eq4Cl7iG3/PLzGlX8bz3p6DKToIcapOoJty8VNl03gjK04WWXz/MUxiibKz/osnosADABpwSW+B6yClU3EyG/A== 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 Received: from SA1PR11MB6734.namprd11.prod.outlook.com (2603:10b6:806:25d::22) by BL1PR11MB5318.namprd11.prod.outlook.com (2603:10b6:208:312::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.48; Sat, 11 May 2024 01:24:12 +0000 Received: from SA1PR11MB6734.namprd11.prod.outlook.com ([fe80::fcf6:46d6:f050:8a8c]) by SA1PR11MB6734.namprd11.prod.outlook.com ([fe80::fcf6:46d6:f050:8a8c%3]) with mapi id 15.20.7544.048; Sat, 11 May 2024 01:24:12 +0000 From: "Li, Xin3" To: "Gao, Chao" 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() Thread-Topic: [PATCH v2 11/25] KVM: x86: Add kvm_is_fred_enabled() Thread-Index: AQHaWfAO0doE8sIK3Eq6W5ZDZAAx+7F/aX4AgBE3YdA= Date: Sat, 11 May 2024 01:24:12 +0000 Message-ID: References: <20240207172646.3981-1-xin3.li@intel.com> <20240207172646.3981-12-xin3.li@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SA1PR11MB6734:EE_|BL1PR11MB5318:EE_ x-ms-office365-filtering-correlation-id: f0776827-c9f0-4d2d-6f05-08dc7159107f x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0;ARA:13230031|366007|376005|7416005|1800799015|38070700009; x-microsoft-antispam-message-info: =?us-ascii?Q?haF3z6s7Pl/fwcI7tdp33HQoUtbixKQIY7kbICnh3VbBEeQ7I776g3Y+7m5s?= =?us-ascii?Q?jqqm1m4CJUKIIWbDBnmG/MFZPCj0pIUvPJ5liyVzBHY9B8wiZJVKcwBO+JQq?= =?us-ascii?Q?OEuY5Htip+CcA3hjQ6AtcKiJonIDdZflJp5xW11m7M+DfI4XPHknA/NH2JxL?= =?us-ascii?Q?mZyKN6GwfXHGeJpX6u7b5wZpJYxq/VVHaJD2QIzDmeiNdZVw0j/O8TVpdg28?= =?us-ascii?Q?yVpo45dfnTfIxOesuc4abTjBT/GRZvYb8N7MOLadvxFUb86Y+SameccmKrkK?= =?us-ascii?Q?ClHo3/TPNts+FWVR+MW/3fhyc9kNCUh3thLQEM/CBMjIgqUHcMQpIqvq0K3f?= =?us-ascii?Q?mmt1O7KaPLAqOdAqTParUIjl6EierKGD6wPMVssDZFDHhqurZISd3wwm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gThDPAmS5Zmh6KKx0KWfF?= =?us-ascii?Q?dXXSFASkt00n/Mf+amr3C/u2Bpq57ncvHqh/OzSYjs02oA=3D=3D?= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR11MB6734.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(376005)(7416005)(1800799015)(38070700009);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?5PqEv4r0zFIPapoLn1s+cUNZ34eF5Qm/uB8HV3Q2+BgPmTd5TM0l35qrbays?= =?us-ascii?Q?0eCdarpdGam9EpQLopkYSpVeHSPImm0KSxg797MIzVWUhEk1Qda8V17AsZ15?= =?us-ascii?Q?pBjpaVGE5GnBsS2PjBvNHYcSyiNfSHLvhZP6IkO4f65joXDQztqPQ1tajD/5?= =?us-ascii?Q?Su/xntkkhjUHaCNkNoT1j6j3shTFZBFHCN6v9yJIseQtC61uDXYAgOGzVztl?= =?us-ascii?Q?iCytdcc/20yll2cDvlqwsG/DjQOGPh62+2HJq4pCMhkTGdJvc8zeml/GDBhZ?= =?us-ascii?Q?JgGSqPOP9luwXbJ22tcUedeRy3je9VZRNh1KllOm/3IaW0T/a7ip3XUb15q7?= =?us-ascii?Q?e/f+bnt+1nROD8Y8+ePJclEHBtsmjJwnmZnm6wSV49LPO8H316GJgj1wjYJP?= =?us-ascii?Q?0tHZNq9KtiEZvWb263syo3SuxiKmNuMohxVjOzSe13rckMvJ1C+BoD6vEEVy?= =?us-ascii?Q?vXIS8FFQ0g0TnUgsF01cCQfFpVmF/wq9+yt0BIIfFzPJgBKn5rDqwoNI6YAS?= =?us-ascii?Q?lJ73IScdCf3EfMOKeR68puXa8Txjknlb3qE6j8lLy7/bFelfpTRo6Fn0W5B7?= =?us-ascii?Q?mBVyJmpnNXJBG446d8nRC0iXHbAlQfCrQN7Aj2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LFuV9iPQpGjoQ24Z+mdnhBs1Xbqe/6PNyKgOH0zqmW9FT2SaV++/c?= =?us-ascii?Q?BHo0jR9EQF0WojL3L+0=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA1PR11MB6734.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0776827-c9f0-4d2d-6f05-08dc7159107f X-MS-Exchange-CrossTenant-originalarrivaltime: 11 May 2024 01:24:12.2202 (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: IcoLmNgeqj+psq8d7LwqbhRrZZvBb8miFcBhfaj7NIEJokkmnGHd4ZXVNibZvxOAIwpsrQrtlPuq78RjukHxiA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR11MB5318 X-OriginatorOrg: intel.com > >+/* > >+ * 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 =3D 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. > >+ */ >=20 > I think we can give more context here, e.g., >=20 > 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=3D1 implies the CPU is in 64-bit mode. What is "more context" here? > Specifically,