mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PULL] irqchip fixes for 4.8-rc4
@ 2016-08-22  8:23 Marc Zyngier
  2016-08-22  8:23 ` [PATCH 1/4] genirq: Correctly configure the trigger on chained interrupts Marc Zyngier
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Marc Zyngier @ 2016-08-22  8:23 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: John Stultz, Linus Walleij, Jon Hunter, Fabio Estevam,
	Sudeep Holla, Jason Cooper, David Daney, Lorenzo Pieralisi,
	linux-kernel

Hi Thomas,

Please find below a handful of fixes targetted at the current
cycle. The most important thing is a fix for the trigger configuration
on chained irqchip (please see the discussion here[1] for
details). The rest is the usual GIC churn, nothing massively critical.

Please pull!

Thanks,

	M.

[1] https://lkml.org/lkml/2016/7/30/3

The following changes since commit 694d0d0bb2030d2e36df73e2d23d5770511dbc8d:

  Linux 4.8-rc2 (2016-08-14 19:11:36 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git tags/irqchip-for-4.8-rc4

for you to fetch changes up to 7611da865c1060b2a7c87a15de663a59035747f8:

  irqchip/gicv3-its: Disable the ITS before initializing it (2016-08-19 09:47:07 +0100)

----------------------------------------------------------------
genirq/irqchip fixes for 4.8-rc4

- A critical fix for chained irqchip where we failed to configure
  the cascade interrupt trigger
- A GIC fix for self-IPI in SMP-on-UP configurations
- A PM fix for GICv3
- A initialization fix the the GICv3 ITS, triggered by kexec

----------------------------------------------------------------
David Daney (1):
      irqchip/gicv3-its: Disable the ITS before initializing it

Marc Zyngier (2):
      genirq: Correctly configure the trigger on chained interrupts
      irqchip/gic: Allow self-SGIs for SMP on UP configurations

Sudeep Holla (1):
      irqchip/gicv3: Remove disabling redistributor and group1 non-secure interrupts

 drivers/irqchip/irq-gic-v3-its.c |  7 ++++++-
 drivers/irqchip/irq-gic-v3.c     | 11 +++++++++--
 drivers/irqchip/irq-gic.c        |  7 +++++++
 kernel/irq/chip.c                | 11 +++++++++++
 4 files changed, 33 insertions(+), 3 deletions(-)

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

* [PATCH 1/4] genirq: Correctly configure the trigger on chained interrupts
  2016-08-22  8:23 [PULL] irqchip fixes for 4.8-rc4 Marc Zyngier
@ 2016-08-22  8:23 ` Marc Zyngier
  2016-08-22  8:23 ` [PATCH 2/4] irqchip/gic: Allow self-SGIs for SMP on UP configurations Marc Zyngier
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Marc Zyngier @ 2016-08-22  8:23 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: John Stultz, Linus Walleij, Jon Hunter, Fabio Estevam,
	Sudeep Holla, Jason Cooper, David Daney, Lorenzo Pieralisi,
	linux-kernel

Commit 1e2a7d78499e ("irqdomain: Don't set type when mapping an IRQ")
moved the trigger configuration call from the irqdomain mapping to
the interrupt being actually requested.

This patch failed to handle the case where we configure a chained
interrupt, which doesn't get requested through the usual path.

In order to solve this, let's call __irq_set_trigger just before
starting the cascade interrupt. Special care must be taken to
make the flow handler stick, as the .irq_set_type method could
have reset it (it doesn't know we're dealing with a chained
interrupt).

Based on an initial patch by Jon Hunter.

Fixes: 1e2a7d78499e ("irqdomain: Don't set type when mapping an IRQ")
Reported-by: John Stultz <john.stultz@linaro.org>
Reported-by: Linus Walleij <linus.walleij@linaro.org>
Tested-by: John Stultz <john.stultz@linaro.org>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 kernel/irq/chip.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index b4c1bc7..6373890 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -820,6 +820,17 @@ __irq_do_set_handler(struct irq_desc *desc, irq_flow_handler_t handle,
 	desc->name = name;
 
 	if (handle != handle_bad_irq && is_chained) {
+		/*
+		 * We're about to start this interrupt immediately,
+		 * hence the need to set the trigger configuration.
+		 * But the .set_type callback may have overridden the
+		 * flow handler, ignoring that we're dealing with a
+		 * chained interrupt. Reset it immediately because we
+		 * do know better.
+		 */
+		__irq_set_trigger(desc, irqd_get_trigger_type(&desc->irq_data));
+		desc->handle_irq = handle;
+
 		irq_settings_set_noprobe(desc);
 		irq_settings_set_norequest(desc);
 		irq_settings_set_nothread(desc);
-- 
2.1.4

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

* [PATCH 2/4] irqchip/gic: Allow self-SGIs for SMP on UP configurations
  2016-08-22  8:23 [PULL] irqchip fixes for 4.8-rc4 Marc Zyngier
  2016-08-22  8:23 ` [PATCH 1/4] genirq: Correctly configure the trigger on chained interrupts Marc Zyngier
