Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1037554pxv; Thu, 15 Jul 2021 23:34:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy3JPK4MVH9Eewt5d8MlzBhcPjUjBgcRvKB2QZUpezUsynsfzBZKYRJeLhz1R3vyhfzQh0J X-Received: by 2002:a92:c549:: with SMTP id a9mr5393252ilj.248.1626417290954; Thu, 15 Jul 2021 23:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626417290; cv=none; d=google.com; s=arc-20160816; b=eY75R2EOQdxs6awXEjXzAeSJejLbff2rmQUp9efqJ/Hy0jQ1qeZeCRNyxtgYqM09gX uAHxjz3YWwaXJc6LFn5MJBMSTBiLzFk02TlyfQS6SqqhpEju2ZBVBE+UstiYXFS3pTAJ QVwx3gTDcKGds9vM1QWTVEAE0zFvCKha484sd9D7psfcI2Uc8xy5W9REQQ7Ju5kzLgdF WeLN59QHohmqJKkrHfn/zW5OsxFvnWM+MNHi4vndHiya6WiAy7mnn9BvlNVpIVCZ7IQ9 TSnEYDkVX9p7fht4T743nhvBKFQVyACO44IOVlihvJdcWRCsz07MqEXJxEAKvkwCZpCY zbNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=kYvP40uuwwYr9NVoMrmSHdfuGUeNw8zjOe9FELwPdL4=; b=xWCi1KkPB0eRW0L15ghDnys46aoTot6F8PU7afwQ3p9eV44D2U8JGmoBITkun7A/oS SnpcTFhO0OsxP6LAwnqN3IN1D4o2Vvv7SAgCD7o7u2PGwR7ipLXwej83JkqLhGiaFbIl DPglSyVf7Fn3Xt8euv2mGj6XPE43o2LupO/ZYbaB7BcZtKy3cVuV8/XH6IwPRxE6sNfP G59M+iQ7zDc90PnESO8tKP+lHd0T0eW2QOMCm1+HvI9yq2H0kmFXj3W20a3sCD1SAZqi WR3BuM7SQ5sSrinV/PqA+fxi62FuWSUuqyHk8KLOfB9UT/L9jbgO4mCmF8MMJxyUXWY7 +I3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@anisinha-ca.20150623.gappssmtp.com header.s=20150623 header.b=i10wPJkx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n4si8348175ion.62.2021.07.15.23.34.36; Thu, 15 Jul 2021 23:34:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@anisinha-ca.20150623.gappssmtp.com header.s=20150623 header.b=i10wPJkx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230011AbhGPGg6 (ORCPT + 99 others); Fri, 16 Jul 2021 02:36:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234815AbhGPGg5 (ORCPT ); Fri, 16 Jul 2021 02:36:57 -0400 Received: from mail-pg1-x529.google.com (mail-pg1-x529.google.com [IPv6:2607:f8b0:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77FBFC061760 for ; Thu, 15 Jul 2021 23:34:03 -0700 (PDT) Received: by mail-pg1-x529.google.com with SMTP id 62so9033220pgf.1 for ; Thu, 15 Jul 2021 23:34:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anisinha-ca.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kYvP40uuwwYr9NVoMrmSHdfuGUeNw8zjOe9FELwPdL4=; b=i10wPJkx51FTJMBZX5Hy+vMCcaqdopyzJHXRV8s/btNrCYRef3A2/5JXNcQHwpRTNk RgB6Ps9KiV6tEudpiJjEL9+7KwqYzkKTUCCTb3XABri31BWTCwayLVO8HmEbBytRs0pF Q94KGUkiR4YhoVqPUkGvPMGpwb4ndv3VMDxYehZCLbKff1Q0U5KSxpeLhfN+kMO1jaAK 0Na4UrVExAYqFS/rskmxjm6X5A6EKxVyTYpTWSKt+BlMAyUnztEgDjlnsWlwgKLb2F3m xTMCe78J6I5jRX11vHyfRUb17JxP0Uz/uTrKO4oGg3GUPvFGUUnlx0AY7iib8PmMERuR aE8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=kYvP40uuwwYr9NVoMrmSHdfuGUeNw8zjOe9FELwPdL4=; b=k3SZEX/xYYoE2glegW+8JSJPy9csEbvzmjYnPis5G1btO5mYxmVsA5QhqwWKxiZIhv GxLoEWDbbCQZb+ZwEeAUQnJ2tYHBoqXupUePrk16rvSyM9xLgJcSjtjqXSc0vnoWyKEw T7Lw5tQrL9n/xzypXFtmxnsR5D7luyRyad8sP/stDbY52Rt6E2AyRJqzpAcSWMsLRMtk ErcOXZyc6g9G6MoYSgSfTh21Bk6/xwN/aDJQ8juTmqpU7aSJ/gKwhWNYt8aUUI42kYAU qUiCNGwtpcVpQ5EYVhjgCqZJtgvPZ8Ykvrvhlg2GrgzX2R0QKVTvNkjJwrHHkFCTqeXq AGcA== X-Gm-Message-State: AOAM532tSEH6t1bgsEQIleI6JXfCFtt0A9WuHMLp7QqKDZm5y7jih/XA 3lYv9nPcEc6MpBQgkAcXJ67FZvW9JIsw9g== X-Received: by 2002:a62:154e:0:b029:32b:743f:dccb with SMTP id 75-20020a62154e0000b029032b743fdccbmr8507710pfv.57.1626417242559; Thu, 15 Jul 2021 23:34:02 -0700 (PDT) Received: from anisinha-lenovo.ba.nuagenetworks.net ([115.96.126.211]) by smtp.googlemail.com with ESMTPSA id v69sm9047971pfc.118.2021.07.15.23.33.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jul 2021 23:34:02 -0700 (PDT) From: Ani Sinha To: linux-kernel@vger.kernel.org Cc: anirban.sinha@nokia.com, mikelley@microsoft.com, Ani Sinha , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Wei Liu , Dexuan Cui , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , linux-hyperv@vger.kernel.org Subject: [PATCH] x86/hyperv: add comment describing TSC_INVARIANT_CONTROL MSR setting bit 0 Date: Fri, 16 Jul 2021 12:03:41 +0530 Message-Id: <20210716063341.2865562-1-ani@anisinha.ca> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit dce7cd62754b5 ("x86/hyperv: Allow guests to enable InvariantTSC") added the support for HV_X64_MSR_TSC_INVARIANT_CONTROL. Setting bit 0 of this synthetic MSR will allow hyper-v guests to report invariant TSC CPU feature through CPUID. This comment adds this explanation to the code and mentions where the Intel's generic platform init code reads this feature bit from CPUID. The comment will help developers understand how the two parts of the initialization (hyperV specific and non-hyperV specific generic hw init) are related. Signed-off-by: Ani Sinha --- arch/x86/kernel/cpu/mshyperv.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index 715458b7729a..d2429748170d 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -368,6 +368,14 @@ static void __init ms_hyperv_init_platform(void) machine_ops.crash_shutdown = hv_machine_crash_shutdown; #endif if (ms_hyperv.features & HV_ACCESS_TSC_INVARIANT) { + /* + * Setting bit 0 of the synthetic MSR 0x40000118 enables + * guests to report invariant TSC feature through CPUID + * instruction, CPUID 0x800000007/EDX, bit 8. See code in + * early_init_intel() where this bit is examined. The + * setting of this MSR bit should happen before init_intel() + * is called. + */ wrmsrl(HV_X64_MSR_TSC_INVARIANT_CONTROL, 0x1); setup_force_cpu_cap(X86_FEATURE_TSC_RELIABLE); } -- 2.25.1