Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1311317pxv; Fri, 16 Jul 2021 06:34:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlyhrLwR8c+s5Ubw0caEQDayXswK8cotvlmGBwRiNmi2GfwvRg5XaWZteLb4FoSmRy/c5S X-Received: by 2002:a02:6f1c:: with SMTP id x28mr8952296jab.95.1626442443160; Fri, 16 Jul 2021 06:34:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626442443; cv=none; d=google.com; s=arc-20160816; b=YmPHOGeb9lrldmxDjF3z4CKcXGQPG8/SSfiKkFuX9vS0P+7KYFDalsopwQqqONkClR pjVqNW4kXasAuckL+SblCQIjqMjW6n5UJdroyXvTSpGoZh4Wu3rHXghBSfY9llMbtH7W Iufh1s7+4NZSOxiZul7H1Rry8aPMyc6Yq31SOK6k40FCQJZXwpK4HIFcEiqfGrfoqDkw kYln9Wokt++3HV5G+eYrL+zTmp+xTlFPCDhI8lpjYrd2Nj3ynu1fR/SnbpdmIcJPZ7Md mu+jQwokAlxgfNqOYjl9eZcIGhdNzIALofoPSckmlup/iXUoub+F2KxyltQDQekRoNaX Yhag== 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=selXb4Bpi1MsQNNsOTSazIAMo3P6W3ZQxlBy+7d1uoA=; b=QX0CYCHjYREHukRjDrPFFhu3libDKsCSL/ucT/Mdg9bXQPFlzdQEUhKzkkb00bOnxK 8KgHBC249rpe0OkYkxOEB0gPcA1Db3P5IEB09v3W/Z5FZ/h4WkuwNkaiCl2JHczTBlbH UwVjJuYtDGkg/g8RH/AmutPlva5x/5xE7dhZhU/b5gMmLZBweXQK9dBdOTQMM23GfG8J pQW0idrMqsProjqZC6bThZk1hayRLiGaPORdkJHqG0o1FntCcyN6vfJRyd3AyrB4m8rI bV3qaSou13Wf8G9RHsQ1pePsvo1MhWH14nJSuksbzMHY0at8bJU89IpswhHCn7ucvhXP ZxjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@anisinha-ca.20150623.gappssmtp.com header.s=20150623 header.b=TKilLRGb; 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 j8si10531ioq.34.2021.07.16.06.33.44; Fri, 16 Jul 2021 06:34:03 -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=TKilLRGb; 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 S239738AbhGPNfz (ORCPT + 99 others); Fri, 16 Jul 2021 09:35:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237892AbhGPNfy (ORCPT ); Fri, 16 Jul 2021 09:35:54 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 887ABC061760 for ; Fri, 16 Jul 2021 06:32:59 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id g24so6455551pji.4 for ; Fri, 16 Jul 2021 06:32:59 -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=selXb4Bpi1MsQNNsOTSazIAMo3P6W3ZQxlBy+7d1uoA=; b=TKilLRGbQctMearfWgitH6Ew9iqkFRPPoNfm4Ep2oUcmmMFvI3jhFgAIZWHZQE3pqd KmraLPyMfR52nqwn100K7VEKcTyCCOHda4CUEN/aP+wRnBtCvUjcD5DU3Qdz4kB6gsBt 5vqp3L3eid5W6E5VukZ9QRN7WrcgIZsSQv8cFLxot0b4dSyoqAetBaJXnica98nfDvKf XLVHVhXZ6oPFQufyxls0PnLHGhGMlas9vd9SCepwmmBJu/wIE5I3UHL7fgAM8rFT+AAm LVnqYBjsEkM5LRcX1q5EeqRg+Wj3YKZH9XUFZRG7Feheupz8oblp5Xoh718Hy6Vx4Iec giyQ== 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=selXb4Bpi1MsQNNsOTSazIAMo3P6W3ZQxlBy+7d1uoA=; b=nYURYyM3mqMhMM2OvS5OWDleParXYl0hbOh+HoASh9Q0zXGDefEXASAE07dPwf+bh2 Ot7Io9DFNiVe6zbD2dWz8RgT0aXiXQWGCOklBX6I/NmFW5+gJVa0Ailh9nlz4mWsItgP rVLSyLoPqVUwJu3498dcSYi2cW0kPy2u+SLBBVUh7mbPKuD6mLhSTjizk6n1SfpXkVBw h2hGLyg/o6sgnGnVIJk1g27aoKI8jlEY+W/tS8T8ppmOVn6VNR2L2swndxTT+3QtfwMr InOgHqmzsWWCy0IiVJDoF5kAkl2jQd8U9Q0009iMCHB0NE3KejWlN3Pd681UH3dQqy84 NODA== X-Gm-Message-State: AOAM533SQUZ9UJykUVtyqnBZpqrl7My27l/6HvApcNz+LQdka/xrWO6P 36Z9Lqf4w0JSq5JUUnPwLsSW6HSqIKUNka3P X-Received: by 2002:a17:902:760c:b029:129:2dde:f8c9 with SMTP id k12-20020a170902760cb02901292ddef8c9mr8036733pll.41.1626442378595; Fri, 16 Jul 2021 06:32:58 -0700 (PDT) Received: from anisinha-lenovo.ba.nuagenetworks.net ([115.96.126.211]) by smtp.googlemail.com with ESMTPSA id v14sm11434730pgo.89.2021.07.16.06.32.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jul 2021 06:32:58 -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 v2] x86/hyperv: add comment describing TSC_INVARIANT_CONTROL MSR setting bit 0 Date: Fri, 16 Jul 2021 19:02:45 +0530 Message-Id: <20210716133245.3272672-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 | 9 +++++++++ 1 file changed, 9 insertions(+) changelog: v1: initial patch v2: slight comment update based on received feedback. diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index 715458b7729a..3b05dab3086e 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -368,6 +368,15 @@ 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) { + /* + * Writing to synthetic MSR 0x40000118 updates/changes the + * guest visible CPUIDs. Setting bit 0 of this MSR 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