@ 2016-08-22  8:23 ` Marc Zyngier
  2016-08-22  8:23 ` [PATCH 3/4] irqchip/gicv3: Remove disabling redistributor and group1 non-secure interrupts Marc Zyngier
  2016-08-22  8:23 ` [PATCH 4/4] irqchip/gicv3-its: Disable the ITS before initializing it Marc Zyngier
  3 siblings, 0 replies; 5+ messages in thread
From: Marc Zyngier @ 2016-08-22  8:23 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Fabio Estevam, John Stultz, Linus Walleij, Jon Hunter,
	Sudeep Holla, Jason Cooper, David Daney, Lorenzo Pieralisi,
	linux-kernel

On systems where a single CPU is present, the GIC may not support
having SGIs delivered to a target list. In that case, we use the
self-SGI mechanism to allow the interrupt to be delivered locally.

Tested-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/irqchip/irq-gic.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c
index c2cab57..390fac5 100644
--- a/drivers/irqchip/irq-gic.c
+++ b/drivers/irqchip/irq-gic.c
@@ -769,6 +769,13 @@ static void gic_raise_softirq(const struct cpumask *mask, unsigned int irq)
 	int cpu;
 	unsigned long flags, map = 0;
 
+	if (unlikely(nr_cpu_ids == 1)) {
+		/* Only one CPU? let's do a self-IPI... */
+		writel_relaxed(2 << 24 | irq,
+			       gic_data_dist_base(&gic_data[0]) + GIC_DIST_SOFTINT);
+		return;
+	}
+
 	raw_spin_lock_irqsave(&irq_controller_lock, flags);
 
 	/* Convert our logical CPU mask into a physical one. */
-- 
2.1.4

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

* [PATCH 3/4] irqchip/gicv3: Remove disabling redistributor and group1 non-secure interrupts
  2016-08-22  8:23 [PULL] irqchip fixes for 4.8-rc4 Marc Zyngier
  2016-08-22  8:23 ` [PATCH 1/4] genirq: Correctly configure the trigger on chained interrupts Marc Zyngier
  2016-08-22  8:23 ` [PATCH 2/4] irqchip/gic: Allow self-SGIs for SMP on UP configurations Marc Zyngier
@ 2016-08-22  8:23 ` Marc Zyngier
  2016-08-22  8:23 ` [PATCH 4/4] irqchip/gicv3-its: Disable the ITS before initializing it Marc Zyngier
  3 siblings, 0 replies; 5+ messages in thread
From: Marc Zyngier @ 2016-08-22  8:23 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Sudeep Holla, Christopher Covington, John Stultz, Linus Walleij,
	Jon Hunter, Fabio Estevam, Jason Cooper, David Daney,
	Lorenzo Pieralisi, linux-kernel

From: Sudeep Holla <sudeep.holla@arm.com>

As per the GICv3 specification, to power down a processor using GICv3
and allow automatic power-on if an interrupt must be sent to a processor,
software must set Enable to zero for all interrupt groups(by writing
to GICC_CTLR or ICC_IGRPEN{0,1}_EL1/3 as appropriate.

When commit 3708d52fc6bb ("irqchip: gic-v3: Implement CPU PM notifier")
was introduced there were no firmware implementations(in particular PSCI)
handling this.

Linux kernel may not be aware of the CPU power state details and might
fail to identify the power states that require quiescing the CPU
interface. Even if it can be aware of those details, it can't determine
which CPU power state have been triggered at the platform level and how
the power control is implemented.

This patch make disabling redistributor and group1 non-secure interrupts
in the power down path and re-enabling of redistributor in the power-up
path conditional. It will be handled in the kernel if and only if the
non-secure accesses are permitted to access and modify control registers.
It is left to the platform implementation otherwise.

Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Tested-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/irqchip/irq-gic-v3.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c
index 6fc56c3..ede5672 100644
--- a/drivers/irqchip/irq-gic-v3.c
+++ b/drivers/irqchip/irq-gic-v3.c
@@ -667,13 +667,20 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
 #endif
 
 #ifdef CONFIG_CPU_PM
+/* Check whether it's single security state view */
+static bool gic_dist_security_disabled(void)
+{
+	return readl_relaxed(gic_data.dist_base + GICD_CTLR) & GICD_CTLR_DS;
+}
+
 static int gic_cpu_pm_notifier(struct notifier_block *self,
 			       unsigned long cmd, void *v)
 {
 	if (cmd == CPU_PM_EXIT) {
-		gic_enable_redist(true);
+		if (gic_dist_security_disabled())
+			gic_enable_redist(true);
 		gic_cpu_sys_reg_init();
-	} else if (cmd == CPU_PM_ENTER) {
+	} else if (cmd == CPU_PM_ENTER && gic_dist_security_disabled()) {
 		gic_write_grpen1(0);
 		gic_enable_redist(false);
 	}
-- 
2.1.4

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

* [PATCH 4/4] irqchip/gicv3-its: Disable the ITS before initializing it
  2016-08-22  8:23 [PULL] irqchip fixes for 4.8-rc4 Marc Zyngier
                   ` (2 preceding siblings ...)
  2016-08-22  8:23 ` [PATCH 3/4] irqchip/gicv3: Remove disabling redistributor and group1 non-secure interrupts Marc Zyngier
@ 2016-08-22  8:23 ` Marc Zyngier
  3 siblings, 0 replies; 5+ messages in thread
