mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "tip-bot2 for Jiaxun Yang" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: philmd@linaro.org, Jiaxun Yang <jiaxun.yang@flygoat.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: timers/core] clocksource/drivers/mips-gic-timer: Correct sched_clock width
Date: Sat, 13 Jul 2024 10:16:55 -0000	[thread overview]
Message-ID: <172086581522.2215.4543941382409253440.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20240612-mips-clks-v2-7-a57e6f49f3db@flygoat.com>

The following commit has been merged into the timers/core branch of tip:

Commit-ID:     5e4bfd66eccaaab65b3d565cfe28483afeacaf1d
Gitweb:        https://git.kernel.org/tip/5e4bfd66eccaaab65b3d565cfe28483afeacaf1d
Author:        Jiaxun Yang <jiaxun.yang@flygoat.com>
AuthorDate:    Wed, 12 Jun 2024 09:54:34 +01:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Fri, 12 Jul 2024 16:07:05 +02:00

clocksource/drivers/mips-gic-timer: Correct sched_clock width

Counter width of GIC is configurable and can be read from a
register.

Use width value from the register for sched_clock.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Link: https://lore.kernel.org/r/20240612-mips-clks-v2-7-a57e6f49f3db@flygoat.com
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/mips-gic-timer.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c
index 7a03d94..1103477 100644
--- a/drivers/clocksource/mips-gic-timer.c
+++ b/drivers/clocksource/mips-gic-timer.c
@@ -19,6 +19,7 @@
 static DEFINE_PER_CPU(struct clock_event_device, gic_clockevent_device);
 static int gic_timer_irq;
 static unsigned int gic_frequency;
+static unsigned int gic_count_width;
 static bool __read_mostly gic_clock_unstable;
 
 static void gic_clocksource_unstable(char *reason);
@@ -186,15 +187,14 @@ static void gic_clocksource_unstable(char *reason)
 
 static int __init __gic_clocksource_init(void)
 {
-	unsigned int count_width;
 	int ret;
 
 	/* Set clocksource mask. */
-	count_width = read_gic_config() & GIC_CONFIG_COUNTBITS;
-	count_width >>= __ffs(GIC_CONFIG_COUNTBITS);
-	count_width *= 4;
-	count_width += 32;
-	gic_clocksource.mask = CLOCKSOURCE_MASK(count_width);
+	gic_count_width = read_gic_config() & GIC_CONFIG_COUNTBITS;
+	gic_count_width >>= __ffs(GIC_CONFIG_COUNTBITS);
+	gic_count_width *= 4;
+	gic_count_width += 32;
+	gic_clocksource.mask = CLOCKSOURCE_MASK(gic_count_width);
 
 	/* Calculate a somewhat reasonable rating value. */
 	if (mips_cm_revision() >= CM_REV_CM3 || !IS_ENABLED(CONFIG_CPU_FREQ))
@@ -264,7 +264,7 @@ static int __init gic_clocksource_of_init(struct device_node *node)
 	if (mips_cm_revision() >= CM_REV_CM3 || !IS_ENABLED(CONFIG_CPU_FREQ)) {
 		sched_clock_register(mips_cm_is64 ?
 				     gic_read_count_64 : gic_read_count_2x32,
-				     64, gic_frequency);
+				     gic_count_width, gic_frequency);
 	}
 
 	return 0;

  reply	other threads:[~2024-07-13 10:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-12  8:54 [PATCH v2 0/7] MIPS: clocksource cumulative enhancements Jiaxun Yang
2024-06-12  8:54 ` [PATCH v2 1/7] MIPS: csrc-r4k: Refine rating computation Jiaxun Yang
2024-06-12  8:54 ` [PATCH v2 2/7] MIPS: csrc-r4k: Apply verification clocksource flags Jiaxun Yang
2024-08-06  4:09   ` Guenter Roeck
2024-08-06  5:06     ` Jiaxun Yang
2024-08-06  5:13       ` Guenter Roeck
2024-08-06 15:06         ` Guenter Roeck
2024-08-08  7:35           ` Jiaxun Yang
2024-06-12  8:54 ` [PATCH v2 3/7] MIPS: csrc-r4k: Select HAVE_UNSTABLE_SCHED_CLOCK if SMP && 64BIT Jiaxun Yang
2024-06-12  8:54 ` [PATCH v2 4/7] MIPS: csrc-r4k: Don't register as sched_clock if unfit Jiaxun Yang
2024-06-12  8:54 ` [PATCH v2 5/7] MIPS: sync-r4k: Rework based on x86 tsc_sync Jiaxun Yang
2024-06-12  8:54 ` [PATCH v2 6/7] clocksource: mips-gic-timer: Refine rating computation Jiaxun Yang
2024-06-21 11:18   ` Jiaxun Yang
2024-07-13 10:16   ` [tip: timers/core] clocksource/drivers/mips-gic-timer: " tip-bot2 for Jiaxun Yang
2024-06-12  8:54 ` [PATCH v2 7/7] clocksource: mips-gic-timer: Correct sched_clock width Jiaxun Yang
2024-07-13 10:16   ` tip-bot2 for Jiaxun Yang [this message]
2024-07-03  5:59 ` [PATCH v2 0/7] MIPS: clocksource cumulative enhancements Jiaxun Yang
2024-07-03 15:24 ` Thomas Bogendoerfer
2024-07-08 16:40   ` Daniel Lezcano

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=172086581522.2215.4543941382409253440.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=daniel.lezcano@linaro.org \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=philmd@linaro.org \
    --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®