summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2014-06-10 13:52:25 +0530
committerSantosh Shukla <sshukla@mvista.com>2014-11-11 18:38:24 +0530
commit30a047c4619aad422e7cfeece6e07623af573897 (patch)
treeb088552346d7a6b1c06a6772983c3ad175bde316
parent82bd0f7b17dfee53a707d9e21afeace69618d0a7 (diff)
clockevents: x86: add support for ONESHOT_STOPPED mode
Clockevent devices can be stopped from core (hrtimers/tick) when they aren't used anymore. This will mostly happen on a idle or tickless cpu. This is done to avoid getting spurious interrupts when core doesn't want to handle them anymore. For stopping clockevent devices, core requests drivers to switch to a special optional mode: CLOCK_EVT_MODE_ONESHOT_STOPPED. At this time platforms can also save some power by disabling these devices. This patch adds support for handling CLOCK_EVT_MODE_ONESHOT_STOPPED mode for x86 drivers. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Santosh Shukla <santosh.shukla@linaro.org>
-rw-r--r--arch/x86/kernel/apic/apic.c1
-rw-r--r--arch/x86/kernel/hpet.c1
-rw-r--r--arch/x86/lguest/boot.c1
-rw-r--r--arch/x86/platform/uv/uv_time.c1
-rw-r--r--arch/x86/xen/time.c2
5 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 24e400e4f93c..c46e2204339b 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -508,6 +508,7 @@ static int lapic_timer_setup(enum clock_event_mode mode,
break;
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_SHUTDOWN:
+ case CLOCK_EVT_MODE_ONESHOT_STOPPED:
v = apic_read(APIC_LVTT);
v |= (APIC_LVT_MASKED | LOCAL_TIMER_VECTOR);
apic_write(APIC_LVTT, v);
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index ed1dad52ed0c..c29fdc12679c 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -350,6 +350,7 @@ static int hpet_set_mode(enum clock_event_mode mode,
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_SHUTDOWN:
+ case CLOCK_EVT_MODE_ONESHOT_STOPPED:
cfg = hpet_readl(HPET_Tn_CFG(timer));
cfg &= ~HPET_TN_ENABLE;
hpet_writel(cfg, HPET_Tn_CFG(timer));
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c
index 264d2eddfe81..c175c299ca8c 100644
--- a/arch/x86/lguest/boot.c
+++ b/arch/x86/lguest/boot.c
@@ -968,6 +968,7 @@ static int lguest_clockevent_set_mode(enum clock_event_mode mode,
switch (mode) {
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_SHUTDOWN:
+ case CLOCK_EVT_MODE_ONESHOT_STOPPED:
/* A 0 argument shuts the clock down. */
hcall(LHCALL_SET_CLOCKEVENT, 0, 0, 0, 0);
break;
diff --git a/arch/x86/platform/uv/uv_time.c b/arch/x86/platform/uv/uv_time.c
index 54f6b0cdbd9b..878361dd94c0 100644
--- a/arch/x86/platform/uv/uv_time.c
+++ b/arch/x86/platform/uv/uv_time.c
@@ -336,6 +336,7 @@ static int uv_rtc_timer_setup(enum clock_event_mode mode,
break;
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_SHUTDOWN:
+ case CLOCK_EVT_MODE_ONESHOT_STOPPED:
uv_rtc_unset_timer(ced_cpu, 1);
break;
default:
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 952f00833cd7..51026acd6098 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -289,6 +289,7 @@ static int xen_timerop_set_mode(enum clock_event_mode mode,
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_SHUTDOWN:
+ case CLOCK_EVT_MODE_ONESHOT_STOPPED:
HYPERVISOR_set_timer_op(0); /* cancel timeout */
break;
default:
@@ -346,6 +347,7 @@ static int xen_vcpuop_set_mode(enum clock_event_mode mode,
case CLOCK_EVT_MODE_UNUSED:
case CLOCK_EVT_MODE_SHUTDOWN:
+ case CLOCK_EVT_MODE_ONESHOT_STOPPED:
if (HYPERVISOR_vcpu_op(VCPUOP_stop_singleshot_timer, cpu, NULL) ||
HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer, cpu, NULL))
BUG();