* [PATCH 1/3] irqchip/gic: fix ARM11MPCore GIC bindings
@ 2015-10-23 22:15 Linus Walleij
2015-10-23 22:15 ` [PATCH 2/3] irqchip/gic: support RealView variant setup Linus Walleij
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Linus Walleij @ 2015-10-23 22:15 UTC (permalink / raw)
To: Thomas Gleixner, Jason Cooper, Marc Zyngier
Cc: linux-kernel, Linus Walleij, devicetree
The GIC bindings for the ARM11MPCore need to differentiate between
the GIC on the Test Chip and the one on the evaluation baseboard.
Split the binding in two and define new compatible-strings.
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: devicetree@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Make this a pure devicetree bindings patch.
- Keep the old binding arm,arm11mp-gic for the "normal" GIC on
the PB11MPCore as it is probably similar to other ARM11MPCore
systems.
- Broke out this irqchip stuff from the rest of the series so as
not to stress the irqchip maintainers. It has no dependencies
on the other patches anyways, and can be merged stand-alone.
---
Documentation/devicetree/bindings/arm/gic.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/arm/gic.txt b/Documentation/devicetree/bindings/arm/gic.txt
index 2da059a4790c..0ffa69755d5e 100644
--- a/Documentation/devicetree/bindings/arm/gic.txt
+++ b/Documentation/devicetree/bindings/arm/gic.txt
@@ -16,6 +16,7 @@ Main node required properties:
"arm,cortex-a9-gic"
"arm,cortex-a7-gic"
"arm,arm11mp-gic"
+ "arm,tc11mp-gic"
"brcm,brahma-b15-gic"
"arm,arm1176jzf-devchip-gic"
"qcom,msm-8660-qgic"
--
2.4.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] irqchip/gic: support RealView variant setup
2015-10-23 22:15 [PATCH 1/3] irqchip/gic: fix ARM11MPCore GIC bindings Linus Walleij
@ 2015-10-23 22:15 ` Linus Walleij
2015-12-09 14:04 ` Marc Zyngier
2015-10-23 22:15 ` [PATCH 3/3] irqchip/gic: assign irqchip dynamically Linus Walleij
2015-11-16 17:39 ` [PATCH 1/3] irqchip/gic: fix ARM11MPCore GIC bindings Rob Herring
2 siblings, 1 reply; 8+ messages in thread
From: Linus Walleij @ 2015-10-23 22:15 UTC (permalink / raw)
To: Thomas Gleixner, Jason Cooper, Marc Zyngier; +Cc: linux-kernel, Linus Walleij
The ARM RealView PB11MPCore reference design has some special
bits in a system controller register to set up the GIC in one
of three modes: legacy, new with DCC, new without DCC. The
register is also used to enable FIQ.
Since the platform will not boot unless this register is set
up to "new with DCC" mode, we need a special quirk to be
compiled-in for the RealView platforms.
If we find the right compatible string on the GIC TestChip,
we enable this quirk by looking up the system controller and
enabling the special bits.
We depend on the CONFIG_REALVIEW_DT Kconfig symbol as the old
boardfile code has the same fix hardcoded, and this is only
needed for the attempts to modernize the RealView code using
device tree.
After fixing this, the PB11MPCore boots with device tree
only.
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Put the IRQCHIP_DECLARE() in the add-on irq-gic-realview.c file
and have it call down to gic_of_init() after its special
initialization
- Created irq-gic.h to export functions inside irq-gic.c. Part of
me wanted to use irq-gic-common.h so as not to proliferate the
header files, but I felt it was encapsulating the functions in
irq-gic-common.c so it seemed dirty, better to give irq-gic.c
its own header file.
- Broke out this irqchip stuff from the rest of the series so as
not to stress the irqchip maintainers. It has no dependencies
on the other patches anyways, and can be merged stand-alone.
---
drivers/irqchip/Makefile | 1 +
drivers/irqchip/irq-gic-realview.c | 43 ++++++++++++++++++++++++++++++++++++++
drivers/irqchip/irq-gic.c | 3 ++-
drivers/irqchip/irq-gic.h | 7 +++++++
4 files changed, 53 insertions(+), 1 deletion(-)
create mode 100644 drivers/irqchip/irq-gic-realview.c
create mode 100644 drivers/irqchip/irq-gic.h
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index bb3048f00e64..7a7d4182777d 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -21,6 +21,7 @@ obj-$(CONFIG_ARCH_SUNXI) += irq-sun4i.o
obj-$(CONFIG_ARCH_SUNXI) += irq-sunxi-nmi.o
obj-$(CONFIG_ARCH_SPEAR3XX) += spear-shirq.o
obj-$(CONFIG_ARM_GIC) += irq-gic.o irq-gic-common.o
+obj-$(CONFIG_REALVIEW_DT) += irq-gic-realview.o
obj-$(CONFIG_ARM_GIC_V2M) += irq-gic-v2m.o
obj-$(CONFIG_ARM_GIC_V3) += irq-gic-v3.o irq-gic-common.o
obj-$(CONFIG_ARM_GIC_V3_ITS) += irq-gic-v3-its.o irq-gic-v3-its-pci-msi.o irq-gic-v3-its-platform-msi.o
diff --git a/drivers/irqchip/irq-gic-realview.c b/drivers/irqchip/irq-gic-realview.c
new file mode 100644
index 000000000000..bb5583c07667
--- /dev/null
+++ b/drivers/irqchip/irq-gic-realview.c
@@ -0,0 +1,43 @@
+/*
+ * Special GIC quirks for the ARM RealView
+ * Copyright (C) 2015 Linus Walleij
+ */
+#include <linux/of.h>
+#include <linux/regmap.h>
+#include <linux/mfd/syscon.h>
+#include <linux/bitops.h>
+#include <linux/irqchip.h>
+
+#include "irq-gic.h"
+
+#define REALVIEW_SYS_LOCK_OFFSET 0x20
+#define REALVIEW_PB11MP_SYS_PLD_CTRL1 0x74
+#define VERSATILE_LOCK_VAL 0xA05F
+#define PLD_INTMODE_MASK BIT(22)|BIT(23)|BIT(24)
+#define PLD_INTMODE_LEGACY 0x0
+#define PLD_INTMODE_NEW_DCC BIT(22)
+#define PLD_INTMODE_NEW_NO_DCC BIT(23)
+#define PLD_INTMODE_FIQ_ENABLE BIT(24)
+
+static int __init
+realview_gic_of_init(struct device_node *node, struct device_node *parent)
+{
+ static struct regmap *map;
+
+ /* The PB11MPCore GIC needs to be configured in the syscon */
+ map = syscon_regmap_lookup_by_compatible("arm,realview-pb11mp-syscon");
+ if (!IS_ERR(map)) {
+ /* new irq mode with no DCC */
+ regmap_write(map, REALVIEW_SYS_LOCK_OFFSET,
+ VERSATILE_LOCK_VAL);
+ regmap_update_bits(map, REALVIEW_PB11MP_SYS_PLD_CTRL1,
+ PLD_INTMODE_NEW_NO_DCC,
+ PLD_INTMODE_MASK);
+ regmap_write(map, REALVIEW_SYS_LOCK_OFFSET, 0x0000);
+ pr_info("TC11MP GIC: set up interrupt controller to NEW mode, no DCC\n");
+ } else {
+ pr_err("TC11MP GIC setup: could not find syscon\n");
+ }
+ return gic_of_init(node, parent);
+}
+IRQCHIP_DECLARE(armtc11mp_gic, "arm,tc11mp-gic", realview_gic_of_init);
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 982c09c2d791..9ec8cf5137d9 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -50,6 +50,7 @@
#include <asm/virt.h>
#include "irq-gic-common.h"
+#include "irq-gic.h"
union gic_base {
void __iomem *common_base;
@@ -1141,7 +1142,7 @@ static bool gic_check_eoimode(struct device_node *node, void __iomem **base)
return true;
}
-static int __init
+int __init
gic_of_init(struct device_node *node, struct device_node *parent)
{
void __iomem *cpu_base;
diff --git a/drivers/irqchip/irq-gic.h b/drivers/irqchip/irq-gic.h
new file mode 100644
index 000000000000..3c45a540c235
--- /dev/null
+++ b/drivers/irqchip/irq-gic.h
@@ -0,0 +1,7 @@
+#include <linux/of.h>
+
+/*
+ * Subdrivers that need some preparatory work can initialize their
+ * chips and call this to register their GICs.
+ */
+int gic_of_init(struct device_node *node, struct device_node *parent);
--
2.4.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] irqchip/gic: assign irqchip dynamically
2015-10-23 22:15 [PATCH 1/3] irqchip/gic: fix ARM11MPCore GIC bindings Linus Walleij
2015-10-23 22:15 ` [PATCH 2/3] irqchip/gic: support RealView variant setup Linus Walleij
@ 2015-10-23 22:15 ` Linus Walleij
2015-12-09 14:15 ` Marc Zyngier
2015-11-16 17:39 ` [PATCH 1/3] irqchip/gic: fix ARM11MPCore GIC bindings Rob Herring
2 siblings, 1 reply; 8+ messages in thread
From: Linus Walleij @ 2015-10-23 22:15 UTC (permalink / raw)
To: Thomas Gleixner, Jason Cooper, Marc Zyngier; +Cc: linux-kernel, Linus Walleij
Instead of having the irqchip being a static struct, make it part
of the per-instance data so we can assign it a dynamic name. This
has the usable side effect of displaying the GIC with an instance
number as GIC0, GIC1 ... GICn in /proc/interrupts, which is helpful
when debugging cascaded GICs, such as on the ARM PB11MPCore.
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v1->v2:
- Keep the static structs around, just delete the .name
field assign them to the chips at registration time, updating
the name field with the instance number.
- Also enumerate the EOIMODE1 sub-chips.
- Broke out this irqchip stuff from the rest of the series so as
not to stress the irqchip maintainers. It has no dependencies
on the other patches anyways, and can be merged stand-alone.
Marc: can't test the EOIMODE1 thing, it's far above me, but it
"should work". Is it correct that there is one unique and coupled
EOIMODE1 instance per GIC instance like this?
---
drivers/irqchip/irq-gic.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 9ec8cf5137d9..fe87ac32fdbe 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -58,6 +58,8 @@ union gic_base {
};
struct gic_chip_data {
+ struct irq_chip chip;
+ struct irq_chip eoimode1_chip;
union gic_base dist_base;
union gic_base cpu_base;
#ifdef CONFIG_CPU_PM
@@ -370,7 +372,6 @@ static void gic_handle_cascade_irq(struct irq_desc *desc)
}
static struct irq_chip gic_chip = {
- .name = "GIC",
.irq_mask = gic_mask_irq,
.irq_unmask = gic_unmask_irq,
.irq_eoi = gic_eoi_irq,
@@ -386,7 +387,6 @@ static struct irq_chip gic_chip = {
};
static struct irq_chip gic_eoimode1_chip = {
- .name = "GICv2",
.irq_mask = gic_eoimode1_mask_irq,
.irq_unmask = gic_unmask_irq,
.irq_eoi = gic_eoimode1_eoi_irq,
@@ -880,11 +880,12 @@ void __init gic_init_physaddr(struct device_node *node)
static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
irq_hw_number_t hw)
{
- struct irq_chip *chip = &gic_chip;
+ struct gic_chip_data *gic = d->host_data;
+ struct irq_chip *chip = &gic->chip;
if (static_key_true(&supports_deactivate)) {
if (d->host_data == (void *)&gic_data[0])
- chip = &gic_eoimode1_chip;
+ chip = &gic->eoimode1_chip;
}
if (hw < 32) {
@@ -989,6 +990,13 @@ static void __init __gic_init_bases(unsigned int gic_nr, int irq_start,
BUG_ON(gic_nr >= MAX_GIC_NR);
gic = &gic_data[gic_nr];
+
+ /* Initialize irq_chip */
+ gic->chip = gic_chip;
+ gic->eoimode1_chip = gic_eoimode1_chip;
+ gic->chip.name = kasprintf(GFP_KERNEL, "GIC%d", gic_nr);
+ gic->eoimode1_chip.name = kasprintf(GFP_KERNEL, "GICv2%d", gic_nr);
+
#ifdef CONFIG_GIC_NON_BANKED
if (percpu_offset) { /* Frankein-GIC without banked registers... */
unsigned int cpu;
--
2.4.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] irqchip/gic: fix ARM11MPCore GIC bindings
2015-10-23 22:15 [PATCH 1/3] irqchip/gic: fix ARM11MPCore GIC bindings Linus Walleij
2015-10-23 22:15 ` [PATCH 2/3] irqchip/gic: support RealView variant setup Linus Walleij
2015-10-23 22:15 ` [PATCH 3/3] irqchip/gic: assign irqchip dynamically Linus Walleij
@ 2015-11-16 17:39 ` Rob Herring
2 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2015-11-16 17:39 UTC (permalink / raw)
To: Linus Walleij
Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, linux-kernel,
devicetree
On Sat, Oct 24, 2015 at 12:15:51AM +0200, Linus Walleij wrote:
> The GIC bindings for the ARM11MPCore need to differentiate between
> the GIC on the Test Chip and the one on the evaluation baseboard.
> Split the binding in two and define new compatible-strings.
>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Cc: devicetree@vger.kernel.org
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Rob Herring <robh@kernel.org>
> ---
> ChangeLog v1->v2:
> - Make this a pure devicetree bindings patch.
> - Keep the old binding arm,arm11mp-gic for the "normal" GIC on
> the PB11MPCore as it is probably similar to other ARM11MPCore
> systems.
> - Broke out this irqchip stuff from the rest of the series so as
> not to stress the irqchip maintainers. It has no dependencies
> on the other patches anyways, and can be merged stand-alone.
> ---
> Documentation/devicetree/bindings/arm/gic.txt | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/arm/gic.txt b/Documentation/devicetree/bindings/arm/gic.txt
> index 2da059a4790c..0ffa69755d5e 100644
> --- a/Documentation/devicetree/bindings/arm/gic.txt
> +++ b/Documentation/devicetree/bindings/arm/gic.txt
> @@ -16,6 +16,7 @@ Main node required properties:
> "arm,cortex-a9-gic"
> "arm,cortex-a7-gic"
> "arm,arm11mp-gic"
> + "arm,tc11mp-gic"
> "brcm,brahma-b15-gic"
> "arm,arm1176jzf-devchip-gic"
> "qcom,msm-8660-qgic"
> --
> 2.4.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] irqchip/gic: support RealView variant setup
2015-10-23 22:15 ` [PATCH 2/3] irqchip/gic: support RealView variant setup Linus Walleij
@ 2015-12-09 14:04 ` Marc Zyngier
2015-12-10 18:33 ` Linus Walleij
0 siblings, 1 reply; 8+ messages in thread
From: Marc Zyngier @ 2015-12-09 14:04 UTC (permalink / raw)
To: Linus Walleij, Thomas Gleixner, Jason Cooper; +Cc: linux-kernel
Hi Linus,
On 23/10/15 23:15, Linus Walleij wrote:
> The ARM RealView PB11MPCore reference design has some special
> bits in a system controller register to set up the GIC in one
> of three modes: legacy, new with DCC, new without DCC. The
> register is also used to enable FIQ.
>
> Since the platform will not boot unless this register is set
> up to "new with DCC" mode, we need a special quirk to be
> compiled-in for the RealView platforms.
>
> If we find the right compatible string on the GIC TestChip,
> we enable this quirk by looking up the system controller and
> enabling the special bits.
>
> We depend on the CONFIG_REALVIEW_DT Kconfig symbol as the old
> boardfile code has the same fix hardcoded, and this is only
> needed for the attempts to modernize the RealView code using
> device tree.
>
> After fixing this, the PB11MPCore boots with device tree
> only.
>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v1->v2:
> - Put the IRQCHIP_DECLARE() in the add-on irq-gic-realview.c file
> and have it call down to gic_of_init() after its special
> initialization
> - Created irq-gic.h to export functions inside irq-gic.c. Part of
> me wanted to use irq-gic-common.h so as not to proliferate the
> header files, but I felt it was encapsulating the functions in
> irq-gic-common.c so it seemed dirty, better to give irq-gic.c
> its own header file.
> - Broke out this irqchip stuff from the rest of the series so as
> not to stress the irqchip maintainers. It has no dependencies
> on the other patches anyways, and can be merged stand-alone.
> ---
> drivers/irqchip/Makefile | 1 +
> drivers/irqchip/irq-gic-realview.c | 43 ++++++++++++++++++++++++++++++++++++++
> drivers/irqchip/irq-gic.c | 3 ++-
> drivers/irqchip/irq-gic.h | 7 +++++++
> 4 files changed, 53 insertions(+), 1 deletion(-)
> create mode 100644 drivers/irqchip/irq-gic-realview.c
> create mode 100644 drivers/irqchip/irq-gic.h
>
> diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
> index bb3048f00e64..7a7d4182777d 100644
> --- a/drivers/irqchip/Makefile
> +++ b/drivers/irqchip/Makefile
> @@ -21,6 +21,7 @@ obj-$(CONFIG_ARCH_SUNXI) += irq-sun4i.o
> obj-$(CONFIG_ARCH_SUNXI) += irq-sunxi-nmi.o
> obj-$(CONFIG_ARCH_SPEAR3XX) += spear-shirq.o
> obj-$(CONFIG_ARM_GIC) += irq-gic.o irq-gic-common.o
> +obj-$(CONFIG_REALVIEW_DT) += irq-gic-realview.o
> obj-$(CONFIG_ARM_GIC_V2M) += irq-gic-v2m.o
> obj-$(CONFIG_ARM_GIC_V3) += irq-gic-v3.o irq-gic-common.o
> obj-$(CONFIG_ARM_GIC_V3_ITS) += irq-gic-v3-its.o irq-gic-v3-its-pci-msi.o irq-gic-v3-its-platform-msi.o
> diff --git a/drivers/irqchip/irq-gic-realview.c b/drivers/irqchip/irq-gic-realview.c
> new file mode 100644
> index 000000000000..bb5583c07667
> --- /dev/null
> +++ b/drivers/irqchip/irq-gic-realview.c
> @@ -0,0 +1,43 @@
> +/*
> + * Special GIC quirks for the ARM RealView
> + * Copyright (C) 2015 Linus Walleij
> + */
> +#include <linux/of.h>
> +#include <linux/regmap.h>
> +#include <linux/mfd/syscon.h>
> +#include <linux/bitops.h>
> +#include <linux/irqchip.h>
> +
> +#include "irq-gic.h"
> +
> +#define REALVIEW_SYS_LOCK_OFFSET 0x20
> +#define REALVIEW_PB11MP_SYS_PLD_CTRL1 0x74
> +#define VERSATILE_LOCK_VAL 0xA05F
> +#define PLD_INTMODE_MASK BIT(22)|BIT(23)|BIT(24)
> +#define PLD_INTMODE_LEGACY 0x0
> +#define PLD_INTMODE_NEW_DCC BIT(22)
> +#define PLD_INTMODE_NEW_NO_DCC BIT(23)
> +#define PLD_INTMODE_FIQ_ENABLE BIT(24)
> +
> +static int __init
> +realview_gic_of_init(struct device_node *node, struct device_node *parent)
> +{
> + static struct regmap *map;
> +
> + /* The PB11MPCore GIC needs to be configured in the syscon */
> + map = syscon_regmap_lookup_by_compatible("arm,realview-pb11mp-syscon");
> + if (!IS_ERR(map)) {
> + /* new irq mode with no DCC */
> + regmap_write(map, REALVIEW_SYS_LOCK_OFFSET,
> + VERSATILE_LOCK_VAL);
> + regmap_update_bits(map, REALVIEW_PB11MP_SYS_PLD_CTRL1,
> + PLD_INTMODE_NEW_NO_DCC,
> + PLD_INTMODE_MASK);
> + regmap_write(map, REALVIEW_SYS_LOCK_OFFSET, 0x0000);
> + pr_info("TC11MP GIC: set up interrupt controller to NEW mode, no DCC\n");
> + } else {
> + pr_err("TC11MP GIC setup: could not find syscon\n");
At this point, you probably want to error out, because the GIC is
probably not usable.
> + }
> + return gic_of_init(node, parent);
> +}
> +IRQCHIP_DECLARE(armtc11mp_gic, "arm,tc11mp-gic", realview_gic_of_init);
> diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
> index 982c09c2d791..9ec8cf5137d9 100644
> --- a/drivers/irqchip/irq-gic.c
> +++ b/drivers/irqchip/irq-gic.c
> @@ -50,6 +50,7 @@
> #include <asm/virt.h>
>
> #include "irq-gic-common.h"
> +#include "irq-gic.h"
>
> union gic_base {
> void __iomem *common_base;
> @@ -1141,7 +1142,7 @@ static bool gic_check_eoimode(struct device_node *node, void __iomem **base)
> return true;
> }
>
> -static int __init
> +int __init
> gic_of_init(struct device_node *node, struct device_node *parent)
> {
> void __iomem *cpu_base;
> diff --git a/drivers/irqchip/irq-gic.h b/drivers/irqchip/irq-gic.h
> new file mode 100644
> index 000000000000..3c45a540c235
> --- /dev/null
> +++ b/drivers/irqchip/irq-gic.h
> @@ -0,0 +1,7 @@
> +#include <linux/of.h>
> +
> +/*
> + * Subdrivers that need some preparatory work can initialize their
> + * chips and call this to register their GICs.
> + */
> +int gic_of_init(struct device_node *node, struct device_node *parent);
>
I'm not exactly fond of yet another include file, and I rather put this
in include/irqchip/arm-gic.h (where this was until I recently removed
it).
How about the following (untested) patch on top of yours:
diff --git a/drivers/irqchip/irq-gic-realview.c b/drivers/irqchip/irq-gic-realview.c
index bb5583c..aa46eb2 100644
--- a/drivers/irqchip/irq-gic-realview.c
+++ b/drivers/irqchip/irq-gic-realview.c
@@ -7,8 +7,7 @@
#include <linux/mfd/syscon.h>
#include <linux/bitops.h>
#include <linux/irqchip.h>
-
-#include "irq-gic.h"
+#include <linux/irqchip/arm-gic.h>
#define REALVIEW_SYS_LOCK_OFFSET 0x20
#define REALVIEW_PB11MP_SYS_PLD_CTRL1 0x74
@@ -37,6 +36,7 @@ realview_gic_of_init(struct device_node *node, struct device_node *parent)
pr_info("TC11MP GIC: set up interrupt controller to NEW mode, no DCC\n");
} else {
pr_err("TC11MP GIC setup: could not find syscon\n");
+ return -ENXIO;
}
return gic_of_init(node, parent);
}
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index aea463e..428f9c1 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -49,7 +49,6 @@
#include <asm/virt.h>
#include "irq-gic-common.h"
-#include "irq-gic.h"
#ifdef CONFIG_ARM64
#include <asm/cpufeature.h>
diff --git a/drivers/irqchip/irq-gic.h b/drivers/irqchip/irq-gic.h
deleted file mode 100644
index 3c45a54..0000000
--- a/drivers/irqchip/irq-gic.h
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <linux/of.h>
-
-/*
- * Subdrivers that need some preparatory work can initialize their
- * chips and call this to register their GICs.
- */
-int gic_of_init(struct device_node *node, struct device_node *parent);
diff --git a/include/linux/irqchip/arm-gic.h b/include/linux/irqchip/arm-gic.h
index bae69e5..d0a29db 100644
--- a/include/linux/irqchip/arm-gic.h
+++ b/include/linux/irqchip/arm-gic.h
@@ -103,6 +103,16 @@ struct device_node;
void gic_cascade_irq(unsigned int gic_nr, unsigned int irq);
int gic_cpu_if_down(unsigned int gic_nr);
+/*
+ * Subdrivers that need some preparatory work can initialize their
+ * chips and call this to register their GICs.
+ */
+int gic_of_init(struct device_node *node, struct device_node *parent);
+
+/*
+ * Legacy platforms not converted to DT yet must use this to init
+ * their GIC
+ */
void gic_init(unsigned int nr, int start,
void __iomem *dist , void __iomem *cpu);
Thanks,
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] irqchip/gic: assign irqchip dynamically
2015-10-23 22:15 ` [PATCH 3/3] irqchip/gic: assign irqchip dynamically Linus Walleij
@ 2015-12-09 14:15 ` Marc Zyngier
2015-12-10 18:34 ` Linus Walleij
0 siblings, 1 reply; 8+ messages in thread
From: Marc Zyngier @ 2015-12-09 14:15 UTC (permalink / raw)
To: Linus Walleij, Thomas Gleixner, Jason Cooper; +Cc: linux-kernel
On 23/10/15 23:15, Linus Walleij wrote:
> Instead of having the irqchip being a static struct, make it part
> of the per-instance data so we can assign it a dynamic name. This
> has the usable side effect of displaying the GIC with an instance
> number as GIC0, GIC1 ... GICn in /proc/interrupts, which is helpful
> when debugging cascaded GICs, such as on the ARM PB11MPCore.
>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Jason Cooper <jason@lakedaemon.net>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> ChangeLog v1->v2:
> - Keep the static structs around, just delete the .name
> field assign them to the chips at registration time, updating
> the name field with the instance number.
> - Also enumerate the EOIMODE1 sub-chips.
> - Broke out this irqchip stuff from the rest of the series so as
> not to stress the irqchip maintainers. It has no dependencies
> on the other patches anyways, and can be merged stand-alone.
>
> Marc: can't test the EOIMODE1 thing, it's far above me, but it
> "should work". Is it correct that there is one unique and coupled
> EOIMODE1 instance per GIC instance like this?
> ---
> drivers/irqchip/irq-gic.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
> index 9ec8cf5137d9..fe87ac32fdbe 100644
> --- a/drivers/irqchip/irq-gic.c
> +++ b/drivers/irqchip/irq-gic.c
> @@ -58,6 +58,8 @@ union gic_base {
> };
>
> struct gic_chip_data {
> + struct irq_chip chip;
> + struct irq_chip eoimode1_chip;
This seems overkill: A given GIC instance is either driven as a GIC or
a GICv2. Never both at the same time.
> union gic_base dist_base;
> union gic_base cpu_base;
> #ifdef CONFIG_CPU_PM
> @@ -370,7 +372,6 @@ static void gic_handle_cascade_irq(struct irq_desc *desc)
> }
>
> static struct irq_chip gic_chip = {
> - .name = "GIC",
> .irq_mask = gic_mask_irq,
> .irq_unmask = gic_unmask_irq,
> .irq_eoi = gic_eoi_irq,
> @@ -386,7 +387,6 @@ static struct irq_chip gic_chip = {
> };
>
> static struct irq_chip gic_eoimode1_chip = {
> - .name = "GICv2",
> .irq_mask = gic_eoimode1_mask_irq,
> .irq_unmask = gic_unmask_irq,
> .irq_eoi = gic_eoimode1_eoi_irq,
> @@ -880,11 +880,12 @@ void __init gic_init_physaddr(struct device_node *node)
> static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
> irq_hw_number_t hw)
> {
> - struct irq_chip *chip = &gic_chip;
> + struct gic_chip_data *gic = d->host_data;
> + struct irq_chip *chip = &gic->chip;
>
> if (static_key_true(&supports_deactivate)) {
> if (d->host_data == (void *)&gic_data[0])
> - chip = &gic_eoimode1_chip;
> + chip = &gic->eoimode1_chip;
> }
>
> if (hw < 32) {
> @@ -989,6 +990,13 @@ static void __init __gic_init_bases(unsigned int gic_nr, int irq_start,
> BUG_ON(gic_nr >= MAX_GIC_NR);
>
> gic = &gic_data[gic_nr];
> +
> + /* Initialize irq_chip */
> + gic->chip = gic_chip;
> + gic->eoimode1_chip = gic_eoimode1_chip;
> + gic->chip.name = kasprintf(GFP_KERNEL, "GIC%d", gic_nr);
> + gic->eoimode1_chip.name = kasprintf(GFP_KERNEL, "GICv2%d", gic_nr);
And there is only ever one GIC in the system that can be driven as a
GICv2 - it can only be instance 0.
> +
> #ifdef CONFIG_GIC_NON_BANKED
> if (percpu_offset) { /* Frankein-GIC without banked registers... */
> unsigned int cpu;
>
So instead of going for another round, how about this on top of your
patch:
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index 428f9c1..174990c 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -70,7 +70,6 @@ union gic_base {
struct gic_chip_data {
struct irq_chip chip;
- struct irq_chip eoimode1_chip;
union gic_base dist_base;
union gic_base cpu_base;
#ifdef CONFIG_CPU_PM
@@ -400,6 +399,7 @@ static struct irq_chip gic_chip = {
};
static struct irq_chip gic_eoimode1_chip = {
+ .name = "GICv2",
.irq_mask = gic_eoimode1_mask_irq,
.irq_unmask = gic_unmask_irq,
.irq_eoi = gic_eoimode1_eoi_irq,
@@ -926,20 +926,14 @@ static int gic_irq_domain_map(struct irq_domain *d, unsigned int irq,
irq_hw_number_t hw)
{
struct gic_chip_data *gic = d->host_data;
- struct irq_chip *chip = &gic->chip;
-
- if (static_key_true(&supports_deactivate)) {
- if (d->host_data == (void *)&gic_data[0])
- chip = &gic->eoimode1_chip;
- }
if (hw < 32) {
irq_set_percpu_devid(irq);
- irq_domain_set_info(d, irq, hw, chip, d->host_data,
+ irq_domain_set_info(d, irq, hw, &gic->chip, d->host_data,
handle_percpu_devid_irq, NULL, NULL);
irq_set_status_flags(irq, IRQ_NOAUTOEN);
} else {
- irq_domain_set_info(d, irq, hw, chip, d->host_data,
+ irq_domain_set_info(d, irq, hw, &gic->chip, d->host_data,
handle_fasteoi_irq, NULL, NULL);
irq_set_probe(irq);
}
@@ -1048,10 +1042,12 @@ static void __init __gic_init_bases(unsigned int gic_nr, int irq_start,
gic = &gic_data[gic_nr];
/* Initialize irq_chip */
- gic->chip = gic_chip;
- gic->eoimode1_chip = gic_eoimode1_chip;
- gic->chip.name = kasprintf(GFP_KERNEL, "GIC%d", gic_nr);
- gic->eoimode1_chip.name = kasprintf(GFP_KERNEL, "GICv2%d", gic_nr);
+ if (static_key_true(&supports_deactivate) && gic_nr == 0) {
+ gic->chip = gic_eoimode1_chip;
+ } else {
+ gic->chip = gic_chip;
+ gic->chip.name = kasprintf(GFP_KERNEL, "GIC-%d", gic_nr);
+ }
#ifdef CONFIG_GIC_NON_BANKED
if (percpu_offset) { /* Frankein-GIC without banked registers... */
If you're OK with this and the previous patch, I'll squash those into
the original ones, and put it on a branch for Thomas to pick up for 4.5.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] irqchip/gic: support RealView variant setup
2015-12-09 14:04 ` Marc Zyngier
@ 2015-12-10 18:33 ` Linus Walleij
0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2015-12-10 18:33 UTC (permalink / raw)
To: Marc Zyngier; +Cc: Thomas Gleixner, Jason Cooper, linux-kernel@vger.kernel.org
On Wed, Dec 9, 2015 at 3:04 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> I'm not exactly fond of yet another include file, and I rather put this
> in include/irqchip/arm-gic.h (where this was until I recently removed
> it).
>
> How about the following (untested) patch on top of yours:
Looks fine, Acked-by! If I run into some problem later I'll just fix it.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] irqchip/gic: assign irqchip dynamically
2015-12-09 14:15 ` Marc Zyngier
@ 2015-12-10 18:34 ` Linus Walleij
0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2015-12-10 18:34 UTC (permalink / raw)
To: Marc Zyngier; +Cc: Thomas Gleixner, Jason Cooper, linux-kernel@vger.kernel.org
On Wed, Dec 9, 2015 at 3:15 PM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> If you're OK with this and the previous patch, I'll squash those into
> the original ones, and put it on a branch for Thomas to pick up for 4.5.
OK go ahead.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-12-10 18:34 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-23 22:15 [PATCH 1/3] irqchip/gic: fix ARM11MPCore GIC bindings Linus Walleij
2015-10-23 22:15 ` [PATCH 2/3] irqchip/gic: support RealView variant setup Linus Walleij
2015-12-09 14:04 ` Marc Zyngier
2015-12-10 18:33 ` Linus Walleij
2015-10-23 22:15 ` [PATCH 3/3] irqchip/gic: assign irqchip dynamically Linus Walleij
2015-12-09 14:15 ` Marc Zyngier
2015-12-10 18:34 ` Linus Walleij
2015-11-16 17:39 ` [PATCH 1/3] irqchip/gic: fix ARM11MPCore GIC bindings Rob Herring
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).