From 293b57003bdb9a97d1eafa61bfafa1db1540b163 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 5 Nov 2020 22:55:36 +0100 Subject: [PATCH] 4.14-stable patches added patches: xen-events-don-t-use-chip_data-for-legacy-irqs.patch --- queue-4.14/series | 1 + ...-don-t-use-chip_data-for-legacy-irqs.patch | 124 ++++++++++++++++++ 2 files changed, 125 insertions(+) create mode 100644 queue-4.14/xen-events-don-t-use-chip_data-for-legacy-irqs.patch diff --git a/queue-4.14/series b/queue-4.14/series index 455ed952c99..5b537fe4d49 100644 --- a/queue-4.14/series +++ b/queue-4.14/series @@ -1 +1,2 @@ drm-i915-break-up-error-capture-compression-loops-with-cond_resched.patch +xen-events-don-t-use-chip_data-for-legacy-irqs.patch diff --git a/queue-4.14/xen-events-don-t-use-chip_data-for-legacy-irqs.patch b/queue-4.14/xen-events-don-t-use-chip_data-for-legacy-irqs.patch new file mode 100644 index 00000000000..02dc68d5675 --- /dev/null +++ b/queue-4.14/xen-events-don-t-use-chip_data-for-legacy-irqs.patch @@ -0,0 +1,124 @@ +From 0891fb39ba67bd7ae023ea0d367297ffff010781 Mon Sep 17 00:00:00 2001 +From: Juergen Gross +Date: Wed, 30 Sep 2020 11:16:14 +0200 +Subject: xen/events: don't use chip_data for legacy IRQs + +From: Juergen Gross + +commit 0891fb39ba67bd7ae023ea0d367297ffff010781 upstream. + +Since commit c330fb1ddc0a ("XEN uses irqdesc::irq_data_common::handler_data to store a per interrupt XEN data pointer which contains XEN specific information.") +Xen is using the chip_data pointer for storing IRQ specific data. When +running as a HVM domain this can result in problems for legacy IRQs, as +those might use chip_data for their own purposes. + +Use a local array for this purpose in case of legacy IRQs, avoiding the +double use. + +Cc: stable@vger.kernel.org +Fixes: c330fb1ddc0a ("XEN uses irqdesc::irq_data_common::handler_data to store a per interrupt XEN data pointer which contains XEN specific information.") +Signed-off-by: Juergen Gross +Tested-by: Stefan Bader +Reviewed-by: Boris Ostrovsky +Link: https://lore.kernel.org/r/20200930091614.13660-1-jgross@suse.com +Signed-off-by: Juergen Gross +[bwh: Backported to 4.9: adjust context] +Signed-off-by: Ben Hutchings +Signed-off-by: Greg Kroah-Hartman +--- + drivers/xen/events/events_base.c | 29 +++++++++++++++++++++-------- + 1 file changed, 21 insertions(+), 8 deletions(-) + +--- a/drivers/xen/events/events_base.c ++++ b/drivers/xen/events/events_base.c +@@ -90,6 +90,8 @@ static bool (*pirq_needs_eoi)(unsigned i + /* Xen will never allocate port zero for any purpose. */ + #define VALID_EVTCHN(chn) ((chn) != 0) + ++static struct irq_info *legacy_info_ptrs[NR_IRQS_LEGACY]; ++ + static struct irq_chip xen_dynamic_chip; + static struct irq_chip xen_percpu_chip; + static struct irq_chip xen_pirq_chip; +@@ -154,7 +156,18 @@ int get_evtchn_to_irq(unsigned evtchn) + /* Get info for IRQ */ + struct irq_info *info_for_irq(unsigned irq) + { +- return irq_get_chip_data(irq); ++ if (irq < nr_legacy_irqs()) ++ return legacy_info_ptrs[irq]; ++ else ++ return irq_get_chip_data(irq); ++} ++ ++static void set_info_for_irq(unsigned int irq, struct irq_info *info) ++{ ++ if (irq < nr_legacy_irqs()) ++ legacy_info_ptrs[irq] = info; ++ else ++ irq_set_chip_data(irq, info); + } + + /* Constructors for packed IRQ information. */ +@@ -375,7 +388,7 @@ static void xen_irq_init(unsigned irq) + info->type = IRQT_UNBOUND; + info->refcnt = -1; + +- irq_set_chip_data(irq, info); ++ set_info_for_irq(irq, info); + + list_add_tail(&info->list, &xen_irq_list_head); + } +@@ -424,14 +437,14 @@ static int __must_check xen_allocate_irq + + static void xen_free_irq(unsigned irq) + { +- struct irq_info *info = irq_get_chip_data(irq); ++ struct irq_info *info = info_for_irq(irq); + + if (WARN_ON(!info)) + return; + + list_del(&info->list); + +- irq_set_chip_data(irq, NULL); ++ set_info_for_irq(irq, NULL); + + WARN_ON(info->refcnt > 0); + +@@ -601,7 +614,7 @@ EXPORT_SYMBOL_GPL(xen_irq_from_gsi); + static void __unbind_from_irq(unsigned int irq) + { + int evtchn = evtchn_from_irq(irq); +- struct irq_info *info = irq_get_chip_data(irq); ++ struct irq_info *info = info_for_irq(irq); + + if (info->refcnt > 0) { + info->refcnt--; +@@ -1105,7 +1118,7 @@ int bind_ipi_to_irqhandler(enum ipi_vect + + void unbind_from_irqhandler(unsigned int irq, void *dev_id) + { +- struct irq_info *info = irq_get_chip_data(irq); ++ struct irq_info *info = info_for_irq(irq); + + if (WARN_ON(!info)) + return; +@@ -1139,7 +1152,7 @@ int evtchn_make_refcounted(unsigned int + if (irq == -1) + return -ENOENT; + +- info = irq_get_chip_data(irq); ++ info = info_for_irq(irq); + + if (!info) + return -ENOENT; +@@ -1167,7 +1180,7 @@ int evtchn_get(unsigned int evtchn) + if (irq == -1) + goto done; + +- info = irq_get_chip_data(irq); ++ info = info_for_irq(irq); + + if (!info) + goto done; -- 2.47.3