From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755869AbcAMTWS (ORCPT ); Wed, 13 Jan 2016 14:22:18 -0500 Received: from mga02.intel.com ([134.134.136.20]:16629 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753961AbcAMTSl (ORCPT ); Wed, 13 Jan 2016 14:18:41 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,290,1449561600"; d="scan'208";a="632939088" From: "Christopher S. Hall" To: tglx@linutronix.de, richardcochran@gmail.com, mingo@redhat.com, john.stultz@linaro.org, hpa@zytor.com, jeffrey.t.kirsher@intel.com Cc: "Christopher S. Hall" , x86@kernel.org, linux-kernel@vger.kernel.org, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, kevin.b.stanton@intel.com Subject: [PATCH v6 3/9] Add correlated clocksource relating aliased auxiliary and system clocks Date: Wed, 13 Jan 2016 04:12:23 -0800 Message-Id: <1452687149-11281-4-git-send-email-christopher.s.hall@intel.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1452687149-11281-1-git-send-email-christopher.s.hall@intel.com> References: <1452687149-11281-1-git-send-email-christopher.s.hall@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ACKNOWLEDGMENT: The original correlated clock source and cross timestamp code was developed by Thomas Gleixner . It has changed considerably and any mistakes are mine. The timekeeping and clocksource code don't currently comprehend two clocks that are aliases of one another. That is clocks that are *exactly* related. The correlated_cs struct encapsulated this relationship between a clocksource and its alias clock. Modern Intel hardware provides an Always Running Timer (ART) which is exactly related to TSC through a known frequency ratio. The ART is an example of a correlated clocksource. Signed-off-by: Christopher S. Hall --- include/linux/clocksource.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h index 4542293..726ca68 100644 --- a/include/linux/clocksource.h +++ b/include/linux/clocksource.h @@ -267,4 +267,18 @@ struct system_counterval_t { struct clocksource *cs; }; +/* + * struct correlated_cs - Descriptor for a clocksource correlated to another + * clocksource + * @related_cs: Pointer to the related timekeeping clocksource + * @convert: Conversion function to convert a timestamp from + * the correlated clocksource to cycles of the related + * timekeeping clocksource + */ +struct correlated_cs { + struct clocksource *related_cs; + cycle_t (*convert)(struct correlated_cs *cs, + cycle_t cycles); +}; + #endif /* _LINUX_CLOCKSOURCE_H */ -- 2.1.4