Skip to content

Commit 5761d64

Browse files
KAGA-KOKOIngo Molnar
authored andcommitted
x86: revert assign IRQs to hpet timer
The commits: commit 37a47db Author: Balaji Rao <balajirrao@gmail.com> Date: Wed Jan 30 13:30:03 2008 +0100 x86: assign IRQs to HPET timers, fix and commit e3f37a5 Author: Balaji Rao <balajirrao@gmail.com> Date: Wed Jan 30 13:30:03 2008 +0100 x86: assign IRQs to HPET timers have been identified to cause a regression on some platforms due to the assignement of legacy IRQs which makes the legacy devices connected to those IRQs disfunctional. Revert them. This fixes http://bugzilla.kernel.org/show_bug.cgi?id=10382 Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent 47001d6 commit 5761d64

3 files changed

Lines changed: 14 additions & 48 deletions

File tree

‎arch/x86/kernel/hpet.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,16 @@ static void hpet_reserve_platform_timers(unsigned long id)
133133
#ifdef CONFIG_HPET_EMULATE_RTC
134134
hpet_reserve_timer(&hd, 1);
135135
#endif
136+
136137
hd.hd_irq[0] = HPET_LEGACY_8254;
137138
hd.hd_irq[1] = HPET_LEGACY_RTC;
138139

139-
for (i = 2; i < nrtimers; timer++, i++)
140-
hd.hd_irq[i] = (timer->hpet_config & Tn_INT_ROUTE_CNF_MASK) >>
141-
Tn_INT_ROUTE_CNF_SHIFT;
140+
for (i = 2; i < nrtimers; timer++, i++)
141+
hd.hd_irq[i] = (timer->hpet_config & Tn_INT_ROUTE_CNF_MASK) >>
142+
Tn_INT_ROUTE_CNF_SHIFT;
143+
142144
hpet_alloc(&hd);
145+
143146
}
144147
#else
145148
static void hpet_reserve_platform_timers(unsigned long id) { }

‎drivers/char/hpet.c‎

Lines changed: 7 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -731,14 +731,14 @@ static unsigned long hpet_calibrate(struct hpets *hpetp)
731731

732732
int hpet_alloc(struct hpet_data *hdp)
733733
{
734-
u64 cap, mcfg, hpet_config;
734+
u64 cap, mcfg;
735735
struct hpet_dev *devp;
736-
u32 i, ntimer, irq;
736+
u32 i, ntimer;
737737
struct hpets *hpetp;
738738
size_t siz;
739739
struct hpet __iomem *hpet;
740740
static struct hpets *last = NULL;
741-
unsigned long period, irq_bitmap;
741+
unsigned long period;
742742
unsigned long long temp;
743743

744744
/*
@@ -765,47 +765,11 @@ int hpet_alloc(struct hpet_data *hdp)
765765
hpetp->hp_hpet_phys = hdp->hd_phys_address;
766766

767767
hpetp->hp_ntimer = hdp->hd_nirqs;
768-
hpet = hpetp->hp_hpet;
769-
770-
/* Assign IRQs statically for legacy devices */
771-
hpetp->hp_dev[0].hd_hdwirq = hdp->hd_irq[0];
772-
hpetp->hp_dev[1].hd_hdwirq = hdp->hd_irq[1];
773-
774-
/* Assign IRQs dynamically for the others */
775-
for (i = 2, devp = &hpetp->hp_dev[2]; i < hdp->hd_nirqs; i++, devp++) {
776-
struct hpet_timer __iomem *timer;
777768

778-
timer = &hpet->hpet_timers[devp - hpetp->hp_dev];
769+
for (i = 0; i < hdp->hd_nirqs; i++)
770+
hpetp->hp_dev[i].hd_hdwirq = hdp->hd_irq[i];
779771

780-
/* Check if there's already an IRQ assigned to the timer */
781-
if (hdp->hd_irq[i]) {
782-
hpetp->hp_dev[i].hd_hdwirq = hdp->hd_irq[i];
783-
continue;
784-
}
785-
786-
hpet_config = readq(&timer->hpet_config);
787-
irq_bitmap = (hpet_config & Tn_INT_ROUTE_CAP_MASK)
788-
>> Tn_INT_ROUTE_CAP_SHIFT;
789-
if (!irq_bitmap)
790-
irq = 0; /* No valid IRQ Assignable */
791-
else {
792-
irq = find_first_bit(&irq_bitmap, 32);
793-
do {
794-
hpet_config |= irq << Tn_INT_ROUTE_CNF_SHIFT;
795-
writeq(hpet_config, &timer->hpet_config);
796-
797-
/*
798-
* Verify whether we have written a valid
799-
* IRQ number by reading it back again
800-
*/
801-
hpet_config = readq(&timer->hpet_config);
802-
if (irq == (hpet_config & Tn_INT_ROUTE_CNF_MASK)
803-
>> Tn_INT_ROUTE_CNF_SHIFT)
804-
break; /* Success */
805-
} while ((irq = (find_next_bit(&irq_bitmap, 32, irq))));
806-
}
807-
hpetp->hp_dev[i].hd_hdwirq = irq;
808-
}
772+
hpet = hpetp->hp_hpet;
809773

810774
cap = readq(&hpet->hpet_cap);
811775

@@ -836,8 +800,7 @@ int hpet_alloc(struct hpet_data *hdp)
836800
hpetp->hp_which, hdp->hd_phys_address,
837801
hpetp->hp_ntimer > 1 ? "s" : "");
838802
for (i = 0; i < hpetp->hp_ntimer; i++)
839-
printk("%s %d", i > 0 ? "," : "",
840-
hpetp->hp_dev[i].hd_hdwirq);
803+
printk("%s %d", i > 0 ? "," : "", hdp->hd_irq[i]);
841804
printk("\n");
842805

843806
printk(KERN_INFO "hpet%u: %u %d-bit timers, %Lu Hz\n",

‎include/linux/hpet.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct hpet {
6464
*/
6565

6666
#define Tn_INT_ROUTE_CAP_MASK (0xffffffff00000000ULL)
67-
#define Tn_INT_ROUTE_CAP_SHIFT (32UL)
67+
#define Tn_INI_ROUTE_CAP_SHIFT (32UL)
6868
#define Tn_FSB_INT_DELCAP_MASK (0x8000UL)
6969
#define Tn_FSB_INT_DELCAP_SHIFT (15)
7070
#define Tn_FSB_EN_CNF_MASK (0x4000UL)

0 commit comments

Comments
 (0)