Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3288270ybb; Tue, 31 Mar 2020 02:10:00 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuYLoky3bSSEv2nyPWv5o6Vv0BLJG44MvzKQyHt1ABys92HCc9+W7REx0O9mwtwT6veu/J2 X-Received: by 2002:a05:6830:16cc:: with SMTP id l12mr12345146otr.172.1585645800167; Tue, 31 Mar 2020 02:10:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585645800; cv=none; d=google.com; s=arc-20160816; b=bV1Vr2ldLkZh+SeqlgBSgMCLGd31NS5tlUoTTf/d/lAHMpfbfiihGGjmzvMtwsmVRl xD1NG0sdJ9fIHpCbH4n99yWUvv0Pi21QEsTIujA1NOZWk8xobM9JDBFZtKc1TSl6JsDW oz+MrIn9ITI5QBkOP8os7qxxqxmdCb9ymnLnqPYQIvb3bjK6ce5LavV7zbxNEh44NKYb e7TCA23AoWNCLIXe8BF1rIsSQFSnrBzaLg65nlzN4hgIvWaWQ2OM2YeU80iA9U/9MY1u Wx4Ihna2XFXsjrrfWeQ2N6uCK0YqteUWrds+0ocsTxKkDnS7fuLFlN/9QS2qhhdLF19j vCgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=HEsfE77Qp2VIA4KvKou7HienKtLxXJHeO0RACVXsIpU=; b=d8Lsru9UEaUC5ztVpr/pu/4saWbuRd4to5KsbOyMX61iaV4RVsueRIwt1WxwddSj0w YAEtdwZrHgBY3Up0DUl3917ewRNW7vj8sScn3E83wofM1m880LKfnZOjnX4nc6zUU1cz zizPFCjHexqwk/mSIkKqgiF4cRir+E/iTq/t8U3c6Pot8gaxg6G3v+lsjmWog5RznzCa hz7rthZTm387KAa08oz1+RlSjXI2uMeXU5mW2MN7NMsINXCMCKQW9YhK0KOYDwmHhZhi DDUNwZ25CuIzXTPEumvkVKxhZ9Voh+8DcOM/Eb5Fp/oq4YFuHGa5r48ItZA1oCO1depO Gimw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=giVrSmA7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f77si7770049oob.89.2020.03.31.02.09.48; Tue, 31 Mar 2020 02:10:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=giVrSmA7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731254AbgCaJI5 (ORCPT + 99 others); Tue, 31 Mar 2020 05:08:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:51674 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731401AbgCaJIy (ORCPT ); Tue, 31 Mar 2020 05:08:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BF8C120787; Tue, 31 Mar 2020 09:08:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585645734; bh=VXl/+8EHQkkOMjgvo6iRPG9Zs80istouIoRKhN0JfAo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=giVrSmA7HgNFenr/3pDPk+sPu+KTHO8ntcsuZ10gX7juBj/HyYOiyMyrn7hGwDxpl rtsCXdV5x1kt5B9UuVyvc2V7B/fQPS0U6uxwZYpv4J40aSyI8RTYlSnQoKD+zPTMCu jvTdvkoUEjsPGojWE/fhf1wlzFWLzc/OkMF6Oe5w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kelley , Andrea Parri , Daniel Lezcano , Sasha Levin Subject: [PATCH 5.5 147/170] clocksource/drivers/hyper-v: Untangle stimers and timesync from clocksources Date: Tue, 31 Mar 2020 10:59:21 +0200 Message-Id: <20200331085438.915714636@linuxfoundation.org> X-Mailer: git-send-email 2.26.0 In-Reply-To: <20200331085423.990189598@linuxfoundation.org> References: <20200331085423.990189598@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yubo Xie [ Upstream commit 0af3e137c144377fbaf5025ba784ff5ba7ad40c9 ] hyperv_timer.c exports hyperv_cs, which is used by stimers and the timesync mechanism. However, the clocksource dependency is not needed: these mechanisms only depend on the partition reference counter (which can be read via a MSR or via the TSC Reference Page). Introduce the (function) pointer hv_read_reference_counter, as an embodiment of the partition reference counter read, and export it in place of the hyperv_cs pointer. The latter can be removed. This should clarify that there's no relationship between Hyper-V stimers & timesync and the Linux clocksource abstractions. No functional or semantic change. Suggested-by: Michael Kelley Signed-off-by: Andrea Parri Reviewed-by: Michael Kelley Signed-off-by: Daniel Lezcano Link: https://lore.kernel.org/r/20200109160650.16150-2-parri.andrea@gmail.com Signed-off-by: Sasha Levin --- drivers/clocksource/hyperv_timer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -327,7 +327,8 @@ static u64 notrace read_hv_clock_tsc(str static u64 read_hv_sched_clock_tsc(void) { - return read_hv_clock_tsc(NULL) - hv_sched_clock_offset; + return (read_hv_clock_tsc(NULL) - hv_sched_clock_offset) * + (NSEC_PER_SEC / HV_CLOCK_HZ); } static struct clocksource hyperv_cs_tsc = { @@ -352,7 +353,8 @@ static u64 notrace read_hv_clock_msr(str static u64 read_hv_sched_clock_msr(void) { - return read_hv_clock_msr(NULL) - hv_sched_clock_offset; + return (read_hv_clock_msr(NULL) - hv_sched_clock_offset) * + (NSEC_PER_SEC / HV_CLOCK_HZ); } static struct clocksource hyperv_cs_msr = {