All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Norris <computersforpeace@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Brian Norris <computersforpeace@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Gregory Fong <gregory.0xf0@gmail.com>,
	<bcm-kernel-feedback-list@broadcom.com>,
	<linux-kernel@vger.kernel.org>, <linux-mips@linux-mips.org>,
	Kevin Cernekee <cernekee@gmail.com>,
	Jason Cooper <jason@lakedaemon.net>
Subject: [PATCH 1/2] genirq: add chip_{suspend,resume} PM support to irq_chip
Date: Fri, 19 Jun 2015 16:26:42 -0700	[thread overview]
Message-ID: <1434756403-379-1-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <20150619224123.GL4917@ld-irv-0074>

Some (admittedly odd) irqchips perform functions that are not directly
related to any of their child IRQ lines, and therefore need to perform
some tasks during suspend/resume regardless of whether there are
any "installed" interrupts for the irqchip. However, the current
generic-chip framework does not call the chip's irq_{suspend,resume}
when there are no interrupts installed (this makes sense, because there
are no irq_data objects for such a call to be made).

More specifically, irq-bcm7120-l2 configures both a forwarding mask
(which affects other top-level GIC IRQs) and a second-level interrupt
mask (for managing its own child interrupts). The former must be
saved/restored on suspend/resume, even when there's nothing to do for
the latter.

This patch adds a second set of suspend/resume hooks to irq_chip, this
time to represent *chip* suspend/resume, rather than IRQ suspend/resume.
These callbacks will always be called for an irqchip and are based on
the per-chip irq_chip_generic struct, rather than the per-IRQ irq_data
struct.

The original problem report is described in extra detail here:
http://lkml.kernel.org/g/20150619224123.GL4917@ld-irv-0074

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 include/linux/irq.h       | 10 ++++++++++
 kernel/irq/generic-chip.c |  6 ++++++
 2 files changed, 16 insertions(+)

diff --git a/include/linux/irq.h b/include/linux/irq.h
index de3213d271ff..2a672d2434a5 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -293,6 +293,8 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
 	return d->hwirq;
 }
 
