[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-ea99110dd024d2f31bde19dda049f3fbf3816a70@git.kernel.org>
Date: Thu, 27 Jun 2019 16:52:30 -0700
From: tip-bot for Thomas Gleixner <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: andi.kleen@...el.com, mingo@...nel.org, hpa@...or.com,
Suravee.Suthikulpanit@....com, linux-kernel@...r.kernel.org,
ricardo.neri-calderon@...ux.intel.com, tglx@...utronix.de,
peterz@...radead.org, ashok.raj@...el.com,
ravi.v.shankar@...el.com, eranian@...gle.com
Subject: [tip:x86/timers] x86/hpet: Carve out shareable parts of
init_one_hpet_msi_clockevent()
Commit-ID: ea99110dd024d2f31bde19dda049f3fbf3816a70
Gitweb: https://git.kernel.org/tip/ea99110dd024d2f31bde19dda049f3fbf3816a70
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Sun, 23 Jun 2019 15:24:07 +0200
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitDate: Fri, 28 Jun 2019 00:57:26 +0200
x86/hpet: Carve out shareable parts of init_one_hpet_msi_clockevent()
To finally remove the static channel0/clockevent storage and to utilize the
channel 0 storage in hpet_base, it's required to run time initialize the
clockevent. The MSI clockevents already have a run time init function.
Carve out the parts which can be shared between the legacy and the MSI
implementation.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Reviewed-by: Ingo Molnar <mingo@...nel.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Ricardo Neri <ricardo.neri-calderon@...ux.intel.com>
Cc: Ashok Raj <ashok.raj@...el.com>
Cc: Andi Kleen <andi.kleen@...el.com>
Cc: Suravee Suthikulpanit <Suravee.Suthikulpanit@....com>
Cc: Stephane Eranian <eranian@...gle.com>
Cc: Ravi Shankar <ravi.v.shankar@...el.com>
Link: https://lkml.kernel.org/r/20190623132436.552451082@linutronix.de
---
arch/x86/kernel/hpet.c | 33 ++++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index 47eb4d36864e..80497fe5354c 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -411,6 +411,25 @@ hpet_clkevt_set_next_event(unsigned long delta, struct clock_event_device *evt)
return res < HPET_MIN_CYCLES ? -ETIME : 0;
}
+static void hpet_init_clockevent(struct hpet_channel *hc, unsigned int rating)
+{
+ struct clock_event_device *evt = &hc->evt;
+
+ evt->rating = rating;
+ evt->irq = hc->irq;
+ evt->name = hc->name;
+ evt->cpumask = cpumask_of(hc->cpu);
+ evt->set_state_oneshot = hpet_clkevt_set_state_oneshot;
+ evt->set_next_event = hpet_clkevt_set_next_event;
+ evt->set_state_shutdown = hpet_clkevt_set_state_shutdown;
+
+ evt->features = CLOCK_EVT_FEAT_ONESHOT;
+ if (hc->boot_cfg & HPET_TN_PERIODIC) {
+ evt->features |= CLOCK_EVT_FEAT_PERIODIC;
+ evt->set_state_periodic = hpet_clkevt_set_state_periodic;
+ }
+}
+
/*
* The HPET clock event device wrapped in a channel for conversion
*/
@@ -510,22 +529,10 @@ static void init_one_hpet_msi_clockevent(struct hpet_channel *hc, int cpu)
hc->cpu = cpu;
per_cpu(cpu_hpet_channel, cpu) = hc;
- evt->name = hc->name;
hpet_setup_msi_irq(hc);
- evt->irq = hc->irq;
- evt->rating = 110;
- evt->features = CLOCK_EVT_FEAT_ONESHOT;
- if (hc->boot_cfg & HPET_TN_PERIODIC) {
- evt->features |= CLOCK_EVT_FEAT_PERIODIC;
- evt->set_state_periodic = hpet_clkevt_set_state_periodic;
- }
-
- evt->set_state_shutdown = hpet_clkevt_set_state_shutdown;
- evt->set_state_oneshot = hpet_clkevt_set_state_oneshot;
- evt->set_next_event = hpet_clkevt_set_next_event;
+ hpet_init_clockevent(hc, 110);
evt->tick_resume = hpet_clkevt_msi_resume;
- evt->cpumask = cpumask_of(hc->cpu);
clockevents_config_and_register(evt, hpet_freq, HPET_MIN_PROG_DELTA,
0x7FFFFFFF);
Powered by blists - more mailing lists