]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 4.19
authorSasha Levin <sashal@kernel.org>
Sun, 29 Oct 2023 22:49:30 +0000 (18:49 -0400)
committerSasha Levin <sashal@kernel.org>
Sun, 29 Oct 2023 22:49:30 +0000 (18:49 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-4.19/acpica-add-support-for-madt-online-enabled-bit.patch [new file with mode: 0644]
queue-4.19/iio-exynos-adc-request-second-interupt-only-when-tou.patch [new file with mode: 0644]
queue-4.19/series
queue-4.19/x86-acpi-boot-use-fadt-version-to-check-support-for-.patch [new file with mode: 0644]
queue-4.19/x86-acpi-don-t-add-cpus-that-are-not-online-capable.patch [new file with mode: 0644]
queue-4.19/x86-i8259-skip-probing-when-acpi-madt-advertises-pca.patch [new file with mode: 0644]

diff --git a/queue-4.19/acpica-add-support-for-madt-online-enabled-bit.patch b/queue-4.19/acpica-add-support-for-madt-online-enabled-bit.patch
new file mode 100644 (file)
index 0000000..3616f31
--- /dev/null
@@ -0,0 +1,36 @@
+From 2c2a21d057044c0274c5aac6e35370aa26a6e9db Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 8 Sep 2021 16:41:45 -0500
+Subject: ACPICA: Add support for MADT online enabled bit
+
+From: Mario Limonciello <mario.limonciello@amd.com>
+
+[ Upstream commit 435a8dc8d9b9d91e625901fea5b5695b9b976d84 ]
+
+The online enabled bit on newer ACPI implmentations will indicate
+whether the CPU is hotpluggable.
+
+Link: http://github.com/acpica/acpica/pull/708/
+Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Stable-dep-of: 128b0c9781c9 ("x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/acpi/actbl2.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
+index 1d4ef0621174d..4b722c376479e 100644
+--- a/include/acpi/actbl2.h
++++ b/include/acpi/actbl2.h
+@@ -715,6 +715,7 @@ struct acpi_madt_generic_translator {
+ /* MADT Local APIC flags */
+ #define ACPI_MADT_ENABLED           (1)       /* 00: Processor is usable if set */
++#define ACPI_MADT_ONLINE_CAPABLE    (2)       /* 01: System HW supports enabling processor at runtime */
+ /* MADT MPS INTI flags (inti_flags) */
+-- 
+2.42.0
+
diff --git a/queue-4.19/iio-exynos-adc-request-second-interupt-only-when-tou.patch b/queue-4.19/iio-exynos-adc-request-second-interupt-only-when-tou.patch
new file mode 100644 (file)
index 0000000..50339c0
--- /dev/null
@@ -0,0 +1,79 @@
+From 06e7fbec8a1ec1863e60b194ba8e28dd64817d28 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Oct 2023 12:14:12 +0200
+Subject: iio: exynos-adc: request second interupt only when touchscreen mode
+ is used
+
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+
+[ Upstream commit 865b080e3229102f160889328ce2e8e97aa65ea0 ]
+
+Second interrupt is needed only when touchscreen mode is used, so don't
+request it unconditionally. This removes the following annoying warning
+during boot:
+
+exynos-adc 14d10000.adc: error -ENXIO: IRQ index 1 not found
+
+Fixes: 2bb8ad9b44c5 ("iio: exynos-adc: add experimental touchscreen support")
+Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Link: https://lore.kernel.org/r/20231009101412.916922-1-m.szyprowski@samsung.com
+Cc: <Stable@vger.kernel.org>
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/iio/adc/exynos_adc.c | 24 ++++++++++++++----------
+ 1 file changed, 14 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
+index 1ca2c4d39f878..7c5ea4ed5332f 100644
+--- a/drivers/iio/adc/exynos_adc.c
++++ b/drivers/iio/adc/exynos_adc.c
+@@ -817,6 +817,12 @@ static int exynos_adc_probe(struct platform_device *pdev)
+               }
+       }
++      /* leave out any TS related code if unreachable */
++      if (IS_REACHABLE(CONFIG_INPUT)) {
++              has_ts = of_property_read_bool(pdev->dev.of_node,
++                                             "has-touchscreen") || pdata;
++      }
++
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0) {
+               dev_err(&pdev->dev, "no irq resource?\n");
+@@ -824,11 +830,15 @@ static int exynos_adc_probe(struct platform_device *pdev)
+       }
+       info->irq = irq;
+-      irq = platform_get_irq(pdev, 1);
+-      if (irq == -EPROBE_DEFER)
+-              return irq;
++      if (has_ts) {
++              irq = platform_get_irq(pdev, 1);
++              if (irq == -EPROBE_DEFER)
++                      return irq;
+-      info->tsirq = irq;
++              info->tsirq = irq;
++      } else {
++              info->tsirq = -1;
++      }
+       info->dev = &pdev->dev;
+@@ -895,12 +905,6 @@ static int exynos_adc_probe(struct platform_device *pdev)
+       if (info->data->init_hw)
+               info->data->init_hw(info);
+-      /* leave out any TS related code if unreachable */
+-      if (IS_REACHABLE(CONFIG_INPUT)) {
+-              has_ts = of_property_read_bool(pdev->dev.of_node,
+-                                             "has-touchscreen") || pdata;
+-      }
+-
+       if (pdata)
+               info->delay = pdata->delay;
+       else
+-- 
+2.42.0
+
index 52c431b06d6f86768305b367c12aaea27f87caf8..c4bb7849f446f2e7226ecc5481d5e3a0a7cad218 100644 (file)
@@ -19,3 +19,8 @@ i2c-stm32f7-fix-pec-handling-in-case-of-smbus-transfers.patch
 nvmem-imx-correct-nregs-for-i.mx6sll.patch
 nvmem-imx-correct-nregs-for-i.mx6ul.patch
 perf-core-fix-potential-null-deref.patch
