Messages in this thread Patch in this message | | | From | Peter Hilber <> | Subject | [RFC PATCH 1/4] x86/tsc: Add clocksource ids for TSC and early TSC | Date | Fri, 18 Aug 2023 03:12:52 +0200 |
| |
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
| |