From: Peter Hilber <peter.hilber@opensynergy.com>
To: linux-kernel@vger.kernel.org
Cc: Peter Hilber <peter.hilber@opensynergy.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
Marc Zyngier <maz@kernel.org>
Subject: [RFC PATCH 1/4] x86/tsc: Add clocksource ids for TSC and early TSC
Date: Fri, 18 Aug 2023 03:12:52 +0200 [thread overview]
Message-ID: <20230818011256.211078-2-peter.hilber@opensynergy.com> (raw)
In-Reply-To: <20230818011256.211078-1-peter.hilber@opensynergy.com>
Add a clocksource id for TSC and a distinct one for the early TSC.
Use distinct ids for TSC and early TSC, since those also have distinct
clocksource structs. This should help to keep existing semantics when
comparing clocksources.
This change will keep ioctl PTP_SYS_OFFSET_PRECISE working on x86 in the
future, when get_device_system_crosststamp() would be changed to compare
enum clocksource_ids, rather than struct clocksource *. It also makes
identifying TSC easier for outside code in general.
Signed-off-by: Peter Hilber <peter.hilber@opensynergy.com>
---
arch/x86/kernel/tsc.c | 3 +++
include/linux/clocksource_ids.h | 2 ++
2 files changed, 5 insertions(+)
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 15f97c0abc9d..132045be76d0 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -11,6 +11,7 @@
#include <linux/cpufreq.h>
#include <linux/delay.h>
#include <linux/clocksource.h>
+#include <linux/clocksource_ids.h>
#include <linux/percpu.h>
#include <linux/timex.h>
#include <linux/static_key.h>
@@ -1168,6 +1169,7 @@ static struct clocksource clocksource_tsc_early = {
.mask = CLOCKSOURCE_MASK(64),
.flags = CLOCK_SOURCE_IS_CONTINUOUS |
CLOCK_SOURCE_MUST_VERIFY,
+ .id = CSID_TSC_EARLY,
.vdso_clock_mode = VDSO_CLOCKMODE_TSC,
.enable = tsc_cs_enable,
.resume = tsc_resume,
@@ -1190,6 +1192,7 @@ static struct clocksource clocksource_tsc = {
CLOCK_SOURCE_VALID_FOR_HRES |
CLOCK_SOURCE_MUST_VERIFY |
CLOCK_SOURCE_VERIFY_PERCPU,
+ .id = CSID_TSC,
.vdso_clock_mode = VDSO_CLOCKMODE_TSC,
.enable = tsc_cs_enable,
.resume = tsc_resume,
diff --git a/include/linux/clocksource_ids.h b/include/linux/clocksource_ids.h
index 16775d7d8f8d..86d23abfde2a 100644
--- a/include/linux/clocksource_ids.h
+++ b/include/linux/clocksource_ids.h
@@ -6,6 +6,8 @@
enum clocksource_ids {
CSID_GENERIC = 0,
CSID_ARM_ARCH_COUNTER,
+ CSID_TSC_EARLY,
+ CSID_TSC,
CSID_MAX,
};
--
2.39.2
next prev parent reply other threads:[~2023-08-18 1:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-18 1:12 [RFC PATCH 0/4] treewide: Use clocksource id for get_device_system_crosststamp() Peter Hilber
2023-08-18 1:12 ` Peter Hilber [this message]
2023-08-18 1:12 ` [RFC PATCH 2/4] x86/kvm: Add clocksource id for kvm-clock Peter Hilber
2023-08-18 1:12 ` [RFC PATCH 3/4] x86/tsc: Use bool, not pointer, for ART availability Peter Hilber
2023-08-18 1:12 ` [RFC PATCH 4/4] treewide: Use clocksource id for struct system_counterval_t Peter Hilber
2023-09-15 13:30 ` Thomas Gleixner
2023-09-15 14:29 ` Peter Hilber
2023-08-25 4:18 ` [RFC PATCH 0/4] treewide: Use clocksource id for get_device_system_crosststamp() John Stultz
2023-09-13 9:10 ` Peter Hilber
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230818011256.211078-2-peter.hilber@opensynergy.com \
--to=peter.hilber@opensynergy.com \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®