+struct irq_chip_generic;
+
 /**
  * struct irq_chip - hardware interrupt chip descriptor
  *
@@ -317,6 +319,12 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
  * @irq_suspend:	function called from core code on suspend once per chip
  * @irq_resume:		function called from core code on resume once per chip
  * @irq_pm_shutdown:	function called from core code on shutdown once per chip
+ * @chip_suspend:	function called from core code on suspend once per
+ *			chip; for handling chip details even when no interrupts
+ *			are in use
+ * @chip_resume:	function called from core code on resume once per chip;
+ *			for handling chip details even when no interrupts are
+ *			in use
  * @irq_calc_mask:	Optional function to set irq_data.mask for special cases
  * @irq_print_chip:	optional to print special chip info in show_interrupts
  * @irq_request_resources:	optional to request resources before calling
@@ -357,6 +365,8 @@ struct irq_chip {
 	void		(*irq_suspend)(struct irq_data *data);
 	void		(*irq_resume)(struct irq_data *data);
 	void		(*irq_pm_shutdown)(struct irq_data *data);
+	void		(*chip_suspend)(struct irq_chip_generic *gc);
+	void		(*chip_resume)(struct irq_chip_generic *gc);
 
 	void		(*irq_calc_mask)(struct irq_data *data);
 
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c
index 15b370daf234..fe25e72d5d13 100644
--- a/kernel/irq/generic-chip.c
+++ b/kernel/irq/generic-chip.c
@@ -553,6 +553,9 @@ static int irq_gc_suspend(void)
 			if (data)
 				ct->chip.irq_suspend(data);
 		}
+
+		if (ct->chip.chip_suspend)
+			ct->chip.chip_suspend(gc);
 	}
 	return 0;
 }
@@ -564,6 +567,9 @@ static void irq_gc_resume(void)
 	list_for_each_entry(gc, &gc_list, list) {
 		struct irq_chip_type *ct = gc->chip_types;
 
+		if (ct->chip.chip_resume)
+			ct->chip.chip_resume(gc);
+
 		if (ct->chip.irq_resume) {
 			struct irq_data *data = irq_gc_get_irq_data(gc);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

WARNING: multiple messages have this Message-ID (diff)
From: Brian Norris <computersforpeace@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Brian Norris <computersforpeace@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Gregory Fong <gregory.0xf0@gmail.com>,
	<bcm-kernel-feedback-list@broadcom.com>,
	<linux-kernel@vger.kernel.org>, <linux-mips@linux-mips.org>,
	Kevin Cernekee <cernekee@gmail.com>,
	Jason Cooper <jason@lakedaemon.net>
Subject: [PATCH 1/2] genirq: add chip_{suspend,resume} PM support to irq_chip
Date: Fri, 19 Jun 2015 16:26:42 -0700	[thread overview]
Message-ID: <1434756403-379-1-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <20150619224123.GL4917@ld-irv-0074>

Some (admittedly odd) irqchips perform functions that are not directly
related to any of their child IRQ lines, and therefore need to perform
some tasks during suspend/resume regardless of whether there are
any "installed" interrupts for the irqchip. However, the current
generic-chip framework does not call the chip's irq_{suspend,resume}
when there are no interrupts installed (this makes sense, because there
are no irq_data objects for such a call to be made).

More specifically, irq-bcm7120-l2 configures both a forwarding mask
(which affects other top-level GIC IRQs) and a second-level interrupt
mask (for managing its own child interrupts). The former must be
saved/restored on suspend/resume, even when there's nothing to do for
the latter.

This patch adds a second set of suspend/resume hooks to irq_chip, this
time to represent *chip* suspend/resume, rather than IRQ suspend/resume.
These callbacks will always be called for an irqchip and are based on
the per-chip irq_chip_generic struct, rather than the per-IRQ irq_data
struct.

The original problem report is described in extra detail here:
http://lkml.kernel.org/g/20150619224123.GL4917@ld-irv-0074

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 include/linux/irq.h       | 10 ++++++++++
 kernel/irq/generic-chip.c |  6 ++++++
 2 files changed, 16 insertions(+)

diff --git a/include/linux/irq.h b/include/linux/irq.h
index de3213d271ff..2a672d2434a5 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -293,6 +293,8 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
 	return d->hwirq;
 }
 
+struct irq_chip_generic;
+
 /**
  * struct irq_chip - hardware interrupt chip descriptor
  *
@@ -317,6 +319,12 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
  * @irq_suspend:	function called from core code on suspend once per chip
  * @irq_resume:		function called from core code on resume once per chip
  * @irq_pm_shutdown:	function called from core code on shutdown once per chip
+ * @chip_suspend:	function called from core code on suspend once per
+ *			chip; for handling chip details even when no interrupts
+ *			are in use
+ * @chip_resume:	function called from core code on resume once per chip;
+ *			for handling chip details even when no interrupts are
+ *			in use
  * @irq_calc_mask:	Optional function to set irq_data.mask for special cases
  * @irq_print_chip:	optional to print special chip info in show_interrupts
  * @irq_request_resources:	optional to request resources before calling
@@ -357,6 +365,8 @@ struct irq_chip {
 	void		(*irq_suspend)(struct irq_data *data);
 	void		(*irq_resume)(struct irq_data *data);
 	void		(*irq_pm_shutdown)(struct irq_data *data);
+	void		(*chip_suspend)(struct irq_chip_generic *gc);
+	void		(*chip_resume)(struct irq_chip_generic *gc);
 
 	void		(*irq_calc_mask)(struct irq_data *data);
 
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c
index 15b370daf234..fe25e72d5d13 100644
--- a/kernel/irq/generic-chip.c
+++ b/kernel/irq/generic-chip.c
@@ -553,6 +553,9 @@ static int irq_gc_suspend(void)
 			if (data)
 				ct->chip.irq_suspend(data);
 		}
+
+		if (ct->chip.chip_suspend)
+			ct->chip.chip_suspend(gc);
 	}
 	return 0;
 }
@@ -564,6 +567,9 @@ static void irq_gc_resume(void)
 	list_for_each_entry(gc, &gc_list, list) {
 		struct irq_chip_type *ct = gc->chip_types;
 
+		if (ct->chip.chip_resume)
+			ct->chip.chip_resume(gc);
+
 		if (ct->chip.irq_resume) {
 			struct irq_data *data = irq_gc_get_irq_data(gc);
 
-- 
1.9.1

WARNING: multiple messages have this Message-ID (diff)
From: Brian Norris <computersforpeace@gmail.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Brian Norris <computersforpeace@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Gregory Fong <gregory.0xf0@gmail.com>,
	bcm-kernel-feedback-list@broadcom.com,
	linux-kernel@vger.kernel.org, linux-mips@linux-mips.org,
	Kevin Cernekee <cernekee@gmail.com>,
	Jason Cooper <jason@lakedaemon.net>
Subject: [PATCH 1/2] genirq: add chip_{suspend,resume} PM support to irq_chip
Date: Fri, 19 Jun 2015 16:26:42 -0700	[thread overview]
Message-ID: <1434756403-379-1-git-send-email-computersforpeace@gmail.com> (raw)
Message-ID: <20150619232642.N_sKA8f2Fs5gIoVBR9tvwwVrtF8qdArh8n0fvzT8MrU@z> (raw)
In-Reply-To: <20150619224123.GL4917@ld-irv-0074>

Some (admittedly odd) irqchips perform functions that are not directly
related to any of their child IRQ lines, and therefore need to perform
some tasks during suspend/resume regardless of whether there are
any "installed" interrupts for the irqchip. However, the current
generic-chip framework does not call the chip's irq_{suspend,resume}
when there are no interrupts installed (this makes sense, because there
are no irq_data objects for such a call to be made).

More specifically, irq-bcm7120-l2 configures both a forwarding mask
(which affects other top-level GIC IRQs) and a second-level interrupt
mask (for managing its own child interrupts). The former must be
saved/restored on suspend/resume, even when there's nothing to do for
the latter.

This patch adds a second set of suspend/resume hooks to irq_chip, this
time to represent *chip* suspend/resume, rather than IRQ suspend/resume.
These callbacks will always be called for an irqchip and are based on
the per-chip irq_chip_generic struct, rather than the per-IRQ irq_data
struct.

The original problem report is described in extra detail here:
http://lkml.kernel.org/g/20150619224123.GL4917@ld-irv-0074

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 include/linux/irq.h       | 10 ++++++++++
 kernel/irq/generic-chip.c |  6 ++++++
 2 files changed, 16 insertions(+)

diff --git a/include/linux/irq.h b/include/linux/irq.h
index de3213d271ff..2a672d2434a5 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -293,6 +293,8 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
 	return d->hwirq;
 }
 
+struct irq_chip_generic;
+
 /**
  * struct irq_chip - hardware interrupt chip descriptor
  *
@@ -317,6 +319,12 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
  * @irq_suspend:	function called from core code on suspend once per chip
  * @irq_resume:		function called from core code on resume once per chip
  * @irq_pm_shutdown:	function called from core code on shutdown once per chip
+ * @chip_suspend:	function called from core code on suspend once per
+ *			chip; for handling chip details even when no interrupts
+ *			are in use
+ * @chip_resume:	function called from core code on resume once per chip;
+ *			for handling chip details even when no interrupts are
+ *			in use
  * @irq_calc_mask:	Optional function to set irq_data.mask for special cases
  * @irq_print_chip:	optional to print special chip info in show_interrupts
  * @irq_request_resources:	optional to request resources before calling
@@ -357,6 +365,8 @@ struct irq_chip {
 	void		(*irq_suspend)(struct irq_data *data);
 	void		(*irq_resume)(struct irq_data *data);
 	void		(*irq_pm_shutdown)(struct irq_data *data);
+	void		(*chip_suspend)(struct irq_chip_generic *gc);
+	void		(*chip_resume)(struct irq_chip_generic *gc);
 
 	void		(*irq_calc_mask)(struct irq_data *data);
 
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c
index 15b370daf234..fe25e72d5d13 100644
--- a/kernel/irq/generic-chip.c
+++ b/kernel/irq/generic-chip.c
@@ -553,6 +553,9 @@ static int irq_gc_suspend(void)
 			if (data)
 				ct->chip.irq_suspend(data);
 		}
+
+		if (ct->chip.chip_suspend)
+			ct->chip.chip_suspend(gc);
 	}
 	return 0;
 }
@@ -564,6 +567,9 @@ static void irq_gc_resume(void)
 	list_for_each_entry(gc, &gc_list, list) {
 		struct irq_chip_type *ct = gc->chip_types;
 
+		if (ct->chip.chip_resume)
+			ct->chip.chip_resume(gc);
+
 		if (ct->chip.irq_resume) {
 			struct irq_data *data = irq_gc_get_irq_data(gc);
 
-- 
1.9.1

  parent reply	other threads:[~2015-06-19 23:27 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19  0:11 [PATCH 0/7] soc: brcmstb: add system suspend support for STB SoCs Brian Norris
2015-06-19  0:11 ` Brian Norris
2015-06-19  0:11 ` Brian Norris
2015-06-19  0:11 ` [PATCH 1/7] Documentation: dt: brcmstb: add system PM bindings Brian Norris
2015-06-19  0:11   ` Brian Norris
2015-09-12 19:58   ` Florian Fainelli
2015-09-12 19:58     ` Florian Fainelli
2015-09-12 19:58     ` Florian Fainelli
2015-06-19  0:11 ` [PATCH 2/7] Documentation: dt: brcmstb: add waketimer documentation Brian Norris
2015-06-19  0:11   ` Brian Norris
2015-06-19  2:09   ` Gregory Fong
2015-06-19  2:09     ` Gregory Fong
2015-06-19  2:09     ` Gregory Fong
2015-09-12 19:58   ` Florian Fainelli
2015-09-12 19:58     ` Florian Fainelli
2015-06-19  0:11 ` [PATCH 3/7] soc: add stubs for brcmstb SoC's Brian Norris
2015-06-19  0:11   ` Brian Norris
2015-09-12 20:16   ` Florian Fainelli
2015-09-12 20:16     ` Florian Fainelli
2015-09-12 20:16     ` Florian Fainelli
2015-06-19  0:11 ` [PATCH 4/7] soc: brcmstb: add PM suspend/resume support (S2/S3/S5) Brian Norris
2015-06-19  0:11   ` Brian Norris
2015-09-12 20:23   ` Florian Fainelli
2015-09-12 20:23     ` Florian Fainelli
2015-09-12 20:23     ` Florian Fainelli
2015-06-19  0:11 ` [PATCH 5/7] soc: brcmstb: add wake-timer driver Brian Norris
2015-06-19  0:11   ` Brian Norris
2015-06-19  2:20   ` Gregory Fong
2015-06-19  2:20     ` Gregory Fong
2015-06-19  2:20     ` Gregory Fong
2015-06-19 17:36     ` Brian Norris
2015-06-19 17:36       ` Brian Norris
2015-06-19 17:36       ` Brian Norris
2015-09-12 20:00   ` Florian Fainelli
2015-09-12 20:00     ` Florian Fainelli
2015-09-12 20:00     ` Florian Fainelli
2015-06-19  0:11 ` [PATCH 6/7] ARM: brcmstb: mask GIC IRQs on suspend Brian Norris
2015-06-19  0:11   ` Brian Norris
2015-06-19  1:48   ` Gregory Fong
2015-06-19  1:48     ` Gregory Fong
2015-06-19  1:48     ` Gregory Fong
2015-09-12 19:53   ` Florian Fainelli
2015-09-12 19:53     ` Florian Fainelli
2015-09-12 19:53     ` Florian Fainelli
2015-09-14 17:29     ` Brian Norris
2015-09-14 17:29       ` Brian Norris
2015-09-14 17:29       ` Brian Norris
2015-09-14 17:42     ` Brian Norris
2015-09-14 17:42       ` Brian Norris
2015-09-14 17:42       ` Brian Norris
2015-09-14 17:43       ` Florian Fainelli
2015-09-14 17:43         ` Florian Fainelli
2015-09-14 17:43         ` Florian Fainelli
2015-06-19  0:11 ` [PATCH 7/7] ARM: dts: brcmstb: add BCM7445 system PM DT nodes Brian Norris
2015-06-19  0:11   ` Brian Norris
2015-09-12 19:58   ` Florian Fainelli
2015-09-12 19:58     ` Florian Fainelli
2015-09-12 19:58     ` Florian Fainelli
2015-06-19  3:20 ` [PATCH 0/7] soc: brcmstb: add system suspend support for STB SoCs Gregory Fong
2015-06-19  3:20   ` Gregory Fong
2015-06-19  3:20   ` Gregory Fong
2015-06-19 22:41   ` Brian Norris
2015-06-19 22:41     ` Brian Norris
2015-06-19 22:41     ` Brian Norris
2015-06-19 22:55     ` Brian Norris
2015-06-19 22:55       ` Brian Norris
2015-06-19 22:55       ` Brian Norris
2015-06-19 23:26     ` Brian Norris [this message]
2015-06-19 23:26       ` [PATCH 1/2] genirq: add chip_{suspend,resume} PM support to irq_chip Brian Norris
2015-06-19 23:26       ` Brian Norris
2015-06-19 23:26       ` [PATCH 2/2] IRQCHIP: bcm7120-l2: perform suspend/resume even without installed child IRQs Brian Norris
2015-06-19 23:26         ` Brian Norris
2015-06-19 23:26         ` Brian Norris
2015-06-19 23:39         ` Florian Fainelli
2015-06-19 23:39           ` Florian Fainelli
2015-06-19 23:38       ` [PATCH 1/2] genirq: add chip_{suspend,resume} PM support to irq_chip Florian Fainelli
2015-06-19 23:38         ` Florian Fainelli
2015-06-20 14:11       ` Thomas Gleixner
2015-06-20 14:11         ` Thomas Gleixner
2015-07-21 18:24         ` Florian Fainelli
2015-07-21 21:23           ` Thomas Gleixner
2015-07-21 21:26             ` Florian Fainelli
2015-07-21 21:26               ` Florian Fainelli
2015-07-21 21:58               ` Thomas Gleixner
2015-07-22 23:28                 ` Brian Norris
2015-07-21 21:36           ` Brian Norris
2015-07-22 23:21       ` [PATCH v2 " Brian Norris
2015-07-22 23:21         ` [PATCH v2 2/2] IRQCHIP: bcm7120-l2: perform suspend/resume even without installed child IRQs Brian Norris
2015-07-27  6:15           ` [tip:irq/core] irqchip/bcm7120-l2: Perform suspend/ resume " tip-bot for Brian Norris
2015-07-27  6:14         ` [tip:irq/core] genirq: Add chip_[suspend|resume] PM support to irq_chip tip-bot for Brian Norris
2015-06-22 19:47 ` [PATCH 0/7] soc: brcmstb: add system suspend support for STB SoCs Brian Norris
2015-06-22 19:47   ` Brian Norris
2015-06-22 19:47   ` Brian Norris
2015-06-24  4:47   ` Florian Fainelli
2015-06-24  4:47     ` Florian Fainelli

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=1434756403-379-1-git-send-email-computersforpeace@gmail.com \
    --to=computersforpeace@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=cernekee@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=gregory.0xf0@gmail.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.