From: Jon Hunter <jonathanh@nvidia.com>
To: Thomas Gleixner <tglx@linutronix.de>,
Jason Cooper <jason@lakedaemon.net>,
Marc Zyngier <marc.zyngier@arm.com>,
Jiang Liu <jiang.liu@linux.intel.com>,
Stephen Warren <swarren@wwwdotorg.org>,
Thierry Reding <thierry.reding@gmail.com>
Cc: Kevin Hilman <khilman@kernel.org>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Grygorii Strashko <grygorii.strashko@ti.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Linus Walleij <linus.walleij@linaro.org>,
Soren Brinkmann <soren.brinkmann@xilinx.com>,
linux-kernel@vger.kernel.org, <linux-tegra@vger.kernel.org>,
Jon Hunter <jonathanh@nvidia.com>
Subject: [RFC PATCH V2 7/8] irqchip/gic: Prepare for adding platform driver
Date: Thu, 17 Dec 2015 10:48:28 +0000 [thread overview]
Message-ID: <1450349309-8107-8-git-send-email-jonathanh@nvidia.com> (raw)
In-Reply-To: <1450349309-8107-1-git-send-email-jonathanh@nvidia.com>
To support GIC chips located in power-domains outside of the CPU subsystem
it is necessary to add a platform driver for these chips, so that the
probing of the chip can be deferred if the power-domain has not yet been
registered with the generic power-domain infrastructure. Before adding a
platform driver for these chips, it is first necessary to move the function
__gic_init_bases() from the __init section so that it is always present
and not removed so it can be used by the platform driver.
The platform driver will only support non-root interrupt controllers
because the root interrupt controller needs to be initialised early. To
avoid section mis-matches it is also necessary to move function calls for
set_smp_cross_call() and set_handle_irq() from __gic_init_bases() (which
are only required for root controllers) because these are also located in
the __init section. Therefore, add the function __gic_init_root() which
will handle root controller specific initialisation and internally call
__gic_init_bases().
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
---
drivers/irqchip/irq-gic-common.c | 4 +-
drivers/irqchip/irq-gic.c | 94 +++++++++++++++++++++++++---------------
2 files changed, 62 insertions(+), 36 deletions(-)
diff --git a/drivers/irqchip/irq-gic-common.c b/drivers/irqchip/irq-gic-common.c
index f174ce0ca361..f8ccb4beaeb5 100644
--- a/drivers/irqchip/irq-gic-common.c
+++ b/drivers/irqchip/irq-gic-common.c
@@ -65,8 +65,8 @@ int gic_configure_irq(unsigned int irq, unsigned int type,
return ret;
}
-void __init gic_dist_config(void __iomem *base, int gic_irqs,
- void (*sync_access)(void))
+void gic_dist_config(void __iomem *base, int gic_irqs,
+ void (*sync_access)(void))
{
unsigned int i;
diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index ebfbb2379320..db3a46e40142 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -717,7 +717,7 @@ static struct notifier_block gic_notifier_block = {
.notifier_call = gic_notifier,
};
-static void __init gic_pm_init(struct gic_chip_data *gic)
+static void gic_pm_init(struct gic_chip_data *gic)
{
gic->saved_ppi_enable = __alloc_percpu(DIV_ROUND_UP(32, 32) * 4,
sizeof(u32));
@@ -735,7 +735,7 @@ static void __init gic_pm_init(struct gic_chip_data *gic)
cpu_pm_register_notifier(&gic_notifier_block);
}
#else
-static void __init gic_pm_init(struct gic_chip_data *gic)
+static void gic_pm_init(struct gic_chip_data *gic)
{
}
#endif
@@ -1010,13 +1010,13 @@ static const struct irq_domain_ops gic_irq_domain_ops = {
.unmap = gic_irq_domain_unmap,
};
-static int __init __gic_init_bases(unsigned int gic_nr, int irq_start,
- void __iomem *dist_base, void __iomem *cpu_base,
- u32 percpu_offset, struct fwnode_handle *handle)
+static int __gic_init_bases(unsigned int gic_nr, int irq_start,
+ void __iomem *dist_base, void __iomem *cpu_base,
+ u32 percpu_offset, struct fwnode_handle *handle)
{
irq_hw_number_t hwirq_base;
struct gic_chip_data *gic;
- int gic_irqs, irq_base, i, ret;
+ int gic_irqs, irq_base, ret;
BUG_ON(gic_nr >= MAX_GIC_NR);
@@ -1110,23 +1110,6 @@ static int __init __gic_init_bases(unsigned int gic_nr, int irq_start,
goto err;
}
- if (gic_nr == 0) {
- /*
- * Initialize the CPU interface map to all CPUs.
- * It will be refined as each CPU probes its ID.
- * This is only necessary for the primary GIC.
- */
- for (i = 0; i < NR_GIC_CPU_IF; i++)
- gic_cpu_map[i] = 0xff;
-#ifdef CONFIG_SMP
- set_smp_cross_call(gic_raise_softirq);
- register_cpu_notifier(&gic_cpu_notifier);
-#endif
- set_handle_irq(gic_handle_irq);
- if (static_key_true(&supports_deactivate))
- pr_info("GIC: Using split EOI/Deactivate mode\n");
- }
-
gic_dist_init(gic);
gic_cpu_init(gic);
gic_pm_init(gic);
@@ -1144,6 +1127,38 @@ err:
return ret;
}
+static int __init __gic_init_root(int irq_start, void __iomem *dist_base,
+ void __iomem *cpu_base, u32 percpu_offset,
+ struct fwnode_handle *handle)
+{
+ int i, ret;
+
+ /*
+ * Initialize the CPU interface map to all CPUs.
+ * It will be refined as each CPU probes its ID.
+ * This is only necessary for the primary GIC.
+ */
+ for (i = 0; i < NR_GIC_CPU_IF; i++)
+ gic_cpu_map[i] = 0xff;
+
+ ret = __gic_init_bases(0, irq_start, dist_base, cpu_base,
+ percpu_offset, handle);
+ if (ret)
+ return ret;
+
+ if (IS_ENABLED(CONFIG_SMP)) {
+ set_smp_cross_call(gic_raise_softirq);
+ register_cpu_notifier(&gic_cpu_notifier);
+ }
+
+ set_handle_irq(gic_handle_irq);
+
+ if (static_key_true(&supports_deactivate))
+ pr_info("GIC: Using split EOI/Deactivate mode\n");
+
+ return 0;
+}
+
void __init gic_init(unsigned int gic_nr, int irq_start,
void __iomem *dist_base, void __iomem *cpu_base)
{
@@ -1152,7 +1167,12 @@ void __init gic_init(unsigned int gic_nr, int irq_start,
* bother with these...
*/
static_key_slow_dec(&supports_deactivate);
- __gic_init_bases(gic_nr, irq_start, dist_base, cpu_base, 0, NULL);
+
+ if (!gic_nr)
+ __gic_init_root(irq_start, dist_base, cpu_base, 0, NULL);
+ else
+ __gic_init_bases(gic_nr, irq_start, dist_base, cpu_base, 0,
+ NULL);
}
#ifdef CONFIG_OF
@@ -1217,18 +1237,24 @@ gic_of_init(struct device_node *node, struct device_node *parent)
return -ENOMEM;
}
- /*
- * Disable split EOI/Deactivate if either HYP is not available
- * or the CPU interface is too small.
- */
- if (gic_cnt == 0 && !gic_check_eoimode(node, &cpu_base))
- static_key_slow_dec(&supports_deactivate);
-
if (of_property_read_u32(node, "cpu-offset", &percpu_offset))
percpu_offset = 0;
- ret = __gic_init_bases(gic_cnt, -1, dist_base, cpu_base, percpu_offset,
- &node->fwnode);
+ if (!gic_cnt) {
+ /*
+ * Disable split EOI/Deactivate if either HYP is not available
+ * or the CPU interface is too small.
+ */
+ if (!gic_check_eoimode(node, &cpu_base))
+ static_key_slow_dec(&supports_deactivate);
+
+ ret = __gic_init_root(-1, dist_base, cpu_base, percpu_offset,
+ &node->fwnode);
+ } else {
+ ret = __gic_init_bases(gic_cnt, -1, dist_base, cpu_base,
+ percpu_offset, &node->fwnode);
+ }
+
if (ret) {
iounmap(dist_base);
iounmap(cpu_base);
@@ -1366,7 +1392,7 @@ static int __init gic_v2_acpi_init(struct acpi_subtable_header *header,
return -ENOMEM;
}
- ret = __gic_init_bases(0, -1, dist_base, cpu_base, 0, domain_handle);
+ ret = __gic_init_root(-1, dist_base, cpu_base, 0, domain_handle);
if (ret) {
pr_err("Failed to initialise GIC\n");
irq_domain_free_fwnode(domain_handle);
--
2.1.4
next prev parent reply other threads:[~2015-12-17 10:51 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-17 10:48 [RFC PATCH V2 0/8] Add support for Tegra210 AGIC Jon Hunter
2015-12-17 10:48 ` [RFC PATCH V2 1/8] irqdomain: Ensure type settings match for an existing mapping Jon Hunter
2015-12-17 13:16 ` Linus Walleij
2015-12-18 10:10 ` Jon Hunter
2015-12-22 9:58 ` Linus Walleij
2015-12-22 10:00 ` Linus Walleij
2015-12-22 11:27 ` Jon Hunter
2015-12-22 11:31 ` Grygorii Strashko
2015-12-17 10:48 ` [RFC PATCH V2 2/8] irqdomain: Don't set type when mapping an IRQ Jon Hunter
2015-12-17 12:18 ` Linus Walleij
2015-12-22 11:18 ` Grygorii Strashko
2015-12-22 11:56 ` Jon Hunter
2016-03-18 9:16 ` Geert Uytterhoeven
2015-12-17 10:48 ` [RFC PATCH V2 3/8] genirq: Add runtime power management support for IRQ chips Jon Hunter
2015-12-17 13:19 ` Linus Walleij
2015-12-18 10:20 ` Jon Hunter
2016-01-12 18:40 ` Grygorii Strashko
2016-01-12 21:43 ` Sören Brinkmann
2016-01-18 14:47 ` Ulf Hansson
2016-01-19 10:43 ` Jon Hunter
2016-01-20 15:30 ` Thomas Gleixner
2016-01-21 8:38 ` Jon Hunter
2016-01-21 12:40 ` Ulf Hansson
2016-01-21 19:51 ` Thomas Gleixner
2016-01-22 11:08 ` Ulf Hansson
2016-01-26 17:17 ` Thomas Gleixner
2016-02-05 14:37 ` Linus Walleij
2016-03-18 13:57 ` Grygorii Strashko
2015-12-17 10:48 ` [RFC PATCH V2 4/8] irqchip/gic: Don't initialise chip if mapping IO space fails Jon Hunter
2015-12-17 13:21 ` Linus Walleij
2015-12-17 10:48 ` [RFC PATCH V2 5/8] irqchip/gic: Return an error if GIC initialisation fails Jon Hunter
2015-12-17 13:26 ` Linus Walleij
2015-12-18 10:24 ` Jon Hunter
2015-12-17 10:48 ` [RFC PATCH V2 6/8] irqchip/gic: Assign irqchip dynamically Jon Hunter
2015-12-17 11:00 ` Marc Zyngier
2015-12-18 10:26 ` Jon Hunter
2015-12-17 10:48 ` Jon Hunter [this message]
2015-12-17 10:48 ` [RFC PATCH V2 8/8] irqchip/gic: Add support for tegra AGIC interrupt controller Jon Hunter
2015-12-17 10:58 ` Jon Hunter
2015-12-17 13:32 ` Linus Walleij
2015-12-18 10:44 ` Jon Hunter
2015-12-22 10:03 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1450349309-8107-8-git-send-email-jonathanh@nvidia.com \
--to=jonathanh@nvidia.com \
--cc=geert@linux-m68k.org \
--cc=grygorii.strashko@ti.com \
--cc=jason@lakedaemon.net \
--cc=jiang.liu@linux.intel.com \
--cc=khilman@kernel.org \
--cc=lars@metafoo.de \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=soren.brinkmann@xilinx.com \
--cc=swarren@wwwdotorg.org \
--cc=tglx@linutronix.de \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome