Skip to contentSkip to conversation

MIPS: GIC: Select R4K counter as fallback.

PATCH In review Steven J. Hill 4 participants 8 messages Sep 11, 2013 – Sep 13, 2013 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 MIPS: GIC: Select R4K counter as fallback.

From: Leonid Yegoshin <[email protected]>

If CONFIG_CSRC_GIC is selected and the GIC is not found during boot, then fallback to the R4K counter gracefully.

---
 arch/mips/include/asm/time.h |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
arch/mips/include/asm/time.h +7 -4
index 2d7b9df..6ff85e6 100644
@@ -18,6 +18,7 @@
 #include <linux/spinlock.h>
 #include <linux/clockchips.h>
 #include <linux/clocksource.h>
+#include <asm/gic.h>
 
 extern spinlock_t rtc_lock;
 
@@ -75,11 +76,13 @@ extern int init_r4k_clocksource(void);
 
 static inline int init_mips_clocksource(void)
 {
-#if defined(CONFIG_CSRC_R4K) && !defined(CONFIG_CSRC_GIC)
-	return init_r4k_clocksource();
-#else
-	return 0;
+#ifdef CONFIG_CSRC_R4K
+#ifdef CONFIG_CSRC_GIC
+	if (!gic_present)
 #endif
+		return init_r4k_clocksource();
+#endif
+	return 0;
 }
 
 static inline void clockevent_set_clock(struct clock_event_device *cd,
Signature · 1 line
1.7.9.5
#1 lore raw
Quoted 11 lines · Steven J. Hill

From: Leonid Yegoshin<[email protected]>

If CONFIG_CSRC_GIC is selected and the GIC is not found during boot, then fallback to the R4K counter gracefully.

---
  arch/mips/include/asm/time.h |   11 +++++++----
  1 file changed, 7 insertions(+), 4 deletions(-)

Hi Steven,

what has changed in V2 against V1 of this patch ?

I prefer the solution that Daney replied to V1 with

John

#2 lore raw
In reply to Steven J. Hill
Quoted 4 lines · Steven J. Hill

From: Leonid Yegoshin <[email protected]>

If CONFIG_CSRC_GIC is selected and the GIC is not found during boot, then fallback to the R4K counter gracefully.

Is there any reason not to always register the r4k clocksource, no matter whether the gic clocksource is present or not? The timekeeping core of the kernel will make sure to use the best available clocksource based on the clocksource's rating.

- Lars

#3 lore raw
Quoted 6 lines · Lars-Peter Clausen
Quoted 4 lines · Steven J. Hill

From: Leonid Yegoshin<[email protected]>

If CONFIG_CSRC_GIC is selected and the GIC is not found during boot, then fallback to the R4K counter gracefully.

Quoted 6 lines

Is there any reason not to always register the r4k clocksource, no matter whether the gic clocksource is present or not? The timekeeping core of the kernel will make sure to use the best available clocksource based on the clocksource's rating.

- Lars

Hi,

in theory yes, but the r4k csrc is coded in a way that it always assumes to always be present and always be running.

John

#4 lore raw
Quoted 12 lines · John Crispin
Quoted 11 lines · Lars-Peter Clausen
Quoted 4 lines · Steven J. Hill

From: Leonid Yegoshin<[email protected]>

If CONFIG_CSRC_GIC is selected and the GIC is not found during boot, then fallback to the R4K counter gracefully.

Is there any reason not to always register the r4k clocksource, no matter whether the gic clocksource is present or not? The timekeeping core of the kernel will make sure to use the best available clocksource based on the clocksource's rating.

Quoted 7 lines
Quoted 1 line

- Lars

Hi,

in theory yes, but the r4k csrc is coded in a way that it always assumes to always be present and always be running.

And it is not present when the GIC clocksource is present?

#5 lore raw
Quoted 15 lines · Lars-Peter Clausen
Quoted 14 lines · John Crispin
Quoted 12 lines · Lars-Peter Clausen
Quoted 4 lines · Steven J. Hill

From: Leonid Yegoshin<[email protected]>

If CONFIG_CSRC_GIC is selected and the GIC is not found during boot, then fallback to the R4K counter gracefully.

Is there any reason not to always register the r4k clocksource, no matter whether the gic clocksource is present or not? The timekeeping core of the kernel will make sure to use the best available clocksource based on the clocksource's rating.

- Lars

Quoted 9 lines
Quoted 5 lines

Hi,

in theory yes, but the r4k csrc is coded in a way that it always assumes to always be present and always be running.

And it is not present when the GIC clocksource is present?

sorry i confused cevt and csrc ...

#6 lore raw
In reply to Lars-Peter Clausen
Quoted 11 lines · Lars-Peter Clausen
Quoted 4 lines · Steven J. Hill

From: Leonid Yegoshin <[email protected]>

If CONFIG_CSRC_GIC is selected and the GIC is not found during boot, then fallback to the R4K counter gracefully.

Is there any reason not to always register the r4k clocksource, no matter whether the gic clocksource is present or not? The timekeeping core of the kernel will make sure to use the best available clocksource based on the clocksource's rating.

- Lars

If you do power saving by switching some core OFF then you should do an additional clock sync after core revival. GIC is free from that but R4K is not. It was a primary reason for GIC clocksource.

- Leonid.

#7 lore raw
Quoted 11 lines · Leonid Yegoshin
Quoted 10 lines · Lars-Peter Clausen
Quoted 4 lines · Steven J. Hill

From: Leonid Yegoshin <[email protected]>

If CONFIG_CSRC_GIC is selected and the GIC is not found during boot, then fallback to the R4K counter gracefully.

Is there any reason not to always register the r4k clocksource, no matter whether the gic clocksource is present or not? The timekeeping core of the kernel will make sure to use the best available clocksource based on the clocksource's rating.

Quoted 5 lines
Quoted 1 line

- Lars

If you do power saving by switching some core OFF then you should do an additional clock sync after core revival.
GIC is free from that but R4K is not. It was a primary reason for GIC clocksource.

Ok, but what I was saying is that there is no need to not register the r4k clocksource if the gic clocksource is present since the kernel can deal with multiple registered clocksources just fine. This is not a problem that needs to be solved in MIPS specific code, if the rating for the clocksources is set properly the kernel will switch to the gic clocksource as soon as it is registered and ignore the r4k clocksource. No need to do any reference to the gic in the r4k clocksource code.

- Lars