linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [RFC/PATCH 1/4] Move xics_setup_8259_cascade() into platforms/pseries/setup.c
@ 2008-04-01  6:42 Michael Ellerman
  2008-04-01  6:42 ` [RFC/PATCH 2/4] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade() Michael Ellerman
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Michael Ellerman @ 2008-04-01  6:42 UTC (permalink / raw)
  To: linuxppc-dev

The code in xics.c to setup the i8259 cascaded irq handler is not really
xics specific, so move it into setup.c - we will clean this up further in
a subsequent patch.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/platforms/pseries/setup.c |   53 +++++++++++++++++++++++++++++++-
 arch/powerpc/platforms/pseries/xics.c  |   48 -----------------------------
 arch/powerpc/platforms/pseries/xics.h  |    3 --
 3 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index fdb9b1c..43e4801 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -127,6 +127,51 @@ void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc)
 	desc->chip->eoi(irq);
 }
 
+static void __init xics_setup_8259_cascade(void)
+{
+	struct device_node *np, *old, *found = NULL;
+	int cascade, naddr;
+	const u32 *addrp;
+	unsigned long intack = 0;
+
+	for_each_node_by_type(np, "interrupt-controller")
+		if (of_device_is_compatible(np, "chrp,iic")) {
+			found = np;
+			break;
+		}
+	if (found == NULL) {
+		printk(KERN_DEBUG "xics: no ISA interrupt controller\n");
+		return;
+	}
+	cascade = irq_of_parse_and_map(found, 0);
+	if (cascade == NO_IRQ) {
+		printk(KERN_ERR "xics: failed to map cascade interrupt");
+		return;
+	}
+	pr_debug("xics: cascade mapped to irq %d\n", cascade);
+
+	for (old = of_node_get(found); old != NULL ; old = np) {
+		np = of_get_parent(old);
+		of_node_put(old);
+		if (np == NULL)
+			break;
+		if (strcmp(np->name, "pci") != 0)
+			continue;
+		addrp = of_get_property(np, "8259-interrupt-acknowledge", NULL);
+		if (addrp == NULL)
+			continue;
+		naddr = of_n_addr_cells(np);
+		intack = addrp[naddr-1];
+		if (naddr > 1)
+			intack |= ((unsigned long)addrp[naddr-2]) << 32;
+	}
+	if (intack)
+		printk(KERN_DEBUG "xics: PCI 8259 intack at 0x%016lx\n", intack);
+	i8259_init(found, intack);
+	of_node_put(found);
+	set_irq_chained_handler(cascade, pseries_8259_cascade);
+}
+
 static void __init pseries_mpic_init_IRQ(void)
 {
 	struct device_node *np, *old, *cascade = NULL;
@@ -206,6 +251,12 @@ static void __init pseries_mpic_init_IRQ(void)
 	set_irq_chained_handler(cascade_irq, pseries_8259_cascade);
 }
 
+static void __init pseries_xics_init_IRQ(void)
+{
+	xics_init_IRQ();
+	xics_setup_8259_cascade();
+}
+
 static void pseries_lpar_enable_pmcs(void)
 {
 	unsigned long set, reset;
@@ -235,7 +286,7 @@ static void __init pseries_discover_pic(void)
 			smp_init_pseries_mpic();
 			return;
 		} else if (strstr(typep, "ppc-xicp")) {
-			ppc_md.init_IRQ       = xics_init_IRQ;
+			ppc_md.init_IRQ       = pseries_xics_init_IRQ;
 			setup_kexec_cpu_down_xics();
 			smp_init_pseries_xics();
 			return;
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index ca52b58..5a72f27 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -655,52 +655,6 @@ static void __init xics_init_one_node(struct device_node *np,
 	}
 }
 
-
-static void __init xics_setup_8259_cascade(void)
-{
-	struct device_node *np, *old, *found = NULL;
-	int cascade, naddr;
-	const u32 *addrp;
-	unsigned long intack = 0;
-
-	for_each_node_by_type(np, "interrupt-controller")
-		if (of_device_is_compatible(np, "chrp,iic")) {
-			found = np;
-			break;
-		}
-	if (found == NULL) {
-		printk(KERN_DEBUG "xics: no ISA interrupt controller\n");
-		return;
-	}
-	cascade = irq_of_parse_and_map(found, 0);
-	if (cascade == NO_IRQ) {
-		printk(KERN_ERR "xics: failed to map cascade interrupt");
-		return;
-	}
-	pr_debug("xics: cascade mapped to irq %d\n", cascade);
-
-	for (old = of_node_get(found); old != NULL ; old = np) {
-		np = of_get_parent(old);
-		of_node_put(old);
-		if (np == NULL)
-			break;
-		if (strcmp(np->name, "pci") != 0)
-			continue;
-		addrp = of_get_property(np, "8259-interrupt-acknowledge", NULL);
-		if (addrp == NULL)
-			continue;
-		naddr = of_n_addr_cells(np);
-		intack = addrp[naddr-1];
-		if (naddr > 1)
-			intack |= ((unsigned long)addrp[naddr-2]) << 32;
-	}
-	if (intack)
-		printk(KERN_DEBUG "xics: PCI 8259 intack at 0x%016lx\n", intack);
-	i8259_init(found, intack);
-	of_node_put(found);
-	set_irq_chained_handler(cascade, pseries_8259_cascade);
-}
-
 void __init xics_init_IRQ(void)
 {
 	struct device_node *np;
@@ -733,8 +687,6 @@ void __init xics_init_IRQ(void)
 
 	xics_setup_cpu();
 
-	xics_setup_8259_cascade();
-
 	ppc64_boot_msg(0x21, "XICS Done");
 }
 
diff --git a/arch/powerpc/platforms/pseries/xics.h b/arch/powerpc/platforms/pseries/xics.h
index c26bcff..1c5321a 100644
--- a/arch/powerpc/platforms/pseries/xics.h
+++ b/arch/powerpc/platforms/pseries/xics.h
@@ -28,7 +28,4 @@ struct xics_ipi_struct {
 
 extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;
 
-struct irq_desc;
-extern void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc);
-
 #endif /* _POWERPC_KERNEL_XICS_H */
-- 
1.5.2.rc1.1884.g59b20

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [RFC/PATCH 2/4] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade()
  2008-04-01  6:42 [RFC/PATCH 1/4] Move xics_setup_8259_cascade() into platforms/pseries/setup.c Michael Ellerman
@ 2008-04-01  6:42 ` Michael Ellerman
  2008-04-18  4:05   ` Benjamin Herrenschmidt
  2008-04-01  6:42 ` [RFC/PATCH 3/4] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ() Michael Ellerman
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Michael Ellerman @ 2008-04-01  6:42 UTC (permalink / raw)
  To: linuxppc-dev

