]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 9 Mar 2025 10:37:18 +0000 (11:37 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 9 Mar 2025 10:37:18 +0000 (11:37 +0100)
added patches:
alsa-hda-intel-add-dell-alc3271-to-power_save-denylist.patch
alsa-hda-realtek-update-alc222-depop-optimize.patch
drm-radeon-fix-rs400_gpu_init-for-ati-mobility-radeon-xpress-200m.patch
gpio-aggregator-protect-driver-attr-handlers-against-module-unload.patch
gpio-rcar-use-raw_spinlock-to-protect-register-access.patch
hid-appleir-fix-potential-null-dereference-at-raw-event-handle.patch
platform-x86-thinkpad_acpi-add-battery-quirk-for-thinkpad-x131e.patch
revert-of-reserved-memory-fix-using-wrong-number-of-cells-to-get-property-alignment.patch
x86-cacheinfo-validate-cpuid-leaf-0x2-edx-output.patch
x86-cpu-properly-parse-cpuid-leaf-0x2-tlb-descriptor-0x63.patch
x86-cpu-validate-cpuid-leaf-0x2-edx-output.patch

12 files changed:
queue-5.15/alsa-hda-intel-add-dell-alc3271-to-power_save-denylist.patch [new file with mode: 0644]
queue-5.15/alsa-hda-realtek-update-alc222-depop-optimize.patch [new file with mode: 0644]
queue-5.15/drm-radeon-fix-rs400_gpu_init-for-ati-mobility-radeon-xpress-200m.patch [new file with mode: 0644]
queue-5.15/gpio-aggregator-protect-driver-attr-handlers-against-module-unload.patch [new file with mode: 0644]
queue-5.15/gpio-rcar-use-raw_spinlock-to-protect-register-access.patch [new file with mode: 0644]
queue-5.15/hid-appleir-fix-potential-null-dereference-at-raw-event-handle.patch [new file with mode: 0644]
queue-5.15/platform-x86-thinkpad_acpi-add-battery-quirk-for-thinkpad-x131e.patch [new file with mode: 0644]
queue-5.15/revert-of-reserved-memory-fix-using-wrong-number-of-cells-to-get-property-alignment.patch [new file with mode: 0644]
queue-5.15/series
queue-5.15/x86-cacheinfo-validate-cpuid-leaf-0x2-edx-output.patch [new file with mode: 0644]
queue-5.15/x86-cpu-properly-parse-cpuid-leaf-0x2-tlb-descriptor-0x63.patch [new file with mode: 0644]
queue-5.15/x86-cpu-validate-cpuid-leaf-0x2-edx-output.patch [new file with mode: 0644]

diff --git a/queue-5.15/alsa-hda-intel-add-dell-alc3271-to-power_save-denylist.patch b/queue-5.15/alsa-hda-intel-add-dell-alc3271-to-power_save-denylist.patch
new file mode 100644 (file)
index 0000000..7be46a3
--- /dev/null
@@ -0,0 +1,57 @@
+From 1ee5aa765c22a0577ec552d460bf2035300b4b51 Mon Sep 17 00:00:00 2001
+From: Hoku Ishibe <me@hokuishi.be>
+Date: Sun, 23 Feb 2025 21:05:17 -0500
+Subject: ALSA: hda: intel: Add Dell ALC3271 to power_save denylist
+
+From: Hoku Ishibe <me@hokuishi.be>
+
+commit 1ee5aa765c22a0577ec552d460bf2035300b4b51 upstream.
+
+Dell XPS 13 7390 with the Realtek ALC3271 codec experiences
+persistent humming noise when the power_save mode is enabled.
+This issue occurs when the codec enters power saving mode,
+leading to unwanted noise from the speakers.
+
+This patch adds the affected model (PCI ID 0x1028:0x0962) to the
+power_save denylist to ensure power_save is disabled by default,
+preventing power-off related noise issues.
+
+Steps to Reproduce
+1. Boot the system with `snd_hda_intel` loaded.
+2. Verify that `power_save` mode is enabled:
+```sh
+cat /sys/module/snd_hda_intel/parameters/power_save
+````
+output: 10 (default power save timeout)
+3. Wait for the power save timeout
+4. Observe a persistent humming noise from the speakers
+5. Disable `power_save` manually:
+```sh
+echo 0 | sudo tee /sys/module/snd_hda_intel/parameters/power_save
+````
+6. Confirm that the noise disappears immediately.
+
+This issue has been observed on my system, and this patch
+successfully eliminates the unwanted noise. If other users
+experience similar issues, additional reports would be helpful.
+
+Signed-off-by: Hoku Ishibe <me@hokuishi.be>
+Cc: <stable@vger.kernel.org>
+Link: https://patch.msgid.link/20250224020517.51035-1-me@hokuishi.be
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/hda_intel.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -2212,6 +2212,8 @@ static const struct snd_pci_quirk power_
+       SND_PCI_QUIRK(0x1631, 0xe017, "Packard Bell NEC IMEDIA 5204", 0),
+       /* KONTRON SinglePC may cause a stall at runtime resume */
+       SND_PCI_QUIRK(0x1734, 0x1232, "KONTRON SinglePC", 0),
++      /* Dell ALC3271 */
++      SND_PCI_QUIRK(0x1028, 0x0962, "Dell ALC3271", 0),
+       {}
+ };
+ #endif /* CONFIG_PM */
diff --git a/queue-5.15/alsa-hda-realtek-update-alc222-depop-optimize.patch b/queue-5.15/alsa-hda-realtek-update-alc222-depop-optimize.patch
new file mode 100644 (file)
index 0000000..0802c8b
--- /dev/null
@@ -0,0 +1,116 @@
+From ca0dedaff92307591f66c9206933fbdfe87add10 Mon Sep 17 00:00:00 2001
+From: Kailang Yang <kailang@realtek.com>
+Date: Wed, 5 Mar 2025 13:54:34 +0800
+Subject: ALSA: hda/realtek: update ALC222 depop optimize
+
+From: Kailang Yang <kailang@realtek.com>
+
+commit ca0dedaff92307591f66c9206933fbdfe87add10 upstream.
+
+Add ALC222 its own depop functions for alc_init and alc_shutup.
+
+[note: this fixes pop noise issues on the models with two headphone
+ jacks -- tiwai ]
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ sound/pci/hda/patch_realtek.c |   76 ++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 76 insertions(+)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -3825,6 +3825,79 @@ static void alc225_shutup(struct hda_cod
+       }
+ }
++static void alc222_init(struct hda_codec *codec)
++{
++      struct alc_spec *spec = codec->spec;
++      hda_nid_t hp_pin = alc_get_hp_pin(spec);
++      bool hp1_pin_sense, hp2_pin_sense;
++
++      if (!hp_pin)
++              return;
++
++      msleep(30);
++
++      hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
++      hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
++
++      if (hp1_pin_sense || hp2_pin_sense) {
++              msleep(2);
++
++              if (hp1_pin_sense)
++                      snd_hda_codec_write(codec, hp_pin, 0,
++                                  AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
++              if (hp2_pin_sense)
++                      snd_hda_codec_write(codec, 0x14, 0,
++                                  AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
++              msleep(75);
++
++              if (hp1_pin_sense)
++                      snd_hda_codec_write(codec, hp_pin, 0,
++                                  AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
++              if (hp2_pin_sense)
++                      snd_hda_codec_write(codec, 0x14, 0,
++                                  AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
++
++              msleep(75);
++      }
++}
++
++static void alc222_shutup(struct hda_codec *codec)
++{
++      struct alc_spec *spec = codec->spec;
++      hda_nid_t hp_pin = alc_get_hp_pin(spec);
++      bool hp1_pin_sense, hp2_pin_sense;
++
++      if (!hp_pin)
++              hp_pin = 0x21;
++
++      hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
++      hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
++
++      if (hp1_pin_sense || hp2_pin_sense) {
++              msleep(2);
++
++              if (hp1_pin_sense)
++                      snd_hda_codec_write(codec, hp_pin, 0,
++                                  AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
++              if (hp2_pin_sense)
++                      snd_hda_codec_write(codec, 0x14, 0,
++                                  AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
++
++              msleep(75);
++
++              if (hp1_pin_sense)
++                      snd_hda_codec_write(codec, hp_pin, 0,
++                                  AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
++              if (hp2_pin_sense)
++                      snd_hda_codec_write(codec, 0x14, 0,
++                                  AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
++
++              msleep(75);
++      }
++      alc_auto_setup_eapd(codec, false);
++      alc_shutup_pins(codec);
++}
++
+ static void alc_default_init(struct hda_codec *codec)
+ {
+       struct alc_spec *spec = codec->spec;
+@@ -10374,8 +10447,11 @@ static int patch_alc269(struct hda_codec
+               spec->codec_variant = ALC269_TYPE_ALC300;
+               spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
+               break;
++      case 0x10ec0222:
+       case 0x10ec0623:
+               spec->codec_variant = ALC269_TYPE_ALC623;
++              spec->shutup = alc222_shutup;
++              spec->init_hook = alc222_init;
+               break;
+       case 0x10ec0700:
+       case 0x10ec0701:
diff --git a/queue-5.15/drm-radeon-fix-rs400_gpu_init-for-ati-mobility-radeon-xpress-200m.patch b/queue-5.15/drm-radeon-fix-rs400_gpu_init-for-ati-mobility-radeon-xpress-200m.patch
new file mode 100644 (file)
index 0000000..5d3fad8
--- /dev/null
@@ -0,0 +1,78 @@
+From 29ffeb73b216ce3eff10229eb077cf9b7812119d Mon Sep 17 00:00:00 2001
+From: Richard Thier <u9vata@gmail.com>
+Date: Mon, 17 Jun 2019 23:46:27 +0200
+Subject: drm/radeon: Fix rs400_gpu_init for ATI mobility radeon Xpress 200M
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Richard Thier <u9vata@gmail.com>
+
+commit 29ffeb73b216ce3eff10229eb077cf9b7812119d upstream.
+
+num_gb_pipes was set to a wrong value using r420_pipe_config
+
+This have lead to HyperZ glitches on fast Z clearing.
+
+Closes: https://bugs.freedesktop.org/show_bug.cgi?id=110897
+Reviewed-by: Marek Olšák <marek.olsak@amd.com>
+Signed-off-by: Richard Thier <u9vata@gmail.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+(cherry picked from commit 044e59a85c4d84e3c8d004c486e5c479640563a6)
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/radeon/r300.c        |    3 ++-
+ drivers/gpu/drm/radeon/radeon_asic.h |    1 +
+ drivers/gpu/drm/radeon/rs400.c       |   18 ++++++++++++++++--
+ 3 files changed, 19 insertions(+), 3 deletions(-)
+
+--- a/drivers/gpu/drm/radeon/r300.c
++++ b/drivers/gpu/drm/radeon/r300.c
+@@ -359,7 +359,8 @@ int r300_mc_wait_for_idle(struct radeon_
+       return -1;
+ }
+-static void r300_gpu_init(struct radeon_device *rdev)
++/* rs400_gpu_init also calls this! */
++void r300_gpu_init(struct radeon_device *rdev)
+ {
+       uint32_t gb_tile_config, tmp;
+--- a/drivers/gpu/drm/radeon/radeon_asic.h
++++ b/drivers/gpu/drm/radeon/radeon_asic.h
+@@ -165,6 +165,7 @@ void r200_set_safe_registers(struct rade
+  */
+ extern int r300_init(struct radeon_device *rdev);
+ extern void r300_fini(struct radeon_device *rdev);
++extern void r300_gpu_init(struct radeon_device *rdev);
+ extern int r300_suspend(struct radeon_device *rdev);
+ extern int r300_resume(struct radeon_device *rdev);
+ extern int r300_asic_reset(struct radeon_device *rdev, bool hard);
+--- a/drivers/gpu/drm/radeon/rs400.c
++++ b/drivers/gpu/drm/radeon/rs400.c
+@@ -255,8 +255,22 @@ int rs400_mc_wait_for_idle(struct radeon
+ static void rs400_gpu_init(struct radeon_device *rdev)
+ {
+-      /* FIXME: is this correct ? */
+-      r420_pipes_init(rdev);
++      /* Earlier code was calling r420_pipes_init and then
++       * rs400_mc_wait_for_idle(rdev). The problem is that
++       * at least on my Mobility Radeon Xpress 200M RC410 card
++       * that ends up in this code path ends up num_gb_pipes == 3
++       * while the card seems to have only one pipe. With the
++       * r420 pipe initialization method.
++       *
++       * Problems shown up as HyperZ glitches, see:
++       * https://bugs.freedesktop.org/show_bug.cgi?id=110897
++       *
++       * Delegating initialization to r300 code seems to work
++       * and results in proper pipe numbers. The rs400 cards
++       * are said to be not r400, but r300 kind of cards.
++       */
++      r300_gpu_init(rdev);
++
+       if (rs400_mc_wait_for_idle(rdev)) {
+               pr_warn("rs400: Failed to wait MC idle while programming pipes. Bad things might happen. %08x\n",
+                       RREG32(RADEON_MC_STATUS));
diff --git a/queue-5.15/gpio-aggregator-protect-driver-attr-handlers-against-module-unload.patch b/queue-5.15/gpio-aggregator-protect-driver-attr-handlers-against-module-unload.patch
new file mode 100644 (file)
index 0000000..fcf5015
--- /dev/null
@@ -0,0 +1,132 @@
+From 12f65d1203507f7db3ba59930fe29a3b8eee9945 Mon Sep 17 00:00:00 2001
+From: Koichiro Den <koichiro.den@canonical.com>
+Date: Mon, 24 Feb 2025 23:31:26 +0900
+Subject: gpio: aggregator: protect driver attr handlers against module unload
+
+From: Koichiro Den <koichiro.den@canonical.com>
+
+commit 12f65d1203507f7db3ba59930fe29a3b8eee9945 upstream.
+
+Both new_device_store and delete_device_store touch module global
+resources (e.g. gpio_aggregator_lock). To prevent race conditions with
+module unload, a reference needs to be held.
+
+Add try_module_get() in these handlers.
+
+For new_device_store, this eliminates what appears to be the most dangerous
+scenario: if an id is allocated from gpio_aggregator_idr but
+platform_device_register has not yet been called or completed, a concurrent
+module unload could fail to unregister/delete the device, leaving behind a
+dangling platform device/GPIO forwarder. This can result in various issues.
+The following simple reproducer demonstrates these problems:
+
+  #!/bin/bash
+  while :; do
+    # note: whether 'gpiochip0 0' exists or not does not matter.
+    echo 'gpiochip0 0' > /sys/bus/platform/drivers/gpio-aggregator/new_device
+  done &
+  while :; do
+    modprobe gpio-aggregator
+    modprobe -r gpio-aggregator
+  done &
+  wait
+
+  Starting with the following warning, several kinds of warnings will appear
+  and the system may become unstable:
+
+  ------------[ cut here ]------------
+  list_del corruption, ffff888103e2e980->next is LIST_POISON1 (dead000000000100)
+  WARNING: CPU: 1 PID: 1327 at lib/list_debug.c:56 __list_del_entry_valid_or_report+0xa3/0x120
+  [...]
+  RIP: 0010:__list_del_entry_valid_or_report+0xa3/0x120
+  [...]
+  Call Trace:
+   <TASK>
+   ? __list_del_entry_valid_or_report+0xa3/0x120
+   ? __warn.cold+0x93/0xf2
+   ? __list_del_entry_valid_or_report+0xa3/0x120
+   ? report_bug+0xe6/0x170
+   ? __irq_work_queue_local+0x39/0xe0
+   ? handle_bug+0x58/0x90
+   ? exc_invalid_op+0x13/0x60
+   ? asm_exc_invalid_op+0x16/0x20
+   ? __list_del_entry_valid_or_report+0xa3/0x120
+   gpiod_remove_lookup_table+0x22/0x60
+   new_device_store+0x315/0x350 [gpio_aggregator]
+   kernfs_fop_write_iter+0x137/0x1f0
+   vfs_write+0x262/0x430
+   ksys_write+0x60/0xd0
+   do_syscall_64+0x6c/0x180
+   entry_SYSCALL_64_after_hwframe+0x76/0x7e
+   [...]
+   </TASK>
+  ---[ end trace 0000000000000000 ]---
+
+Fixes: 828546e24280 ("gpio: Add GPIO Aggregator")
+Cc: stable@vger.kernel.org
+Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
+Link: https://lore.kernel.org/r/20250224143134.3024598-2-koichiro.den@canonical.com
+Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpio/gpio-aggregator.c |   20 +++++++++++++++++---
+ 1 file changed, 17 insertions(+), 3 deletions(-)
+
+--- a/drivers/gpio/gpio-aggregator.c
++++ b/drivers/gpio/gpio-aggregator.c
+@@ -116,10 +116,15 @@ static ssize_t new_device_store(struct d
+       struct platform_device *pdev;
+       int res, id;
++      if (!try_module_get(THIS_MODULE))
++              return -ENOENT;
++
+       /* kernfs guarantees string termination, so count + 1 is safe */
+       aggr = kzalloc(sizeof(*aggr) + count + 1, GFP_KERNEL);
+-      if (!aggr)
+-              return -ENOMEM;
++      if (!aggr) {
++              res = -ENOMEM;
++              goto put_module;
++      }
+       memcpy(aggr->args, buf, count + 1);
+@@ -158,6 +163,7 @@ static ssize_t new_device_store(struct d
+       }
+       aggr->pdev = pdev;
++      module_put(THIS_MODULE);
+       return count;
+ remove_table:
+@@ -172,6 +178,8 @@ free_table:
+       kfree(aggr->lookups);
+ free_ga:
+       kfree(aggr);
++put_module:
++      module_put(THIS_MODULE);
+       return res;
+ }
+@@ -200,13 +208,19 @@ static ssize_t delete_device_store(struc
+       if (error)
+               return error;
++      if (!try_module_get(THIS_MODULE))
++              return -ENOENT;
++
+       mutex_lock(&gpio_aggregator_lock);
+       aggr = idr_remove(&gpio_aggregator_idr, id);
+       mutex_unlock(&gpio_aggregator_lock);
+-      if (!aggr)
++      if (!aggr) {
++              module_put(THIS_MODULE);
+               return -ENOENT;
++      }
+       gpio_aggregator_free(aggr);
++      module_put(THIS_MODULE);
+       return count;
+ }
+ static DRIVER_ATTR_WO(delete_device);
diff --git a/queue-5.15/gpio-rcar-use-raw_spinlock-to-protect-register-access.patch b/queue-5.15/gpio-rcar-use-raw_spinlock-to-protect-register-access.patch
new file mode 100644 (file)
index 0000000..03cc1ed
--- /dev/null
@@ -0,0 +1,186 @@
+From f02c41f87cfe61440c18bf77d1ef0a884b9ee2b5 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Niklas=20S=C3=B6derlund?=
+ <niklas.soderlund+renesas@ragnatech.se>
+Date: Tue, 21 Jan 2025 14:58:33 +0100
+Subject: gpio: rcar: Use raw_spinlock to protect register access
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
+
+commit f02c41f87cfe61440c18bf77d1ef0a884b9ee2b5 upstream.
+
+Use raw_spinlock in order to fix spurious messages about invalid context
+when spinlock debugging is enabled. The lock is only used to serialize
+register access.
+
+    [    4.239592] =============================
+    [    4.239595] [ BUG: Invalid wait context ]
+    [    4.239599] 6.13.0-rc7-arm64-renesas-05496-gd088502a519f #35 Not tainted
+    [    4.239603] -----------------------------
+    [    4.239606] kworker/u8:5/76 is trying to lock:
+    [    4.239609] ffff0000091898a0 (&p->lock){....}-{3:3}, at: gpio_rcar_config_interrupt_input_mode+0x34/0x164
+    [    4.239641] other info that might help us debug this:
+    [    4.239643] context-{5:5}
+    [    4.239646] 5 locks held by kworker/u8:5/76:
+    [    4.239651]  #0: ffff0000080fb148 ((wq_completion)async){+.+.}-{0:0}, at: process_one_work+0x190/0x62c
+    [    4.250180] OF: /soc/sound@ec500000/ports/port@0/endpoint: Read of boolean property 'frame-master' with a value.
+    [    4.254094]  #1: ffff80008299bd80 ((work_completion)(&entry->work)){+.+.}-{0:0}, at: process_one_work+0x1b8/0x62c
+    [    4.254109]  #2: ffff00000920c8f8
+    [    4.258345] OF: /soc/sound@ec500000/ports/port@1/endpoint: Read of boolean property 'bitclock-master' with a value.
+    [    4.264803]  (&dev->mutex){....}-{4:4}, at: __device_attach_async_helper+0x3c/0xdc
+    [    4.264820]  #3: ffff00000a50ca40 (request_class#2){+.+.}-{4:4}, at: __setup_irq+0xa0/0x690
+    [    4.264840]  #4:
+    [    4.268872] OF: /soc/sound@ec500000/ports/port@1/endpoint: Read of boolean property 'frame-master' with a value.
+    [    4.273275] ffff00000a50c8c8 (lock_class){....}-{2:2}, at: __setup_irq+0xc4/0x690
+    [    4.296130] renesas_sdhi_internal_dmac ee100000.mmc: mmc1 base at 0x00000000ee100000, max clock rate 200 MHz
+    [    4.304082] stack backtrace:
+    [    4.304086] CPU: 1 UID: 0 PID: 76 Comm: kworker/u8:5 Not tainted 6.13.0-rc7-arm64-renesas-05496-gd088502a519f #35
+    [    4.304092] Hardware name: Renesas Salvator-X 2nd version board based on r8a77965 (DT)
+    [    4.304097] Workqueue: async async_run_entry_fn
+    [    4.304106] Call trace:
+    [    4.304110]  show_stack+0x14/0x20 (C)
+    [    4.304122]  dump_stack_lvl+0x6c/0x90
+    [    4.304131]  dump_stack+0x14/0x1c
+    [    4.304138]  __lock_acquire+0xdfc/0x1584
+    [    4.426274]  lock_acquire+0x1c4/0x33c
+    [    4.429942]  _raw_spin_lock_irqsave+0x5c/0x80
+    [    4.434307]  gpio_rcar_config_interrupt_input_mode+0x34/0x164
+    [    4.440061]  gpio_rcar_irq_set_type+0xd4/0xd8
+    [    4.444422]  __irq_set_trigger+0x5c/0x178
+    [    4.448435]  __setup_irq+0x2e4/0x690
+    [    4.452012]  request_threaded_irq+0xc4/0x190
+    [    4.456285]  devm_request_threaded_irq+0x7c/0xf4
+    [    4.459398] ata1: link resume succeeded after 1 retries
+    [    4.460902]  mmc_gpiod_request_cd_irq+0x68/0xe0
+    [    4.470660]  mmc_start_host+0x50/0xac
+    [    4.474327]  mmc_add_host+0x80/0xe4
+    [    4.477817]  tmio_mmc_host_probe+0x2b0/0x440
+    [    4.482094]  renesas_sdhi_probe+0x488/0x6f4
+    [    4.486281]  renesas_sdhi_internal_dmac_probe+0x60/0x78
+    [    4.491509]  platform_probe+0x64/0xd8
+    [    4.495178]  really_probe+0xb8/0x2a8
+    [    4.498756]  __driver_probe_device+0x74/0x118
+    [    4.503116]  driver_probe_device+0x3c/0x154
+    [    4.507303]  __device_attach_driver+0xd4/0x160
+    [    4.511750]  bus_for_each_drv+0x84/0xe0
+    [    4.515588]  __device_attach_async_helper+0xb0/0xdc
+    [    4.520470]  async_run_entry_fn+0x30/0xd8
+    [    4.524481]  process_one_work+0x210/0x62c
+    [    4.528494]  worker_thread+0x1ac/0x340
+    [    4.532245]  kthread+0x10c/0x110
+    [    4.535476]  ret_from_fork+0x10/0x20
+
+Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
+Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20250121135833.3769310-1-niklas.soderlund+renesas@ragnatech.se
+Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpio/gpio-rcar.c |   24 ++++++++++++------------
+ 1 file changed, 12 insertions(+), 12 deletions(-)
+
+--- a/drivers/gpio/gpio-rcar.c
++++ b/drivers/gpio/gpio-rcar.c
+@@ -41,7 +41,7 @@ struct gpio_rcar_info {
+ struct gpio_rcar_priv {
+       void __iomem *base;
+-      spinlock_t lock;
++      raw_spinlock_t lock;
+       struct device *dev;
+       struct gpio_chip gpio_chip;
+       struct irq_chip irq_chip;
+@@ -121,7 +121,7 @@ static void gpio_rcar_config_interrupt_i
+        * "Setting Level-Sensitive Interrupt Input Mode"
+        */
+-      spin_lock_irqsave(&p->lock, flags);
++      raw_spin_lock_irqsave(&p->lock, flags);
+       /* Configure positive or negative logic in POSNEG */
+       gpio_rcar_modify_bit(p, POSNEG, hwirq, !active_high_rising_edge);
+@@ -140,7 +140,7 @@ static void gpio_rcar_config_interrupt_i
+       if (!level_trigger)
+               gpio_rcar_write(p, INTCLR, BIT(hwirq));
+-      spin_unlock_irqrestore(&p->lock, flags);
++      raw_spin_unlock_irqrestore(&p->lock, flags);
+ }
+ static int gpio_rcar_irq_set_type(struct irq_data *d, unsigned int type)
+@@ -233,7 +233,7 @@ static void gpio_rcar_config_general_inp
+        * "Setting General Input Mode"
+        */
+-      spin_lock_irqsave(&p->lock, flags);
++      raw_spin_lock_irqsave(&p->lock, flags);
+       /* Configure positive logic in POSNEG */
+       gpio_rcar_modify_bit(p, POSNEG, gpio, false);
+@@ -248,7 +248,7 @@ static void gpio_rcar_config_general_inp
+       if (p->info.has_outdtsel && output)
+               gpio_rcar_modify_bit(p, OUTDTSEL, gpio, false);
+-      spin_unlock_irqrestore(&p->lock, flags);
++      raw_spin_unlock_irqrestore(&p->lock, flags);
+ }
+ static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset)
+@@ -334,7 +334,7 @@ static int gpio_rcar_get_multiple(struct
+               return 0;
+       }
+-      spin_lock_irqsave(&p->lock, flags);
++      raw_spin_lock_irqsave(&p->lock, flags);
+       outputs = gpio_rcar_read(p, INOUTSEL);
+       m = outputs & bankmask;
+       if (m)
+@@ -343,7 +343,7 @@ static int gpio_rcar_get_multiple(struct
+       m = ~outputs & bankmask;
+       if (m)
+               val |= gpio_rcar_read(p, INDT) & m;
+-      spin_unlock_irqrestore(&p->lock, flags);
++      raw_spin_unlock_irqrestore(&p->lock, flags);
+       bits[0] = val;
+       return 0;
+@@ -354,9 +354,9 @@ static void gpio_rcar_set(struct gpio_ch
+       struct gpio_rcar_priv *p = gpiochip_get_data(chip);
+       unsigned long flags;
+-      spin_lock_irqsave(&p->lock, flags);
++      raw_spin_lock_irqsave(&p->lock, flags);
+       gpio_rcar_modify_bit(p, OUTDT, offset, value);
+-      spin_unlock_irqrestore(&p->lock, flags);
++      raw_spin_unlock_irqrestore(&p->lock, flags);
+ }
+ static void gpio_rcar_set_multiple(struct gpio_chip *chip, unsigned long *mask,
+@@ -373,12 +373,12 @@ static void gpio_rcar_set_multiple(struc
+       if (!bankmask)
+               return;
+-      spin_lock_irqsave(&p->lock, flags);
++      raw_spin_lock_irqsave(&p->lock, flags);
+       val = gpio_rcar_read(p, OUTDT);
+       val &= ~bankmask;
+       val |= (bankmask & bits[0]);
+       gpio_rcar_write(p, OUTDT, val);
+-      spin_unlock_irqrestore(&p->lock, flags);
++      raw_spin_unlock_irqrestore(&p->lock, flags);
+ }
+ static int gpio_rcar_direction_output(struct gpio_chip *chip, unsigned offset,
+@@ -491,7 +491,7 @@ static int gpio_rcar_probe(struct platfo
+               return -ENOMEM;
+       p->dev = dev;
+-      spin_lock_init(&p->lock);
++      raw_spin_lock_init(&p->lock);
+       /* Get device configuration from DT node */
+       ret = gpio_rcar_parse_dt(p, &npins);
diff --git a/queue-5.15/hid-appleir-fix-potential-null-dereference-at-raw-event-handle.patch b/queue-5.15/hid-appleir-fix-potential-null-dereference-at-raw-event-handle.patch
new file mode 100644 (file)
index 0000000..28b0dd1
--- /dev/null
@@ -0,0 +1,100 @@
+From 2ff5baa9b5275e3acafdf7f2089f74cccb2f38d1 Mon Sep 17 00:00:00 2001
+From: Daniil Dulov <d.dulov@aladdin.ru>
+Date: Mon, 24 Feb 2025 20:30:30 +0300
+Subject: HID: appleir: Fix potential NULL dereference at raw event handle
+
+From: Daniil Dulov <d.dulov@aladdin.ru>
+
+commit 2ff5baa9b5275e3acafdf7f2089f74cccb2f38d1 upstream.
+
+Syzkaller reports a NULL pointer dereference issue in input_event().
+
+BUG: KASAN: null-ptr-deref in instrument_atomic_read include/linux/instrumented.h:68 [inline]
+BUG: KASAN: null-ptr-deref in _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
+BUG: KASAN: null-ptr-deref in is_event_supported drivers/input/input.c:67 [inline]
+BUG: KASAN: null-ptr-deref in input_event+0x42/0xa0 drivers/input/input.c:395
+Read of size 8 at addr 0000000000000028 by task syz-executor199/2949
+
+CPU: 0 UID: 0 PID: 2949 Comm: syz-executor199 Not tainted 6.13.0-rc4-syzkaller-00076-gf097a36ef88d #0
+Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024
+Call Trace:
+ <IRQ>
+ __dump_stack lib/dump_stack.c:94 [inline]
+ dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120
+ kasan_report+0xd9/0x110 mm/kasan/report.c:602
+ check_region_inline mm/kasan/generic.c:183 [inline]
+ kasan_check_range+0xef/0x1a0 mm/kasan/generic.c:189
+ instrument_atomic_read include/linux/instrumented.h:68 [inline]
+ _test_bit include/asm-generic/bitops/instrumented-non-atomic.h:141 [inline]
+ is_event_supported drivers/input/input.c:67 [inline]
+ input_event+0x42/0xa0 drivers/input/input.c:395
+ input_report_key include/linux/input.h:439 [inline]
+ key_down drivers/hid/hid-appleir.c:159 [inline]
+ appleir_raw_event+0x3e5/0x5e0 drivers/hid/hid-appleir.c:232
+ __hid_input_report.constprop.0+0x312/0x440 drivers/hid/hid-core.c:2111
+ hid_ctrl+0x49f/0x550 drivers/hid/usbhid/hid-core.c:484
+ __usb_hcd_giveback_urb+0x389/0x6e0 drivers/usb/core/hcd.c:1650
+ usb_hcd_giveback_urb+0x396/0x450 drivers/usb/core/hcd.c:1734
+ dummy_timer+0x17f7/0x3960 drivers/usb/gadget/udc/dummy_hcd.c:1993
+ __run_hrtimer kernel/time/hrtimer.c:1739 [inline]
+ __hrtimer_run_queues+0x20a/0xae0 kernel/time/hrtimer.c:1803
+ hrtimer_run_softirq+0x17d/0x350 kernel/time/hrtimer.c:1820
+ handle_softirqs+0x206/0x8d0 kernel/softirq.c:561
+ __do_softirq kernel/softirq.c:595 [inline]
+ invoke_softirq kernel/softirq.c:435 [inline]
+ __irq_exit_rcu+0xfa/0x160 kernel/softirq.c:662
+ irq_exit_rcu+0x9/0x30 kernel/softirq.c:678
+ instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline]
+ sysvec_apic_timer_interrupt+0x90/0xb0 arch/x86/kernel/apic/apic.c:1049
+ </IRQ>
+ <TASK>
+ asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:702
+ __mod_timer+0x8f6/0xdc0 kernel/time/timer.c:1185
+ add_timer+0x62/0x90 kernel/time/timer.c:1295
+ schedule_timeout+0x11f/0x280 kernel/time/sleep_timeout.c:98
+ usbhid_wait_io+0x1c7/0x380 drivers/hid/usbhid/hid-core.c:645
+ usbhid_init_reports+0x19f/0x390 drivers/hid/usbhid/hid-core.c:784
+ hiddev_ioctl+0x1133/0x15b0 drivers/hid/usbhid/hiddev.c:794
+ vfs_ioctl fs/ioctl.c:51 [inline]
+ __do_sys_ioctl fs/ioctl.c:906 [inline]
+ __se_sys_ioctl fs/ioctl.c:892 [inline]
+ __x64_sys_ioctl+0x190/0x200 fs/ioctl.c:892
+ do_syscall_x64 arch/x86/entry/common.c:52 [inline]
+ do_syscall_64+0xcd/0x250 arch/x86/entry/common.c:83
+ entry_SYSCALL_64_after_hwframe+0x77/0x7f
+ </TASK>
+
+This happens due to the malformed report items sent by the emulated device
+which results in a report, that has no fields, being added to the report list.
+Due to this appleir_input_configured() is never called, hidinput_connect()
+fails which results in the HID_CLAIMED_INPUT flag is not being set. However,
+it  does not make appleir_probe() fail and lets the event callback to be
+called without the associated input device.
+
+Thus, add a check for the HID_CLAIMED_INPUT flag and leave the event hook
+early if the driver didn't claim any input_dev for some reason. Moreover,
+some other hid drivers accessing input_dev in their event callbacks do have
+similar checks, too.
+
+Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
+
+Fixes: 9a4a5574ce42 ("HID: appleir: add support for Apple ir devices")
+Cc: stable@vger.kernel.org
+Signed-off-by: Daniil Dulov <d.dulov@aladdin.ru>
+Signed-off-by: Jiri Kosina <jkosina@suse.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/hid/hid-appleir.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/hid/hid-appleir.c
++++ b/drivers/hid/hid-appleir.c
+@@ -188,7 +188,7 @@ static int appleir_raw_event(struct hid_
+       static const u8 flatbattery[] = { 0x25, 0x87, 0xe0 };
+       unsigned long flags;
+-      if (len != 5)
++      if (len != 5 || !(hid->claimed & HID_CLAIMED_INPUT))
+               goto out;
+       if (!memcmp(data, keydown, sizeof(keydown))) {
diff --git a/queue-5.15/platform-x86-thinkpad_acpi-add-battery-quirk-for-thinkpad-x131e.patch b/queue-5.15/platform-x86-thinkpad_acpi-add-battery-quirk-for-thinkpad-x131e.patch
new file mode 100644 (file)
index 0000000..bc75c65
--- /dev/null
@@ -0,0 +1,43 @@
+From d0d10eaedcb53740883d7e5d53c5e15c879b48fb Mon Sep 17 00:00:00 2001
+From: Mingcong Bai <jeffbai@aosc.io>
+Date: Sat, 22 Feb 2025 00:48:24 +0800
+Subject: platform/x86: thinkpad_acpi: Add battery quirk for ThinkPad X131e
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Mingcong Bai <jeffbai@aosc.io>
+
+commit d0d10eaedcb53740883d7e5d53c5e15c879b48fb upstream.
+
+Based on the dmesg messages from the original reporter:
+
+[    4.964073] ACPI: \_SB_.PCI0.LPCB.EC__.HKEY: BCTG evaluated but flagged as error
+[    4.964083] thinkpad_acpi: Error probing battery 2
+
+Lenovo ThinkPad X131e also needs this battery quirk.
+
+Reported-by: Fan Yang <804284660@qq.com>
+Tested-by: Fan Yang <804284660@qq.com>
+Co-developed-by: Xi Ruoyao <xry111@xry111.site>
+Signed-off-by: Xi Ruoyao <xry111@xry111.site>
+Signed-off-by: Mingcong Bai <jeffbai@aosc.io>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20250221164825.77315-1-jeffbai@aosc.io
+Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/platform/x86/thinkpad_acpi.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/platform/x86/thinkpad_acpi.c
++++ b/drivers/platform/x86/thinkpad_acpi.c
+@@ -9766,6 +9766,7 @@ static const struct tpacpi_quirk battery
+        * Individual addressing is broken on models that expose the
+        * primary battery as BAT1.
+        */
++      TPACPI_Q_LNV('G', '8', true),       /* ThinkPad X131e */
+       TPACPI_Q_LNV('8', 'F', true),       /* Thinkpad X120e */
+       TPACPI_Q_LNV('J', '7', true),       /* B5400 */
+       TPACPI_Q_LNV('J', 'I', true),       /* Thinkpad 11e */
diff --git a/queue-5.15/revert-of-reserved-memory-fix-using-wrong-number-of-cells-to-get-property-alignment.patch b/queue-5.15/revert-of-reserved-memory-fix-using-wrong-number-of-cells-to-get-property-alignment.patch
new file mode 100644 (file)
index 0000000..353180f
--- /dev/null
@@ -0,0 +1,39 @@
+From 75f1f311d883dfaffb98be3c1da208d6ed5d4df9 Mon Sep 17 00:00:00 2001
+From: "Rob Herring (Arm)" <robh@kernel.org>
+Date: Wed, 26 Feb 2025 13:38:19 -0600
+Subject: Revert "of: reserved-memory: Fix using wrong number of cells to get property 'alignment'"
+
+From: Rob Herring (Arm) <robh@kernel.org>
+
+commit 75f1f311d883dfaffb98be3c1da208d6ed5d4df9 upstream.
+
+This reverts commit 267b21d0bef8e67dbe6c591c9991444e58237ec9.
+
+Turns out some DTs do depend on this behavior. Specifically, a
+downstream Pixel 6 DT. Revert the change at least until we can decide if
+the DT spec can be changed instead.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/of/of_reserved_mem.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/of/of_reserved_mem.c
++++ b/drivers/of/of_reserved_mem.c
+@@ -105,12 +105,12 @@ static int __init __reserved_mem_alloc_s
+       prop = of_get_flat_dt_prop(node, "alignment", &len);
+       if (prop) {
+-              if (len != dt_root_size_cells * sizeof(__be32)) {
++              if (len != dt_root_addr_cells * sizeof(__be32)) {
+                       pr_err("invalid alignment property in '%s' node.\n",
+                               uname);
+                       return -EINVAL;
+               }
+-              align = dt_mem_next_cell(dt_root_size_cells, &prop);
++              align = dt_mem_next_cell(dt_root_addr_cells, &prop);
+       }
+       nomap = of_get_flat_dt_prop(node, "no-map", NULL) != NULL;
index 0a9fa7429cf6807f6e08d3f37f312c86318f3617..76829d3fb402231b58524a94df899d285278bafe 100644 (file)
@@ -540,3 +540,14 @@ riscv-cacheinfo-initialize-cacheinfo-s-level-and-typ.patch
 riscv-prevent-a-bad-reference-count-on-cpu-nodes.patch
 riscv-cacheinfo-use-of_property_present-for-non-bool.patch
 efi-don-t-map-the-entire-mokvar-table-to-determine-i.patch
+revert-of-reserved-memory-fix-using-wrong-number-of-cells-to-get-property-alignment.patch
+hid-appleir-fix-potential-null-dereference-at-raw-event-handle.patch
+gpio-rcar-use-raw_spinlock-to-protect-register-access.patch
+gpio-aggregator-protect-driver-attr-handlers-against-module-unload.patch
+alsa-hda-intel-add-dell-alc3271-to-power_save-denylist.patch
+alsa-hda-realtek-update-alc222-depop-optimize.patch
+drm-radeon-fix-rs400_gpu_init-for-ati-mobility-radeon-xpress-200m.patch
+platform-x86-thinkpad_acpi-add-battery-quirk-for-thinkpad-x131e.patch
+x86-cacheinfo-validate-cpuid-leaf-0x2-edx-output.patch
+x86-cpu-validate-cpuid-leaf-0x2-edx-output.patch
+x86-cpu-properly-parse-cpuid-leaf-0x2-tlb-descriptor-0x63.patch
diff --git a/queue-5.15/x86-cacheinfo-validate-cpuid-leaf-0x2-edx-output.patch b/queue-5.15/x86-cacheinfo-validate-cpuid-leaf-0x2-edx-output.patch
new file mode 100644 (file)
index 0000000..f909028
--- /dev/null
@@ -0,0 +1,44 @@
+From 8177c6bedb7013cf736137da586cf783922309dd Mon Sep 17 00:00:00 2001
+From: "Ahmed S. Darwish" <darwi@linutronix.de>
+Date: Tue, 4 Mar 2025 09:51:12 +0100
+Subject: x86/cacheinfo: Validate CPUID leaf 0x2 EDX output
+
+From: Ahmed S. Darwish <darwi@linutronix.de>
+
+commit 8177c6bedb7013cf736137da586cf783922309dd upstream.
+
+CPUID leaf 0x2 emits one-byte descriptors in its four output registers
+EAX, EBX, ECX, and EDX.  For these descriptors to be valid, the most
+significant bit (MSB) of each register must be clear.
+
+The historical Git commit:
+
+  019361a20f016 ("- pre6: Intel: start to add Pentium IV specific stuff (128-byte cacheline etc)...")
+
+introduced leaf 0x2 output parsing.  It only validated the MSBs of EAX,
+EBX, and ECX, but left EDX unchecked.
+
+Validate EDX's most-significant bit.
+
+Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de>
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Cc: stable@vger.kernel.org
+Cc: "H. Peter Anvin" <hpa@zytor.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Link: https://lore.kernel.org/r/20250304085152.51092-2-darwi@linutronix.de
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/cpu/cacheinfo.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/kernel/cpu/cacheinfo.c
++++ b/arch/x86/kernel/cpu/cacheinfo.c
+@@ -795,7 +795,7 @@ void init_intel_cacheinfo(struct cpuinfo
+                       cpuid(2, &regs[0], &regs[1], &regs[2], &regs[3]);
+                       /* If bit 31 is set, this is an unknown format */
+-                      for (j = 0 ; j < 3 ; j++)
++                      for (j = 0 ; j < 4 ; j++)
+                               if (regs[j] & (1 << 31))
+                                       regs[j] = 0;
diff --git a/queue-5.15/x86-cpu-properly-parse-cpuid-leaf-0x2-tlb-descriptor-0x63.patch b/queue-5.15/x86-cpu-properly-parse-cpuid-leaf-0x2-tlb-descriptor-0x63.patch
new file mode 100644 (file)
index 0000000..c965248
--- /dev/null
@@ -0,0 +1,119 @@
+From f6bdaab79ee4228a143ee1b4cb80416d6ffc0c63 Mon Sep 17 00:00:00 2001
+From: "Ahmed S. Darwish" <darwi@linutronix.de>
+Date: Tue, 4 Mar 2025 09:51:14 +0100
+Subject: x86/cpu: Properly parse CPUID leaf 0x2 TLB descriptor 0x63
+
+From: Ahmed S. Darwish <darwi@linutronix.de>
+
+commit f6bdaab79ee4228a143ee1b4cb80416d6ffc0c63 upstream.
+
+CPUID leaf 0x2's one-byte TLB descriptors report the number of entries
+for specific TLB types, among other properties.
+
+Typically, each emitted descriptor implies the same number of entries
+for its respective TLB type(s).  An emitted 0x63 descriptor is an
+exception: it implies 4 data TLB entries for 1GB pages and 32 data TLB
+entries for 2MB or 4MB pages.
+
+For the TLB descriptors parsing code, the entry count for 1GB pages is
+encoded at the intel_tlb_table[] mapping, but the 2MB/4MB entry count is
+totally ignored.
+
+Update leaf 0x2's parsing logic 0x2 to account for 32 data TLB entries
+for 2MB/4MB pages implied by the 0x63 descriptor.
+
+Fixes: e0ba94f14f74 ("x86/tlb_info: get last level TLB entry number of CPU")
+Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de>
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Cc: stable@kernel.org
+Cc: "H. Peter Anvin" <hpa@zytor.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Link: https://lore.kernel.org/r/20250304085152.51092-4-darwi@linutronix.de
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/cpu/intel.c |   60 ++++++++++++++++++++++++++++----------------
+ 1 file changed, 39 insertions(+), 21 deletions(-)
+
+--- a/arch/x86/kernel/cpu/intel.c
++++ b/arch/x86/kernel/cpu/intel.c
+@@ -749,26 +749,37 @@ static unsigned int intel_size_cache(str
+ }
+ #endif
+-#define TLB_INST_4K   0x01
+-#define TLB_INST_4M   0x02
+-#define TLB_INST_2M_4M        0x03
+-
+-#define TLB_INST_ALL  0x05
+-#define TLB_INST_1G   0x06
+-
+-#define TLB_DATA_4K   0x11
+-#define TLB_DATA_4M   0x12
+-#define TLB_DATA_2M_4M        0x13
+-#define TLB_DATA_4K_4M        0x14
+-
+-#define TLB_DATA_1G   0x16
+-
+-#define TLB_DATA0_4K  0x21
+-#define TLB_DATA0_4M  0x22
+-#define TLB_DATA0_2M_4M       0x23
+-
+-#define STLB_4K               0x41
+-#define STLB_4K_2M    0x42
++#define TLB_INST_4K           0x01
++#define TLB_INST_4M           0x02
++#define TLB_INST_2M_4M                0x03
++
++#define TLB_INST_ALL          0x05
++#define TLB_INST_1G           0x06
++
++#define TLB_DATA_4K           0x11
++#define TLB_DATA_4M           0x12
++#define TLB_DATA_2M_4M                0x13
++#define TLB_DATA_4K_4M                0x14
++
++#define TLB_DATA_1G           0x16
++#define TLB_DATA_1G_2M_4M     0x17
++
++#define TLB_DATA0_4K          0x21
++#define TLB_DATA0_4M          0x22
++#define TLB_DATA0_2M_4M               0x23
++
++#define STLB_4K                       0x41
++#define STLB_4K_2M            0x42
++
++/*
++ * All of leaf 0x2's one-byte TLB descriptors implies the same number of
++ * entries for their respective TLB types.  The 0x63 descriptor is an
++ * exception: it implies 4 dTLB entries for 1GB pages 32 dTLB entries
++ * for 2MB or 4MB pages.  Encode descriptor 0x63 dTLB entry count for
++ * 2MB/4MB pages here, as its count for dTLB 1GB pages is already at the
++ * intel_tlb_table[] mapping.
++ */
++#define TLB_0x63_2M_4M_ENTRIES        32
+ static const struct _tlb_table intel_tlb_table[] = {
+       { 0x01, TLB_INST_4K,            32,     " TLB_INST 4 KByte pages, 4-way set associative" },
+@@ -790,7 +801,8 @@ static const struct _tlb_table intel_tlb
+       { 0x5c, TLB_DATA_4K_4M,         128,    " TLB_DATA 4 KByte and 4 MByte pages" },
+       { 0x5d, TLB_DATA_4K_4M,         256,    " TLB_DATA 4 KByte and 4 MByte pages" },
+       { 0x61, TLB_INST_4K,            48,     " TLB_INST 4 KByte pages, full associative" },
+-      { 0x63, TLB_DATA_1G,            4,      " TLB_DATA 1 GByte pages, 4-way set associative" },
++      { 0x63, TLB_DATA_1G_2M_4M,      4,      " TLB_DATA 1 GByte pages, 4-way set associative"
++                                              " (plus 32 entries TLB_DATA 2 MByte or 4 MByte pages, not encoded here)" },
+       { 0x6b, TLB_DATA_4K,            256,    " TLB_DATA 4 KByte pages, 8-way associative" },
+       { 0x6c, TLB_DATA_2M_4M,         128,    " TLB_DATA 2 MByte or 4 MByte pages, 8-way associative" },
+       { 0x6d, TLB_DATA_1G,            16,     " TLB_DATA 1 GByte pages, fully associative" },
+@@ -890,6 +902,12 @@ static void intel_tlb_lookup(const unsig
+               if (tlb_lld_4m[ENTRIES] < intel_tlb_table[k].entries)
+                       tlb_lld_4m[ENTRIES] = intel_tlb_table[k].entries;
+               break;
++      case TLB_DATA_1G_2M_4M:
++              if (tlb_lld_2m[ENTRIES] < TLB_0x63_2M_4M_ENTRIES)
++                      tlb_lld_2m[ENTRIES] = TLB_0x63_2M_4M_ENTRIES;
++              if (tlb_lld_4m[ENTRIES] < TLB_0x63_2M_4M_ENTRIES)
++                      tlb_lld_4m[ENTRIES] = TLB_0x63_2M_4M_ENTRIES;
++              fallthrough;
+       case TLB_DATA_1G:
+               if (tlb_lld_1g[ENTRIES] < intel_tlb_table[k].entries)
+                       tlb_lld_1g[ENTRIES] = intel_tlb_table[k].entries;
diff --git a/queue-5.15/x86-cpu-validate-cpuid-leaf-0x2-edx-output.patch b/queue-5.15/x86-cpu-validate-cpuid-leaf-0x2-edx-output.patch
new file mode 100644 (file)
index 0000000..92da07e
--- /dev/null
@@ -0,0 +1,41 @@
+From 1881148215c67151b146450fb89ec22fd92337a7 Mon Sep 17 00:00:00 2001
+From: "Ahmed S. Darwish" <darwi@linutronix.de>
+Date: Tue, 4 Mar 2025 09:51:13 +0100
+Subject: x86/cpu: Validate CPUID leaf 0x2 EDX output
+
+From: Ahmed S. Darwish <darwi@linutronix.de>
+
+commit 1881148215c67151b146450fb89ec22fd92337a7 upstream.
+
+CPUID leaf 0x2 emits one-byte descriptors in its four output registers
+EAX, EBX, ECX, and EDX.  For these descriptors to be valid, the most
+significant bit (MSB) of each register must be clear.
+
+Leaf 0x2 parsing at intel.c only validated the MSBs of EAX, EBX, and
+ECX, but left EDX unchecked.
+
+Validate EDX's most-significant bit as well.
+
+Fixes: e0ba94f14f74 ("x86/tlb_info: get last level TLB entry number of CPU")
+Signed-off-by: Ahmed S. Darwish <darwi@linutronix.de>
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Cc: stable@kernel.org
+Cc: "H. Peter Anvin" <hpa@zytor.com>
+Cc: Linus Torvalds <torvalds@linux-foundation.org>
+Link: https://lore.kernel.org/r/20250304085152.51092-3-darwi@linutronix.de
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/x86/kernel/cpu/intel.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/kernel/cpu/intel.c
++++ b/arch/x86/kernel/cpu/intel.c
+@@ -913,7 +913,7 @@ static void intel_detect_tlb(struct cpui
+               cpuid(2, &regs[0], &regs[1], &regs[2], &regs[3]);
+               /* If bit 31 is set, this is an unknown format */
+-              for (j = 0 ; j < 3 ; j++)
++              for (j = 0 ; j < 4 ; j++)
+                       if (regs[j] & (1 << 31))
+                               regs[j] = 0;