Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1313821pxv; Fri, 16 Jul 2021 06:37:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfEVw3Fk2SjydBYvxKxnbTT0wlbRwxuXHTWpdgF9yh8zKThlDQn9IU5vWjjcSAhzEjGcef X-Received: by 2002:a17:906:2a04:: with SMTP id j4mr12032772eje.344.1626442662150; Fri, 16 Jul 2021 06:37:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626442662; cv=none; d=google.com; s=arc-20160816; b=Rg3IVre/Q88CNjpEU0bsnArgoLyH1g/I4eZFrdm0iZyCyl8IfKlwYN7Eq+qktqO8Q1 VvEc2+jiV6JR5sfS2yHy0xByYU6Uux68QPs2Y5RspDMcEV9omCGTK5fNidMMVi9ShEBB Ag3NRao2/ahWlexd9yDliPGOdiczU8abL1OcY5e9ReFW6yPbYq/XskoZ4qHK8shpNWiM NXG0sNLQ8GBVZAyXJjSl5E+7towrLq3g+E9D4yfFDdWfgt3bdZji+C0kPMTzf24KV2EJ /a7oQYo+92EvpHbPcC7RiOldjjmH8vUeAl5H5FuK9k7lfHTbbB6n7m2r6wJTu1zrmMCf erhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:date:from:dkim-signature; bh=fGgLXOAW+XYOflDoI9DlmXYjo7kRzoGFVJ7ubU3NwUg=; b=QXhAmjzvjPWDPny70SbkX08c3x6Pggds/3At42cHVDLvXYSDCfE9L8G/egpNMgWY+o fOUnRuGKZxMRWcf/PTHUIvp7YFqHcvJPTohbyaKfw60WFiFzhD9rXI+FeCOeCSnvRWt7 dVgt6dUS04cU8ZY/UtcFwYbgtx418OZOfzyUoYQz1SxH8RruFp431KvpnhYZ1Jt59A6f kbQFdobbD944s+532RJCTiDrqln18Rpgk4L166Pu2VDX6/ehMN3l4Mrn56w8sXBTVGmM F30ma9b+74mCcU1tMCqsKzMeALkLv2KqBeY2IMVTTdjz9OXf6aoanAbcot44wOSiY/zE cQ2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@anisinha-ca.20150623.gappssmtp.com header.s=20150623 header.b=TIaYvYMf; 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 t22si10813684edv.464.2021.07.16.06.37.18; Fri, 16 Jul 2021 06:37:42 -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=TIaYvYMf; 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 S239967AbhGPNgx (ORCPT + 99 others); Fri, 16 Jul 2021 09:36:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239904AbhGPNgw (ORCPT ); Fri, 16 Jul 2021 09:36:52 -0400 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33F8BC06175F for ; Fri, 16 Jul 2021 06:33:57 -0700 (PDT) Received: by mail-pj1-x1029.google.com with SMTP id bt15so6469111pjb.2 for ; Fri, 16 Jul 2021 06:33:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anisinha-ca.20150623.gappssmtp.com; s=20150623; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=fGgLXOAW+XYOflDoI9DlmXYjo7kRzoGFVJ7ubU3NwUg=; b=TIaYvYMfXmpt6sdGaeC2ECGubiFR1yIRQAkBP05fGdqPLzBTnKZ7QyyclaS/vleLyA O9jQgOsXQJF82T4AQvc77k6cXSMeyiTkCz6F+MnuQEb0FZXAb9myL9EAXxw6Q4fz+Rci MN4Oi2hPy4BJ8EkbCoU9iTR3H3ihrRcJ/jm8csy5X6xdoiFLGufnFsUYpbGU1caNr8U/ aYh+LFjgw/t4dxhmqF290smTsSzhVYAt0n6h/PTHKynuJKxiQCnpBzYZJh9MOQUI+h60 Xwibii1BPudU5EYmX1vKI40/AHhuDjX+0van4WdA7pR3KYe3tu1MtazEDdp3cirurq33 BRyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=fGgLXOAW+XYOflDoI9DlmXYjo7kRzoGFVJ7ubU3NwUg=; b=LOPMx2mojmzKCv/9pk6/RNoZTf5SNSZcQqblT2WJh1GrBylMU/u8QOVLaSNv1KkntY LqxuiKgsMkSzwaWm1Y6n9VUg2dtcQDDRadOdfqb1bk8DK2a+gxbyVOyZVRaenijrlKil gU6e4w1shnVgzNLV16Bd6qUWucipWsC+4Ny0I5lIOiaKwJqV0heiMapiYw77QLtU2BaN /jB6pVEjUt1FmfildyrEOtJmbZ6Soog/vQZw05muy6XuFUCwRBOTG7sPyvf7RLV6XAr0 UrQbPsBD8/vDuuzFNl220J2t8nanzflGz+gJjm6gyE9dPGQQQfpnZTVYP4Wft9QFmUQR SRhw== X-Gm-Message-State: AOAM530+RNR6ixb205QzgCN34bCFkCHc1Qn92h2PUYl2VB/rvywq7vqM QPyRpTAYuMUBZWmQLRJGPCeUUw== X-Received: by 2002:a17:902:da83:b029:129:9f09:bedb with SMTP id j3-20020a170902da83b02901299f09bedbmr8010088plx.56.1626442436610; Fri, 16 Jul 2021 06:33:56 -0700 (PDT) Received: from anisinha-lenovo ([115.96.126.211]) by smtp.googlemail.com with ESMTPSA id 73sm8800400pjz.24.2021.07.16.06.33.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jul 2021 06:33:56 -0700 (PDT) From: Ani Sinha X-Google-Original-From: Ani Sinha Date: Fri, 16 Jul 2021 19:03:48 +0530 (IST) X-X-Sender: anisinha@anisinha-lenovo To: Vitaly Kuznetsov cc: Ani Sinha , linux-kernel@vger.kernel.org, anirban.sinha@nokia.com, mikelley@microsoft.com, "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: Re: [PATCH] x86/hyperv: add comment describing TSC_INVARIANT_CONTROL MSR setting bit 0 In-Reply-To: <8735se1jbw.fsf@vitty.brq.redhat.com> Message-ID: References: <20210716063341.2865562-1-ani@anisinha.ca> <8735se1jbw.fsf@vitty.brq.redhat.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 16 Jul 2021, Vitaly Kuznetsov wrote: > Ani Sinha writes: > > > 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. > > It should probably be emphasized, that write to 0x40000118 > updates/changes guest visible CPUIDs. This may not be clear as CPUIDs > are generally considered 'static'. Patch v2 sent.