Skip to content

Commit 5ca1237

Browse files
mpeozbenh
authored andcommitted
powerpc/xics: Move irq_host matching into the ics backend
An upcoming new ics backend will need to implement different matching semantics to the current ones, which are essentially the RTAS ics backends. So move the current match into the RTAS backend, and allow other ics backends to override. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
1 parent ab814b9 commit 5ca1237

3 files changed

Lines changed: 19 additions & 5 deletions

File tree

‎arch/powerpc/include/asm/xics.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ struct ics {
5959
int (*map)(struct ics *ics, unsigned int virq);
6060
void (*mask_unknown)(struct ics *ics, unsigned long vec);
6161
long (*get_server)(struct ics *ics, unsigned long vec);
62+
int (*host_match)(struct ics *ics, struct device_node *node);
6263
char data[];
6364
};
6465

‎arch/powerpc/sysdev/xics/ics-rtas.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ static int ibm_int_off;
2626
static int ics_rtas_map(struct ics *ics, unsigned int virq);
2727
static void ics_rtas_mask_unknown(struct ics *ics, unsigned long vec);
2828
static long ics_rtas_get_server(struct ics *ics, unsigned long vec);
29+
static int ics_rtas_host_match(struct ics *ics, struct device_node *node);
2930

3031
/* Only one global & state struct ics */
3132
static struct ics ics_rtas = {
3233
.map = ics_rtas_map,
3334
.mask_unknown = ics_rtas_mask_unknown,
3435
.get_server = ics_rtas_get_server,
36+
.host_match = ics_rtas_host_match,
3537
};
3638

3739
static void ics_rtas_unmask_irq(struct irq_data *d)
@@ -202,6 +204,15 @@ static long ics_rtas_get_server(struct ics *ics, unsigned long vec)
202204
return status[0];
203205
}
204206

207+
static int ics_rtas_host_match(struct ics *ics, struct device_node *node)
208+
{
209+
/* IBM machines have interrupt parents of various funky types for things
210+
* like vdevices, events, etc... The trick we use here is to match
211+
* everything here except the legacy 8259 which is compatible "chrp,iic"
212+
*/
213+
return !of_device_is_compatible(node, "chrp,iic");
214+
}
215+
205216
int ics_rtas_init(void)
206217
{
207218
ibm_get_xive = rtas_token("ibm,get-xive");

‎arch/powerpc/sysdev/xics/xics-common.c‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,13 @@ int xics_get_irq_server(unsigned int virq, const struct cpumask *cpumask,
331331

332332
static int xics_host_match(struct irq_host *h, struct device_node *node)
333333
{
334-
/* IBM machines have interrupt parents of various funky types for things
335-
* like vdevices, events, etc... The trick we use here is to match
336-
* everything here except the legacy 8259 which is compatible "chrp,iic"
337-
*/
338-
return !of_device_is_compatible(node, "chrp,iic");
334+
struct ics *ics;
335+
336+
list_for_each_entry(ics, &ics_list, link)
337+
if (ics->host_match(ics, node))
338+
return 1;
339+
340+
return 0;
339341
}
340342

341343
/* Dummies */

0 commit comments

Comments
 (0)