Skip to contentSkip to conversation

SGI RTC: add clocksource/clockevent driver and generic timer vector

PATCH Superseded Dimitri Sivanich 2 participants 4 messages Nov 24, 2008 – Dec 5, 2008

Subsystems (5)

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

v4 cover SGI RTC: add clocksource/clockevent driver and generic timer vector

The following patches provide a driver for synchronized RTC clocksource and clockevents for SGI systems, as well as a generic timer system interrupt.

With these patches, a module can be installed that registers the system-wide synchronized RTC clocksource and timers as both a clocksource and clockevents device running in high resolution mode.

[PATCH 1/2 v4] SGI RTC: add generic timer system interrupt [PATCH 2/2 v4] SGI RTC: add clocksource driver

#1 lore raw

PATCH v4 1/2 SGI RTC: add generic timer system interrupt

This patch allocates a system interrupt vector for platform specific use in implementing timer interrupts.

---

Changed register/unregister function names.

 arch/x86/include/asm/hw_irq.h      |    1 
 arch/x86/include/asm/irq.h         |    2 +
 arch/x86/include/asm/irq_vectors.h |    5 +++
 arch/x86/kernel/entry_64.S         |    4 ++
 arch/x86/kernel/irqinit_64.c       |   45 +++++++++++++++++++++++++++++++++
 5 files changed, 57 insertions(+)
arch/x86/kernel/entry_64.S +4 -0
Index: linux/arch/x86/kernel/entry_64.S
===================================================================
@@ -865,6 +865,10 @@ ENTRY(apic_timer_interrupt)
 	apicinterrupt LOCAL_TIMER_VECTOR,smp_apic_timer_interrupt
 END(apic_timer_interrupt)
 
+ENTRY(generic_timer_interrupt)
+	apicinterrupt GENERIC_TIMER_VECTOR,smp_generic_timer_interrupt
+END(generic_timer_interrupt)
+
 ENTRY(uv_bau_message_intr1)
 	apicinterrupt 220,uv_bau_message_interrupt
 END(uv_bau_message_intr1)
arch/x86/kernel/irqinit_64.c +45 -0

63 lines not on this page · raw message

arch/x86/include/asm/irq_vectors.h +5 -0
Index: linux/arch/x86/include/asm/irq_vectors.h
===================================================================
@@ -92,6 +92,11 @@
 #define LOCAL_PERFMON_VECTOR	0xee
 
 /*
+ * Generic timer vector for platform specific use
+ */
+#define GENERIC_TIMER_VECTOR	0xed
+
+/*
  * First APIC vector available to drivers: (vectors 0x30-0xee) we
  * start at 0x31(0x41) to spread out vectors evenly between priority
  * levels. (0x80 is the syscall vector)
arch/x86/include/asm/hw_irq.h +1 -0
Index: linux/arch/x86/include/asm/hw_irq.h
===================================================================
@@ -29,6 +29,7 @@
 
 /* Interrupt handlers registered during init_IRQ */
 extern void apic_timer_interrupt(void);
+extern void generic_timer_interrupt(void);
 extern void error_interrupt(void);
 extern void spurious_interrupt(void);
 extern void thermal_interrupt(void);
arch/x86/include/asm/irq.h +2 -0
Index: linux/arch/x86/include/asm/irq.h
===================================================================
@@ -38,6 +38,8 @@ extern void fixup_irqs(cpumask_t map);
 
 extern unsigned int do_IRQ(struct pt_regs *regs);
 extern void init_IRQ(void);
+extern int register_generic_timer_extension(void (*fn)(void));
+extern void unregister_generic_timer_extension(void);
 extern void native_init_IRQ(void);
 
 /* Interrupt vector management */
#2 lore raw

PATCH v4 2/2 SGI RTC: add clocksource driver

This patch provides a driver for SGI RTC clocks and timers.

This provides a high resolution clock and timer source using the SGI system-wide synchronized RTC clock/timer hardware.

---

Changed the shift values for clocksource and clockevent. Made other stylistic changes.

 drivers/clocksource/Makefile |    1 
 drivers/clocksource/rtc_uv.c |  410 +++++++++++++++++++++++++++++++++++++++
 drivers/misc/Kconfig         |    9 
 kernel/time/clockevents.c    |    1 
 kernel/time/clocksource.c    |    1 
 5 files changed, 422 insertions(+)
drivers/clocksource/Makefile +1 -0
Index: linux/drivers/clocksource/Makefile
===================================================================
@@ -2,3 +2,4 @@ obj-$(CONFIG_ATMEL_TCB_CLKSRC)	+= tcb_cl
 obj-$(CONFIG_X86_CYCLONE_TIMER)	+= cyclone.o
 obj-$(CONFIG_X86_PM_TIMER)	+= acpi_pm.o
 obj-$(CONFIG_SCx200HR_TIMER)	+= scx200_hrt.o
+obj-$(CONFIG_SGI_RTC_TIMER)	+= rtc_uv.o
drivers/misc/Kconfig +9 -0
Index: linux/drivers/misc/Kconfig
===================================================================
@@ -498,6 +498,15 @@ config SGI_GRU_DEBUG
 	This option enables addition debugging code for the SGI GRU driver. If
 	you are unsure, say N.
 
+config SGI_RTC_TIMER
+	tristate "SGI RTC driver"
+	depends on GENERIC_CLOCKEVENTS_BUILD
+	depends on (X86_64 || IA64_SGI_UV || IA64_GENERIC) && SMP
+	default m
+	---help---
+	This option enables RTC event handling and adds the systemwide RTC
+	as a high resolution clock source for SGI systems.
+
 source "drivers/misc/c2port/Kconfig"
 
 endif # MISC_DEVICES
drivers/clocksource/rtc_uv.c new file +410 -0

410 lines not on this page · raw message

kernel/time/clockevents.c +1 -0
Index: linux/kernel/time/clockevents.c
===================================================================
@@ -183,6 +183,7 @@ void clockevents_register_device(struct 
 
 	spin_unlock(&clockevents_lock);
 }
+EXPORT_SYMBOL_GPL(clockevents_register_device);
 
 /*
  * Noop handler when we shut down an event device
kernel/time/clocksource.c +1 -0
Index: linux/kernel/time/clocksource.c
===================================================================
@@ -369,6 +369,7 @@ void clocksource_unregister(struct clock
 	next_clocksource = select_clocksource();
 	spin_unlock_irqrestore(&clocksource_lock, flags);
 }
+EXPORT_SYMBOL(clocksource_unregister);
 
 #ifdef CONFIG_SYSFS
 /**
Acked-by on v4 2/2
#3 lore raw

Re: [PATCH 2/2 v4] SGI RTC: add clocksource driver

Quoted 12 lines · Dimitri Sivanich

This patch provides a driver for SGI RTC clocks and timers.

This provides a high resolution clock and timer source using the SGI system-wide synchronized RTC clock/timer hardware.

---

Changed the shift values for clocksource and clockevent. Made other stylistic changes.

[snip]

drivers/clocksource/rtc_uv.c line 47

Quoted 8 lines
drivers/clocksource/rtc_uv.c new file +8 -0
+static struct clocksource clocksource_uv = {
+	.name		= RTC_NAME,
+	.rating		= 400,
+	.read		= uv_read_rtc,
+	.mask		= (cycle_t)UVH_RTC_REAL_TIME_CLOCK_MASK,
+	.shift		= 10,
+	.flags		= CLOCK_SOURCE_IS_CONTINUOUS,
+};

Hey Dimitri,
Sorry for being slow to catch this. This address my earlier concerns.
Thanks!

-john