[SRU][jammy/linux-aws][kinetic/linux-aws][PATCH 10/20] UBUNTU: SAUCE: xen/events: add xen_shutdown_pirqs helper function

Gerald Yang gerald.yang at canonical.com
Wed Aug 17 08:51:39 UTC 2022


From: Munehisa Kamata <kamatam at amazon.com>

BugLink: https://bugs.launchpad.net/bugs/1968062

Add a simple helper function to "shutdown" active PIRQs, which actually
closes event channels but keeps related IRQ structures intact. PM
suspend/hibernation code will rely on this.

Signed-off-by: Munehisa Kamata <kamatam at amazon.com>
Signed-off-by: Anchal Agarwal <anchalag at amazon.com>
Reviewed-by: Munehisa Kamata <kamatam at amazon.com>
Reviewed-by: Eduardo Valentin <eduval at amazon.com>
CR: https://cr.amazon.com/r/8273214/
(cherry picked from commit 5d311aa62b86e7ef655895c973e1422395b2d3fa amazon-5.15.y/mainline)
Signed-off-by: Gerald Yang <gerald.yang at canonical.com>
Signed-off-by: Matthew Ruffell <matthew.ruffell at canonical.com>
---
 drivers/xen/events/events_base.c | 12 ++++++++++++
 include/xen/events.h             |  1 +
 2 files changed, 13 insertions(+)

diff --git a/drivers/xen/events/events_base.c b/drivers/xen/events/events_base.c
index 46d9295d9a6e..36c683aee9d4 100644
--- a/drivers/xen/events/events_base.c
+++ b/drivers/xen/events/events_base.c
@@ -2124,6 +2124,18 @@ void xen_irq_resume(void)
 	restore_pirqs();
 }
 
+void xen_shutdown_pirqs(void)
+{
+	struct irq_info *info;
+
+	list_for_each_entry(info, &xen_irq_list_head, list) {
+		if (info->type != IRQT_PIRQ || !VALID_EVTCHN(info->evtchn))
+			continue;
+
+		shutdown_pirq(irq_get_irq_data(info->irq));
+	}
+}
+
 static struct irq_chip xen_dynamic_chip __read_mostly = {
 	.name			= "xen-dyn",
 
diff --git a/include/xen/events.h b/include/xen/events.h
index 344081e71584..7f30459489d7 100644
--- a/include/xen/events.h
+++ b/include/xen/events.h
@@ -86,6 +86,7 @@ static inline void notify_remote_via_evtchn(evtchn_port_t port)
 void notify_remote_via_irq(int irq);
 
 void xen_irq_resume(void);
+void xen_shutdown_pirqs(void);
 
 /* Clear an irq's pending state, in preparation for polling on it */
 void xen_clear_irq_pending(int irq);
-- 
2.34.1




More information about the kernel-team mailing list