Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp364489pxb; Wed, 3 Feb 2021 07:20:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJwwYJ3A07SeeFdwxSkrMKnDgSisBNB0GnEc5bJ+8tLXSMv5FUHmpkWKMIQnLo5L6me4FI4B X-Received: by 2002:aa7:d696:: with SMTP id d22mr3406776edr.361.1612365623645; Wed, 03 Feb 2021 07:20:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612365623; cv=none; d=google.com; s=arc-20160816; b=kNqxmCb4Ix6E0t5vZsQapfNcc2MJLXjvWZPkt8o6ghQ2ZL/FIYsPDrRlfksLbbQ5uU u91atCmFJuTLFp310FN3wYIWxIfdWzGZK98QH0TLXHj/BpNVetOsIuMmA074OBA+uqWf 3zZzSv0eAp/hu7qjObCgVmfevLwcT3C0lWtfYPoFzayu4hYa9GH+LXbUBZuX2mTD2xCY 3GloHREMw7XPDwHYSc7btigZY24HqxdRGTC6y1Nzaj/ONsiT4hTtO+9DreIyERpN+3px V+1iKg7jsY23zkMJHqwfWBzi/5FUCS2rT4qTQrQdvFEJ7sAw6hvQ0QtojsymarU2Pae5 y5hg== 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; bh=FHy0KwnAzp3tkRfraJo+vCO/BYi9ytTwN+69RhVts4k=; b=fGnXyquEGLn0hyrRYWdYGunXElmLTiW77DLXKT+IggvGwE/3SFeECN7B2c6YFE1nEm bjFtMPxuA9frhVaua3lB1cTXQJWXm3Q+bHzJq5romQKt7HfXCAn/LChnivdXv12ChElW Um5FC9VcQp1EBZqBdTYMCA3vG7qrRKyngDgupk37ao/cZHqqtuOsQm51j+EPrJKdf/UO sXaZ0AiVPtfHedCzVMdooI7xglaTPqhno0CzxLd/Q/agnV52/5G8DF0+m7asy5r5CEdL 4Yrkotqlg+GK3NmCSHy8QyTUfRqLb57wl0lEbdGcZ1xVuL0qs8/e+4e1SqIKqq1c7koa yCCQ== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si1386858edq.149.2021.02.03.07.19.58; Wed, 03 Feb 2021 07:20:23 -0800 (PST) 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; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234078AbhBCPQO (ORCPT + 99 others); Wed, 3 Feb 2021 10:16:14 -0500 Received: from mail-wm1-f46.google.com ([209.85.128.46]:34608 "EHLO mail-wm1-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233953AbhBCPFX (ORCPT ); Wed, 3 Feb 2021 10:05:23 -0500 Received: by mail-wm1-f46.google.com with SMTP id o10so4135554wmc.1; Wed, 03 Feb 2021 07:05:07 -0800 (PST) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=FHy0KwnAzp3tkRfraJo+vCO/BYi9ytTwN+69RhVts4k=; b=Vc8AohlEHewBGdLv3V7QW7miM9vYCcYWqhhpE1B7OElXmYEb11vIZBfuXQYb8IYRdI WgSb5Og2mzcCFhgAujRjFiXXJWK5nbMlR/14JvTCAtj0MSrL+ur7LdUTVOUj0aGH4Cvl oJa4c4DqfYLhDqgi2A+FeTf6RMbPIXdJLv/CiSvSn9jWV/E5zeexLMXpgL165AywmKka vRkydIelhlEuUcIvsMPxZ99sg5qk8eUGrMT6Y4v25DAAH0SxWQssJOtui48JdIL5vsn2 5whoaYuB19LGEqtZNfVKibP8jTGYrfsytlK7usdoRegDw4B/MuHT5nN5tYWDE6J93qfR YX3A== X-Gm-Message-State: AOAM533i19YRKzr6D8mPw3cY309xDuR+3MGOBHav8EWxWCutYvFRgHyB ci3Wvr992BxMO1XDaskHCCNDMfARLsk= X-Received: by 2002:a1c:dc83:: with SMTP id t125mr3214517wmg.154.1612364681630; Wed, 03 Feb 2021 07:04:41 -0800 (PST) Received: from liuwe-devbox-debian-v2.j3c5onc20sse1dnehy4noqpfcg.zx.internal.cloudapp.net ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id r17sm4051704wro.46.2021.02.03.07.04.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Feb 2021 07:04:41 -0800 (PST) From: Wei Liu To: Linux on Hyper-V List Cc: virtualization@lists.linux-foundation.org, Linux Kernel List , Michael Kelley , Vineeth Pillai , Sunil Muthuswamy , Nuno Das Neves , pasha.tatashin@soleen.com, Wei Liu , Daniel Lezcano , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Thomas Gleixner Subject: [PATCH v6 04/16] clocksource/hyperv: use MSR-based access if running as root Date: Wed, 3 Feb 2021 15:04:23 +0000 Message-Id: <20210203150435.27941-5-wei.liu@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210203150435.27941-1-wei.liu@kernel.org> References: <20210203150435.27941-1-wei.liu@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When Linux runs as the root partition, the setup required for TSC page is different. Luckily Linux also has access to the MSR based clocksource. We can just disable the TSC page clocksource if Linux is the root partition. Signed-off-by: Wei Liu Acked-by: Daniel Lezcano Reviewed-by: Pavel Tatashin Reviewed-by: Michael Kelley --- drivers/clocksource/hyperv_timer.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyperv_timer.c index ba04cb381cd3..269a691bd2c4 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -426,6 +426,9 @@ static bool __init hv_init_tsc_clocksource(void) if (!(ms_hyperv.features & HV_MSR_REFERENCE_TSC_AVAILABLE)) return false; + if (hv_root_partition) + return false; + hv_read_reference_counter = read_hv_clock_tsc; phys_addr = virt_to_phys(hv_get_tsc_page()); -- 2.20.1