Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp643266rwi; Thu, 13 Oct 2022 03:18:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qVQjvYuYxbi6j/2grJ6GlTUq8OADzdDrYeZWXA13dLyTVZZIdHfGSstzeuBUazKmS9rOW X-Received: by 2002:a17:907:7287:b0:78d:8f26:5911 with SMTP id dt7-20020a170907728700b0078d8f265911mr21364249ejc.463.1665656317667; Thu, 13 Oct 2022 03:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665656317; cv=none; d=google.com; s=arc-20160816; b=r6E+RvOl0w31gjAdc7nfKS63dIYDxK0H6Hunzz20VJTqlVd1uslg6mbLtzC0wPKGiL ojRy91NMCnrFyvUFQafmCV6FBggloXSbGwSKgXg68TYvWc7NJskv98uZKpIfg7ioWPuk on1a3aq/jBL3hHPfnY1Vsn0ZA/ehPSNOibKxHDPobq4DjQ2BrYvuxUSuCEgSXNOM3RzD 5lN0ftW3/XsuEhW5i8FtPpXaeNOHY0OuEvjdlMtwkRsEIf/VQZnUC1ZAganWPptg7zaR pYw6qAUMUX0WainkRR/6AzBOqbDFjxsIVziSU8ahHvzP52Z+Tq6WSV3pQwZl1SNX7lL6 RfoQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HwsXYYG8kR6dOA4gfCT2K1dWA8ovO4ni9T56gaC1L68=; b=GFZYCKqyE4lrj9FanOKC0KJHfTAWI05fgJeJ+jwIHcEcpD6fpvUkd6nQk78PR1AuEA 4/M0rpiy9fYhHweOCV8Lxr+pJFG3F/8rqNG63NklkrV0gNKksNFJMBLttB4z3BkP4vJk IFm7flfyQLGBnMWUKOkRdf8SgGRM6WFyaDUnjpQs+QZ6Y5EGT44Nwleu5hBES5N8p3BG BlJZe257rySaMjNa6awNAv5OnxSIFBsehDTJvusp5S2qUQ75rt4VvnkeireVQlPRsiw2 SVcZ6Wz6DOOMRier9bfb5nSwEBESglvYbykU2lwq+/Lu6fw+D/aw0G06TaxKF7pqFtIb 9fgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EnkH35Lr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cw17-20020a170906479100b00788a4c018b5si303469ejc.806.2022.10.13.03.18.12; Thu, 13 Oct 2022 03:18:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EnkH35Lr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229717AbiJMJ7J (ORCPT + 99 others); Thu, 13 Oct 2022 05:59:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229519AbiJMJ7B (ORCPT ); Thu, 13 Oct 2022 05:59:01 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E58853031 for ; Thu, 13 Oct 2022 02:58:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1665655139; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HwsXYYG8kR6dOA4gfCT2K1dWA8ovO4ni9T56gaC1L68=; b=EnkH35LrO//YmtlZbXkE2ft5clLCSnHXcR4OuDHXNZ0qCXAE42pq701yZ9R5sjGwo02KmD ChCU5a4UB/5U7Xd87sh3ZwcziftNw2oY83pBubPktm8WkFcw/NepUvV9ConGEn51Fxhmzp PeMZTsQJloJSNkdpVZyb0TuVOwcuZnk= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-88-5v4_ZQznPa6bLI7iMl32Tg-1; Thu, 13 Oct 2022 05:58:56 -0400 X-MC-Unique: 5v4_ZQznPa6bLI7iMl32Tg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 962733C0E203; Thu, 13 Oct 2022 09:58:55 +0000 (UTC) Received: from ovpn-194-196.brq.redhat.com (ovpn-194-196.brq.redhat.com [10.40.194.196]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8607047505F; Thu, 13 Oct 2022 09:58:53 +0000 (UTC) From: Vitaly Kuznetsov To: kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson Cc: Wanpeng Li , Jim Mattson , Michael Kelley , Maxim Levitsky , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 1/7] x86/hyperv: Add HV_EXPOSE_INVARIANT_TSC define Date: Thu, 13 Oct 2022 11:58:43 +0200 Message-Id: <20221013095849.705943-2-vkuznets@redhat.com> In-Reply-To: <20221013095849.705943-1-vkuznets@redhat.com> References: <20221013095849.705943-1-vkuznets@redhat.com> MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Avoid open coding BIT(0) of HV_X64_MSR_TSC_INVARIANT_CONTROL by adding a dedicated define. While there's only one user at this moment, the upcoming KVM implementation of Hyper-V Invariant TSC feature will need to use it as well. Reviewed-by: Michael Kelley Signed-off-by: Vitaly Kuznetsov --- arch/x86/include/asm/hyperv-tlfs.h | 3 +++ arch/x86/kernel/cpu/mshyperv.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h index 3089ec352743..196a8945bcd7 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -253,6 +253,9 @@ enum hv_isolation_type { /* TSC invariant control */ #define HV_X64_MSR_TSC_INVARIANT_CONTROL 0x40000118 +/* HV_X64_MSR_TSC_INVARIANT_CONTROL bits */ +#define HV_EXPOSE_INVARIANT_TSC BIT_ULL(0) + /* Register name aliases for temporary compatibility */ #define HV_X64_MSR_STIMER0_COUNT HV_REGISTER_STIMER0_COUNT #define HV_X64_MSR_STIMER0_CONFIG HV_REGISTER_STIMER0_CONFIG diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c index 831613959a92..e402923800d7 100644 --- a/arch/x86/kernel/cpu/mshyperv.c +++ b/arch/x86/kernel/cpu/mshyperv.c @@ -388,7 +388,7 @@ static void __init ms_hyperv_init_platform(void) * setting of this MSR bit should happen before init_intel() * is called. */ - wrmsrl(HV_X64_MSR_TSC_INVARIANT_CONTROL, 0x1); + wrmsrl(HV_X64_MSR_TSC_INVARIANT_CONTROL, HV_EXPOSE_INVARIANT_TSC); setup_force_cpu_cap(X86_FEATURE_TSC_RELIABLE); } -- 2.37.3