+iio-exynos-adc-request-second-interupt-only-when-tou.patch
+acpica-add-support-for-madt-online-enabled-bit.patch
+x86-acpi-don-t-add-cpus-that-are-not-online-capable.patch
+x86-acpi-boot-use-fadt-version-to-check-support-for-.patch
+x86-i8259-skip-probing-when-acpi-madt-advertises-pca.patch
diff --git a/queue-4.19/x86-acpi-boot-use-fadt-version-to-check-support-for-.patch b/queue-4.19/x86-acpi-boot-use-fadt-version-to-check-support-for-.patch
new file mode 100644 (file)
index 0000000..9aa13b7
--- /dev/null
@@ -0,0 +1,55 @@
+From 730e9f58786ffb9b887d4318f15c98af47d1acaf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 29 Mar 2023 12:45:35 -0500
+Subject: x86/ACPI/boot: Use FADT version to check support for online capable
+
+From: Mario Limonciello <mario.limonciello@amd.com>
+
+[ Upstream commit a74fabfbd1b7013045afc8cc541e6cab3360ccb5 ]
+
+ACPI 6.3 introduced the online capable bit, and also introduced MADT
+version 5.
+
+Latter was used to distinguish whether the offset storing online capable
+could be used. However ACPI 6.2b has MADT version "45" which is for
+an errata version of the ACPI 6.2 spec.  This means that the Linux code
+for detecting availability of MADT will mistakenly flag ACPI 6.2b as
+supporting online capable which is inaccurate as it's an ACPI 6.3 feature.
+
+Instead use the FADT major and minor revision fields to distinguish this.
+
+  [ bp: Massage. ]
+
+Fixes: aa06e20f1be6 ("x86/ACPI: Don't add CPUs that are not online capable")
+Reported-by: Eric DeVolder <eric.devolder@oracle.com>
+Reported-by: Borislav Petkov <bp@alien8.de>
+Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
+Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
+Cc: <stable@kernel.org>
+Link: https://lore.kernel.org/r/943d2445-84df-d939-f578-5d8240d342cc@unsolicited.net
+Stable-dep-of: 128b0c9781c9 ("x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/kernel/acpi/boot.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
+index 5869ade7932c7..fca71bef57644 100644
+--- a/arch/x86/kernel/acpi/boot.c
++++ b/arch/x86/kernel/acpi/boot.c
+@@ -156,7 +156,11 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
+               printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n",
+                      madt->address);
+       }
+-      if (madt->header.revision >= 5)
++
++      /* ACPI 6.3 and newer support the online capable bit. */
++      if (acpi_gbl_FADT.header.revision > 6 ||
++          (acpi_gbl_FADT.header.revision == 6 &&
++           acpi_gbl_FADT.minor_revision >= 3))
+               acpi_support_online_capable = true;
+       default_acpi_madt_oem_check(madt->header.oem_id,
+-- 
+2.42.0
+
diff --git a/queue-4.19/x86-acpi-don-t-add-cpus-that-are-not-online-capable.patch b/queue-4.19/x86-acpi-don-t-add-cpus-that-are-not-online-capable.patch
new file mode 100644 (file)
index 0000000..400143c
--- /dev/null
@@ -0,0 +1,64 @@
+From a6abbca496083ad8d6e6c728634097e019a29709 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 8 Sep 2021 16:41:46 -0500
+Subject: x86/ACPI: Don't add CPUs that are not online capable
+
+From: Mario Limonciello <mario.limonciello@amd.com>
+
+[ Upstream commit aa06e20f1be628186f0c2dcec09ea0009eb69778 ]
+
+A number of systems are showing "hotplug capable" CPUs when they
+are not really hotpluggable.  This is because the MADT has extra
+CPU entries to support different CPUs that may be inserted into
+the socket with different numbers of cores.
+
+Starting with ACPI 6.3 the spec has an Online Capable bit in the
+MADT used to determine whether or not a CPU is hotplug capable
+when the enabled bit is not set.
+
+Link: https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/05_ACPI_Software_Programming_Model/ACPI_Software_Programming_Model.html?#local-apic-flags
+Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Stable-dep-of: 128b0c9781c9 ("x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/kernel/acpi/boot.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
+index 8b1aa1206d980..5869ade7932c7 100644
+--- a/arch/x86/kernel/acpi/boot.c
++++ b/arch/x86/kernel/acpi/boot.c
+@@ -78,6 +78,7 @@ int acpi_fix_pin2_polarity __initdata;
+ #ifdef CONFIG_X86_LOCAL_APIC
+ static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE;
++static bool acpi_support_online_capable;
+ #endif
+ #ifdef CONFIG_X86_IO_APIC
+@@ -155,6 +156,8 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
+               printk(KERN_DEBUG PREFIX "Local APIC address 0x%08x\n",
+                      madt->address);
+       }
++      if (madt->header.revision >= 5)
++              acpi_support_online_capable = true;
+       default_acpi_madt_oem_check(madt->header.oem_id,
+                                   madt->header.oem_table_id);
+@@ -256,6 +259,12 @@ acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end)
+       if (processor->id == 0xff)
+               return 0;
++      /* don't register processors that can not be onlined */
++      if (acpi_support_online_capable &&
++          !(processor->lapic_flags & ACPI_MADT_ENABLED) &&
++          !(processor->lapic_flags & ACPI_MADT_ONLINE_CAPABLE))
++              return 0;
++
+       /*
+        * We need to register disabled CPU as well to permit
+        * counting disabled CPUs. This allows us to size
+-- 
+2.42.0
+
diff --git a/queue-4.19/x86-i8259-skip-probing-when-acpi-madt-advertises-pca.patch b/queue-4.19/x86-i8259-skip-probing-when-acpi-madt-advertises-pca.patch
new file mode 100644 (file)
index 0000000..d2988a1
--- /dev/null
@@ -0,0 +1,151 @@
+From 4a21b5b6a53603da0bdb198838ce2659f3568e0b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 25 Oct 2023 23:04:15 +0200
+Subject: x86/i8259: Skip probing when ACPI/MADT advertises PCAT compatibility
+
+From: Thomas Gleixner <tglx@linutronix.de>
+
+[ Upstream commit 128b0c9781c9f2651bea163cb85e52a6c7be0f9e ]
+
+David and a few others reported that on certain newer systems some legacy
+interrupts fail to work correctly.
+
+Debugging revealed that the BIOS of these systems leaves the legacy PIC in
+uninitialized state which makes the PIC detection fail and the kernel
+switches to a dummy implementation.
+
+Unfortunately this fallback causes quite some code to fail as it depends on
+checks for the number of legacy PIC interrupts or the availability of the
+real PIC.
+
+In theory there is no reason to use the PIC on any modern system when
+IO/APIC is available, but the dependencies on the related checks cannot be
+resolved trivially and on short notice. This needs lots of analysis and
+rework.
+
+The PIC detection has been added to avoid quirky checks and force selection
+of the dummy implementation all over the place, especially in VM guest
+scenarios. So it's not an option to revert the relevant commit as that
+would break a lot of other scenarios.
+
+One solution would be to try to initialize the PIC on detection fail and
+retry the detection, but that puts the burden on everything which does not
+have a PIC.
+
+Fortunately the ACPI/MADT table header has a flag field, which advertises
+in bit 0 that the system is PCAT compatible, which means it has a legacy
+8259 PIC.
+
+Evaluate that bit and if set avoid the detection routine and keep the real
+PIC installed, which then gets initialized (for nothing) and makes the rest
+of the code with all the dependencies work again.
+
+Fixes: e179f6914152 ("x86, irq, pic: Probe for legacy PIC and set legacy_pic appropriately")
+Reported-by: David Lazar <dlazar@gmail.com>
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Tested-by: David Lazar <dlazar@gmail.com>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
+Cc: stable@vger.kernel.org
+Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218003
+Link: https://lore.kernel.org/r/875y2u5s8g.ffs@tglx
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/include/asm/i8259.h |  2 ++
+ arch/x86/kernel/acpi/boot.c  |  3 +++
+ arch/x86/kernel/i8259.c      | 38 ++++++++++++++++++++++++++++--------
+ 3 files changed, 35 insertions(+), 8 deletions(-)
+
+diff --git a/arch/x86/include/asm/i8259.h b/arch/x86/include/asm/i8259.h
+index 89789e8c80f66..e16574c16e933 100644
+--- a/arch/x86/include/asm/i8259.h
++++ b/arch/x86/include/asm/i8259.h
+@@ -67,6 +67,8 @@ struct legacy_pic {
+       void (*make_irq)(unsigned int irq);
+ };
++void legacy_pic_pcat_compat(void);
++
+ extern struct legacy_pic *legacy_pic;
+ extern struct legacy_pic null_legacy_pic;
+diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
+index fca71bef57644..6302f425998de 100644
+--- a/arch/x86/kernel/acpi/boot.c
++++ b/arch/x86/kernel/acpi/boot.c
+@@ -157,6 +157,9 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
+                      madt->address);
+       }
++      if (madt->flags & ACPI_MADT_PCAT_COMPAT)
++              legacy_pic_pcat_compat();
++
+       /* ACPI 6.3 and newer support the online capable bit. */
+       if (acpi_gbl_FADT.header.revision > 6 ||
+           (acpi_gbl_FADT.header.revision == 6 &&
+diff --git a/arch/x86/kernel/i8259.c b/arch/x86/kernel/i8259.c
+index 8821d0ab0a08c..82753622f4890 100644
+--- a/arch/x86/kernel/i8259.c
++++ b/arch/x86/kernel/i8259.c
+@@ -32,6 +32,7 @@
+  */
+ static void init_8259A(int auto_eoi);
++static bool pcat_compat __ro_after_init;
+ static int i8259A_auto_eoi;
+ DEFINE_RAW_SPINLOCK(i8259A_lock);
+@@ -301,15 +302,32 @@ static void unmask_8259A(void)
+ static int probe_8259A(void)
+ {
++      unsigned char new_val, probe_val = ~(1 << PIC_CASCADE_IR);
+       unsigned long flags;
+-      unsigned char probe_val = ~(1 << PIC_CASCADE_IR);
+-      unsigned char new_val;
++
++      /*
++       * If MADT has the PCAT_COMPAT flag set, then do not bother probing
++       * for the PIC. Some BIOSes leave the PIC uninitialized and probing
++       * fails.
++       *
++       * Right now this causes problems as quite some code depends on
++       * nr_legacy_irqs() > 0 or has_legacy_pic() == true. This is silly
++       * when the system has an IO/APIC because then PIC is not required
++       * at all, except for really old machines where the timer interrupt
++       * must be routed through the PIC. So just pretend that the PIC is
++       * there and let legacy_pic->init() initialize it for nothing.
++       *
++       * Alternatively this could just try to initialize the PIC and
++       * repeat the probe, but for cases where there is no PIC that's
++       * just pointless.
++       */
++      if (pcat_compat)
++              return nr_legacy_irqs();
++
+       /*
+-       * Check to see if we have a PIC.
+-       * Mask all except the cascade and read
+-       * back the value we just wrote. If we don't
+-       * have a PIC, we will read 0xff as opposed to the
+-       * value we wrote.
++       * Check to see if we have a PIC.  Mask all except the cascade and
++       * read back the value we just wrote. If we don't have a PIC, we
++       * will read 0xff as opposed to the value we wrote.
+        */
+       raw_spin_lock_irqsave(&i8259A_lock, flags);
+@@ -431,5 +449,9 @@ static int __init i8259A_init_ops(void)
+       return 0;
+ }
+-
+ device_initcall(i8259A_init_ops);
++
++void __init legacy_pic_pcat_compat(void)
++{
++      pcat_compat = true;
++}
+-- 
+2.42.0
+