From: Marc Zyngier @ 2016-08-22  8:23 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: David Daney, John Stultz, Linus Walleij, Jon Hunter,
	Fabio Estevam, Sudeep Holla, Jason Cooper, Lorenzo Pieralisi,
	linux-kernel

From: David Daney <david.daney@cavium.com>

When starting a kexec/kdump kernel, the GIC ITS will already have been
enabled.  According to the ARM Generic Interrupt Controller
Architecture Specification (GIC architecture Version 3.0 and version
4.0), writing to GITS_BASER<n> or GITS_CBASER is "UNPREDICTABLE" when
the ITS is enabled.  On Cavium Thunder systems, this prevents the ITS
from being initializing in the kexec/kdump kernel, resulting in
failure to register/enable interrupts for all devices.

The fix is to disable the ITS if it is not already in the disabled
state.  This allows the ITS to be properly initialized and then
re-enabled in the kexec/kdump kernel.

Acked-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/irqchip/irq-gic-v3-its.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 7ceaba8..36b9c28 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -1545,7 +1545,12 @@ static int its_force_quiescent(void __iomem *base)
 	u32 val;
 
 	val = readl_relaxed(base + GITS_CTLR);
-	if (val & GITS_CTLR_QUIESCENT)
+	/*
+	 * GIC architecture specification requires the ITS to be both
+	 * disabled and quiescent for writes to GITS_BASER<n> or
+	 * GITS_CBASER to not have UNPREDICTABLE results.
+	 */
+	if ((val & GITS_CTLR_QUIESCENT) && !(val & GITS_CTLR_ENABLE))
 		return 0;
 
 	/* Disable the generation of all interrupts to this ITS */
-- 
2.1.4

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

end of thread, other threads:[~2016-08-22  8:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-22  8:23 [PULL] irqchip fixes for 4.8-rc4 Marc Zyngier
2016-08-22  8:23 ` [PATCH 1/4] genirq: Correctly configure the trigger on chained interrupts Marc Zyngier
2016-08-22  8:23 ` [PATCH 2/4] irqchip/gic: Allow self-SGIs for SMP on UP configurations Marc Zyngier
2016-08-22  8:23 ` [PATCH 3/4] irqchip/gicv3: Remove disabling redistributor and group1 non-secure interrupts Marc Zyngier
2016-08-22  8:23 ` [PATCH 4/4] irqchip/gicv3-its: Disable the ITS before initializing it Marc Zyngier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®