aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/platforms/pseries/xics.c39
1 files changed, 12 insertions, 27 deletions
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index c3f05d4aff4d..43df53c30aa0 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -516,6 +516,8 @@ static struct irq_chip xics_pic_lpar = {
516 .set_affinity = xics_set_affinity 516 .set_affinity = xics_set_affinity
517}; 517};
518 518
519/* Points to the irq_chip we're actually using */
520static struct irq_chip *xics_irq_chip;
519 521
520static int xics_host_match(struct irq_host *h, struct device_node *node) 522static int xics_host_match(struct irq_host *h, struct device_node *node)
521{ 523{
@@ -526,23 +528,13 @@ static int xics_host_match(struct irq_host *h, struct device_node *node)
526 return !of_device_is_compatible(node, "chrp,iic"); 528 return !of_device_is_compatible(node, "chrp,iic");
527} 529}
528 530
529static int xics_host_map_direct(struct irq_host *h, unsigned int virq, 531static int xics_host_map(struct irq_host *h, unsigned int virq,
530 irq_hw_number_t hw) 532 irq_hw_number_t hw)
531{ 533{
532 pr_debug("xics: map_direct virq %d, hwirq 0x%lx\n", virq, hw); 534 pr_debug("xics: map virq %d, hwirq 0x%lx\n", virq, hw);
533 535
534 get_irq_desc(virq)->status |= IRQ_LEVEL; 536 get_irq_desc(virq)->status |= IRQ_LEVEL;
535 set_irq_chip_and_handler(virq, &xics_pic_direct, handle_fasteoi_irq); 537 set_irq_chip_and_handler(virq, xics_irq_chip, handle_fasteoi_irq);
536 return 0;
537}
538
539static int xics_host_map_lpar(struct irq_host *h, unsigned int virq,
540 irq_hw_number_t hw)
541{
542 pr_debug("xics: map_direct virq %d, hwirq 0x%lx\n", virq, hw);
543
544 get_irq_desc(virq)->status |= IRQ_LEVEL;
545 set_irq_chip_and_handler(virq, &xics_pic_lpar, handle_fasteoi_irq);
546 return 0; 538 return 0;
547} 539}
548 540
@@ -561,27 +553,20 @@ static int xics_host_xlate(struct irq_host *h, struct device_node *ct,
561 return 0; 553 return 0;
562} 554}
563 555
564static struct irq_host_ops xics_host_direct_ops = { 556static struct irq_host_ops xics_host_ops = {
565 .match = xics_host_match, 557 .match = xics_host_match,
566 .map = xics_host_map_direct, 558 .map = xics_host_map,
567 .xlate = xics_host_xlate,
568};
569
570static struct irq_host_ops xics_host_lpar_ops = {
571 .match = xics_host_match,
572 .map = xics_host_map_lpar,
573 .xlate = xics_host_xlate, 559 .xlate = xics_host_xlate,
574}; 560};
575 561
576static void __init xics_init_host(void) 562static void __init xics_init_host(void)
577{ 563{
578 struct irq_host_ops *ops;
579
580 if (firmware_has_feature(FW_FEATURE_LPAR)) 564 if (firmware_has_feature(FW_FEATURE_LPAR))
581 ops = &xics_host_lpar_ops; 565 xics_irq_chip = &xics_pic_lpar;
582 else 566 else
583 ops = &xics_host_direct_ops; 567 xics_irq_chip = &xics_pic_direct;
584 xics_host = irq_alloc_host(NULL, IRQ_HOST_MAP_TREE, 0, ops, 568
569 xics_host = irq_alloc_host(NULL, IRQ_HOST_MAP_TREE, 0, &xics_host_ops,
585 XICS_IRQ_SPURIOUS); 570 XICS_IRQ_SPURIOUS);
586 BUG_ON(xics_host == NULL); 571 BUG_ON(xics_host == NULL);
587 irq_set_default_host(xics_host); 572 irq_set_default_host(xics_host);