Skip to content

Commit 69a07a4

Browse files
Thomas Bogendoerferpaulburton
authored andcommitted
MIPS: SGI-IP27: rework HUB interrupts
This commit rearranges the HUB interrupt code by using MIPS_IRQ_CPU interrupt handling code and modern Linux IRQ framework features to get rid of global arrays. It also adds support for irq affinity setting. Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de> Signed-off-by: Paul Burton <paul.burton@mips.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: James Hogan <jhogan@kernel.org> Cc: linux-mips@vger.kernel.org Cc: linux-kernel@vger.kernel.org
1 parent 2c86562 commit 69a07a4

File tree

11 files changed

+260
-531
lines changed

11 files changed

+260
-531
lines changed

arch/mips/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,7 @@ config SGI_IP27
675675
select DEFAULT_SGI_PARTITION
676676
select SYS_HAS_EARLY_PRINTK
677677
select HAVE_PCI
678+
select IRQ_MIPS_CPU
678679
select NR_CPUS_DEFAULT_64
679680
select SYS_HAS_CPU_R10000
680681
select SYS_SUPPORTS_64BIT_KERNEL

arch/mips/include/asm/mach-ip27/irq.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
#ifndef __ASM_MACH_IP27_IRQ_H
1111
#define __ASM_MACH_IP27_IRQ_H
1212

13-
/*
14-
* A hardwired interrupt number is completely stupid for this system - a
15-
* large configuration might have thousands if not tenthousands of
16-
* interrupts.
17-
*/
1813
#define NR_IRQS 256
1914

2015
#include_next <irq.h>
2116

17+
#define IP27_HUB_PEND0_IRQ (MIPS_CPU_IRQ_BASE + 2)
18+
#define IP27_HUB_PEND1_IRQ (MIPS_CPU_IRQ_BASE + 3)
19+
#define IP27_RT_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 4)
20+
21+
#define IP27_HUB_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8)
22+
#define IP27_HUB_IRQ_COUNT 128
23+
2224
#endif /* __ASM_MACH_IP27_IRQ_H */

arch/mips/include/asm/mach-ip27/mmzone.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,11 @@
88

99
#define pa_to_nid(addr) NASID_TO_COMPACT_NODEID(NASID_GET(addr))
1010

11-
#define LEVELS_PER_SLICE 128
12-
13-
struct slice_data {
14-
unsigned long irq_enable_mask[2];
15-
int level_to_irq[LEVELS_PER_SLICE];
16-
};
17-
1811
struct hub_data {
1912
kern_vars_t kern_vars;
2013
DECLARE_BITMAP(h_bigwin_used, HUB_NUM_BIG_WINDOW);
2114
cpumask_t h_cpus;
2215
unsigned long slice_map;
23-
unsigned long irq_alloc_mask[2];
24-
struct slice_data slice[2];
2516
};
2617

