mirror of
https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9.git
synced 2026-09-09 00:08:12 +08:00
powerpc/time: Expose boot_tb via accessor
JIRA: https://issues.redhat.com/browse/RHEL-53366 commit 2dc019ca39347f76891d34a992b67258078aa45d Author: Aboorva Devarajan <aboorvad@linux.ibm.com> Date: Mon Sep 15 15:59:41 2025 +0530 powerpc/time: Expose boot_tb via accessor - Define accessor function get_boot_tb() to safely return boot_tb value, this is only needed when running in SPLPAR environments, so the accessor is built conditionally under CONFIG_PPC_SPLPAR. - Tag boot_tb as __ro_after_init since it is written once at initialized and never updated afterwards. Signed-off-by: Aboorva Devarajan <aboorvad@linux.ibm.com> Tested-by: Tejas Manhas <tejas05@linux.ibm.com> Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20250915102947.26681-2-atrajeev@linux.ibm.com Signed-off-by: Mamatha Inamdar <minamdar@redhat.com>
This commit is contained in:
@@ -26,6 +26,10 @@ extern struct clock_event_device decrementer_clockevent;
|
||||
|
||||
extern void generic_calibrate_decr(void);
|
||||
|
||||
#ifdef CONFIG_PPC_SPLPAR
|
||||
extern u64 get_boot_tb(void);
|
||||
#endif
|
||||
|
||||
/* Some sane defaults: 125 MHz timebase, 1GHz processor */
|
||||
extern unsigned long ppc_proc_freq;
|
||||
#define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8)
|
||||
|
||||
@@ -130,7 +130,7 @@ EXPORT_SYMBOL_GPL(rtc_lock);
|
||||
|
||||
static u64 tb_to_ns_scale __read_mostly;
|
||||
static unsigned tb_to_ns_shift __read_mostly;
|
||||
static u64 boot_tb __read_mostly;
|
||||
static u64 boot_tb __ro_after_init;
|
||||
|
||||
extern struct timezone sys_tz;
|
||||
static long timezone_offset;
|
||||
@@ -683,6 +683,12 @@ notrace unsigned long long sched_clock(void)
|
||||
return mulhdu(get_tb() - boot_tb, tb_to_ns_scale) << tb_to_ns_shift;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PPC_SPLPAR
|
||||
u64 get_boot_tb(void)
|
||||
{
|
||||
return boot_tb;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_PPC_PSERIES
|
||||
|
||||
|
||||
Reference in New Issue
Block a user