Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1112670pxu; Wed, 6 Jan 2021 12:38:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJx3SeGy9o5ZdBodJnFZvldgySbPFZwUADlDE1fQnDX0cyx373NkE9PT2LqR1d+jauQdKgW5 X-Received: by 2002:a17:906:2da:: with SMTP id 26mr4069741ejk.15.1609965504573; Wed, 06 Jan 2021 12:38:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609965504; cv=none; d=google.com; s=arc-20160816; b=Y5ATM4j+5OufOMIhT4P0IereVdgTKR1jj7hw4g4HD8/W8TAeXrKaoKDfX9+Xsq0gff JrwXFTqA44MO7CYELXsAY1mzpG9WIJ+vJFiLSSXu2DtpG1YYVmzKg4ov5yvodvecbcvD wyIchBGGqcelknf2P/8WGauN06FGe8zT1d7hEA7TaRjnDIETv8quJH/OioIUSaLAIAgb bgZ0e0g86EKd8ZbFZv+roUqfBWrAw5PJNSS2PD7iVcrCtGny5rFBEDQnnv30dHb8LxD3 iRoGMFZpqrixh+RKtGuXUXG8f1mJXJHPxv3FR5wPRgTmROPE7Z7cQKkIs9FEQ5GKMpU9 Hf2A== 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=5A3GMg0kaUdhNbdjiZ51gEYmRqMxSWUTkm0nm29z41k=; b=ZSjpUtGZJI8l/S2Qn0rJT4ezCNiRrLRpC7TWvJLuaSBm/2NqPUMTTfwOiCLzpQ4Kxv EZt+nEWmybs0BWRDax/j5fl4m8rTGSfwvNyPMGhsRPWqKR1W923OewbClfDZBM5vgIlB +lk3u8EhT790UWsd+zhhlFta3QgS8uFqY7EaULWLujaKcQoLUU7OgzqKXkT6b+Ka9MgT 0H7L8ng0gQvCaO5YRnPQiPAQyeTqCJkIrz8YRt9VX7PFiEp6LVOI/9AmUqdta4vGy2JQ Kj0nEJq2zhNu1oaWBvr+z43XLjE6rFjmTZrgGoe0ZEhUCTKzQqJ8joZvcEYOES4g0Qge 4d9A== 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 hk16si1366255ejb.8.2021.01.06.12.37.53; Wed, 06 Jan 2021 12:38:24 -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 S1727404AbhAFUel (ORCPT + 99 others); Wed, 6 Jan 2021 15:34:41 -0500 Received: from mail-wm1-f48.google.com ([209.85.128.48]:52222 "EHLO mail-wm1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727323AbhAFUek (ORCPT ); Wed, 6 Jan 2021 15:34:40 -0500 Received: by mail-wm1-f48.google.com with SMTP id v14so3451016wml.1; Wed, 06 Jan 2021 12:34:23 -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=5A3GMg0kaUdhNbdjiZ51gEYmRqMxSWUTkm0nm29z41k=; b=bPx+Dy5+JxdJok+SaaNykOQfsG1BaOxDD3Bl1K/Nwp9fQSixGMV4c846MH+/MV4CDY bosOFtvB/Ehq+h71OBL2qm2Boi/vXx1pNhJJ58mrNEqew/caYC/5XT9PZ43yCRc8S9co Al7rzYgRCXE1HqYOeOFGFvBJtMbwN+2Djy52tov7CRErc/+V924FQ1Sts7cbrHobWZ5F qgE2n/+d5qZk8I8TMR4k0l3uxpJUQRni4E+w6R/qysDlKCbGVQKvuImjILBGUucyy+eY DZR6AzZZmXA464N6Ks917z5vwSAbn1b2pnLXfPnd3wDt2lR4O7+wwpG5PMBUV731WZKi y3nw== X-Gm-Message-State: AOAM533CaMVa9xza+bVoTV31QR5pU4s7pW/fwjSZL7IKswtKW0ljfeFZ 1XWELXo/uXd20fXjeS3W0cHbV+OxcrI= X-Received: by 2002:a1c:a9c8:: with SMTP id s191mr5224786wme.89.1609965238215; Wed, 06 Jan 2021 12:33:58 -0800 (PST) Received: from liuwe-devbox-debian-v2.j3c5onc20sse1dnehy4noqpfcg.zx.internal.cloudapp.net ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id u9sm4499456wmb.32.2021.01.06.12.33.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 12:33:57 -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 , Wei Liu , Daniel Lezcano , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Thomas Gleixner Subject: [PATCH v4 05/17] clocksource/hyperv: use MSR-based access if running as root Date: Wed, 6 Jan 2021 20:33:38 +0000 Message-Id: <20210106203350.14568-6-wei.liu@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210106203350.14568-1-wei.liu@kernel.org> References: <20210106203350.14568-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 --- 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