2718
struct node_data {

arch/mips/include/asm/pci/bridge.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,6 @@ struct bridge_controller {
808808
struct bridge_regs *base;
809809
nasid_t nasid;
810810
unsigned int widget_id;
811-
unsigned int irq_cpu;
812811
u64 baddr;
813812
unsigned int pci_int[8];
814813
};
@@ -823,8 +822,7 @@ struct bridge_controller {
823822
#define bridge_clr(bc, reg, val) \
824823
__raw_writel(__raw_readl(&bc->base->reg) & ~(val), &bc->base->reg)
825824

826-
extern void register_bridge_irq(unsigned int irq);
827-
extern int request_bridge_irq(struct bridge_controller *bc);
825+
extern int request_bridge_irq(struct bridge_controller *bc, int pin);
828826

829827
extern struct pci_ops bridge_pci_ops;
830828

arch/mips/pci/pci-ip27.c

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,12 @@
2323
*/
2424
#define MAX_PCI_BUSSES 40
2525

26-
/*
27-
* Max #PCI devices (like scsi controllers) we handle on a bus.
28-
*/
29-
#define MAX_DEVICES_PER_PCIBUS 8
30-
3126
/*
3227
* XXX: No kmalloc available when we do our crosstalk scan,
3328
* we should try to move it later in the boot process.
3429
*/
3530
static struct bridge_controller bridges[MAX_PCI_BUSSES];
3631

37-
/*
38-
* Translate from irq to software PCI bus number and PCI slot.
39-
*/
40-
struct bridge_controller *irq_to_bridge[MAX_PCI_BUSSES * MAX_DEVICES_PER_PCIBUS];
41-
int irq_to_slot[MAX_PCI_BUSSES * MAX_DEVICES_PER_PCIBUS];
42-
4332
extern struct pci_ops bridge_pci_ops;
4433

4534
int bridge_probe(nasid_t nasid, int widget_id, int masterwid)
@@ -77,7 +66,6 @@ int bridge_probe(nasid_t nasid, int widget_id, int masterwid)
7766
bc->io.end = ~0UL;
7867
bc->io.flags = IORESOURCE_IO;
7968

80-
bc->irq_cpu = smp_processor_id();
8169
bc->widget_id = widget_id;
8270
bc->nasid = nasid;
8371

@@ -165,16 +153,12 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
165153

166154
irq = bc->pci_int[slot];
167155
if (irq == -1) {
168-
irq = request_bridge_irq(bc);
156+
irq = request_bridge_irq(bc, slot);
169157
if (irq < 0)
170158
return irq;
171159

172160
bc->pci_int[slot] = irq;
173161
}
174-
175-
irq_to_bridge[irq] = bc;
176-
irq_to_slot[irq] = slot;
177-
178162
dev->irq = irq;
179163

180164
return 0;

arch/mips/sgi-ip27/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33
# Makefile for the IP27 specific kernel interface routines under Linux.
44
#
55

6-
obj-y := ip27-berr.o ip27-irq.o ip27-irqno.o ip27-init.o ip27-klconfig.o \
6+
obj-y := ip27-berr.o ip27-irq.o ip27-init.o ip27-klconfig.o \
77
ip27-klnuma.o ip27-memory.o ip27-nmi.o ip27-reset.o ip27-timer.o \
88
ip27-hubio.o ip27-xtalk.o
99

1010
obj-$(CONFIG_EARLY_PRINTK) += ip27-console.o
11-
obj-$(CONFIG_PCI) += ip27-irq-pci.o
1211
obj-$(CONFIG_SMP) += ip27-smp.o

arch/mips/sgi-ip27/ip27-init.c

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ static void per_hub_init(cnodeid_t cnode)
5656
{
5757
struct hub_data *hub = hub_data(cnode);
5858
nasid_t nasid = COMPACT_TO_NASID_NODEID(cnode);
59-
int i;
6059

6160
cpumask_set_cpu(smp_processor_id(), &hub->h_cpus);
6261

@@ -87,24 +86,6 @@ static void per_hub_init(cnodeid_t cnode)
8786
__flush_cache_all();
8887
}
8988
#endif
90-
91-
/*
92-
* Some interrupts are reserved by hardware or by software convention.
93-
* Mark these as reserved right away so they won't be used accidentally
94-
* later.
95-
*/
96-
for (i = 0; i <= BASE_PCI_IRQ; i++) {
97-
__set_bit(i, hub->irq_alloc_mask);
98-
LOCAL_HUB_CLR_INTR(INT_PEND0_BASELVL + i);
99-
}
100-
101-
__set_bit(IP_PEND0_6_63, hub->irq_alloc_mask);
102-
LOCAL_HUB_S(PI_INT_PEND_MOD, IP_PEND0_6_63);
103-
104-
for (i = NI_BRDCAST_ERR_A; i <= MSC_PANIC_INTR; i++) {
105-
__set_bit(i, hub->irq_alloc_mask);
106-
LOCAL_HUB_CLR_INTR(INT_PEND1_BASELVL + i);
107-
}
10889
}
10990

11091
void per_cpu_init(void)
@@ -113,8 +94,6 @@ void per_cpu_init(void)
11394
int slice = LOCAL_HUB_L(PI_CPU_NUM);
11495
cnodeid_t cnode = get_compact_nodeid();
11596
struct hub_data *hub = hub_data(cnode);
116-
struct slice_data *si = hub->slice + slice;
117-
int i;
11897

11998
if (test_and_set_bit(slice, &hub->slice_map))
12099
return;
@@ -123,22 +102,14 @@ void per_cpu_init(void)
123102

124103
per_hub_init(cnode);
125104

126-
for (i = 0; i < LEVELS_PER_SLICE; i++)
127-
si->level_to_irq[i] = -1;
128-
129-
/*
130-
* We use this so we can find the local hub's data as fast as only
131-
* possible.
132-
*/
133-
cpu_data[cpu].data = si;
134-
135105
cpu_time_init();
136106
install_ipi();
137107

138108
/* Install our NMI handler if symmon hasn't installed one. */
139109
install_cpu_nmi_handler(cputoslice(cpu));
140110

141-
set_c0_status(SRB_DEV0 | SRB_DEV1);
111+
enable_percpu_irq(IP27_HUB_PEND0_IRQ, IRQ_TYPE_NONE);
112+
enable_percpu_irq(IP27_HUB_PEND1_IRQ, IRQ_TYPE_NONE);
142113
}
143114

144115
/*

0 commit comments

Comments
 (0)