Remove the xics references from xics_setup_8259_cascade(), and merge the
good bits from the almost identical logic in pseries_mpic_init_IRQ().

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/platforms/pseries/setup.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 43e4801..1e1faa1 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -127,28 +127,32 @@ void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc)
 	desc->chip->eoi(irq);
 }
 
-static void __init xics_setup_8259_cascade(void)
+static void __init pseries_setup_i8259_cascade(void)
 {
 	struct device_node *np, *old, *found = NULL;
-	int cascade, naddr;
+	unsigned int cascade;
 	const u32 *addrp;
 	unsigned long intack = 0;
+	int naddr;
 
-	for_each_node_by_type(np, "interrupt-controller")
+	for_each_node_by_type(np, "interrupt-controller") {
 		if (of_device_is_compatible(np, "chrp,iic")) {
 			found = np;
 			break;
 		}
+	}
+
 	if (found == NULL) {
-		printk(KERN_DEBUG "xics: no ISA interrupt controller\n");
+		printk(KERN_DEBUG "pic: no ISA interrupt controller\n");
 		return;
 	}
+
 	cascade = irq_of_parse_and_map(found, 0);
 	if (cascade == NO_IRQ) {
-		printk(KERN_ERR "xics: failed to map cascade interrupt");
+		printk(KERN_ERR "pic: failed to map cascade interrupt");
 		return;
 	}
-	pr_debug("xics: cascade mapped to irq %d\n", cascade);
+	pr_debug("pic: cascade mapped to irq %d\n", cascade);
 
 	for (old = of_node_get(found); old != NULL ; old = np) {
 		np = of_get_parent(old);
@@ -166,7 +170,7 @@ static void __init xics_setup_8259_cascade(void)
 			intack |= ((unsigned long)addrp[naddr-2]) << 32;
 	}
 	if (intack)
-		printk(KERN_DEBUG "xics: PCI 8259 intack at 0x%016lx\n", intack);
+		printk(KERN_DEBUG "pic: PCI 8259 intack at 0x%016lx\n", intack);
 	i8259_init(found, intack);
 	of_node_put(found);
 	set_irq_chained_handler(cascade, pseries_8259_cascade);
@@ -254,7 +258,7 @@ static void __init pseries_mpic_init_IRQ(void)
 static void __init pseries_xics_init_IRQ(void)
 {
 	xics_init_IRQ();
-	xics_setup_8259_cascade();
+	pseries_setup_i8259_cascade();
 }
 
 static void pseries_lpar_enable_pmcs(void)
-- 
1.5.2.rc1.1884.g59b20

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [RFC/PATCH 3/4] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ()
  2008-04-01  6:42 [RFC/PATCH 1/4] Move xics_setup_8259_cascade() into platforms/pseries/setup.c Michael Ellerman
  2008-04-01  6:42 ` [RFC/PATCH 2/4] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade() Michael Ellerman
@ 2008-04-01  6:42 ` Michael Ellerman
  2008-04-18  4:15   ` Benjamin Herrenschmidt
  2008-04-01  6:42 ` [RFC/PATCH 4/4] Simplify xics direct/lpar irq_host setup Michael Ellerman
  2008-04-18  3:59 ` [RFC/PATCH 1/4] Move xics_setup_8259_cascade() into platforms/pseries/setup.c Benjamin Herrenschmidt
  3 siblings, 1 reply; 9+ messages in thread
From: Michael Ellerman @ 2008-04-01  6:42 UTC (permalink / raw)
  To: linuxppc-dev

pseries_mpic_init_IRQ() implements the same logic as the xics code did to
find the i8259 cascade irq. Now that we've pulled that logic out into
pseries_setup_i8259_cascade() we can use it in the mpic code.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/platforms/pseries/setup.c |   43 +------------------------------
 1 files changed, 2 insertions(+), 41 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 1e1faa1..22c047c 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -178,12 +178,9 @@ static void __init pseries_setup_i8259_cascade(void)
 
 static void __init pseries_mpic_init_IRQ(void)
 {
-	struct device_node *np, *old, *cascade = NULL;
-        const unsigned int *addrp;
-	unsigned long intack = 0;
+	struct device_node *np;
 	const unsigned int *opprop;
 	unsigned long openpic_addr = 0;
-	unsigned int cascade_irq;
 	int naddr, n, i, opplen;
 	struct mpic *mpic;
 
@@ -216,43 +213,7 @@ static void __init pseries_mpic_init_IRQ(void)
 	mpic_init(mpic);
 
 	/* Look for cascade */
-	for_each_node_by_type(np, "interrupt-controller")
-		if (of_device_is_compatible(np, "chrp,iic")) {
-			cascade = np;
-			break;
-		}
-	if (cascade == NULL)
-		return;
-
-	cascade_irq = irq_of_parse_and_map(cascade, 0);
-	if (cascade_irq == NO_IRQ) {
-		printk(KERN_ERR "mpic: failed to map cascade interrupt");
-		return;
-	}
-
-	/* Check ACK type */
-	for (old = of_node_get(cascade); old != NULL ; old = np) {
-		np = of_get_parent(old);
-		of_node_put(old);
-		if (np == NULL)
-			break;
-		if (strcmp(np->name, "pci") != 0)
-			continue;
-		addrp = of_get_property(np, "8259-interrupt-acknowledge",
-					    NULL);
-		if (addrp == NULL)
-			continue;
-		naddr = of_n_addr_cells(np);
-		intack = addrp[naddr-1];
-		if (naddr > 1)
-			intack |= ((unsigned long)addrp[naddr-2]) << 32;
-	}
-	if (intack)
-		printk(KERN_DEBUG "mpic: PCI 8259 intack at 0x%016lx\n",
-		       intack);
-	i8259_init(cascade, intack);
-	of_node_put(cascade);
-	set_irq_chained_handler(cascade_irq, pseries_8259_cascade);
+	pseries_setup_i8259_cascade();
 }
 
 static void __init pseries_xics_init_IRQ(void)
-- 
1.5.2.rc1.1884.g59b20

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [RFC/PATCH 4/4] Simplify xics direct/lpar irq_host setup
  2008-04-01  6:42 [RFC/PATCH 1/4] Move xics_setup_8259_cascade() into platforms/pseries/setup.c Michael Ellerman
  2008-04-01  6:42 ` [RFC/PATCH 2/4] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade() Michael Ellerman
  2008-04-01  6:42 ` [RFC/PATCH 3/4] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ() Michael Ellerman
@ 2008-04-01  6:42 ` Michael Ellerman
  2008-04-18  4:16   ` Benjamin Herrenschmidt
  2008-04-18  3:59 ` [RFC/PATCH 1/4] Move xics_setup_8259_cascade() into platforms/pseries/setup.c Benjamin Herrenschmidt
  3 siblings, 1 reply; 9+ messages in thread
From: Michael Ellerman @ 2008-04-01  6:42 UTC (permalink / raw)
  To: linuxppc-dev

The xics code currently has a direct and lpar variant of xics_host_map, the
only difference being which irq_chip they use. If we remember which irq_chip
we're using we can combine these two routines. That also allows us to have a
single irq_host_ops instead of two.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/platforms/pseries/xics.c |   39 ++++++++++----------------------
 1 files changed, 12 insertions(+), 27 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index 5a72f27..2fd8088 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 = {
 	.set_affinity = xics_set_affinity
 };
 
+/* Points to the irq_chip we're actually using */
+static struct irq_chip *xics_irq_chip;
 
 static int xics_host_match(struct irq_host *h, struct device_node *node)
 {
@@ -526,23 +528,13 @@ static int xics_host_match(struct irq_host *h, struct device_node *node)
 	return !of_device_is_compatible(node, "chrp,iic");
 }
 
-static int xics_host_map_direct(struct irq_host *h, unsigned int virq,
-				irq_hw_number_t hw)
+static int xics_host_map(struct irq_host *h, unsigned int virq,
+			 irq_hw_number_t hw)
 {
-	pr_debug("xics: map_direct virq %d, hwirq 0x%lx\n", virq, hw);
+	pr_debug("xics: map virq %d, hwirq 0x%lx\n", virq, hw);
 
 	get_irq_desc(virq)->status |= IRQ_LEVEL;
-	set_irq_chip_and_handler(virq, &xics_pic_direct, handle_fasteoi_irq);
-	return 0;
-}
-
-static int xics_host_map_lpar(struct irq_host *h, unsigned int virq,
-			      irq_hw_number_t hw)
-{
-	pr_debug("xics: map_direct virq %d, hwirq 0x%lx\n", virq, hw);
-
-	get_irq_desc(virq)->status |= IRQ_LEVEL;
-	set_irq_chip_and_handler(virq, &xics_pic_lpar, handle_fasteoi_irq);
+	set_irq_chip_and_handler(virq, xics_irq_chip, handle_fasteoi_irq);
 	return 0;
 }
 
@@ -561,27 +553,20 @@ static int xics_host_xlate(struct irq_host *h, struct device_node *ct,
 	return 0;
 }
 
-static struct irq_host_ops xics_host_direct_ops = {
+static struct irq_host_ops xics_host_ops = {
 	.match = xics_host_match,
-	.map = xics_host_map_direct,
-	.xlate = xics_host_xlate,
-};
-
-static struct irq_host_ops xics_host_lpar_ops = {
-	.match = xics_host_match,
-	.map = xics_host_map_lpar,
+	.map = xics_host_map,
 	.xlate = xics_host_xlate,
 };
 
 static void __init xics_init_host(void)
 {
-	struct irq_host_ops *ops;
-
 	if (firmware_has_feature(FW_FEATURE_LPAR))
-		ops = &xics_host_lpar_ops;
+		xics_irq_chip = &xics_pic_lpar;
 	else
-		ops = &xics_host_direct_ops;
-	xics_host = irq_alloc_host(NULL, IRQ_HOST_MAP_TREE, 0, ops,
+		xics_irq_chip = &xics_pic_direct;
+
+	xics_host = irq_alloc_host(NULL, IRQ_HOST_MAP_TREE, 0, &xics_host_ops,
 				   XICS_IRQ_SPURIOUS);
 	BUG_ON(xics_host == NULL);
 	irq_set_default_host(xics_host);
-- 
1.5.2.rc1.1884.g59b20

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [RFC/PATCH 1/4] Move xics_setup_8259_cascade() into platforms/pseries/setup.c
  2008-04-01  6:42 [RFC/PATCH 1/4] Move xics_setup_8259_cascade() into platforms/pseries/setup.c Michael Ellerman
                   ` (2 preceding siblings ...)
  2008-04-01  6:42 ` [RFC/PATCH 4/4] Simplify xics direct/lpar irq_host setup Michael Ellerman
@ 2008-04-18  3:59 ` Benjamin Herrenschmidt
  3 siblings, 0 replies; 9+ messages in thread
From: Benjamin Herrenschmidt @ 2008-04-18  3:59 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev


On Tue, 2008-04-01 at 17:42 +1100, Michael Ellerman wrote:
> The code in xics.c to setup the i8259 cascaded irq handler is not really
> xics specific, so move it into setup.c - we will clean this up further in
> a subsequent patch.
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> ---
>  arch/powerpc/platforms/pseries/setup.c |   53 +++++++++++++++++++++++++++++++-
>  arch/powerpc/platforms/pseries/xics.c  |   48 -----------------------------
>  arch/powerpc/platforms/pseries/xics.h  |    3 --
>  3 files changed, 52 insertions(+), 52 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
> index fdb9b1c..43e4801 100644
> --- a/arch/powerpc/platforms/pseries/setup.c
> +++ b/arch/powerpc/platforms/pseries/setup.c
> @@ -127,6 +127,51 @@ void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc)
>  	desc->chip->eoi(irq);
>  }
>  
> +static void __init xics_setup_8259_cascade(void)
> +{
> +	struct device_node *np, *old, *found = NULL;
> +	int cascade, naddr;
> +	const u32 *addrp;
> +	unsigned long intack = 0;
> +
> +	for_each_node_by_type(np, "interrupt-controller")
> +		if (of_device_is_compatible(np, "chrp,iic")) {
> +			found = np;
> +			break;
> +		}
> +	if (found == NULL) {
> +		printk(KERN_DEBUG "xics: no ISA interrupt controller\n");
> +		return;
> +	}
> +	cascade = irq_of_parse_and_map(found, 0);
> +	if (cascade == NO_IRQ) {
> +		printk(KERN_ERR "xics: failed to map cascade interrupt");
> +		return;
> +	}
> +	pr_debug("xics: cascade mapped to irq %d\n", cascade);
> +
> +	for (old = of_node_get(found); old != NULL ; old = np) {
> +		np = of_get_parent(old);
> +		of_node_put(old);
> +		if (np == NULL)
> +			break;
> +		if (strcmp(np->name, "pci") != 0)
> +			continue;
> +		addrp = of_get_property(np, "8259-interrupt-acknowledge", NULL);
> +		if (addrp == NULL)
> +			continue;
> +		naddr = of_n_addr_cells(np);
> +		intack = addrp[naddr-1];
> +		if (naddr > 1)
> +			intack |= ((unsigned long)addrp[naddr-2]) << 32;
> +	}
> +	if (intack)
> +		printk(KERN_DEBUG "xics: PCI 8259 intack at 0x%016lx\n", intack);
> +	i8259_init(found, intack);
> +	of_node_put(found);
> +	set_irq_chained_handler(cascade, pseries_8259_cascade);
> +}
> +
>  static void __init pseries_mpic_init_IRQ(void)
>  {
>  	struct device_node *np, *old, *cascade = NULL;
> @@ -206,6 +251,12 @@ static void __init pseries_mpic_init_IRQ(void)
>  	set_irq_chained_handler(cascade_irq, pseries_8259_cascade);
>  }
>  
> +static void __init pseries_xics_init_IRQ(void)
> +{
> +	xics_init_IRQ();
> +	xics_setup_8259_cascade();
> +}
> +
>  static void pseries_lpar_enable_pmcs(void)
>  {
>  	unsigned long set, reset;
> @@ -235,7 +286,7 @@ static void __init pseries_discover_pic(void)
>  			smp_init_pseries_mpic();
>  			return;
>  		} else if (strstr(typep, "ppc-xicp")) {
> -			ppc_md.init_IRQ       = xics_init_IRQ;
> +			ppc_md.init_IRQ       = pseries_xics_init_IRQ;
>  			setup_kexec_cpu_down_xics();
>  			smp_init_pseries_xics();
>  			return;
> diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
> index ca52b58..5a72f27 100644
> --- a/arch/powerpc/platforms/pseries/xics.c
> +++ b/arch/powerpc/platforms/pseries/xics.c
> @@ -655,52 +655,6 @@ static void __init xics_init_one_node(struct device_node *np,
>  	}
>  }
>  
> -
> -static void __init xics_setup_8259_cascade(void)
> -{
> -	struct device_node *np, *old, *found = NULL;
> -	int cascade, naddr;
> -	const u32 *addrp;
> -	unsigned long intack = 0;
> -
> -	for_each_node_by_type(np, "interrupt-controller")
> -		if (of_device_is_compatible(np, "chrp,iic")) {
> -			found = np;
> -			break;
> -		}
> -	if (found == NULL) {
> -		printk(KERN_DEBUG "xics: no ISA interrupt controller\n");
> -		return;
> -	}
> -	cascade = irq_of_parse_and_map(found, 0);
> -	if (cascade == NO_IRQ) {
> -		printk(KERN_ERR "xics: failed to map cascade interrupt");
> -		return;
> -	}
> -	pr_debug("xics: cascade mapped to irq %d\n", cascade);
> -
> -	for (old = of_node_get(found); old != NULL ; old = np) {
> -		np = of_get_parent(old);
> -		of_node_put(old);
> -		if (np == NULL)
> -			break;
> -		if (strcmp(np->name, "pci") != 0)
> -			continue;
> -		addrp = of_get_property(np, "8259-interrupt-acknowledge", NULL);
> -		if (addrp == NULL)
> -			continue;
> -		naddr = of_n_addr_cells(np);
> -		intack = addrp[naddr-1];
> -		if (naddr > 1)
> -			intack |= ((unsigned long)addrp[naddr-2]) << 32;
> -	}
> -	if (intack)
> -		printk(KERN_DEBUG "xics: PCI 8259 intack at 0x%016lx\n", intack);
> -	i8259_init(found, intack);
> -	of_node_put(found);
> -	set_irq_chained_handler(cascade, pseries_8259_cascade);
> -}
> -
>  void __init xics_init_IRQ(void)
>  {
>  	struct device_node *np;
> @@ -733,8 +687,6 @@ void __init xics_init_IRQ(void)
>  
>  	xics_setup_cpu();
>  
> -	xics_setup_8259_cascade();
> -
>  	ppc64_boot_msg(0x21, "XICS Done");
>  }
>  
> diff --git a/arch/powerpc/platforms/pseries/xics.h b/arch/powerpc/platforms/pseries/xics.h
> index c26bcff..1c5321a 100644
> --- a/arch/powerpc/platforms/pseries/xics.h
> +++ b/arch/powerpc/platforms/pseries/xics.h
> @@ -28,7 +28,4 @@ struct xics_ipi_struct {
>  
>  extern struct xics_ipi_struct xics_ipi_message[NR_CPUS] __cacheline_aligned;
>  
> -struct irq_desc;
> -extern void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc);
> -
>  #endif /* _POWERPC_KERNEL_XICS_H */

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC/PATCH 2/4] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade()
  2008-04-01  6:42 ` [RFC/PATCH 2/4] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade() Michael Ellerman
@ 2008-04-18  4:05   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 9+ messages in thread
From: Benjamin Herrenschmidt @ 2008-04-18  4:05 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev


On Tue, 2008-04-01 at 17:42 +1100, Michael Ellerman wrote:
> Remove the xics references from xics_setup_8259_cascade(), and merge the
> good bits from the almost identical logic in pseries_mpic_init_IRQ().
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> ---
>  arch/powerpc/platforms/pseries/setup.c |   20 ++++++++++++--------
>  1 files changed, 12 insertions(+), 8 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
> index 43e4801..1e1faa1 100644
> --- a/arch/powerpc/platforms/pseries/setup.c
> +++ b/arch/powerpc/platforms/pseries/setup.c
> @@ -127,28 +127,32 @@ void pseries_8259_cascade(unsigned int irq, struct irq_desc *desc)
>  	desc->chip->eoi(irq);
>  }
>  
> -static void __init xics_setup_8259_cascade(void)
> +static void __init pseries_setup_i8259_cascade(void)
>  {
>  	struct device_node *np, *old, *found = NULL;
> -	int cascade, naddr;
> +	unsigned int cascade;
>  	const u32 *addrp;
>  	unsigned long intack = 0;
> +	int naddr;
>  
> -	for_each_node_by_type(np, "interrupt-controller")
> +	for_each_node_by_type(np, "interrupt-controller") {
>  		if (of_device_is_compatible(np, "chrp,iic")) {
>  			found = np;
>  			break;
>  		}
> +	}
> +
>  	if (found == NULL) {
> -		printk(KERN_DEBUG "xics: no ISA interrupt controller\n");
> +		printk(KERN_DEBUG "pic: no ISA interrupt controller\n");
>  		return;
>  	}
> +
>  	cascade = irq_of_parse_and_map(found, 0);
>  	if (cascade == NO_IRQ) {
> -		printk(KERN_ERR "xics: failed to map cascade interrupt");
> +		printk(KERN_ERR "pic: failed to map cascade interrupt");
>  		return;
>  	}
> -	pr_debug("xics: cascade mapped to irq %d\n", cascade);
> +	pr_debug("pic: cascade mapped to irq %d\n", cascade);
>  
>  	for (old = of_node_get(found); old != NULL ; old = np) {
>  		np = of_get_parent(old);
> @@ -166,7 +170,7 @@ static void __init xics_setup_8259_cascade(void)
>  			intack |= ((unsigned long)addrp[naddr-2]) << 32;
>  	}
>  	if (intack)
> -		printk(KERN_DEBUG "xics: PCI 8259 intack at 0x%016lx\n", intack);
> +		printk(KERN_DEBUG "pic: PCI 8259 intack at 0x%016lx\n", intack);
>  	i8259_init(found, intack);
>  	of_node_put(found);
>  	set_irq_chained_handler(cascade, pseries_8259_cascade);
> @@ -254,7 +258,7 @@ static void __init pseries_mpic_init_IRQ(void)
>  static void __init pseries_xics_init_IRQ(void)
>  {
>  	xics_init_IRQ();
> -	xics_setup_8259_cascade();
> +	pseries_setup_i8259_cascade();
>  }
>  
>  static void pseries_lpar_enable_pmcs(void)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC/PATCH 3/4] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ()
  2008-04-01  6:42 ` [RFC/PATCH 3/4] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ() Michael Ellerman
@ 2008-04-18  4:15   ` Benjamin Herrenschmidt
  2008-04-18  4:47     ` Michael Ellerman
  0 siblings, 1 reply; 9+ messages in thread
From: Benjamin Herrenschmidt @ 2008-04-18  4:15 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev


On Tue, 2008-04-01 at 17:42 +1100, Michael Ellerman wrote:
> pseries_mpic_init_IRQ() implements the same logic as the xics code did to
> find the i8259 cascade irq. Now that we've pulled that logic out into
> pseries_setup_i8259_cascade() we can use it in the mpic code.
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

(provided you test it and it works :-)

Ben.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC/PATCH 4/4] Simplify xics direct/lpar irq_host setup
  2008-04-01  6:42 ` [RFC/PATCH 4/4] Simplify xics direct/lpar irq_host setup Michael Ellerman
@ 2008-04-18  4:16   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 9+ messages in thread
From: Benjamin Herrenschmidt @ 2008-04-18  4:16 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev


On Tue, 2008-04-01 at 17:42 +1100, Michael Ellerman wrote:
> The xics code currently has a direct and lpar variant of xics_host_map, the
> only difference being which irq_chip they use. If we remember which irq_chip
> we're using we can combine these two routines. That also allows us to have a
> single irq_host_ops instead of two.
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> ---

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [RFC/PATCH 3/4] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ()
  2008-04-18  4:15   ` Benjamin Herrenschmidt
@ 2008-04-18  4:47     ` Michael Ellerman
  0 siblings, 0 replies; 9+ messages in thread
From: Michael Ellerman @ 2008-04-18  4:47 UTC (permalink / raw)
  To: benh; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 918 bytes --]

On Fri, 2008-04-18 at 14:15 +1000, Benjamin Herrenschmidt wrote:
> On Tue, 2008-04-01 at 17:42 +1100, Michael Ellerman wrote:
> > pseries_mpic_init_IRQ() implements the same logic as the xics code did to
> > find the i8259 cascade irq. Now that we've pulled that logic out into
> > pseries_setup_i8259_cascade() we can use it in the mpic code.
> > 
> > Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> 
> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> 
> (provided you test it and it works :-)

Done. Booted on a Power something (5 or 6) partion and also booted fine
on bongohits, an old power 3 machine with an MPIC.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-04-18  4:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-01  6:42 [RFC/PATCH 1/4] Move xics_setup_8259_cascade() into platforms/pseries/setup.c Michael Ellerman
2008-04-01  6:42 ` [RFC/PATCH 2/4] Turn xics_setup_8259_cascade() into a generic pseries_setup_i8259_cascade() Michael Ellerman
2008-04-18  4:05   ` Benjamin Herrenschmidt
2008-04-01  6:42 ` [RFC/PATCH 3/4] Use pseries_setup_i8259_cascade() in pseries_mpic_init_IRQ() Michael Ellerman
2008-04-18  4:15   ` Benjamin Herrenschmidt
2008-04-18  4:47     ` Michael Ellerman
2008-04-01  6:42 ` [RFC/PATCH 4/4] Simplify xics direct/lpar irq_host setup Michael Ellerman
2008-04-18  4:16   ` Benjamin Herrenschmidt
2008-04-18  3:59 ` [RFC/PATCH 1/4] Move xics_setup_8259_cascade() into platforms/pseries/setup.c Benjamin Herrenschmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).