]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 6.9
authorSasha Levin <sashal@kernel.org>
Tue, 23 Jul 2024 00:20:18 +0000 (20:20 -0400)
committerSasha Levin <sashal@kernel.org>
Tue, 23 Jul 2024 00:20:18 +0000 (20:20 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
153 files changed:
queue-6.9/acpi-ac-properly-notify-powermanagement-core-about-c.patch [new file with mode: 0644]
queue-6.9/acpi-ec-abort-address-space-access-upon-error.patch [new file with mode: 0644]
queue-6.9/acpi-ec-avoid-returning-ae_ok-on-errors-in-address-s.patch [new file with mode: 0644]
queue-6.9/alsa-dmaengine-synchronize-dma-channel-after-drop.patch [new file with mode: 0644]
queue-6.9/alsa-dmaengine_pcm-terminate-dmaengine-before-synchr.patch [new file with mode: 0644]
queue-6.9/alsa-hda-cs35l41-support-lenovo-thinkbook-13x-gen-4.patch [new file with mode: 0644]
queue-6.9/alsa-hda-cs35l41-support-lenovo-thinkbook-16p-gen-5.patch [new file with mode: 0644]
queue-6.9/alsa-hda-cs35l56-fix-lifecycle-of-codec-pointer.patch [new file with mode: 0644]
queue-6.9/alsa-hda-cs35l56-select-serial_multi_instantiate.patch [new file with mode: 0644]
queue-6.9/alsa-hda-realtek-add-more-codec-id-to-no-shutup-pins.patch [new file with mode: 0644]
queue-6.9/alsa-hda-realtek-support-lenovo-thinkbook-13x-gen-4.patch [new file with mode: 0644]
queue-6.9/alsa-hda-realtek-support-lenovo-thinkbook-16p-gen-5.patch [new file with mode: 0644]
queue-6.9/alsa-hda-relatek-enable-mute-led-on-hp-laptop-15-gw0.patch [new file with mode: 0644]
queue-6.9/alsa-hda-use-imply-for-suggesting-config_serial_mult.patch [new file with mode: 0644]
queue-6.9/alsa-pcm-allow-resume-only-for-suspended-streams.patch [new file with mode: 0644]
queue-6.9/arm64-armv8_deprecated-fix-warning-in-isndep-cpuhp-s.patch [new file with mode: 0644]
queue-6.9/asoc-amd-yc-fix-non-functional-mic-on-asus-m5602ra.patch [new file with mode: 0644]
queue-6.9/asoc-codecs-es8326-solve-headphone-detection-issue.patch [new file with mode: 0644]
queue-6.9/asoc-cs35l56-disconnect-asp1-tx-sources-when-asp1-da.patch [new file with mode: 0644]
queue-6.9/asoc-intel-avs-fix-route-override.patch [new file with mode: 0644]
queue-6.9/asoc-rt722-sdca-sdw-add-debounce-time-for-type-detec.patch [new file with mode: 0644]
queue-6.9/asoc-rt722-sdca-sdw-add-silence-detection-register-a.patch [new file with mode: 0644]
queue-6.9/asoc-sof-intel-hda-pcm-limit-the-maximum-number-of-p.patch [new file with mode: 0644]
queue-6.9/asoc-sof-sof-audio-skip-unprepare-for-in-use-widgets.patch [new file with mode: 0644]
queue-6.9/asoc-ti-davinci-mcasp-set-min-period-size-using-fifo.patch [new file with mode: 0644]
queue-6.9/asoc-ti-omap-hdmi-fix-too-long-driver-name.patch [new file with mode: 0644]
queue-6.9/asoc-topology-do-not-assign-fields-that-are-already-.patch [new file with mode: 0644]
queue-6.9/asoc-topology-fix-references-to-freed-memory.patch [new file with mode: 0644]
queue-6.9/bluetooth-btnxpuart-enable-power-save-feature-on-sta.patch [new file with mode: 0644]
queue-6.9/bluetooth-hci_core-cancel-all-works-upon-hci_unregis.patch [new file with mode: 0644]
queue-6.9/bluetooth-l2cap-sync-sock-recv-cb-and-release.patch [new file with mode: 0644]
queue-6.9/btrfs-ensure-fast-fsync-waits-for-ordered-extents-af.patch [new file with mode: 0644]
queue-6.9/btrfs-fix-uninitialized-return-value-in-the-ref-veri.patch [new file with mode: 0644]
queue-6.9/btrfs-qgroup-fix-quota-root-leak-after-quota-disable.patch [new file with mode: 0644]
queue-6.9/btrfs-scrub-handle-rst-lookup-error-correctly.patch [new file with mode: 0644]
queue-6.9/bytcr_rt5640-inverse-jack-detect-for-archos-101-cesi.patch [new file with mode: 0644]
queue-6.9/cachefiles-add-consistency-check-for-copen-cread.patch [new file with mode: 0644]
queue-6.9/cachefiles-make-on-demand-read-killable.patch [new file with mode: 0644]
queue-6.9/cachefiles-set-object-to-close-if-ondemand_id-0-in-c.patch [new file with mode: 0644]
queue-6.9/can-kvaser_usb-fix-return-value-for-hif_usb_send_reg.patch [new file with mode: 0644]
queue-6.9/clk-qcom-apss-ipq-pll-remove-config_ctl_hi_val-from-.patch [new file with mode: 0644]
queue-6.9/closures-change-bug_on-to-warn_on.patch [new file with mode: 0644]
queue-6.9/cpumask-limit-force_nr_cpus-to-just-the-up-case.patch [new file with mode: 0644]
queue-6.9/drivers-perf-riscv-reset-the-counter-to-hpmevent-map.patch [new file with mode: 0644]
queue-6.9/drm-amd-display-account-for-cursor-prefetch-bw-in-dm.patch [new file with mode: 0644]
queue-6.9/drm-amd-display-add-refresh-rate-range-check.patch [new file with mode: 0644]
queue-6.9/drm-amd-display-change-dram_clock_latency-to-34us-fo.patch [new file with mode: 0644]
queue-6.9/drm-amd-display-change-dram_clock_latency-to-34us-fo.patch-18657 [new file with mode: 0644]
queue-6.9/drm-amd-display-fix-array-index-out-of-bounds-in-dml.patch [new file with mode: 0644]
queue-6.9/drm-amd-display-fix-refresh-rate-range-for-some-pane.patch [new file with mode: 0644]
queue-6.9/drm-amd-display-update-efficiency-bandwidth-for-dcn3.patch [new file with mode: 0644]
queue-6.9/drm-amd-swsmu-add-mall-init-support-workaround-for-s.patch [new file with mode: 0644]
queue-6.9/drm-amdgpu-indicate-cu-havest-info-to-cp.patch [new file with mode: 0644]
queue-6.9/drm-amdgpu-init-ta-fw-for-psp-v14.patch [new file with mode: 0644]
queue-6.9/drm-amdgpu-pptable-fix-ubsan-array-index-out-of-boun.patch [new file with mode: 0644]
queue-6.9/drm-exynos-dp-drop-driver-owner-initialization.patch [new file with mode: 0644]
queue-6.9/drm-mediatek-call-drm_atomic_helper_shutdown-at-shut.patch [new file with mode: 0644]
queue-6.9/drm-panel-orientation-quirks-add-quirk-for-aya-neo-k.patch [new file with mode: 0644]
queue-6.9/drm-radeon-check-bo_va-bo-is-non-null-before-using-i.patch [new file with mode: 0644]
queue-6.9/drm-renesas-shmobile-call-drm_atomic_helper_shutdown.patch [new file with mode: 0644]
queue-6.9/drm-vmwgfx-fix-missing-hypervisor_guest-dependency.patch [new file with mode: 0644]
queue-6.9/efi-libstub-zboot.lds-discard-.discard-sections.patch [new file with mode: 0644]
queue-6.9/erofs-ensure-m_llen-is-reset-to-0-if-metadata-is-inv.patch [new file with mode: 0644]
queue-6.9/fs-better-handle-deep-ancestor-chains-in-is_subdir.patch [new file with mode: 0644]
queue-6.9/fs-file-fix-the-check-in-find_next_fd.patch [new file with mode: 0644]
queue-6.9/gpio-pca953x-fix-pca953x_irq_bus_sync_unlock-race.patch [new file with mode: 0644]
queue-6.9/hfsplus-fix-uninit-value-in-copy_name.patch [new file with mode: 0644]
queue-6.9/hid-ignore-battery-for-elan-touchscreens-2f2c-and-41.patch [new file with mode: 0644]
queue-6.9/ibmvnic-add-tx-check-to-prevent-skb-leak.patch [new file with mode: 0644]
queue-6.9/ila-block-bh-in-ila_output.patch [new file with mode: 0644]
queue-6.9/input-add-event-code-for-accessibility-key.patch [new file with mode: 0644]
queue-6.9/input-add-support-for-do-not-disturb.patch [new file with mode: 0644]
queue-6.9/input-ads7846-use-spi_device_id-table.patch [new file with mode: 0644]
queue-6.9/input-elantech-fix-touchpad-state-on-resume-for-leno.patch [new file with mode: 0644]
queue-6.9/input-i8042-add-ayaneo-kun-to-i8042-quirk-table.patch [new file with mode: 0644]
queue-6.9/input-silead-always-support-10-fingers.patch [new file with mode: 0644]
queue-6.9/input-xpad-add-support-for-asus-rog-raikiri-pro.patch [new file with mode: 0644]
queue-6.9/io_uring-fix-possible-deadlock-in-io_register_iowq_m.patch [new file with mode: 0644]
queue-6.9/iomap-fix-iomap_adjust_read_range-for-plen-calculati.patch [new file with mode: 0644]
queue-6.9/kconfig-gconf-give-a-proper-initial-state-to-the-sav.patch [new file with mode: 0644]
queue-6.9/kconfig-remove-wrong-expr_trans_bool.patch [new file with mode: 0644]
queue-6.9/ksmbd-return-file_device_disk-instead-of-super-magic.patch [new file with mode: 0644]
queue-6.9/kvm-ppc-book3s-hv-prevent-uaf-in-kvm_spapr_tce_attac.patch [new file with mode: 0644]
queue-6.9/loongarch-fix-gmac-s-phy-mode-definitions-in-dts.patch [new file with mode: 0644]
queue-6.9/loop-disable-fallocate-zero-and-discard-if-not-suppo.patch [new file with mode: 0644]
queue-6.9/mei-demote-client-disconnect-warning-on-suspend-to-d.patch [new file with mode: 0644]
queue-6.9/mips-fix-compat_sys_lseek-syscall.patch [new file with mode: 0644]
queue-6.9/net-ipv6-rpl_iptunnel-block-bh-in-rpl_output-and-rpl.patch [new file with mode: 0644]
queue-6.9/net-mac802154-fix-racy-device-stats-updates-by-dev_s.patch [new file with mode: 0644]
queue-6.9/net-mvpp2-fill-in-dev_port-attribute.patch [new file with mode: 0644]
queue-6.9/net-usb-qmi_wwan-add-telit-fn912-compositions.patch [new file with mode: 0644]
queue-6.9/nfs-avoid-flushing-many-pages-with-nfs_file_sync.patch [new file with mode: 0644]
queue-6.9/nfs-don-t-invalidate-dentries-on-transient-errors.patch [new file with mode: 0644]
queue-6.9/nfs-propagate-readlink-errors-in-nfs_symlink_filler.patch [new file with mode: 0644]
queue-6.9/nfsv4-fix-memory-leak-in-nfs4_set_security_label.patch [new file with mode: 0644]
queue-6.9/null_blk-fix-validation-of-block-size.patch [new file with mode: 0644]
queue-6.9/nvme-avoid-double-free-special-payload.patch [new file with mode: 0644]
queue-6.9/nvme-fabrics-use-reserved-tag-for-reg-read-write-com.patch [new file with mode: 0644]
queue-6.9/nvme-fix-nvme_ns_deac-may-incorrectly-identifying-th.patch [new file with mode: 0644]
queue-6.9/nvmet-always-initialize-cqe.result.patch [new file with mode: 0644]
queue-6.9/octeontx2-pf-fix-coverity-and-klockwork-issues-in-oc.patch [new file with mode: 0644]
queue-6.9/of-irq-factor-out-parsing-of-interrupt-map-parent-ph.patch [new file with mode: 0644]
queue-6.9/parport-amiga-mark-driver-struct-with-__refdata-to-p.patch [new file with mode: 0644]
queue-6.9/platform-mellanox-nvsw-sn2201-add-check-for-platform.patch [new file with mode: 0644]
queue-6.9/platform-x86-amd-hsmp-check-hsmp-support-on-amd-fami.patch [new file with mode: 0644]
queue-6.9/platform-x86-lg-laptop-change-acpi-device-id.patch [new file with mode: 0644]
queue-6.9/platform-x86-lg-laptop-remove-lgex0815-hotkey-handli.patch [new file with mode: 0644]
queue-6.9/platform-x86-lg-laptop-use-acpi-device-handle-when-e.patch [new file with mode: 0644]
queue-6.9/platform-x86-wireless-hotkey-add-support-for-lg-airp.patch [new file with mode: 0644]
queue-6.9/pnp-hide-pnp_bus_type-from-the-non-pnp-code.patch [new file with mode: 0644]
queue-6.9/powerpc-eeh-avoid-possible-crash-when-edev-pdev-chan.patch [new file with mode: 0644]
queue-6.9/powerpc-pseries-whitelist-dtl-slub-object-for-copyin.patch [new file with mode: 0644]
queue-6.9/riscv-stacktrace-fix-usage-of-ftrace_graph_ret_addr.patch [new file with mode: 0644]
queue-6.9/s390-sclp-fix-sclp_init-cleanup-on-failure.patch [new file with mode: 0644]
queue-6.9/scsi-core-alua-i-o-errors-for-alua-state-transitions.patch [new file with mode: 0644]
queue-6.9/scsi-libsas-fix-exp-attached-device-scan-after-probe.patch [new file with mode: 0644]
queue-6.9/scsi-qedf-don-t-process-stag-work-during-unload-and-.patch [new file with mode: 0644]
queue-6.9/scsi-qedf-set-qed_slowpath_params-to-zero-before-use.patch [new file with mode: 0644]
queue-6.9/scsi-qedf-wait-for-stag-work-during-unload.patch [new file with mode: 0644]
queue-6.9/scsi-sr-fix-unintentional-arithmetic-wraparound.patch [new file with mode: 0644]
queue-6.9/selftest-timerns-fix-clang-build-failures-for-abs-ca.patch [new file with mode: 0644]
queue-6.9/selftests-bpf-extend-tcx-tests-to-cover-late-tcx_ent.patch [new file with mode: 0644]
queue-6.9/selftests-cachestat-fix-build-warnings-on-ppc64.patch [new file with mode: 0644]
queue-6.9/selftests-futex-pass-_gnu_source-without-a-value-to-.patch [new file with mode: 0644]
queue-6.9/selftests-openat2-fix-build-warnings-on-ppc64.patch [new file with mode: 0644]
queue-6.9/selftests-openvswitch-set-value-to-nla-flags.patch [new file with mode: 0644]
queue-6.9/selftests-overlayfs-fix-build-error-on-ppc64.patch [new file with mode: 0644]
queue-6.9/selftests-vdso-fix-clang-build-errors-and-warnings.patch [new file with mode: 0644]
queue-6.9/series
queue-6.9/spi-davinci-unset-powerdown-bit-when-releasing-resou.patch [new file with mode: 0644]
queue-6.9/spi-fix-octal-mode-support.patch [new file with mode: 0644]
queue-6.9/spi-imx-don-t-expect-dma-for-i.mx-25-35-50-51-53-csp.patch [new file with mode: 0644]
queue-6.9/spi-mux-set-ctlr-bits_per_word_mask.patch [new file with mode: 0644]
queue-6.9/tee-optee-ffa-fix-missing-field-initializers-warning.patch [new file with mode: 0644]
queue-6.9/tools-power-cpupower-fix-pstate-frequency-reporting-.patch [new file with mode: 0644]
queue-6.9/vfio-create-vfio_fs_type-with-inode-per-device.patch [new file with mode: 0644]
queue-6.9/vfio-pci-insert-full-vma-on-mmap-d-mmio-fault.patch [new file with mode: 0644]
queue-6.9/vfio-pci-use-unmap_mapping_range.patch [new file with mode: 0644]
queue-6.9/wifi-cfg80211-fix-6-ghz-scan-request-building.patch [new file with mode: 0644]
queue-6.9/wifi-cfg80211-wext-add-extra-siocsiwscan-data-check.patch [new file with mode: 0644]
queue-6.9/wifi-iwlwifi-mvm-d3-fix-wowlan-command-version-looku.patch [new file with mode: 0644]
queue-6.9/wifi-iwlwifi-mvm-fix-scan-abort-handling-with-hw-rfk.patch [new file with mode: 0644]
queue-6.9/wifi-iwlwifi-mvm-handle-ba-session-teardown-in-rf-ki.patch [new file with mode: 0644]
queue-6.9/wifi-iwlwifi-mvm-handle-bigtk-cipher-in-kek_kck-cmd.patch [new file with mode: 0644]
queue-6.9/wifi-iwlwifi-mvm-properly-set-6-ghz-channel-direct-p.patch [new file with mode: 0644]
queue-6.9/wifi-iwlwifi-mvm-remove-stale-sta-link-data-during-r.patch [new file with mode: 0644]
queue-6.9/wifi-iwlwifi-properly-set-wiphy_flag_supports_ext_ke.patch [new file with mode: 0644]
queue-6.9/wifi-mac80211-apply-mcast-rate-only-if-interface-is-.patch [new file with mode: 0644]
queue-6.9/wifi-mac80211-avoid-address-calculations-via-out-of-.patch [new file with mode: 0644]
queue-6.9/wifi-mac80211-fix-ubsan-noise-in-ieee80211_prep_hw_s.patch [new file with mode: 0644]
queue-6.9/wifi-mac80211-handle-tasklet-frames-before-stopping.patch [new file with mode: 0644]
queue-6.9/wifi-mac80211-mesh-init-nonpeer_pm-to-active-by-defa.patch [new file with mode: 0644]
queue-6.9/workqueue-refactor-worker-id-formatting-and-make-wq_.patch [new file with mode: 0644]

diff --git a/queue-6.9/acpi-ac-properly-notify-powermanagement-core-about-c.patch b/queue-6.9/acpi-ac-properly-notify-powermanagement-core-about-c.patch
new file mode 100644 (file)
index 0000000..e685956
--- /dev/null
@@ -0,0 +1,75 @@
+From 1c83445b396cbc74f15a734dc7b85abfd6d029f1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 26 May 2024 23:40:01 +0200
+Subject: ACPI: AC: Properly notify powermanagement core about changes
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Thomas Weißschuh <linux@weissschuh.net>
+
+[ Upstream commit ac62f52138f752d6c74adc6321e4996d84caf5bb ]
+
+The powermanagement core does various actions when a powersupply changes.
+It calls into notifiers, LED triggers, other power supplies and emits an uevent.
+
+To make sure that all these actions happen properly call power_supply_changed().
+
+Reported-by: Rajas Paranjpe <paranjperajas@gmail.com>
+Closes: https://github.com/MrChromebox/firmware/issues/420#issuecomment-2132251318
+Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
+Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.com>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/acpi/ac.c  | 4 ++--
+ drivers/acpi/sbs.c | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
+index 2d4a35e6dd18d..09a87fa222c78 100644
+--- a/drivers/acpi/ac.c
++++ b/drivers/acpi/ac.c
+@@ -145,7 +145,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
+                                                 dev_name(&adev->dev), event,
+                                                 (u32) ac->state);
+               acpi_notifier_call_chain(adev, event, (u32) ac->state);
+-              kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE);
++              power_supply_changed(ac->charger);
+       }
+ }
+@@ -268,7 +268,7 @@ static int acpi_ac_resume(struct device *dev)
+       if (acpi_ac_get_state(ac))
+               return 0;
+       if (old_state != ac->state)
+-              kobject_uevent(&ac->charger->dev.kobj, KOBJ_CHANGE);
++              power_supply_changed(ac->charger);
+       return 0;
+ }
+diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
+index 94e3c000df2e1..dc8164b182dcc 100644
+--- a/drivers/acpi/sbs.c
++++ b/drivers/acpi/sbs.c
+@@ -610,7 +610,7 @@ static void acpi_sbs_callback(void *context)
+       if (sbs->charger_exists) {
+               acpi_ac_get_present(sbs);
+               if (sbs->charger_present != saved_charger_state)
+-                      kobject_uevent(&sbs->charger->dev.kobj, KOBJ_CHANGE);
++                      power_supply_changed(sbs->charger);
+       }
+       if (sbs->manager_present) {
+@@ -622,7 +622,7 @@ static void acpi_sbs_callback(void *context)
+                       acpi_battery_read(bat);
+                       if (saved_battery_state == bat->present)
+                               continue;
+-                      kobject_uevent(&bat->bat->dev.kobj, KOBJ_CHANGE);
++                      power_supply_changed(bat->bat);
+               }
+       }
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.9/acpi-ec-abort-address-space-access-upon-error.patch b/queue-6.9/acpi-ec-abort-address-space-access-upon-error.patch
new file mode 100644 (file)
index 0000000..4a148e8
--- /dev/null
@@ -0,0 +1,45 @@
+From cb54a0023ff5b2d6f9e911affa82b92e9099c321 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 22 May 2024 23:36:48 +0200
+Subject: ACPI: EC: Abort address space access upon error
+
+From: Armin Wolf <W_Armin@gmx.de>
+
+[ Upstream commit f6f172dc6a6d7775b2df6adfd1350700e9a847ec ]
+
+When a multi-byte address space access is requested, acpi_ec_read()/
+acpi_ec_write() is being called multiple times.
+
+Abort such operations if a single call to acpi_ec_read() /
+acpi_ec_write() fails, as the data read from / written to the EC
+might be incomplete.
+
+Signed-off-by: Armin Wolf <W_Armin@gmx.de>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/acpi/ec.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
+index 1cec29ab64ce8..b66e5971fd3d1 100644
+--- a/drivers/acpi/ec.c
++++ b/drivers/acpi/ec.c
+@@ -1333,10 +1333,13 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
+       if (ec->busy_polling || bits > 8)
+               acpi_ec_burst_enable(ec);
+-      for (i = 0; i < bytes; ++i, ++address, ++value)
++      for (i = 0; i < bytes; ++i, ++address, ++value) {
+               result = (function == ACPI_READ) ?
+                       acpi_ec_read(ec, address, value) :
+                       acpi_ec_write(ec, address, *value);
++              if (result < 0)
++                      break;
++      }
+       if (ec->busy_polling || bits > 8)
+               acpi_ec_burst_disable(ec);
+-- 
+2.43.0
+
diff --git a/queue-6.9/acpi-ec-avoid-returning-ae_ok-on-errors-in-address-s.patch b/queue-6.9/acpi-ec-avoid-returning-ae_ok-on-errors-in-address-s.patch
new file mode 100644 (file)
index 0000000..87184cf
--- /dev/null
@@ -0,0 +1,43 @@
+From 6513ae86e49abc7242a152387f9627f5ea8487b6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 22 May 2024 23:36:49 +0200
+Subject: ACPI: EC: Avoid returning AE_OK on errors in address space handler
+
+From: Armin Wolf <W_Armin@gmx.de>
+
+[ Upstream commit c4bd7f1d78340e63de4d073fd3dbe5391e2996e5 ]
+
+If an error code other than EINVAL, ENODEV or ETIME is returned
+by acpi_ec_read() / acpi_ec_write(), then AE_OK is incorrectly
+returned by acpi_ec_space_handler().
+
+Fix this by only returning AE_OK on success, and return AE_ERROR
+otherwise.
+
+Signed-off-by: Armin Wolf <W_Armin@gmx.de>
+[ rjw: Subject and changelog edits ]
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/acpi/ec.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
+index b66e5971fd3d1..299ec653388ce 100644
+--- a/drivers/acpi/ec.c
++++ b/drivers/acpi/ec.c
+@@ -1351,8 +1351,10 @@ acpi_ec_space_handler(u32 function, acpi_physical_address address,
+               return AE_NOT_FOUND;
+       case -ETIME:
+               return AE_TIME;
+-      default:
++      case 0:
+               return AE_OK;
++      default:
++              return AE_ERROR;
+       }
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.9/alsa-dmaengine-synchronize-dma-channel-after-drop.patch b/queue-6.9/alsa-dmaengine-synchronize-dma-channel-after-drop.patch
new file mode 100644 (file)
index 0000000..0bad7a9
--- /dev/null
@@ -0,0 +1,98 @@
+From 945b43df04e2895dd67b560c6791f3ee2d56117f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 11 Jun 2024 18:02:55 +0530
+Subject: ALSA: dmaengine: Synchronize dma channel after drop()
+
+From: Jai Luthra <j-luthra@ti.com>
+
+[ Upstream commit e8343410ddf08fc36a9b9cc7c51a4e53a262d4c6 ]
+
+Sometimes the stream may be stopped due to XRUN events, in which case
+the userspace can call snd_pcm_drop() and snd_pcm_prepare() to stop and
+start the stream again.
+
+In these cases, we must wait for the DMA channel to synchronize before
+marking the stream as prepared for playback, as the DMA channel gets
+stopped by drop() without any synchronization. Make sure the ALSA core
+synchronizes the DMA channel by adding a sync_stop() hook.
+
+Reviewed-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
+Signed-off-by: Jai Luthra <j-luthra@ti.com>
+Link: https://lore.kernel.org/r/20240611-asoc_next-v3-1-fcfd84b12164@ti.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/sound/dmaengine_pcm.h         |  1 +
+ sound/core/pcm_dmaengine.c            | 10 ++++++++++
+ sound/soc/soc-generic-dmaengine-pcm.c |  8 ++++++++
+ 3 files changed, 19 insertions(+)
+
+diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h
+index d70c55f17df7c..94dbb23580f2f 100644
+--- a/include/sound/dmaengine_pcm.h
++++ b/include/sound/dmaengine_pcm.h
+@@ -36,6 +36,7 @@ snd_pcm_uframes_t snd_dmaengine_pcm_pointer_no_residue(struct snd_pcm_substream
+ int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,
+       struct dma_chan *chan);
+ int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream);
++int snd_dmaengine_pcm_sync_stop(struct snd_pcm_substream *substream);
+ int snd_dmaengine_pcm_open_request_chan(struct snd_pcm_substream *substream,
+       dma_filter_fn filter_fn, void *filter_data);
+diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c
+index 494ec0c207fad..d142609570347 100644
+--- a/sound/core/pcm_dmaengine.c
++++ b/sound/core/pcm_dmaengine.c
+@@ -349,6 +349,16 @@ int snd_dmaengine_pcm_open_request_chan(struct snd_pcm_substream *substream,
+ }
+ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_open_request_chan);
++int snd_dmaengine_pcm_sync_stop(struct snd_pcm_substream *substream)
++{
++      struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream);
++
++      dmaengine_synchronize(prtd->dma_chan);
++
++      return 0;
++}
++EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_sync_stop);
++
+ /**
+  * snd_dmaengine_pcm_close - Close a dmaengine based PCM substream
+  * @substream: PCM substream
+diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c
+index 092ca09f36319..7fa75b55c65e2 100644
+--- a/sound/soc/soc-generic-dmaengine-pcm.c
++++ b/sound/soc/soc-generic-dmaengine-pcm.c
+@@ -318,6 +318,12 @@ static int dmaengine_copy(struct snd_soc_component *component,
+       return 0;
+ }
++static int dmaengine_pcm_sync_stop(struct snd_soc_component *component,
++                                 struct snd_pcm_substream *substream)
++{
++      return snd_dmaengine_pcm_sync_stop(substream);
++}
++
+ static const struct snd_soc_component_driver dmaengine_pcm_component = {
+       .name           = SND_DMAENGINE_PCM_DRV_NAME,
+       .probe_order    = SND_SOC_COMP_ORDER_LATE,
+@@ -327,6 +333,7 @@ static const struct snd_soc_component_driver dmaengine_pcm_component = {
+       .trigger        = dmaengine_pcm_trigger,
+       .pointer        = dmaengine_pcm_pointer,
+       .pcm_construct  = dmaengine_pcm_new,
++      .sync_stop      = dmaengine_pcm_sync_stop,
+ };
+ static const struct snd_soc_component_driver dmaengine_pcm_component_process = {
+@@ -339,6 +346,7 @@ static const struct snd_soc_component_driver dmaengine_pcm_component_process = {
+       .pointer        = dmaengine_pcm_pointer,
+       .copy           = dmaengine_copy,
+       .pcm_construct  = dmaengine_pcm_new,
++      .sync_stop      = dmaengine_pcm_sync_stop,
+ };
+ static const char * const dmaengine_pcm_dma_channel_names[] = {
+-- 
+2.43.0
+
diff --git a/queue-6.9/alsa-dmaengine_pcm-terminate-dmaengine-before-synchr.patch b/queue-6.9/alsa-dmaengine_pcm-terminate-dmaengine-before-synchr.patch
new file mode 100644 (file)
index 0000000..8071488
--- /dev/null
@@ -0,0 +1,66 @@
+From 53c33127677b7cc095580d1692321d6d77db8a34 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Jun 2024 10:40:18 +0800
+Subject: ALSA: dmaengine_pcm: terminate dmaengine before synchronize
+
+From: Shengjiu Wang <shengjiu.wang@nxp.com>
+
+[ Upstream commit 6a7db25aad8ce6512b366d2ce1d0e60bac00a09d ]
+
+When dmaengine supports pause function, in suspend state,
+dmaengine_pause() is called instead of dmaengine_terminate_async(),
+
+In end of playback stream, the runtime->state will go to
+SNDRV_PCM_STATE_DRAINING, if system suspend & resume happen
+at this time, application will not resume playback stream, the
+stream will be closed directly, the dmaengine_terminate_async()
+will not be called before the dmaengine_synchronize(), which
+violates the call sequence for dmaengine_synchronize().
+
+This behavior also happens for capture streams, but there is no
+SNDRV_PCM_STATE_DRAINING state for capture. So use
+dmaengine_tx_status() to check the DMA status if the status is
+DMA_PAUSED, then call dmaengine_terminate_async() to terminate
+dmaengine before dmaengine_synchronize().
+
+Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
+Link: https://patch.msgid.link/1718851218-27803-1-git-send-email-shengjiu.wang@nxp.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/core/pcm_dmaengine.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/sound/core/pcm_dmaengine.c b/sound/core/pcm_dmaengine.c
+index d142609570347..e299e8634751f 100644
+--- a/sound/core/pcm_dmaengine.c
++++ b/sound/core/pcm_dmaengine.c
+@@ -368,6 +368,12 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_sync_stop);
+ int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream)
+ {
+       struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream);
++      struct dma_tx_state state;
++      enum dma_status status;
++
++      status = dmaengine_tx_status(prtd->dma_chan, prtd->cookie, &state);
++      if (status == DMA_PAUSED)
++              dmaengine_terminate_async(prtd->dma_chan);
+       dmaengine_synchronize(prtd->dma_chan);
+       kfree(prtd);
+@@ -388,6 +394,12 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close);
+ int snd_dmaengine_pcm_close_release_chan(struct snd_pcm_substream *substream)
+ {
+       struct dmaengine_pcm_runtime_data *prtd = substream_to_prtd(substream);
++      struct dma_tx_state state;
++      enum dma_status status;
++
++      status = dmaengine_tx_status(prtd->dma_chan, prtd->cookie, &state);
++      if (status == DMA_PAUSED)
++              dmaengine_terminate_async(prtd->dma_chan);
+       dmaengine_synchronize(prtd->dma_chan);
+       dma_release_channel(prtd->dma_chan);
+-- 
+2.43.0
+
diff --git a/queue-6.9/alsa-hda-cs35l41-support-lenovo-thinkbook-13x-gen-4.patch b/queue-6.9/alsa-hda-cs35l41-support-lenovo-thinkbook-13x-gen-4.patch
new file mode 100644 (file)
index 0000000..4ef2c9f
--- /dev/null
@@ -0,0 +1,45 @@
+From 84dbd6c9df931bc9ae42ca9f69beed40410d37a3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 6 Jun 2024 14:03:49 +0100
+Subject: ALSA: hda: cs35l41: Support Lenovo Thinkbook 13x Gen 4
+
+From: Stefan Binding <sbinding@opensource.cirrus.com>
+
+[ Upstream commit b32f92d1af3789038f03c2899e3be0d00b43faf2 ]
+
+This laptop does not contain _DSD so needs to be supported using the
+configuration table.
+
+Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Link: https://lore.kernel.org/r/20240606130351.333495-3-sbinding@opensource.cirrus.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/cs35l41_hda_property.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
+index e034828df4452..6ad6cb176d43a 100644
+--- a/sound/pci/hda/cs35l41_hda_property.c
++++ b/sound/pci/hda/cs35l41_hda_property.c
+@@ -118,6 +118,8 @@ static const struct cs35l41_config cs35l41_config_table[] = {
+       { "17AA38B5", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
+       { "17AA38B6", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
+       { "17AA38B7", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
++      { "17AA38C7", 4, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, CS35L41_LEFT, CS35L41_RIGHT }, 0, 2, -1, 1000, 4500, 24 },
++      { "17AA38C8", 4, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, CS35L41_LEFT, CS35L41_RIGHT }, 0, 2, -1, 1000, 4500, 24 },
+       { "17AA38F9", 2, EXTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
+       { "17AA38FA", 2, EXTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
+       {}
+@@ -511,6 +513,8 @@ static const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
+       { "CSC3551", "17AA38B5", generic_dsd_config },
+       { "CSC3551", "17AA38B6", generic_dsd_config },
+       { "CSC3551", "17AA38B7", generic_dsd_config },
++      { "CSC3551", "17AA38C7", generic_dsd_config },
++      { "CSC3551", "17AA38C8", generic_dsd_config },
+       { "CSC3551", "17AA38F9", generic_dsd_config },
+       { "CSC3551", "17AA38FA", generic_dsd_config },
+       {}
+-- 
+2.43.0
+
diff --git a/queue-6.9/alsa-hda-cs35l41-support-lenovo-thinkbook-16p-gen-5.patch b/queue-6.9/alsa-hda-cs35l41-support-lenovo-thinkbook-16p-gen-5.patch
new file mode 100644 (file)
index 0000000..2e7e099
--- /dev/null
@@ -0,0 +1,45 @@
+From 78415dda7e1e10b77ef11acedf0bef21d0aa8df6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 6 Jun 2024 14:03:48 +0100
+Subject: ALSA: hda: cs35l41: Support Lenovo Thinkbook 16P Gen 5
+
+From: Stefan Binding <sbinding@opensource.cirrus.com>
+
+[ Upstream commit 82f3daed2d3590fa286a02301573a183dd902a0f ]
+
+This laptop does not contain _DSD so needs to be supported using the
+configuration table.
+
+Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Link: https://lore.kernel.org/r/20240606130351.333495-2-sbinding@opensource.cirrus.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/cs35l41_hda_property.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
+index 4f5e581cdd5ff..e034828df4452 100644
+--- a/sound/pci/hda/cs35l41_hda_property.c
++++ b/sound/pci/hda/cs35l41_hda_property.c
+@@ -118,6 +118,8 @@ static const struct cs35l41_config cs35l41_config_table[] = {
+       { "17AA38B5", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
+       { "17AA38B6", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
+       { "17AA38B7", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 0, 0, 0 },
++      { "17AA38F9", 2, EXTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
++      { "17AA38FA", 2, EXTERNAL, { CS35L41_RIGHT, CS35L41_LEFT, 0, 0 }, 0, 2, -1, 0, 0, 0 },
+       {}
+ };
+@@ -509,6 +511,8 @@ static const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
+       { "CSC3551", "17AA38B5", generic_dsd_config },
+       { "CSC3551", "17AA38B6", generic_dsd_config },
+       { "CSC3551", "17AA38B7", generic_dsd_config },
++      { "CSC3551", "17AA38F9", generic_dsd_config },
++      { "CSC3551", "17AA38FA", generic_dsd_config },
+       {}
+ };
+-- 
+2.43.0
+
diff --git a/queue-6.9/alsa-hda-cs35l56-fix-lifecycle-of-codec-pointer.patch b/queue-6.9/alsa-hda-cs35l56-fix-lifecycle-of-codec-pointer.patch
new file mode 100644 (file)
index 0000000..bdde878
--- /dev/null
@@ -0,0 +1,47 @@
+From fac68d5707a604f160ee901e0c9f66368547e6c8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 31 May 2024 12:27:16 +0100
+Subject: ALSA: hda: cs35l56: Fix lifecycle of codec pointer
+
+From: Simon Trimmer <simont@opensource.cirrus.com>
+
+[ Upstream commit d339131bf02d4ed918415574082caf5e8af6e664 ]
+
+The codec should be cleared when the amp driver is unbound and when
+resuming it should be tested to prevent loading firmware into the device
+and ALSA in a partially configured system state.
+
+Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
+Link: https://lore.kernel.org/r/20240531112716.25323-1-simont@opensource.cirrus.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/cs35l56_hda.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/sound/pci/hda/cs35l56_hda.c b/sound/pci/hda/cs35l56_hda.c
+index 6b77c38a0e155..e134ede6c5aa5 100644
+--- a/sound/pci/hda/cs35l56_hda.c
++++ b/sound/pci/hda/cs35l56_hda.c
+@@ -735,6 +735,8 @@ static void cs35l56_hda_unbind(struct device *dev, struct device *master, void *
+       if (comps[cs35l56->index].dev == dev)
+               memset(&comps[cs35l56->index], 0, sizeof(*comps));
++      cs35l56->codec = NULL;
++
+       dev_dbg(cs35l56->base.dev, "Unbound\n");
+ }
+@@ -840,6 +842,9 @@ static int cs35l56_hda_system_resume(struct device *dev)
+       cs35l56->suspended = false;
++      if (!cs35l56->codec)
++              return 0;
++
+       ret = cs35l56_is_fw_reload_needed(&cs35l56->base);
+       dev_dbg(cs35l56->base.dev, "fw_reload_needed: %d\n", ret);
+       if (ret > 0) {
+-- 
+2.43.0
+
diff --git a/queue-6.9/alsa-hda-cs35l56-select-serial_multi_instantiate.patch b/queue-6.9/alsa-hda-cs35l56-select-serial_multi_instantiate.patch
new file mode 100644 (file)
index 0000000..fd6825d
--- /dev/null
@@ -0,0 +1,47 @@
+From bb48ec29d83942f69d69c0ad69e75a2296efd967 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 19 Jun 2024 17:16:02 +0100
+Subject: ALSA: hda: cs35l56: Select SERIAL_MULTI_INSTANTIATE
+
+From: Simon Trimmer <simont@opensource.cirrus.com>
+
+[ Upstream commit 9b1effff19cdf2230d3ecb07ff4038a0da32e9cc ]
+
+The ACPI IDs used in the CS35L56 HDA drivers are all handled by the
+serial multi-instantiate driver which starts multiple Linux device
+instances from a single ACPI Device() node.
+
+As serial multi-instantiate is not an optional part of the system add it
+as a dependency in Kconfig so that it is not overlooked.
+
+Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
+Link: https://lore.kernel.org/20240619161602.117452-1-simont@opensource.cirrus.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/Kconfig | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
+index f806636242ee9..9f560a8186802 100644
+--- a/sound/pci/hda/Kconfig
++++ b/sound/pci/hda/Kconfig
+@@ -160,6 +160,7 @@ config SND_HDA_SCODEC_CS35L56_I2C
+       depends on ACPI || COMPILE_TEST
+       depends on SND_SOC
+       select FW_CS_DSP
++      select SERIAL_MULTI_INSTANTIATE
+       select SND_HDA_GENERIC
+       select SND_SOC_CS35L56_SHARED
+       select SND_HDA_SCODEC_CS35L56
+@@ -176,6 +177,7 @@ config SND_HDA_SCODEC_CS35L56_SPI
+       depends on ACPI || COMPILE_TEST
+       depends on SND_SOC
+       select FW_CS_DSP
++      select SERIAL_MULTI_INSTANTIATE
+       select SND_HDA_GENERIC
+       select SND_SOC_CS35L56_SHARED
+       select SND_HDA_SCODEC_CS35L56
+-- 
+2.43.0
+
diff --git a/queue-6.9/alsa-hda-realtek-add-more-codec-id-to-no-shutup-pins.patch b/queue-6.9/alsa-hda-realtek-add-more-codec-id-to-no-shutup-pins.patch
new file mode 100644 (file)
index 0000000..15c1c90
--- /dev/null
@@ -0,0 +1,41 @@
+From c797eb4817366c399e93514be16f80dfee0f68d3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 18 Jun 2024 14:16:04 +0800
+Subject: ALSA: hda/realtek: Add more codec ID to no shutup pins list
+
+From: Kailang Yang <kailang@realtek.com>
+
+[ Upstream commit 70794b9563fe011988bcf6a081af9777e63e8d37 ]
+
+If it enter to runtime D3 state, it didn't shutup Headset MIC pin.
+
+Signed-off-by: Kailang Yang <kailang@realtek.com>
+Link: https://lore.kernel.org/r/8d86f61e7d6f4a03b311e4eb4e5caaef@realtek.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/patch_realtek.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 9a326e66b0b19..a260dfb7fde0c 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -585,10 +585,14 @@ static void alc_shutup_pins(struct hda_codec *codec)
+       switch (codec->core.vendor_id) {
+       case 0x10ec0236:
+       case 0x10ec0256:
++      case 0x10ec0257:
+       case 0x19e58326:
+       case 0x10ec0283:
++      case 0x10ec0285:
+       case 0x10ec0286:
++      case 0x10ec0287:
+       case 0x10ec0288:
++      case 0x10ec0295:
+       case 0x10ec0298:
+               alc_headset_mic_no_shutup(codec);
+               break;
+-- 
+2.43.0
+
diff --git a/queue-6.9/alsa-hda-realtek-support-lenovo-thinkbook-13x-gen-4.patch b/queue-6.9/alsa-hda-realtek-support-lenovo-thinkbook-13x-gen-4.patch
new file mode 100644 (file)
index 0000000..0f69946
--- /dev/null
@@ -0,0 +1,37 @@
+From 7e9fe48792ef1354b0ef7203c3d7431bb5ec66cf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 6 Jun 2024 14:03:51 +0100
+Subject: ALSA: hda/realtek: Support Lenovo Thinkbook 13x Gen 4
+
+From: Stefan Binding <sbinding@opensource.cirrus.com>
+
+[ Upstream commit 4ecb16d9250e6fcf8818572bf317b6adae16515b ]
+
+Add support for this laptop, which uses CS35L41 HDA amps.
+The laptop does not contain valid _DSD for these amps, so requires
+entries into the CS35L41 configuration table to function correctly.
+
+Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Link: https://lore.kernel.org/r/20240606130351.333495-5-sbinding@opensource.cirrus.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/patch_realtek.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index db28547f3c637..9a326e66b0b19 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -10538,6 +10538,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+       SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
+       SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
+       SND_PCI_QUIRK(0x17aa, 0x38c3, "Y980 DUAL", ALC287_FIXUP_TAS2781_I2C),
++      SND_PCI_QUIRK(0x17aa, 0x38c7, "Thinkbook 13x Gen 4", ALC287_FIXUP_CS35L41_I2C_4),
++      SND_PCI_QUIRK(0x17aa, 0x38c8, "Thinkbook 13x Gen 4", ALC287_FIXUP_CS35L41_I2C_4),
+       SND_PCI_QUIRK(0x17aa, 0x38cb, "Y790 YG DUAL", ALC287_FIXUP_TAS2781_I2C),
+       SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
+       SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
+-- 
+2.43.0
+
diff --git a/queue-6.9/alsa-hda-realtek-support-lenovo-thinkbook-16p-gen-5.patch b/queue-6.9/alsa-hda-realtek-support-lenovo-thinkbook-16p-gen-5.patch
new file mode 100644 (file)
index 0000000..38e8aad
--- /dev/null
@@ -0,0 +1,39 @@
+From 3eeaf9b6e5317c9f98bfe29247af1c80485563a4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 6 Jun 2024 14:03:50 +0100
+Subject: ALSA: hda/realtek: Support Lenovo Thinkbook 16P Gen 5
+
+From: Stefan Binding <sbinding@opensource.cirrus.com>
+
+[ Upstream commit 75f2ea939b5c694b36aad8ef823a2f9bcf7b3d7d ]
+
+Add support for this laptop, which uses CS35L41 HDA amps.
+The laptop does not contain valid _DSD for these amps, so requires
+entries into the CS35L41 configuration table to function correctly.
+
+[ fixed to lower hex numbers in quirk entries -- tiwai ]
+
+Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Link: https://lore.kernel.org/r/20240606130351.333495-4-sbinding@opensource.cirrus.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/patch_realtek.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index 98f580e273e48..db28547f3c637 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -10542,6 +10542,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+       SND_PCI_QUIRK(0x17aa, 0x38cd, "Y790 VECO DUAL", ALC287_FIXUP_TAS2781_I2C),
+       SND_PCI_QUIRK(0x17aa, 0x38d2, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
+       SND_PCI_QUIRK(0x17aa, 0x38d7, "Lenovo Yoga 9 14IMH9", ALC287_FIXUP_YOGA9_14IMH9_BASS_SPK_PIN),
++      SND_PCI_QUIRK(0x17aa, 0x38f9, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
++      SND_PCI_QUIRK(0x17aa, 0x38fa, "Thinkbook 16P Gen5", ALC287_FIXUP_CS35L41_I2C_2),
+       SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
+       SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
+       SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
+-- 
+2.43.0
+
diff --git a/queue-6.9/alsa-hda-relatek-enable-mute-led-on-hp-laptop-15-gw0.patch b/queue-6.9/alsa-hda-relatek-enable-mute-led-on-hp-laptop-15-gw0.patch
new file mode 100644 (file)
index 0000000..bc192ba
--- /dev/null
@@ -0,0 +1,35 @@
+From 6430f3a327848f1c490cbd359c9e5c889ce54daf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 25 Jun 2024 13:12:02 +0500
+Subject: ALSA: hda/relatek: Enable Mute LED on HP Laptop 15-gw0xxx
+
+From: Aivaz Latypov <reichaivaz@gmail.com>
+
+[ Upstream commit 1d091a98c399c17d0571fa1d91a7123a698446e4 ]
+
+This HP Laptop uses ALC236 codec with COEF 0x07 controlling
+the mute LED. Enable existing quirk for this device.
+
+Signed-off-by: Aivaz Latypov <reichaivaz@gmail.com>
+Link: https://patch.msgid.link/20240625081217.1049-1-reichaivaz@gmail.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/patch_realtek.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
+index a260dfb7fde0c..8a52ed9aa465c 100644
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -10039,6 +10039,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
+       SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
+       SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
+       SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
++      SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
+       SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
+       SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
+       SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
+-- 
+2.43.0
+
diff --git a/queue-6.9/alsa-hda-use-imply-for-suggesting-config_serial_mult.patch b/queue-6.9/alsa-hda-use-imply-for-suggesting-config_serial_mult.patch
new file mode 100644 (file)
index 0000000..670fdb5
--- /dev/null
@@ -0,0 +1,51 @@
+From 45c605dd8d73e726f6b1dbe9e2d8bd74a13e5e29 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 21 Jun 2024 09:39:09 +0200
+Subject: ALSA: hda: Use imply for suggesting CONFIG_SERIAL_MULTI_INSTANTIATE
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit 17563b4a19d1844bdbccc7a82d2f31c28ca9cfae ]
+
+The recent fix introduced a reverse selection of
+CONFIG_SERIAL_MULTI_INSTANTIATE, but its condition isn't always met.
+Use a weak reverse selection to suggest the config for avoiding such
+inconsistencies, instead.
+
+Fixes: 9b1effff19cd ("ALSA: hda: cs35l56: Select SERIAL_MULTI_INSTANTIATE")
+Reported-by: kernel test robot <lkp@intel.com>
+Closes: https://lore.kernel.org/oe-kbuild-all/202406210732.ozgk8IMK-lkp@intel.com/
+Closes: https://lore.kernel.org/oe-kbuild-all/202406211244.oLhoF3My-lkp@intel.com/
+Reviewed-by: Richard Fitzgerald <rf@opensource.cirrus.com>
+Link: https://patch.msgid.link/20240621073915.19576-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/Kconfig | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
+index 9f560a8186802..b6869fe019f29 100644
+--- a/sound/pci/hda/Kconfig
++++ b/sound/pci/hda/Kconfig
+@@ -160,7 +160,7 @@ config SND_HDA_SCODEC_CS35L56_I2C
+       depends on ACPI || COMPILE_TEST
+       depends on SND_SOC
+       select FW_CS_DSP
+-      select SERIAL_MULTI_INSTANTIATE
++      imply SERIAL_MULTI_INSTANTIATE
+       select SND_HDA_GENERIC
+       select SND_SOC_CS35L56_SHARED
+       select SND_HDA_SCODEC_CS35L56
+@@ -177,7 +177,7 @@ config SND_HDA_SCODEC_CS35L56_SPI
+       depends on ACPI || COMPILE_TEST
+       depends on SND_SOC
+       select FW_CS_DSP
+-      select SERIAL_MULTI_INSTANTIATE
++      imply SERIAL_MULTI_INSTANTIATE
+       select SND_HDA_GENERIC
+       select SND_SOC_CS35L56_SHARED
+       select SND_HDA_SCODEC_CS35L56
+-- 
+2.43.0
+
diff --git a/queue-6.9/alsa-pcm-allow-resume-only-for-suspended-streams.patch b/queue-6.9/alsa-pcm-allow-resume-only-for-suspended-streams.patch
new file mode 100644 (file)
index 0000000..e5cc89d
--- /dev/null
@@ -0,0 +1,35 @@
+From 1218d267a714f75e8e5639a4f2498cd6cbd06d3b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 24 Jun 2024 14:54:34 +0200
+Subject: ALSA: PCM: Allow resume only for suspended streams
+
+From: Takashi Iwai <tiwai@suse.de>
+
+[ Upstream commit 1225675ca74c746f09211528588e83b3def1ff6a ]
+
+snd_pcm_resume() should bail out if the stream isn't in a suspended
+state.  Otherwise it'd allow doubly resume.
+
+Link: https://patch.msgid.link/20240624125443.27808-1-tiwai@suse.de
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/core/pcm_native.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
+index 0b76e76823d28..353ecd960a1f5 100644
+--- a/sound/core/pcm_native.c
++++ b/sound/core/pcm_native.c
+@@ -1775,6 +1775,8 @@ static int snd_pcm_pre_resume(struct snd_pcm_substream *substream,
+                             snd_pcm_state_t state)
+ {
+       struct snd_pcm_runtime *runtime = substream->runtime;
++      if (runtime->state != SNDRV_PCM_STATE_SUSPENDED)
++              return -EBADFD;
+       if (!(runtime->info & SNDRV_PCM_INFO_RESUME))
+               return -ENOSYS;
+       runtime->trigger_master = substream;
+-- 
+2.43.0
+
diff --git a/queue-6.9/arm64-armv8_deprecated-fix-warning-in-isndep-cpuhp-s.patch b/queue-6.9/arm64-armv8_deprecated-fix-warning-in-isndep-cpuhp-s.patch
new file mode 100644 (file)
index 0000000..bccae24
--- /dev/null
@@ -0,0 +1,51 @@
+From 7bc854a18638c700a8f70c9b87f13ebc2b81bbd3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Apr 2024 17:35:01 +0800
+Subject: arm64: armv8_deprecated: Fix warning in isndep cpuhp starting process
+
+From: Wei Li <liwei391@huawei.com>
+
+[ Upstream commit 14951beaec93696b092a906baa0f29322cf34004 ]
+
+The function run_all_insn_set_hw_mode() is registered as startup callback
+of 'CPUHP_AP_ARM64_ISNDEP_STARTING', it invokes set_hw_mode() methods of
+all emulated instructions.
+
+As the STARTING callbacks are not expected to fail, if one of the
+set_hw_mode() fails, e.g. due to el0 mixed-endian is not supported for
+'setend', it will report a warning:
+
+```
+CPU[2] cannot support the emulation of setend
+CPU 2 UP state arm64/isndep:starting (136) failed (-22)
+CPU2: Booted secondary processor 0x0000000002 [0x414fd0c1]
+```
+
+To fix it, add a check for INSN_UNAVAILABLE status and skip the process.
+
+Signed-off-by: Wei Li <liwei391@huawei.com>
+Tested-by: Huisong Li <lihuisong@huawei.com>
+Link: https://lore.kernel.org/r/20240423093501.3460764-1-liwei391@huawei.com
+Signed-off-by: Will Deacon <will@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/kernel/armv8_deprecated.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8_deprecated.c
+index dd6ce86d4332b..b776e7424fe91 100644
+--- a/arch/arm64/kernel/armv8_deprecated.c
++++ b/arch/arm64/kernel/armv8_deprecated.c
+@@ -462,6 +462,9 @@ static int run_all_insn_set_hw_mode(unsigned int cpu)
+       for (int i = 0; i < ARRAY_SIZE(insn_emulations); i++) {
+               struct insn_emulation *insn = insn_emulations[i];
+               bool enable = READ_ONCE(insn->current_mode) == INSN_HW;
++              if (insn->status == INSN_UNAVAILABLE)
++                      continue;
++
+               if (insn->set_hw_mode && insn->set_hw_mode(enable)) {
+                       pr_warn("CPU[%u] cannot support the emulation of %s",
+                               cpu, insn->name);
+-- 
+2.43.0
+
diff --git a/queue-6.9/asoc-amd-yc-fix-non-functional-mic-on-asus-m5602ra.patch b/queue-6.9/asoc-amd-yc-fix-non-functional-mic-on-asus-m5602ra.patch
new file mode 100644 (file)
index 0000000..ca560b1
--- /dev/null
@@ -0,0 +1,41 @@
+From 03aa32a688e9f69c5cf902135895b1846ad67a5a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 26 Jun 2024 10:03:34 +0300
+Subject: ASoC: amd: yc: Fix non-functional mic on ASUS M5602RA
+
+From: Vyacheslav Frantsishko <itmymaill@gmail.com>
+
+[ Upstream commit 63b47f026cc841bd3d3438dd6fccbc394dfead87 ]
+
+The Vivobook S 16X IPS needs a quirks-table entry for the internal microphone to function properly.
+
+Signed-off-by: Vyacheslav Frantsishko <itmymaill@gmail.com>
+Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
+Link: https://patch.msgid.link/20240626070334.45633-1-itmymaill@gmail.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/amd/yc/acp6x-mach.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c
+index 1760b5d42460a..4e3a8ce690a45 100644
+--- a/sound/soc/amd/yc/acp6x-mach.c
++++ b/sound/soc/amd/yc/acp6x-mach.c
+@@ -283,6 +283,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "M5402RA"),
+               }
+       },
++        {
++              .driver_data = &acp6x_card,
++              .matches = {
++                      DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."),
++                      DMI_MATCH(DMI_PRODUCT_NAME, "M5602RA"),
++              }
++      },
+       {
+               .driver_data = &acp6x_card,
+               .matches = {
+-- 
+2.43.0
+
diff --git a/queue-6.9/asoc-codecs-es8326-solve-headphone-detection-issue.patch b/queue-6.9/asoc-codecs-es8326-solve-headphone-detection-issue.patch
new file mode 100644 (file)
index 0000000..d68b1eb
--- /dev/null
@@ -0,0 +1,46 @@
+From 70a98eac9d639f1e558e7d341f84d3176283feaa Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 4 Jun 2024 10:19:46 +0800
+Subject: ASoC: codecs: ES8326: Solve headphone detection issue
+
+From: Zhang Yi <zhangyi@everest-semi.com>
+
+[ Upstream commit b7c40988808f8d7426dee1e4d96a4e204de4a8bc ]
+
+When switching between OMTP and CTIA headset, we can hear pop noise.
+To solve this issue, We modified the configuration for headphone detection
+
+Signed-off-by: Zhang Yi <zhangyi@everest-semi.com>
+Link: https://msgid.link/r/20240604021946.2911-1-zhangyi@everest-semi.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/es8326.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/codecs/es8326.c b/sound/soc/codecs/es8326.c
+index 17bd6b5160772..8b2328d5d0c74 100644
+--- a/sound/soc/codecs/es8326.c
++++ b/sound/soc/codecs/es8326.c
+@@ -865,12 +865,16 @@ static void es8326_jack_detect_handler(struct work_struct *work)
+                        * set auto-check mode, then restart jack_detect_work after 400ms.
+                        * Don't report jack status.
+                        */
+-                      regmap_write(es8326->regmap, ES8326_INT_SOURCE,
+-                                      (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
++                      regmap_write(es8326->regmap, ES8326_INT_SOURCE, 0x00);
+                       regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x01);
++                      regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x10, 0x00);
+                       es8326_enable_micbias(es8326->component);
+                       usleep_range(50000, 70000);
+                       regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x03, 0x00);
++                      regmap_update_bits(es8326->regmap, ES8326_HPDET_TYPE, 0x10, 0x10);
++                      usleep_range(50000, 70000);
++                      regmap_write(es8326->regmap, ES8326_INT_SOURCE,
++                                      (ES8326_INT_SRC_PIN9 | ES8326_INT_SRC_BUTTON));
+                       regmap_write(es8326->regmap, ES8326_SYS_BIAS, 0x1f);
+                       regmap_update_bits(es8326->regmap, ES8326_HP_DRIVER_REF, 0x0f, 0x08);
+                       queue_delayed_work(system_wq, &es8326->jack_detect_work,
+-- 
+2.43.0
+
diff --git a/queue-6.9/asoc-cs35l56-disconnect-asp1-tx-sources-when-asp1-da.patch b/queue-6.9/asoc-cs35l56-disconnect-asp1-tx-sources-when-asp1-da.patch
new file mode 100644 (file)
index 0000000..f2545a4
--- /dev/null
@@ -0,0 +1,78 @@
+From 55d85c08cf5b4060f68ccf6b7c30cc7f9d478437 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 13 Jun 2024 14:25:27 +0100
+Subject: ASoC: cs35l56: Disconnect ASP1 TX sources when ASP1 DAI is hooked up
+
+From: Richard Fitzgerald <rf@opensource.cirrus.com>
+
+[ Upstream commit 8af49868e51ed1ba117b74728af12abe1eda82e5 ]
+
+If the ASP1 DAI is hooked up by the machine driver the ASP TX mixer
+sources should be initialized to disconnected. There aren't currently
+any available products using the ASP so this doesn't affect any
+existing systems.
+
+The cs35l56 does not have any fixed default for the mixer source
+registers. When the cs35l56 boots, its firmware patches these registers
+to setup a system-specific routing; this is so that Windows can use
+generic SDCA drivers instead of needing knowledge of chip-specific
+registers. The setup varies between end-products, which each have
+customized firmware, and so the default register state varies between
+end-products. It can also change if the firmware on an end-product is
+upgraded - for example if a change was needed to the routing for Windows
+use-cases. It must be emphasized that the settings applied by the
+firmware are not internal magic tuning; they are statically implementing
+use-case setup that on Linux would be done via ALSA controls.
+
+The driver is currently syncing the mixer controls with whatever
+initial state the firmware wrote to the registers, so that they report
+the actual audio routing. But if the ASP DAI is hooked up this can create
+a powered-up DAPM graph without anything intentionally setting up a path.
+This can lead to parts of the audio system powering up unexpectedly.
+
+For example when cs35l56 is connected to cs42l43 using a codec-codec link,
+this can create a complete DAPM graph which then powers-up cs42l43. But
+the cs42l43 can only be clocked from its SoundWire bus so this causes a
+bunch of errors in the kernel log where cs42l43 is unexpectedly powered-up
+without a clock.
+
+If the host is taking ownership of the ASP (either directly or as a
+codec-to-codec link) there is no need to keep the mixer settings that the
+firmware wrote. The driver has ALSA controls for setting these using
+standard Linux mechanisms. So if the machine driver hooks up the ASP the
+ASP mixers are initialized to "None" (no input). This prevents unintended
+DAPM-graph power-ups, and means the initial state of the mixers is
+always going to be None.
+
+Since the initial state of the mixers can vary from system to system and
+potentially between firmware upgrades, no use-case manager can currently
+assume that cs35l56 has a known initial state. The firmware could just as
+easily default them to "None" as to any input source. So defaulting them
+to "None" in the driver is not increasing the entropy of the system.
+
+Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
+Link: https://lore.kernel.org/r/20240613132527.46537-1-rf@opensource.cirrus.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/cs35l56-shared.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c
+index fd02b621da52c..d29878af2a80d 100644
+--- a/sound/soc/codecs/cs35l56-shared.c
++++ b/sound/soc/codecs/cs35l56-shared.c
+@@ -214,6 +214,10 @@ static const struct reg_sequence cs35l56_asp1_defaults[] = {
+       REG_SEQ0(CS35L56_ASP1_FRAME_CONTROL5,   0x00020100),
+       REG_SEQ0(CS35L56_ASP1_DATA_CONTROL1,    0x00000018),
+       REG_SEQ0(CS35L56_ASP1_DATA_CONTROL5,    0x00000018),
++      REG_SEQ0(CS35L56_ASP1TX1_INPUT,         0x00000000),
++      REG_SEQ0(CS35L56_ASP1TX2_INPUT,         0x00000000),
++      REG_SEQ0(CS35L56_ASP1TX3_INPUT,         0x00000000),
++      REG_SEQ0(CS35L56_ASP1TX4_INPUT,         0x00000000),
+ };
+ /*
+-- 
+2.43.0
+
diff --git a/queue-6.9/asoc-intel-avs-fix-route-override.patch b/queue-6.9/asoc-intel-avs-fix-route-override.patch
new file mode 100644 (file)
index 0000000..0cc4771
--- /dev/null
@@ -0,0 +1,71 @@
+From 02c4cbb6a7986c30a5ac85a1f3e145d5dfc3e2f7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 3 Jun 2024 12:28:16 +0200
+Subject: ASoC: Intel: avs: Fix route override
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Amadeusz SÅ‚awiÅ„ski <amadeuszx.slawinski@linux.intel.com>
+
+[ Upstream commit fd660b1bd015e5aa9a558ee04088f2431010548d ]
+
+Instead of overriding existing memory strings that may be too short,
+just allocate needed memory and point the route at it.
+
+Reported-by: Jason Montleon <jmontleo@redhat.com>
+Link: https://github.com/thesofproject/avs-topology-xml/issues/22#issuecomment-2127892605
+Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
+Signed-off-by: Amadeusz SÅ‚awiÅ„ski <amadeuszx.slawinski@linux.intel.com>
+Link: https://lore.kernel.org/r/20240603102818.36165-3-amadeuszx.slawinski@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/intel/avs/topology.c | 19 +++++++++++++++----
+ 1 file changed, 15 insertions(+), 4 deletions(-)
+
+diff --git a/sound/soc/intel/avs/topology.c b/sound/soc/intel/avs/topology.c
+index 42b42903ae9de..691d16ce95a0f 100644
+--- a/sound/soc/intel/avs/topology.c
++++ b/sound/soc/intel/avs/topology.c
+@@ -1545,8 +1545,8 @@ static int avs_route_load(struct snd_soc_component *comp, int index,
+ {
+       struct snd_soc_acpi_mach *mach = dev_get_platdata(comp->card->dev);
+       size_t len = SNDRV_CTL_ELEM_ID_NAME_MAXLEN;
+-      char buf[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+       int ssp_port, tdm_slot;
++      char *buf;
+       /* See parse_link_formatted_string() for dynamic naming when(s). */
+       if (!avs_mach_singular_ssp(mach))
+@@ -1557,13 +1557,24 @@ static int avs_route_load(struct snd_soc_component *comp, int index,
+               return 0;
+       tdm_slot = avs_mach_ssp_tdm(mach, ssp_port);
++      buf = devm_kzalloc(comp->card->dev, len, GFP_KERNEL);
++      if (!buf)
++              return -ENOMEM;
+       avs_ssp_sprint(buf, len, route->source, ssp_port, tdm_slot);
+-      strscpy((char *)route->source, buf, len);
++      route->source = buf;
++
++      buf = devm_kzalloc(comp->card->dev, len, GFP_KERNEL);
++      if (!buf)
++              return -ENOMEM;
+       avs_ssp_sprint(buf, len, route->sink, ssp_port, tdm_slot);
+-      strscpy((char *)route->sink, buf, len);
++      route->sink = buf;
++
+       if (route->control) {
++              buf = devm_kzalloc(comp->card->dev, len, GFP_KERNEL);
++              if (!buf)
++                      return -ENOMEM;
+               avs_ssp_sprint(buf, len, route->control, ssp_port, tdm_slot);
+-              strscpy((char *)route->control, buf, len);
++              route->control = buf;
+       }
+       return 0;
+-- 
+2.43.0
+
diff --git a/queue-6.9/asoc-rt722-sdca-sdw-add-debounce-time-for-type-detec.patch b/queue-6.9/asoc-rt722-sdca-sdw-add-debounce-time-for-type-detec.patch
new file mode 100644 (file)
index 0000000..fc2cc96
--- /dev/null
@@ -0,0 +1,35 @@
+From 2e0b0b92b6401d9f6f19e21754ecd51dbe77f23e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 12 Jun 2024 09:01:07 +0000
+Subject: ASoC: rt722-sdca-sdw: add debounce time for type detection
+
+From: Jack Yu <jack.yu@realtek.com>
+
+[ Upstream commit f3b198e4788fcc8d03ed0c8bd5e3856c6a5760c5 ]
+
+Add debounce time in headset type detection for better performance.
+
+Signed-off-by: Jack Yu <jack.yu@realtek.com>
+Link: https://lore.kernel.org/r/7e502e9a9dd94122a1b60deb5ceb60fb@realtek.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/rt722-sdca-sdw.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sound/soc/codecs/rt722-sdca-sdw.c b/sound/soc/codecs/rt722-sdca-sdw.c
+index 0a14198f8a424..543a3fa1f5d3c 100644
+--- a/sound/soc/codecs/rt722-sdca-sdw.c
++++ b/sound/soc/codecs/rt722-sdca-sdw.c
+@@ -352,7 +352,7 @@ static int rt722_sdca_interrupt_callback(struct sdw_slave *slave,
+       if (status->sdca_cascade && !rt722->disable_irq)
+               mod_delayed_work(system_power_efficient_wq,
+-                      &rt722->jack_detect_work, msecs_to_jiffies(30));
++                      &rt722->jack_detect_work, msecs_to_jiffies(280));
+       mutex_unlock(&rt722->disable_irq_lock);
+-- 
+2.43.0
+
diff --git a/queue-6.9/asoc-rt722-sdca-sdw-add-silence-detection-register-a.patch b/queue-6.9/asoc-rt722-sdca-sdw-add-silence-detection-register-a.patch
new file mode 100644 (file)
index 0000000..4e7cf3a
--- /dev/null
@@ -0,0 +1,42 @@
+From bdc9f7cf26988c8256e180f434d22ddc34db5fe9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 3 Jun 2024 10:47:16 +0000
+Subject: ASoC: rt722-sdca-sdw: add silence detection register as volatile
+
+From: Jack Yu <jack.yu@realtek.com>
+
+[ Upstream commit 968c974c08106fcf911d8d390d0f049af855d348 ]
+
+Including silence detection register as volatile.
+
+Signed-off-by: Jack Yu <jack.yu@realtek.com>
+Link: https://msgid.link/r/c66a6bd6d220426793096b42baf85437@realtek.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/rt722-sdca-sdw.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/sound/soc/codecs/rt722-sdca-sdw.c b/sound/soc/codecs/rt722-sdca-sdw.c
+index 65d584c1886e8..0a14198f8a424 100644
+--- a/sound/soc/codecs/rt722-sdca-sdw.c
++++ b/sound/soc/codecs/rt722-sdca-sdw.c
+@@ -68,6 +68,7 @@ static bool rt722_sdca_mbq_readable_register(struct device *dev, unsigned int re
+       case 0x200007f:
+       case 0x2000082 ... 0x200008e:
+       case 0x2000090 ... 0x2000094:
++      case 0x3110000:
+       case 0x5300000 ... 0x5300002:
+       case 0x5400002:
+       case 0x5600000 ... 0x5600007:
+@@ -125,6 +126,7 @@ static bool rt722_sdca_mbq_volatile_register(struct device *dev, unsigned int re
+       case 0x2000067:
+       case 0x2000084:
+       case 0x2000086:
++      case 0x3110000:
+               return true;
+       default:
+               return false;
+-- 
+2.43.0
+
diff --git a/queue-6.9/asoc-sof-intel-hda-pcm-limit-the-maximum-number-of-p.patch b/queue-6.9/asoc-sof-intel-hda-pcm-limit-the-maximum-number-of-p.patch
new file mode 100644 (file)
index 0000000..e089797
--- /dev/null
@@ -0,0 +1,43 @@
+From 2fa0d5c95895f4c03f4e1cd4612366e541cedbf2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 4 Jul 2024 11:01:06 +0200
+Subject: ASoC: SOF: Intel: hda-pcm: Limit the maximum number of periods by
+ MAX_BDL_ENTRIES
+
+From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
+
+[ Upstream commit 82bb8db96610b558920b8c57cd250ec90567d79b ]
+
+The HDaudio specification Section 3.6.2 limits the number of BDL entries to 256.
+
+Make sure we don't allow more periods than this normative value.
+
+Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://patch.msgid.link/20240704090106.371497-1-pierre-louis.bossart@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/sof/intel/hda-pcm.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/sound/soc/sof/intel/hda-pcm.c b/sound/soc/sof/intel/hda-pcm.c
+index d7b446f3f973e..8b5fbbc777bd4 100644
+--- a/sound/soc/sof/intel/hda-pcm.c
++++ b/sound/soc/sof/intel/hda-pcm.c
+@@ -254,6 +254,12 @@ int hda_dsp_pcm_open(struct snd_sof_dev *sdev,
+       snd_pcm_hw_constraint_integer(substream->runtime,
+                                     SNDRV_PCM_HW_PARAM_PERIODS);
++      /* Limit the maximum number of periods to not exceed the BDL entries count */
++      if (runtime->hw.periods_max > HDA_DSP_MAX_BDL_ENTRIES)
++              snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIODS,
++                                           runtime->hw.periods_min,
++                                           HDA_DSP_MAX_BDL_ENTRIES);
++
+       /* Only S16 and S32 supported by HDA hardware when used without DSP */
+       if (sdev->dspless_mode_selected)
+               snd_pcm_hw_constraint_mask64(substream->runtime, SNDRV_PCM_HW_PARAM_FORMAT,
+-- 
+2.43.0
+
diff --git a/queue-6.9/asoc-sof-sof-audio-skip-unprepare-for-in-use-widgets.patch b/queue-6.9/asoc-sof-sof-audio-skip-unprepare-for-in-use-widgets.patch
new file mode 100644 (file)
index 0000000..9bf551b
--- /dev/null
@@ -0,0 +1,46 @@
+From f2a6080b213a8d39b69a1ae7f4f27ce630e7abf6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 12 Jun 2024 15:12:03 +0300
+Subject: ASoC: SOF: sof-audio: Skip unprepare for in-use widgets on error
+ rollback
+
+From: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
+
+[ Upstream commit 6f2a43e3d14f6e31a3b041a1043195d02c54d615 ]
+
+If the ipc_prepare() callback fails for a module instance, on error rewind
+we must skip the ipc_unprepare() call for ones that has positive use count.
+
+The positive use count means that the module instance is in active use, it
+cannot be unprepared.
+
+The issue affects capture direction paths with branches (single dai with
+multiple PCMs), the affected widgets are in the shared part of the paths.
+
+Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
+Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
+Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
+Link: https://lore.kernel.org/r/20240612121203.15468-1-peter.ujfalusi@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/sof/sof-audio.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c
+index e693dcb475e4d..d1a7d867f6a3a 100644
+--- a/sound/soc/sof/sof-audio.c
++++ b/sound/soc/sof/sof-audio.c
+@@ -485,7 +485,7 @@ sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget
+                       if (ret < 0) {
+                               /* unprepare the source widget */
+                               if (widget_ops[widget->id].ipc_unprepare &&
+-                                  swidget && swidget->prepared) {
++                                  swidget && swidget->prepared && swidget->use_count == 0) {
+                                       widget_ops[widget->id].ipc_unprepare(swidget);
+                                       swidget->prepared = false;
+                               }
+-- 
+2.43.0
+
diff --git a/queue-6.9/asoc-ti-davinci-mcasp-set-min-period-size-using-fifo.patch b/queue-6.9/asoc-ti-davinci-mcasp-set-min-period-size-using-fifo.patch
new file mode 100644 (file)
index 0000000..0083faa
--- /dev/null
@@ -0,0 +1,69 @@
+From 6eba7d7fa646f0898f352aae023642710842c2c4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 11 Jun 2024 18:02:56 +0530
+Subject: ASoC: ti: davinci-mcasp: Set min period size using FIFO config
+
+From: Jai Luthra <j-luthra@ti.com>
+
+[ Upstream commit c5dcf8ab10606e76c1d8a0ec77f27d84a392e874 ]
+
+The minimum period size was enforced to 64 as older devices integrating
+McASP with EDMA used an internal FIFO of 64 samples.
+
+With UDMA based platforms this internal McASP FIFO is optional, as the
+DMA engine internally does some buffering which is already accounted for
+when registering the platform. So we should read the actual FIFO
+configuration (txnumevt/rxnumevt) instead of hardcoding frames.min to
+64.
+
+Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
+Signed-off-by: Jai Luthra <j-luthra@ti.com>
+Link: https://lore.kernel.org/r/20240611-asoc_next-v3-2-fcfd84b12164@ti.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/ti/davinci-mcasp.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
+index 1e760c3155213..2b1ed91a736c9 100644
+--- a/sound/soc/ti/davinci-mcasp.c
++++ b/sound/soc/ti/davinci-mcasp.c
+@@ -1472,10 +1472,11 @@ static int davinci_mcasp_hw_rule_min_periodsize(
+ {
+       struct snd_interval *period_size = hw_param_interval(params,
+                                               SNDRV_PCM_HW_PARAM_PERIOD_SIZE);
++      u8 numevt = *((u8 *)rule->private);
+       struct snd_interval frames;
+       snd_interval_any(&frames);
+-      frames.min = 64;
++      frames.min = numevt;
+       frames.integer = 1;
+       return snd_interval_refine(period_size, &frames);
+@@ -1490,6 +1491,7 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
+       u32 max_channels = 0;
+       int i, dir, ret;
+       int tdm_slots = mcasp->tdm_slots;
++      u8 *numevt;
+       /* Do not allow more then one stream per direction */
+       if (mcasp->substreams[substream->stream])
+@@ -1589,9 +1591,12 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
+                       return ret;
+       }
++      numevt = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
++                       &mcasp->txnumevt :
++                       &mcasp->rxnumevt;
+       snd_pcm_hw_rule_add(substream->runtime, 0,
+                           SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
+-                          davinci_mcasp_hw_rule_min_periodsize, NULL,
++                          davinci_mcasp_hw_rule_min_periodsize, numevt,
+                           SNDRV_PCM_HW_PARAM_PERIOD_SIZE, -1);
+       return 0;
+-- 
+2.43.0
+
diff --git a/queue-6.9/asoc-ti-omap-hdmi-fix-too-long-driver-name.patch b/queue-6.9/asoc-ti-omap-hdmi-fix-too-long-driver-name.patch
new file mode 100644 (file)
index 0000000..7c49dfb
--- /dev/null
@@ -0,0 +1,43 @@
+From 8e0895dc5dfd8f678dd71ebb7d0944c8b7f9ea7d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 10 Jun 2024 14:58:47 +0200
+Subject: ASoC: ti: omap-hdmi: Fix too long driver name
+
+From: Primoz Fiser <primoz.fiser@norik.com>
+
+[ Upstream commit 524d3f126362b6033e92cbe107ae2158d7fbff94 ]
+
+Set driver name to "HDMI". This simplifies the code and gets rid of
+the following error messages:
+
+  ASoC: driver name too long 'HDMI 58040000.encoder' -> 'HDMI_58040000_e'
+
+Signed-off-by: Primoz Fiser <primoz.fiser@norik.com>
+Acked-by: Peter Ujfalusi <peter.ujfalusi@gmail.com>
+Link: https://lore.kernel.org/r/20240610125847.773394-1-primoz.fiser@norik.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/ti/omap-hdmi.c | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/sound/soc/ti/omap-hdmi.c b/sound/soc/ti/omap-hdmi.c
+index 4513b527ab970..ad8925b6481ca 100644
+--- a/sound/soc/ti/omap-hdmi.c
++++ b/sound/soc/ti/omap-hdmi.c
+@@ -354,11 +354,7 @@ static int omap_hdmi_audio_probe(struct platform_device *pdev)
+       if (!card)
+               return -ENOMEM;
+-      card->name = devm_kasprintf(dev, GFP_KERNEL,
+-                                  "HDMI %s", dev_name(ad->dssdev));
+-      if (!card->name)
+-              return -ENOMEM;
+-
++      card->name = "HDMI";
+       card->owner = THIS_MODULE;
+       card->dai_link =
+               devm_kzalloc(dev, sizeof(*(card->dai_link)), GFP_KERNEL);
+-- 
+2.43.0
+
diff --git a/queue-6.9/asoc-topology-do-not-assign-fields-that-are-already-.patch b/queue-6.9/asoc-topology-do-not-assign-fields-that-are-already-.patch
new file mode 100644 (file)
index 0000000..da41f65
--- /dev/null
@@ -0,0 +1,44 @@
+From 2f76740b4b1b0074ab8333a117a9511593950ae1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 3 Jun 2024 12:28:17 +0200
+Subject: ASoC: topology: Do not assign fields that are already set
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Amadeusz SÅ‚awiÅ„ski <amadeuszx.slawinski@linux.intel.com>
+
+[ Upstream commit daf0b99d4720c9f05bdb81c73b2efdb43fa9def3 ]
+
+The routes are allocated with kzalloc(), so all fields are zeroed by
+default, skip unnecessary assignments.
+
+Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
+Signed-off-by: Amadeusz SÅ‚awiÅ„ski <amadeuszx.slawinski@linux.intel.com>
+Link: https://lore.kernel.org/r/20240603102818.36165-4-amadeuszx.slawinski@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/soc-topology.c | 6 +-----
+ 1 file changed, 1 insertion(+), 5 deletions(-)
+
+diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
+index 7add1dbf1d214..ce22613bf9690 100644
+--- a/sound/soc/soc-topology.c
++++ b/sound/soc/soc-topology.c
+@@ -1072,11 +1072,7 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
+                       break;
+               }
+-              /* set to NULL atm for tplg users */
+-              route->connected = NULL;
+-              if (strnlen(elem->control, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == 0) {
+-                      route->control = NULL;
+-              } else {
++              if (strnlen(elem->control, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) != 0) {
+                       route->control = devm_kmemdup(tplg->dev, elem->control,
+                                                     min(strlen(elem->control),
+                                                         SNDRV_CTL_ELEM_ID_NAME_MAXLEN),
+-- 
+2.43.0
+
diff --git a/queue-6.9/asoc-topology-fix-references-to-freed-memory.patch b/queue-6.9/asoc-topology-fix-references-to-freed-memory.patch
new file mode 100644 (file)
index 0000000..d0ab466
--- /dev/null
@@ -0,0 +1,72 @@
+From 43c9012820229c55a0397a57169419994ba3d41a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 3 Jun 2024 12:28:15 +0200
+Subject: ASoC: topology: Fix references to freed memory
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Amadeusz SÅ‚awiÅ„ski <amadeuszx.slawinski@linux.intel.com>
+
+[ Upstream commit 97ab304ecd95c0b1703ff8c8c3956dc6e2afe8e1 ]
+
+Most users after parsing a topology file, release memory used by it, so
+having pointer references directly into topology file contents is wrong.
+Use devm_kmemdup(), to allocate memory as needed.
+
+Reported-by: Jason Montleon <jmontleo@redhat.com>
+Link: https://github.com/thesofproject/avs-topology-xml/issues/22#issuecomment-2127892605
+Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
+Signed-off-by: Amadeusz SÅ‚awiÅ„ski <amadeuszx.slawinski@linux.intel.com>
+Link: https://lore.kernel.org/r/20240603102818.36165-2-amadeuszx.slawinski@linux.intel.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/soc-topology.c | 27 ++++++++++++++++++++++-----
+ 1 file changed, 22 insertions(+), 5 deletions(-)
+
+diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
+index ba4890991f0d7..7add1dbf1d214 100644
+--- a/sound/soc/soc-topology.c
++++ b/sound/soc/soc-topology.c
+@@ -1060,15 +1060,32 @@ static int soc_tplg_dapm_graph_elems_load(struct soc_tplg *tplg,
+                       break;
+               }
+-              route->source = elem->source;
+-              route->sink = elem->sink;
++              route->source = devm_kmemdup(tplg->dev, elem->source,
++                                           min(strlen(elem->source),
++                                               SNDRV_CTL_ELEM_ID_NAME_MAXLEN),
++                                           GFP_KERNEL);
++              route->sink = devm_kmemdup(tplg->dev, elem->sink,
++                                         min(strlen(elem->sink), SNDRV_CTL_ELEM_ID_NAME_MAXLEN),
++                                         GFP_KERNEL);
++              if (!route->source || !route->sink) {
++                      ret = -ENOMEM;
++                      break;
++              }
+               /* set to NULL atm for tplg users */
+               route->connected = NULL;
+-              if (strnlen(elem->control, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == 0)
++              if (strnlen(elem->control, SNDRV_CTL_ELEM_ID_NAME_MAXLEN) == 0) {
+                       route->control = NULL;
+-              else
+-                      route->control = elem->control;
++              } else {
++                      route->control = devm_kmemdup(tplg->dev, elem->control,
++                                                    min(strlen(elem->control),
++                                                        SNDRV_CTL_ELEM_ID_NAME_MAXLEN),
++                                                    GFP_KERNEL);
++                      if (!route->control) {
++                              ret = -ENOMEM;
++                              break;
++                      }
++              }
+               /* add route dobj to dobj_list */
+               route->dobj.type = SND_SOC_DOBJ_GRAPH;
+-- 
+2.43.0
+
diff --git a/queue-6.9/bluetooth-btnxpuart-enable-power-save-feature-on-sta.patch b/queue-6.9/bluetooth-btnxpuart-enable-power-save-feature-on-sta.patch
new file mode 100644 (file)
index 0000000..f88d5ce
--- /dev/null
@@ -0,0 +1,46 @@
+From 701125de05f063b0cc6677271675a69c7ef9434e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 14 Jun 2024 13:50:39 +0530
+Subject: Bluetooth: btnxpuart: Enable Power Save feature on startup
+
+From: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
+
+[ Upstream commit 4183a7be77009fc31c5760429fe095f163bf96a9 ]
+
+This sets the default power save mode setting to enabled.
+
+The power save feature is now stable and stress test issues, such as the
+TX timeout error, have been resolved.
+commit c7ee0bc8db32 ("Bluetooth: btnxpuart: Resolve TX timeout error in
+power save stress test")
+
+With this setting, the driver will send the vendor command to FW at
+startup, to enable power save feature.
+
+User can disable this feature using the following vendor command:
+hcitool cmd 3f 23 03 00 00 (HCI_NXP_AUTO_SLEEP_MODE)
+
+Signed-off-by: Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com>
+Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/bluetooth/btnxpuart.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
+index 9d0c7e278114b..9bfa9a6ad56c8 100644
+--- a/drivers/bluetooth/btnxpuart.c
++++ b/drivers/bluetooth/btnxpuart.c
+@@ -281,7 +281,7 @@ static u8 crc8_table[CRC8_TABLE_SIZE];
+ /* Default configurations */
+ #define DEFAULT_H2C_WAKEUP_MODE       WAKEUP_METHOD_BREAK
+-#define DEFAULT_PS_MODE               PS_MODE_DISABLE
++#define DEFAULT_PS_MODE               PS_MODE_ENABLE
+ #define FW_INIT_BAUDRATE      HCI_NXP_PRI_BAUDRATE
+ static struct sk_buff *nxp_drv_send_cmd(struct hci_dev *hdev, u16 opcode,
+-- 
+2.43.0
+
diff --git a/queue-6.9/bluetooth-hci_core-cancel-all-works-upon-hci_unregis.patch b/queue-6.9/bluetooth-hci_core-cancel-all-works-upon-hci_unregis.patch
new file mode 100644 (file)
index 0000000..19998eb
--- /dev/null
@@ -0,0 +1,54 @@
+From 620c4ad21387a2c49290a4dd9419b117e7de17ee Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 10 Jun 2024 20:00:32 +0900
+Subject: Bluetooth: hci_core: cancel all works upon hci_unregister_dev()
+
+From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
+
+[ Upstream commit 0d151a103775dd9645c78c97f77d6e2a5298d913 ]
+
+syzbot is reporting that calling hci_release_dev() from hci_error_reset()
+due to hci_dev_put() from hci_error_reset() can cause deadlock at
+destroy_workqueue(), for hci_error_reset() is called from
+hdev->req_workqueue which destroy_workqueue() needs to flush.
+
+We need to make sure that hdev->{rx_work,cmd_work,tx_work} which are
+queued into hdev->workqueue and hdev->{power_on,error_reset} which are
+queued into hdev->req_workqueue are no longer running by the moment
+
+       destroy_workqueue(hdev->workqueue);
+       destroy_workqueue(hdev->req_workqueue);
+
+are called from hci_release_dev().
+
+Call cancel_work_sync() on these work items from hci_unregister_dev()
+as soon as hdev->list is removed from hci_dev_list.
+
+Reported-by: syzbot <syzbot+da0a9c9721e36db712e8@syzkaller.appspotmail.com>
+Closes: https://syzkaller.appspot.com/bug?extid=da0a9c9721e36db712e8
+Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/bluetooth/hci_core.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
+index 24f6b6a5c7721..131bb8b5777b4 100644
+--- a/net/bluetooth/hci_core.c
++++ b/net/bluetooth/hci_core.c
+@@ -2744,7 +2744,11 @@ void hci_unregister_dev(struct hci_dev *hdev)
+       list_del(&hdev->list);
+       write_unlock(&hci_dev_list_lock);
++      cancel_work_sync(&hdev->rx_work);
++      cancel_work_sync(&hdev->cmd_work);
++      cancel_work_sync(&hdev->tx_work);
+       cancel_work_sync(&hdev->power_on);
++      cancel_work_sync(&hdev->error_reset);
+       hci_cmd_sync_clear(hdev);
+-- 
+2.43.0
+
diff --git a/queue-6.9/bluetooth-l2cap-sync-sock-recv-cb-and-release.patch b/queue-6.9/bluetooth-l2cap-sync-sock-recv-cb-and-release.patch
new file mode 100644 (file)
index 0000000..1f08da4
--- /dev/null
@@ -0,0 +1,93 @@
+From 4134da15c9f539b2c5395a06469d5503879c7932 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 15 Jun 2024 09:45:54 +0800
+Subject: bluetooth/l2cap: sync sock recv cb and release
+
+From: Edward Adam Davis <eadavis@qq.com>
+
+[ Upstream commit 89e856e124f9ae548572c56b1b70c2255705f8fe ]
+
+The problem occurs between the system call to close the sock and hci_rx_work,
+where the former releases the sock and the latter accesses it without lock protection.
+
+           CPU0                       CPU1
+           ----                       ----
+           sock_close                 hci_rx_work
+          l2cap_sock_release         hci_acldata_packet
+          l2cap_sock_kill            l2cap_recv_frame
+          sk_free                    l2cap_conless_channel
+                                     l2cap_sock_recv_cb
+
+If hci_rx_work processes the data that needs to be received before the sock is
+closed, then everything is normal; Otherwise, the work thread may access the
+released sock when receiving data.
+
+Add a chan mutex in the rx callback of the sock to achieve synchronization between
+the sock release and recv cb.
+
+Sock is dead, so set chan data to NULL, avoid others use invalid sock pointer.
+
+Reported-and-tested-by: syzbot+b7f6f8c9303466e16c8a@syzkaller.appspotmail.com
+Signed-off-by: Edward Adam Davis <eadavis@qq.com>
+Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/bluetooth/l2cap_sock.c | 25 ++++++++++++++++++++++---
+ 1 file changed, 22 insertions(+), 3 deletions(-)
+
+diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
+index 8645461d45e81..64827e553d638 100644
+--- a/net/bluetooth/l2cap_sock.c
++++ b/net/bluetooth/l2cap_sock.c
+@@ -1239,6 +1239,10 @@ static void l2cap_sock_kill(struct sock *sk)
+       BT_DBG("sk %p state %s", sk, state_to_string(sk->sk_state));
++      /* Sock is dead, so set chan data to NULL, avoid other task use invalid
++       * sock pointer.
++       */
++      l2cap_pi(sk)->chan->data = NULL;
+       /* Kill poor orphan */
+       l2cap_chan_put(l2cap_pi(sk)->chan);
+@@ -1481,12 +1485,25 @@ static struct l2cap_chan *l2cap_sock_new_connection_cb(struct l2cap_chan *chan)
+ static int l2cap_sock_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb)
+ {
+-      struct sock *sk = chan->data;
+-      struct l2cap_pinfo *pi = l2cap_pi(sk);
++      struct sock *sk;
++      struct l2cap_pinfo *pi;
+       int err;
+-      lock_sock(sk);
++      /* To avoid race with sock_release, a chan lock needs to be added here
++       * to synchronize the sock.
++       */
++      l2cap_chan_hold(chan);
++      l2cap_chan_lock(chan);
++      sk = chan->data;
++      if (!sk) {
++              l2cap_chan_unlock(chan);
++              l2cap_chan_put(chan);
++              return -ENXIO;
++      }
++
++      pi = l2cap_pi(sk);
++      lock_sock(sk);
+       if (chan->mode == L2CAP_MODE_ERTM && !list_empty(&pi->rx_busy)) {
+               err = -ENOMEM;
+               goto done;
+@@ -1535,6 +1552,8 @@ static int l2cap_sock_recv_cb(struct l2cap_chan *chan, struct sk_buff *skb)
+ done:
+       release_sock(sk);
++      l2cap_chan_unlock(chan);
++      l2cap_chan_put(chan);
+       return err;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.9/btrfs-ensure-fast-fsync-waits-for-ordered-extents-af.patch b/queue-6.9/btrfs-ensure-fast-fsync-waits-for-ordered-extents-af.patch
new file mode 100644 (file)
index 0000000..08ddd46
--- /dev/null
@@ -0,0 +1,194 @@
+From bf0c26a541f8573f445be01141e0e1252c1ad6df Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 17 May 2024 12:48:25 +0100
+Subject: btrfs: ensure fast fsync waits for ordered extents after a write
+ failure
+
+From: Filipe Manana <fdmanana@suse.com>
+
+[ Upstream commit f13e01b89daf42330a4a722f451e48c3e2edfc8d ]
+
+If a write path in COW mode fails, either before submitting a bio for the
+new extents or an actual IO error happens, we can end up allowing a fast
+fsync to log file extent items that point to unwritten extents.
+
+This is because dropping the extent maps happens when completing ordered
+extents, at btrfs_finish_one_ordered(), and the completion of an ordered
+extent is executed in a work queue.
+
+This can result in a fast fsync to start logging file extent items based
+on existing extent maps before the ordered extents complete, therefore
+resulting in a log that has file extent items that point to unwritten
+extents, resulting in a corrupt file if a crash happens after and the log
+tree is replayed the next time the fs is mounted.
+
+This can happen for both direct IO writes and buffered writes.
+
+For example consider a direct IO write, in COW mode, that fails at
+btrfs_dio_submit_io() because btrfs_extract_ordered_extent() returned an
+error:
+
+1) We call btrfs_finish_ordered_extent() with the 'uptodate' parameter
+   set to false, meaning an error happened;
+
+2) That results in marking the ordered extent with the BTRFS_ORDERED_IOERR
+   flag;
+
+3) btrfs_finish_ordered_extent() queues the completion of the ordered
+   extent - so that btrfs_finish_one_ordered() will be executed later in
+   a work queue. That function will drop extent maps in the range when
+   it's executed, since the extent maps point to unwritten locations
+   (signaled by the BTRFS_ORDERED_IOERR flag);
+
+4) After calling btrfs_finish_ordered_extent() we keep going down the
+   write path and unlock the inode;
+
+5) After that a fast fsync starts and locks the inode;
+
+6) Before the work queue executes btrfs_finish_one_ordered(), the fsync
+   task sees the extent maps that point to the unwritten locations and
+   logs file extent items based on them - it does not know they are
+   unwritten, and the fast fsync path does not wait for ordered extents
+   to complete, which is an intentional behaviour in order to reduce
+   latency.
+
+For the buffered write case, here's one example:
+
+1) A fast fsync begins, and it starts by flushing delalloc and waiting for
+   the writeback to complete by calling filemap_fdatawait_range();
+
+2) Flushing the dellaloc created a new extent map X;
+
+3) During the writeback some IO error happened, and at the end io callback
+   (end_bbio_data_write()) we call btrfs_finish_ordered_extent(), which
+   sets the BTRFS_ORDERED_IOERR flag in the ordered extent and queues its
+   completion;
+
+4) After queuing the ordered extent completion, the end io callback clears
+   the writeback flag from all pages (or folios), and from that moment the
+   fast fsync can proceed;
+
+5) The fast fsync proceeds sees extent map X and logs a file extent item
+   based on extent map X, resulting in a log that points to an unwritten
+   data extent - because the ordered extent completion hasn't run yet, it
+   happens only after the logging.
+
+To fix this make btrfs_finish_ordered_extent() set the inode flag
+BTRFS_INODE_NEEDS_FULL_SYNC in case an error happened for a COW write,
+so that a fast fsync will wait for ordered extent completion.
+
+Note that this issues of using extent maps that point to unwritten
+locations can not happen for reads, because in read paths we start by
+locking the extent range and wait for any ordered extents in the range
+to complete before looking for extent maps.
+
+Reviewed-by: Qu Wenruo <wqu@suse.com>
+Signed-off-by: Filipe Manana <fdmanana@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/btrfs/btrfs_inode.h  | 10 ++++++++++
+ fs/btrfs/file.c         | 16 ++++++++++++++++
+ fs/btrfs/ordered-data.c | 31 +++++++++++++++++++++++++++++++
+ 3 files changed, 57 insertions(+)
+
+diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
+index 100020ca4658e..787ca2892d7a6 100644
+--- a/fs/btrfs/btrfs_inode.h
++++ b/fs/btrfs/btrfs_inode.h
+@@ -89,6 +89,16 @@ enum {
+       BTRFS_INODE_FREE_SPACE_INODE,
+       /* Set when there are no capabilities in XATTs for the inode. */
+       BTRFS_INODE_NO_CAP_XATTR,
++      /*
++       * Set if an error happened when doing a COW write before submitting a
++       * bio or during writeback. Used for both buffered writes and direct IO
++       * writes. This is to signal a fast fsync that it has to wait for
++       * ordered extents to complete and therefore not log extent maps that
++       * point to unwritten extents (when an ordered extent completes and it
++       * has the BTRFS_ORDERED_IOERR flag set, it drops extent maps in its
++       * range).
++       */
++      BTRFS_INODE_COW_WRITE_ERROR,
+ };
+ /* in memory btrfs inode */
+diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
+index f9d76072398da..97f6133b6eee8 100644
+--- a/fs/btrfs/file.c
++++ b/fs/btrfs/file.c
+@@ -1875,6 +1875,7 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
+        */
+       if (full_sync || btrfs_is_zoned(fs_info)) {
+               ret = btrfs_wait_ordered_range(inode, start, len);
++              clear_bit(BTRFS_INODE_COW_WRITE_ERROR, &BTRFS_I(inode)->runtime_flags);
+       } else {
+               /*
+                * Get our ordered extents as soon as possible to avoid doing
+@@ -1884,6 +1885,21 @@ int btrfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync)
+               btrfs_get_ordered_extents_for_logging(BTRFS_I(inode),
+                                                     &ctx.ordered_extents);
+               ret = filemap_fdatawait_range(inode->i_mapping, start, end);
++              if (ret)
++                      goto out_release_extents;
++
++              /*
++               * Check and clear the BTRFS_INODE_COW_WRITE_ERROR now after
++               * starting and waiting for writeback, because for buffered IO
++               * it may have been set during the end IO callback
++               * (end_bbio_data_write() -> btrfs_finish_ordered_extent()) in
++               * case an error happened and we need to wait for ordered
++               * extents to complete so that any extent maps that point to
++               * unwritten locations are dropped and we don't log them.
++               */
++              if (test_and_clear_bit(BTRFS_INODE_COW_WRITE_ERROR,
++                                     &BTRFS_I(inode)->runtime_flags))
++                      ret = btrfs_wait_ordered_range(inode, start, len);
+       }
+       if (ret)
+diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
+index c2a42bcde98e0..7dbf4162c75a5 100644
+--- a/fs/btrfs/ordered-data.c
++++ b/fs/btrfs/ordered-data.c
+@@ -382,6 +382,37 @@ bool btrfs_finish_ordered_extent(struct btrfs_ordered_extent *ordered,
+       ret = can_finish_ordered_extent(ordered, page, file_offset, len, uptodate);
+       spin_unlock_irqrestore(&inode->ordered_tree_lock, flags);
++      /*
++       * If this is a COW write it means we created new extent maps for the
++       * range and they point to unwritten locations if we got an error either
++       * before submitting a bio or during IO.
++       *
++       * We have marked the ordered extent with BTRFS_ORDERED_IOERR, and we
++       * are queuing its completion below. During completion, at
++       * btrfs_finish_one_ordered(), we will drop the extent maps for the
++       * unwritten extents.
++       *
++       * However because completion runs in a work queue we can end up having
++       * a fast fsync running before that. In the case of direct IO, once we
++       * unlock the inode the fsync might start, and we queue the completion
++       * before unlocking the inode. In the case of buffered IO when writeback
++       * finishes (end_bbio_data_write()) we queue the completion, so if the
++       * writeback was triggered by a fast fsync, the fsync might start
++       * logging before ordered extent completion runs in the work queue.
++       *
++       * The fast fsync will log file extent items based on the extent maps it
++       * finds, so if by the time it collects extent maps the ordered extent
++       * completion didn't happen yet, it will log file extent items that
++       * point to unwritten extents, resulting in a corruption if a crash
++       * happens and the log tree is replayed. Note that a fast fsync does not
++       * wait for completion of ordered extents in order to reduce latency.
++       *
++       * Set a flag in the inode so that the next fast fsync will wait for
++       * ordered extents to complete before starting to log.
++       */
++      if (!uptodate && !test_bit(BTRFS_ORDERED_NOCOW, &ordered->flags))
++              set_bit(BTRFS_INODE_COW_WRITE_ERROR, &inode->runtime_flags);
++
+       if (ret)
+               btrfs_queue_ordered_fn(ordered);
+       return ret;
+-- 
+2.43.0
+
diff --git a/queue-6.9/btrfs-fix-uninitialized-return-value-in-the-ref-veri.patch b/queue-6.9/btrfs-fix-uninitialized-return-value-in-the-ref-veri.patch
new file mode 100644 (file)
index 0000000..39ddebc
--- /dev/null
@@ -0,0 +1,61 @@
+From 7e0baaab5dd955a8cc396cca0fa839eb32810869 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 23 Jun 2024 12:50:26 +0100
+Subject: btrfs: fix uninitialized return value in the ref-verify tool
+
+From: Filipe Manana <fdmanana@suse.com>
+
+[ Upstream commit 9da45c88e124f13a3c4d480b89b298e007fbb9e4 ]
+
+In the ref-verify tool, when processing the inline references of an extent
+item, we may end up returning with uninitialized return value, because:
+
+1) The 'ret' variable is not initialized if there are no inline extent
+   references ('ptr' == 'end' before the while loop starts);
+
+2) If we find an extent owner inline reference we don't initialize 'ret'.
+
+So fix these cases by initializing 'ret' to 0 when declaring the variable
+and set it to -EINVAL if we find an extent owner inline references and
+simple quotas are not enabled (as well as print an error message).
+
+Reported-by: Mirsad Todorovac <mtodorovac69@gmail.com>
+Link: https://lore.kernel.org/linux-btrfs/59b40ebe-c824-457d-8b24-0bbca69d472b@gmail.com/
+Signed-off-by: Filipe Manana <fdmanana@suse.com>
+Reviewed-by: David Sterba <dsterba@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/btrfs/ref-verify.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/fs/btrfs/ref-verify.c b/fs/btrfs/ref-verify.c
+index 8c4fc98ca9ce7..aa7ddc09c55fa 100644
+--- a/fs/btrfs/ref-verify.c
++++ b/fs/btrfs/ref-verify.c
+@@ -441,7 +441,8 @@ static int process_extent_item(struct btrfs_fs_info *fs_info,
+       u32 item_size = btrfs_item_size(leaf, slot);
+       unsigned long end, ptr;
+       u64 offset, flags, count;
+-      int type, ret;
++      int type;
++      int ret = 0;
+       ei = btrfs_item_ptr(leaf, slot, struct btrfs_extent_item);
+       flags = btrfs_extent_flags(leaf, ei);
+@@ -486,7 +487,11 @@ static int process_extent_item(struct btrfs_fs_info *fs_info,
+                                                 key->objectid, key->offset);
+                       break;
+               case BTRFS_EXTENT_OWNER_REF_KEY:
+-                      WARN_ON(!btrfs_fs_incompat(fs_info, SIMPLE_QUOTA));
++                      if (!btrfs_fs_incompat(fs_info, SIMPLE_QUOTA)) {
++                              btrfs_err(fs_info,
++                        "found extent owner ref without simple quotas enabled");
++                              ret = -EINVAL;
++                      }
+                       break;
+               default:
+                       btrfs_err(fs_info, "invalid key type in iref");
+-- 
+2.43.0
+
diff --git a/queue-6.9/btrfs-qgroup-fix-quota-root-leak-after-quota-disable.patch b/queue-6.9/btrfs-qgroup-fix-quota-root-leak-after-quota-disable.patch
new file mode 100644 (file)
index 0000000..899e48e
--- /dev/null
@@ -0,0 +1,59 @@
+From b1c216e11f867ce86efb54db01db52547c65fcd4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Jun 2024 12:32:00 +0100
+Subject: btrfs: qgroup: fix quota root leak after quota disable failure
+
+From: Filipe Manana <fdmanana@suse.com>
+
+[ Upstream commit a7e4c6a3031c74078dba7fa36239d0f4fe476c53 ]
+
+If during the quota disable we fail when cleaning the quota tree or when
+deleting the root from the root tree, we jump to the 'out' label without
+ever dropping the reference on the quota root, resulting in a leak of the
+root since fs_info->quota_root is no longer pointing to the root (we have
+set it to NULL just before those steps).
+
+Fix this by always doing a btrfs_put_root() call under the 'out' label.
+This is a problem that exists since qgroups were first added in 2012 by
+commit bed92eae26cc ("Btrfs: qgroup implementation and prototypes"), but
+back then we missed a kfree on the quota root and free_extent_buffer()
+calls on its root and commit root nodes, since back then roots were not
+yet reference counted.
+
+Reviewed-by: Boris Burkov <boris@bur.io>
+Reviewed-by: Qu Wenruo <wqu@suse.com>
+Signed-off-by: Filipe Manana <fdmanana@suse.com>
+Reviewed-by: David Sterba <dsterba@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/btrfs/qgroup.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c
+index 4caa078d972a3..9af2afb417308 100644
+--- a/fs/btrfs/qgroup.c
++++ b/fs/btrfs/qgroup.c
+@@ -1351,7 +1351,7 @@ static int flush_reservations(struct btrfs_fs_info *fs_info)
+ int btrfs_quota_disable(struct btrfs_fs_info *fs_info)
+ {
+-      struct btrfs_root *quota_root;
++      struct btrfs_root *quota_root = NULL;
+       struct btrfs_trans_handle *trans = NULL;
+       int ret = 0;
+@@ -1449,9 +1449,9 @@ int btrfs_quota_disable(struct btrfs_fs_info *fs_info)
+       btrfs_free_tree_block(trans, btrfs_root_id(quota_root),
+                             quota_root->node, 0, 1);
+-      btrfs_put_root(quota_root);
+ out:
++      btrfs_put_root(quota_root);
+       mutex_unlock(&fs_info->qgroup_ioctl_lock);
+       if (ret && trans)
+               btrfs_end_transaction(trans);
+-- 
+2.43.0
+
diff --git a/queue-6.9/btrfs-scrub-handle-rst-lookup-error-correctly.patch b/queue-6.9/btrfs-scrub-handle-rst-lookup-error-correctly.patch
new file mode 100644 (file)
index 0000000..5c00ad9
--- /dev/null
@@ -0,0 +1,101 @@
+From 766cf62489693b6170aec74281d3e1aa52ba188a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 17 Jun 2024 15:18:44 +0930
+Subject: btrfs: scrub: handle RST lookup error correctly
+
+From: Qu Wenruo <wqu@suse.com>
+
+[ Upstream commit 2c49908634a2b97b1c3abe0589be2739ac5e7fd5 ]
+
+[BUG]
+When running btrfs/060 with forced RST feature, it would crash the
+following ASSERT() inside scrub_read_endio():
+
+       ASSERT(sector_nr < stripe->nr_sectors);
+
+Before that, we would have tree dump from
+btrfs_get_raid_extent_offset(), as we failed to find the RST entry for
+the range.
+
+[CAUSE]
+Inside scrub_submit_extent_sector_read() every time we allocated a new
+bbio we immediately called btrfs_map_block() to make sure there was some
+RST range covering the scrub target.
+
+But if btrfs_map_block() fails, we immediately call endio for the bbio,
+while the bbio is newly allocated, it's completely empty.
+
+Then inside scrub_read_endio(), we go through the bvecs to find
+the sector number (as bi_sector is no longer reliable if the bio is
+submitted to lower layers).
+
+And since the bio is empty, such bvecs iteration would not find any
+sector matching the sector, and return sector_nr == stripe->nr_sectors,
+triggering the ASSERT().
+
+[FIX]
+Instead of calling btrfs_map_block() after allocating a new bbio, call
+btrfs_map_block() first.
+
+Since our only objective of calling btrfs_map_block() is only to update
+stripe_len, there is really no need to do that after btrfs_alloc_bio().
+
+This new timing would avoid the problem of handling empty bbio
+completely, and in fact fixes a possible race window for the old code,
+where if the submission thread is the only owner of the pending_io, the
+scrub would never finish (since we didn't decrease the pending_io
+counter).
+
+Although the root cause of RST lookup failure still needs to be
+addressed.
+
+Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
+Signed-off-by: Qu Wenruo <wqu@suse.com>
+Signed-off-by: David Sterba <dsterba@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/btrfs/scrub.c | 24 ++++++++++++++----------
+ 1 file changed, 14 insertions(+), 10 deletions(-)
+
+diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
+index afd6932f5e895..d7caa3732f074 100644
+--- a/fs/btrfs/scrub.c
++++ b/fs/btrfs/scrub.c
+@@ -1688,20 +1688,24 @@ static void scrub_submit_extent_sector_read(struct scrub_ctx *sctx,
+                                           (i << fs_info->sectorsize_bits);
+                       int err;
+-                      bbio = btrfs_bio_alloc(stripe->nr_sectors, REQ_OP_READ,
+-                                             fs_info, scrub_read_endio, stripe);
+-                      bbio->bio.bi_iter.bi_sector = logical >> SECTOR_SHIFT;
+-
+                       io_stripe.is_scrub = true;
++                      stripe_len = (nr_sectors - i) << fs_info->sectorsize_bits;
++                      /*
++                       * For RST cases, we need to manually split the bbio to
++                       * follow the RST boundary.
++                       */
+                       err = btrfs_map_block(fs_info, BTRFS_MAP_READ, logical,
+-                                            &stripe_len, &bioc, &io_stripe,
+-                                            &mirror);
++                                            &stripe_len, &bioc, &io_stripe, &mirror);
+                       btrfs_put_bioc(bioc);
+-                      if (err) {
+-                              btrfs_bio_end_io(bbio,
+-                                               errno_to_blk_status(err));
+-                              return;
++                      if (err < 0) {
++                              set_bit(i, &stripe->io_error_bitmap);
++                              set_bit(i, &stripe->error_bitmap);
++                              continue;
+                       }
++
++                      bbio = btrfs_bio_alloc(stripe->nr_sectors, REQ_OP_READ,
++                                             fs_info, scrub_read_endio, stripe);
++                      bbio->bio.bi_iter.bi_sector = logical >> SECTOR_SHIFT;
+               }
+               __bio_add_page(&bbio->bio, page, fs_info->sectorsize, pgoff);
+-- 
+2.43.0
+
diff --git a/queue-6.9/bytcr_rt5640-inverse-jack-detect-for-archos-101-cesi.patch b/queue-6.9/bytcr_rt5640-inverse-jack-detect-for-archos-101-cesi.patch
new file mode 100644 (file)
index 0000000..4d669d1
--- /dev/null
@@ -0,0 +1,48 @@
+From 6b9092e2bb6d2b2809edc51f547dee01e9b047b6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 8 Jun 2024 19:02:51 +0200
+Subject: bytcr_rt5640 : inverse jack detect for Archos 101 cesium
+
+From: Thomas GENTY <tomlohave@gmail.com>
+
+[ Upstream commit e3209a1827646daaab744aa6a5767b1f57fb5385 ]
+
+When headphones are plugged in, they appear absent; when they are removed,
+they appear present.
+Add a specific entry in bytcr_rt5640 for this device
+
+Signed-off-by: Thomas GENTY <tomlohave@gmail.com>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Link: https://lore.kernel.org/r/20240608170251.99936-1-tomlohave@gmail.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/intel/boards/bytcr_rt5640.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c
+index b41a1147f1c34..a64d1989e28a5 100644
+--- a/sound/soc/intel/boards/bytcr_rt5640.c
++++ b/sound/soc/intel/boards/bytcr_rt5640.c
+@@ -610,6 +610,17 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {
+                                       BYT_RT5640_SSP0_AIF1 |
+                                       BYT_RT5640_MCLK_EN),
+       },
++      {
++              .matches = {
++                      DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ARCHOS"),
++                      DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ARCHOS 101 CESIUM"),
++              },
++              .driver_data = (void *)(BYTCR_INPUT_DEFAULTS |
++                                      BYT_RT5640_JD_NOT_INV |
++                                      BYT_RT5640_DIFF_MIC |
++                                      BYT_RT5640_SSP0_AIF1 |
++                                      BYT_RT5640_MCLK_EN),
++      },
+       {
+               .matches = {
+                       DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ARCHOS"),
+-- 
+2.43.0
+
diff --git a/queue-6.9/cachefiles-add-consistency-check-for-copen-cread.patch b/queue-6.9/cachefiles-add-consistency-check-for-copen-cread.patch
new file mode 100644 (file)
index 0000000..4982137
--- /dev/null
@@ -0,0 +1,96 @@
+From 8bc633bbb37a775245eeea1fddef64625d839e38 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 22 May 2024 19:43:02 +0800
+Subject: cachefiles: add consistency check for copen/cread
+
+From: Baokun Li <libaokun1@huawei.com>
+
+[ Upstream commit a26dc49df37e996876f50a0210039b2d211fdd6f ]
+
+This prevents malicious processes from completing random copen/cread
+requests and crashing the system. Added checks are listed below:
+
+  * Generic, copen can only complete open requests, and cread can only
+    complete read requests.
+  * For copen, ondemand_id must not be 0, because this indicates that the
+    request has not been read by the daemon.
+  * For cread, the object corresponding to fd and req should be the same.
+
+Signed-off-by: Baokun Li <libaokun1@huawei.com>
+Link: https://lore.kernel.org/r/20240522114308.2402121-7-libaokun@huaweicloud.com
+Acked-by: Jeff Layton <jlayton@kernel.org>
+Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com>
+Signed-off-by: Christian Brauner <brauner@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/cachefiles/ondemand.c | 27 ++++++++++++++++++++-------
+ 1 file changed, 20 insertions(+), 7 deletions(-)
+
+diff --git a/fs/cachefiles/ondemand.c b/fs/cachefiles/ondemand.c
+index 7e4874f60de10..ad6dc4f54ae7b 100644
+--- a/fs/cachefiles/ondemand.c
++++ b/fs/cachefiles/ondemand.c
+@@ -97,12 +97,12 @@ static loff_t cachefiles_ondemand_fd_llseek(struct file *filp, loff_t pos,
+ }
+ static long cachefiles_ondemand_fd_ioctl(struct file *filp, unsigned int ioctl,
+-                                       unsigned long arg)
++                                       unsigned long id)
+ {
+       struct cachefiles_object *object = filp->private_data;
+       struct cachefiles_cache *cache = object->volume->cache;
+       struct cachefiles_req *req;
+-      unsigned long id;
++      XA_STATE(xas, &cache->reqs, id);
+       if (ioctl != CACHEFILES_IOC_READ_COMPLETE)
+               return -EINVAL;
+@@ -110,10 +110,15 @@ static long cachefiles_ondemand_fd_ioctl(struct file *filp, unsigned int ioctl,
+       if (!test_bit(CACHEFILES_ONDEMAND_MODE, &cache->flags))
+               return -EOPNOTSUPP;
+-      id = arg;
+-      req = xa_erase(&cache->reqs, id);
+-      if (!req)
++      xa_lock(&cache->reqs);
++      req = xas_load(&xas);
++      if (!req || req->msg.opcode != CACHEFILES_OP_READ ||
++          req->object != object) {
++              xa_unlock(&cache->reqs);
+               return -EINVAL;
++      }
++      xas_store(&xas, NULL);
++      xa_unlock(&cache->reqs);
+       trace_cachefiles_ondemand_cread(object, id);
+       complete(&req->done);
+@@ -142,6 +147,7 @@ int cachefiles_ondemand_copen(struct cachefiles_cache *cache, char *args)
+       unsigned long id;
+       long size;
+       int ret;
++      XA_STATE(xas, &cache->reqs, 0);
+       if (!test_bit(CACHEFILES_ONDEMAND_MODE, &cache->flags))
+               return -EOPNOTSUPP;
+@@ -165,9 +171,16 @@ int cachefiles_ondemand_copen(struct cachefiles_cache *cache, char *args)
+       if (ret)
+               return ret;
+-      req = xa_erase(&cache->reqs, id);
+-      if (!req)
++      xa_lock(&cache->reqs);
++      xas.xa_index = id;
++      req = xas_load(&xas);
++      if (!req || req->msg.opcode != CACHEFILES_OP_OPEN ||
++          !req->object->ondemand->ondemand_id) {
++              xa_unlock(&cache->reqs);
+               return -EINVAL;
++      }
++      xas_store(&xas, NULL);
++      xa_unlock(&cache->reqs);
+       /* fail OPEN request if copen format is invalid */
+       ret = kstrtol(psize, 0, &size);
+-- 
+2.43.0
+
diff --git a/queue-6.9/cachefiles-make-on-demand-read-killable.patch b/queue-6.9/cachefiles-make-on-demand-read-killable.patch
new file mode 100644 (file)
index 0000000..e00396a
--- /dev/null
@@ -0,0 +1,103 @@
+From 40c6f12bec7fe2fb2622b780635c2b66f91f5bda Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 22 May 2024 19:43:08 +0800
+Subject: cachefiles: make on-demand read killable
+
+From: Baokun Li <libaokun1@huawei.com>
+
+[ Upstream commit bc9dde6155464e906e630a0a5c17a4cab241ffbb ]
+
+Replacing wait_for_completion() with wait_for_completion_killable() in
+cachefiles_ondemand_send_req() allows us to kill processes that might
+trigger a hunk_task if the daemon is abnormal.
+
+But now only CACHEFILES_OP_READ is killable, because OP_CLOSE and OP_OPEN
+is initiated from kworker context and the signal is prohibited in these
+kworker.
+
+Note that when the req in xas changes, i.e. xas_load(&xas) != req, it
+means that a process will complete the current request soon, so wait
+again for the request to be completed.
+
+In addition, add the cachefiles_ondemand_finish_req() helper function to
+simplify the code.
+
+Suggested-by: Hou Tao <houtao1@huawei.com>
+Signed-off-by: Baokun Li <libaokun1@huawei.com>
+Link: https://lore.kernel.org/r/20240522114308.2402121-13-libaokun@huaweicloud.com
+Acked-by: Jeff Layton <jlayton@kernel.org>
+Reviewed-by: Jia Zhu <zhujia.zj@bytedance.com>
+Signed-off-by: Christian Brauner <brauner@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/cachefiles/ondemand.c | 40 ++++++++++++++++++++++++++++------------
+ 1 file changed, 28 insertions(+), 12 deletions(-)
+
+diff --git a/fs/cachefiles/ondemand.c b/fs/cachefiles/ondemand.c
+index a0e34581a1cd6..d0059d36cbd51 100644
+--- a/fs/cachefiles/ondemand.c
++++ b/fs/cachefiles/ondemand.c
+@@ -380,6 +380,20 @@ static struct cachefiles_req *cachefiles_ondemand_select_req(struct xa_state *xa
+       return NULL;
+ }
++static inline bool cachefiles_ondemand_finish_req(struct cachefiles_req *req,
++                                                struct xa_state *xas, int err)
++{
++      if (unlikely(!xas || !req))
++              return false;
++
++      if (xa_cmpxchg(xas->xa, xas->xa_index, req, NULL, 0) != req)
++              return false;
++
++      req->error = err;
++      complete(&req->done);
++      return true;
++}
++
+ ssize_t cachefiles_ondemand_daemon_read(struct cachefiles_cache *cache,
+                                       char __user *_buffer, size_t buflen)
+ {
+@@ -443,16 +457,8 @@ ssize_t cachefiles_ondemand_daemon_read(struct cachefiles_cache *cache,
+ out:
+       cachefiles_put_object(req->object, cachefiles_obj_put_read_req);
+       /* Remove error request and CLOSE request has no reply */
+-      if (ret || msg->opcode == CACHEFILES_OP_CLOSE) {
+-              xas_reset(&xas);
+-              xas_lock(&xas);
+-              if (xas_load(&xas) == req) {
+-                      req->error = ret;
+-                      complete(&req->done);
+-                      xas_store(&xas, NULL);
+-              }
+-              xas_unlock(&xas);
+-      }
++      if (ret || msg->opcode == CACHEFILES_OP_CLOSE)
++              cachefiles_ondemand_finish_req(req, &xas, ret);
+       cachefiles_req_put(req);
+       return ret ? ret : n;
+ }
+@@ -557,8 +563,18 @@ static int cachefiles_ondemand_send_req(struct cachefiles_object *object,
+               goto out;
+       wake_up_all(&cache->daemon_pollwq);
+-      wait_for_completion(&req->done);
+-      ret = req->error;
++wait:
++      ret = wait_for_completion_killable(&req->done);
++      if (!ret) {
++              ret = req->error;
++      } else {
++              ret = -EINTR;
++              if (!cachefiles_ondemand_finish_req(req, &xas, ret)) {
++                      /* Someone will complete it soon. */
++                      cpu_relax();
++                      goto wait;
++              }
++      }
+       cachefiles_req_put(req);
+       return ret;
+ out:
+-- 
+2.43.0
+
diff --git a/queue-6.9/cachefiles-set-object-to-close-if-ondemand_id-0-in-c.patch b/queue-6.9/cachefiles-set-object-to-close-if-ondemand_id-0-in-c.patch
new file mode 100644 (file)
index 0000000..db5a3a4
--- /dev/null
@@ -0,0 +1,65 @@
+From 7d4df3597d1e734fac356c90891819ee386ff8de Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 22 May 2024 19:43:06 +0800
+Subject: cachefiles: Set object to close if ondemand_id < 0 in copen
+
+From: Zizhi Wo <wozizhi@huawei.com>
+
+[ Upstream commit 4f8703fb3482f92edcfd31661857b16fec89c2c0 ]
+
+If copen is maliciously called in the user mode, it may delete the request
+corresponding to the random id. And the request may have not been read yet.
+
+Note that when the object is set to reopen, the open request will be done
+with the still reopen state in above case. As a result, the request
+corresponding to this object is always skipped in select_req function, so
+the read request is never completed and blocks other process.
+
+Fix this issue by simply set object to close if its id < 0 in copen.
+
+Signed-off-by: Zizhi Wo <wozizhi@huawei.com>
+Signed-off-by: Baokun Li <libaokun1@huawei.com>
+Link: https://lore.kernel.org/r/20240522114308.2402121-11-libaokun@huaweicloud.com
+Acked-by: Jeff Layton <jlayton@kernel.org>
+Reviewed-by: Jia Zhu <zhujia.zj@bytedance.com>
+Signed-off-by: Christian Brauner <brauner@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/cachefiles/ondemand.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/fs/cachefiles/ondemand.c b/fs/cachefiles/ondemand.c
+index ad6dc4f54ae7b..a0e34581a1cd6 100644
+--- a/fs/cachefiles/ondemand.c
++++ b/fs/cachefiles/ondemand.c
+@@ -182,6 +182,7 @@ int cachefiles_ondemand_copen(struct cachefiles_cache *cache, char *args)
+       xas_store(&xas, NULL);
+       xa_unlock(&cache->reqs);
++      info = req->object->ondemand;
+       /* fail OPEN request if copen format is invalid */
+       ret = kstrtol(psize, 0, &size);
+       if (ret) {
+@@ -201,7 +202,6 @@ int cachefiles_ondemand_copen(struct cachefiles_cache *cache, char *args)
+               goto out;
+       }
+-      info = req->object->ondemand;
+       spin_lock(&info->lock);
+       /*
+        * The anonymous fd was closed before copen ? Fail the request.
+@@ -241,6 +241,11 @@ int cachefiles_ondemand_copen(struct cachefiles_cache *cache, char *args)
+       wake_up_all(&cache->daemon_pollwq);
+ out:
++      spin_lock(&info->lock);
++      /* Need to set object close to avoid reopen status continuing */
++      if (info->ondemand_id == CACHEFILES_ONDEMAND_ID_CLOSED)
++              cachefiles_ondemand_set_object_close(req->object);
++      spin_unlock(&info->lock);
+       complete(&req->done);
+       return ret;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.9/can-kvaser_usb-fix-return-value-for-hif_usb_send_reg.patch b/queue-6.9/can-kvaser_usb-fix-return-value-for-hif_usb_send_reg.patch
new file mode 100644 (file)
index 0000000..39b8d7a
--- /dev/null
@@ -0,0 +1,36 @@
+From 57965feebc585c080e236039277c7a796b16abe9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 May 2024 12:10:20 +0800
+Subject: can: kvaser_usb: fix return value for hif_usb_send_regout
+
+From: Chen Ni <nichen@iscas.ac.cn>
+
+[ Upstream commit 0d34d8163fd87978a6abd792e2d8ad849f4c3d57 ]
+
+As the potential failure of usb_submit_urb(), it should be better to
+return the err variable to catch the error.
+
+Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
+Link: https://lore.kernel.org/all/20240521041020.1519416-1-nichen@iscas.ac.cn
+Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
+index ffc3e93292501..024169461cad0 100644
+--- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
++++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_core.c
+@@ -295,7 +295,7 @@ int kvaser_usb_send_cmd_async(struct kvaser_usb_net_priv *priv, void *cmd,
+       }
+       usb_free_urb(urb);
+-      return 0;
++      return err;
+ }
+ int kvaser_usb_can_rx_over_error(struct net_device *netdev)
+-- 
+2.43.0
+
diff --git a/queue-6.9/clk-qcom-apss-ipq-pll-remove-config_ctl_hi_val-from-.patch b/queue-6.9/clk-qcom-apss-ipq-pll-remove-config_ctl_hi_val-from-.patch
new file mode 100644 (file)
index 0000000..bbf82b7
--- /dev/null
@@ -0,0 +1,49 @@
+From 9242873208fc3eea1aa83ee7d3a7339b5c222f0f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 9 May 2024 10:08:04 +0200
+Subject: clk: qcom: apss-ipq-pll: remove 'config_ctl_hi_val' from Stromer pll
+ configs
+
+From: Gabor Juhos <j4g8y7@gmail.com>
+
+[ Upstream commit 2ba8425678af422da37b6c9b50e9ce66f0f55cae ]
+
+Since the CONFIG_CTL register is only 32 bits wide in the Stromer
+and Stromer Plus PLLs , the 'config_ctl_hi_val' values from the
+IPQ5018 and IPQ5332 configurations are not used so remove those.
+
+No functional changes.
+
+Signed-off-by: Gabor Juhos <j4g8y7@gmail.com>
+Reviewed-by: Kathiravan Thirumoorthy <quic_kathirav@quicinc.com>
+Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org>
+Link: https://lore.kernel.org/r/20240509-stromer-config-ctl-v1-1-6034e17b28d5@gmail.com
+Signed-off-by: Bjorn Andersson <andersson@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/clk/qcom/apss-ipq-pll.c | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/drivers/clk/qcom/apss-ipq-pll.c b/drivers/clk/qcom/apss-ipq-pll.c
+index d7ab5bd5d4b41..e12bb9abf6b6a 100644
+--- a/drivers/clk/qcom/apss-ipq-pll.c
++++ b/drivers/clk/qcom/apss-ipq-pll.c
+@@ -100,7 +100,6 @@ static struct clk_alpha_pll ipq_pll_stromer_plus = {
+ static const struct alpha_pll_config ipq5018_pll_config = {
+       .l = 0x2a,
+       .config_ctl_val = 0x4001075b,
+-      .config_ctl_hi_val = 0x304,
+       .main_output_mask = BIT(0),
+       .aux_output_mask = BIT(1),
+       .early_output_mask = BIT(3),
+@@ -114,7 +113,6 @@ static const struct alpha_pll_config ipq5018_pll_config = {
+ static const struct alpha_pll_config ipq5332_pll_config = {
+       .l = 0x2d,
+       .config_ctl_val = 0x4001075b,
+-      .config_ctl_hi_val = 0x304,
+       .main_output_mask = BIT(0),
+       .aux_output_mask = BIT(1),
+       .early_output_mask = BIT(3),
+-- 
+2.43.0
+
diff --git a/queue-6.9/closures-change-bug_on-to-warn_on.patch b/queue-6.9/closures-change-bug_on-to-warn_on.patch
new file mode 100644 (file)
index 0000000..63312aa
--- /dev/null
@@ -0,0 +1,95 @@
+From 729ccbb2fa7d7b2dd43618a5346b3670ba77e9bd Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Jun 2024 09:45:09 -0400
+Subject: closures: Change BUG_ON() to WARN_ON()
+
+From: Kent Overstreet <kent.overstreet@linux.dev>
+
+[ Upstream commit 339b84ab6b1d66900c27bd999271cb2ae40ce812 ]
+
+If a BUG_ON() can be hit in the wild, it shouldn't be a BUG_ON()
+
+For reference, this has popped up once in the CI, and we'll need more
+info to debug it:
+
+03240 ------------[ cut here ]------------
+03240 kernel BUG at lib/closure.c:21!
+03240 kernel BUG at lib/closure.c:21!
+03240 Internal error: Oops - BUG: 00000000f2000800 [#1] SMP
+03240 Modules linked in:
+03240 CPU: 15 PID: 40534 Comm: kworker/u80:1 Not tainted 6.10.0-rc4-ktest-ga56da69799bd #25570
+03240 Hardware name: linux,dummy-virt (DT)
+03240 Workqueue: btree_update btree_interior_update_work
+03240 pstate: 00001005 (nzcv daif -PAN -UAO -TCO -DIT +SSBS BTYPE=--)
+03240 pc : closure_put+0x224/0x2a0
+03240 lr : closure_put+0x24/0x2a0
+03240 sp : ffff0000d12071c0
+03240 x29: ffff0000d12071c0 x28: dfff800000000000 x27: ffff0000d1207360
+03240 x26: 0000000000000040 x25: 0000000000000040 x24: 0000000000000040
+03240 x23: ffff0000c1f20180 x22: 0000000000000000 x21: ffff0000c1f20168
+03240 x20: 0000000040000000 x19: ffff0000c1f20140 x18: 0000000000000001
+03240 x17: 0000000000003aa0 x16: 0000000000003ad0 x15: 1fffe0001c326974
+03240 x14: 0000000000000a1e x13: 0000000000000000 x12: 1fffe000183e402d
+03240 x11: ffff6000183e402d x10: dfff800000000000 x9 : ffff6000183e402e
+03240 x8 : 0000000000000001 x7 : 00009fffe7c1bfd3 x6 : ffff0000c1f2016b
+03240 x5 : ffff0000c1f20168 x4 : ffff6000183e402e x3 : ffff800081391954
+03240 x2 : 0000000000000001 x1 : 0000000000000000 x0 : 00000000a8000000
+03240 Call trace:
+03240  closure_put+0x224/0x2a0
+03240  bch2_check_for_deadlock+0x910/0x1028
+03240  bch2_six_check_for_deadlock+0x1c/0x30
+03240  six_lock_slowpath.isra.0+0x29c/0xed0
+03240  six_lock_ip_waiter+0xa8/0xf8
+03240  __bch2_btree_node_lock_write+0x14c/0x298
+03240  bch2_trans_lock_write+0x6d4/0xb10
+03240  __bch2_trans_commit+0x135c/0x5520
+03240  btree_interior_update_work+0x1248/0x1c10
+03240  process_scheduled_works+0x53c/0xd90
+03240  worker_thread+0x370/0x8c8
+03240  kthread+0x258/0x2e8
+03240  ret_from_fork+0x10/0x20
+03240 Code: aa1303e0 d63f0020 a94363f7 17ffff8c (d4210000)
+03240 ---[ end trace 0000000000000000 ]---
+03240 Kernel panic - not syncing: Oops - BUG: Fatal exception
+03240 SMP: stopping secondary CPUs
+03241 SMP: failed to stop secondary CPUs 13,15
+03241 Kernel Offset: disabled
+03241 CPU features: 0x00,00000003,80000008,4240500b
+03241 Memory Limit: none
+03241 ---[ end Kernel panic - not syncing: Oops - BUG: Fatal exception ]---
+03246 ========= FAILED TIMEOUT copygc_torture_no_checksum in 7200s
+
+Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ lib/closure.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/lib/closure.c b/lib/closure.c
+index c16540552d61b..99380d9b4aa94 100644
+--- a/lib/closure.c
++++ b/lib/closure.c
+@@ -17,12 +17,18 @@ static inline void closure_put_after_sub(struct closure *cl, int flags)
+ {
+       int r = flags & CLOSURE_REMAINING_MASK;
+-      BUG_ON(flags & CLOSURE_GUARD_MASK);
+-      BUG_ON(!r && (flags & ~CLOSURE_DESTRUCTOR));
++      if (WARN(flags & CLOSURE_GUARD_MASK,
++               "closure has guard bits set: %x (%u)",
++               flags & CLOSURE_GUARD_MASK, (unsigned) __fls(r)))
++              r &= ~CLOSURE_GUARD_MASK;
+       if (!r) {
+               smp_acquire__after_ctrl_dep();
++              WARN(flags & ~CLOSURE_DESTRUCTOR,
++                   "closure ref hit 0 with incorrect flags set: %x (%u)",
++                   flags & ~CLOSURE_DESTRUCTOR, (unsigned) __fls(flags));
++
+               cl->closure_get_happened = false;
+               if (cl->fn && !(flags & CLOSURE_DESTRUCTOR)) {
+-- 
+2.43.0
+
diff --git a/queue-6.9/cpumask-limit-force_nr_cpus-to-just-the-up-case.patch b/queue-6.9/cpumask-limit-force_nr_cpus-to-just-the-up-case.patch
new file mode 100644 (file)
index 0000000..3906d08
--- /dev/null
@@ -0,0 +1,65 @@
+From 7eb015c2836ccc1d28120713bea87fd0de73d896 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 18 Jun 2024 09:00:04 -0700
+Subject: cpumask: limit FORCE_NR_CPUS to just the UP case
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+[ Upstream commit 5d272dd1b3430bb31fa30042490fa081512424e4 ]
+
+Hardcoding the number of CPUs at compile time does improve code
+generation, but if you get it wrong the result will be confusion.
+
+We already limited this earlier to only "experts" (see commit
+fe5759d5bfda "cpumask: limit visibility of FORCE_NR_CPUS"), but with
+distro kernel configs often having EXPERT enabled, that turns out to not
+be much of a limit.
+
+To quote the philosophers at Disney: "Everyone can be an expert. And
+when everyone's an expert, no one will be".
+
+There's a runtime warning if you then set nr_cpus to anything but the
+forced number, but apparently that can be ignored too [1] and by then
+it's pretty much too late anyway.
+
+If we had some real way to limit this to "embedded only", maybe it would
+be worth it, but let's see if anybody even notices that the option is
+gone.  We need to simplify kernel configuration anyway.
+
+Link: https://lore.kernel.org/all/20240618105036.208a8860@rorschach.local.home/ [1]
+Reported-by: Steven Rostedt <rostedt@goodmis.org>
+Cc: Masami Hiramatsu <mhiramat@kernel.org>
+Cc: Mark Rutland <mark.rutland@arm.com>
+Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+Cc: Paul McKenney <paulmck@kernel.org>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Yury Norov <yury.norov@gmail.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ lib/Kconfig | 8 +-------
+ 1 file changed, 1 insertion(+), 7 deletions(-)
+
+diff --git a/lib/Kconfig b/lib/Kconfig
+index 4557bb8a52565..c98e11c7330ec 100644
+--- a/lib/Kconfig
++++ b/lib/Kconfig
+@@ -539,13 +539,7 @@ config CPUMASK_OFFSTACK
+         stack overflow.
+ config FORCE_NR_CPUS
+-       bool "Set number of CPUs at compile time"
+-       depends on SMP && EXPERT && !COMPILE_TEST
+-       help
+-         Say Yes if you have NR_CPUS set to an actual number of possible
+-         CPUs in your system, not to a default value. This forces the core
+-         code to rely on compile-time value and optimize kernel routines
+-         better.
++      def_bool !SMP
+ config CPU_RMAP
+       bool
+-- 
+2.43.0
+
diff --git a/queue-6.9/drivers-perf-riscv-reset-the-counter-to-hpmevent-map.patch b/queue-6.9/drivers-perf-riscv-reset-the-counter-to-hpmevent-map.patch
new file mode 100644 (file)
index 0000000..77774be
--- /dev/null
@@ -0,0 +1,40 @@
+From f6267cd9c4153cd88140a53e3f879835924678f2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 28 Jun 2024 00:51:42 -0700
+Subject: drivers/perf: riscv: Reset the counter to hpmevent mapping while
+ starting cpus
+
+From: Samuel Holland <samuel.holland@sifive.com>
+
+[ Upstream commit 7dd646cf745c34d31e7ed2a52265e9ca8308f58f ]
+
+Currently, we stop all the counters while a new cpu is brought online.
+However, the hpmevent to counter mappings are not reset. The firmware may
+have some stale encoding in their mapping structure which may lead to
+undesirable results. We have not encountered such scenario though.
+
+Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
+Signed-off-by: Atish Patra <atishp@rivosinc.com>
+Link: https://lore.kernel.org/r/20240628-misc_perf_fixes-v4-2-e01cfddcf035@rivosinc.com
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/perf/riscv_pmu_sbi.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/perf/riscv_pmu_sbi.c b/drivers/perf/riscv_pmu_sbi.c
+index 3e44d2fb8bf81..6d3fdf3a688dd 100644
+--- a/drivers/perf/riscv_pmu_sbi.c
++++ b/drivers/perf/riscv_pmu_sbi.c
+@@ -634,7 +634,7 @@ static inline void pmu_sbi_stop_all(struct riscv_pmu *pmu)
+        * which may include counters that are not enabled yet.
+        */
+       sbi_ecall(SBI_EXT_PMU, SBI_EXT_PMU_COUNTER_STOP,
+-                0, pmu->cmask, 0, 0, 0, 0);
++                0, pmu->cmask, SBI_PMU_STOP_FLAG_RESET, 0, 0, 0);
+ }
+ static inline void pmu_sbi_stop_hw_ctrs(struct riscv_pmu *pmu)
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-amd-display-account-for-cursor-prefetch-bw-in-dm.patch b/queue-6.9/drm-amd-display-account-for-cursor-prefetch-bw-in-dm.patch
new file mode 100644 (file)
index 0000000..79e71b7
--- /dev/null
@@ -0,0 +1,44 @@
+From 47b59194e7196b7098e5619425ea006794040b71 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Jun 2024 15:11:38 -0400
+Subject: drm/amd/display: Account for cursor prefetch BW in DML1 mode support
+
+From: Alvin Lee <alvin.lee2@amd.com>
+
+[ Upstream commit 074b3a886713f69d98d30bb348b1e4cb3ce52b22 ]
+
+[Description]
+We need to ensure to take into account cursor prefetch BW in
+mode support or we may pass ModeQuery but fail an actual flip
+which will cause a hang. Flip may fail because the cursor_pre_bw
+is populated during mode programming (and mode programming is
+never called prior to ModeQuery).
+
+Reviewed-by: Chaitanya Dhere <chaitanya.dhere@amd.com>
+Reviewed-by: Nevenko Stupar <nevenko.stupar@amd.com>
+Signed-off-by: Jerry Zuo <jerry.zuo@amd.com>
+Signed-off-by: Alvin Lee <alvin.lee2@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
+index 6c84b0fa40f44..0782a34689a00 100644
+--- a/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
++++ b/drivers/gpu/drm/amd/display/dc/dml/dcn32/display_mode_vba_32.c
+@@ -3364,6 +3364,9 @@ void dml32_ModeSupportAndSystemConfigurationFull(struct display_mode_lib *mode_l
+                                                       &mode_lib->vba.UrgentBurstFactorLumaPre[k],
+                                                       &mode_lib->vba.UrgentBurstFactorChromaPre[k],
+                                                       &mode_lib->vba.NotUrgentLatencyHidingPre[k]);
++
++                                      v->cursor_bw_pre[k] = mode_lib->vba.NumberOfCursors[k] * mode_lib->vba.CursorWidth[k][0] * mode_lib->vba.CursorBPP[k][0] /
++                                                      8.0 / (mode_lib->vba.HTotal[k] / mode_lib->vba.PixelClock[k]) * v->VRatioPreY[i][j][k];
+                               }
+                               {
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-amd-display-add-refresh-rate-range-check.patch b/queue-6.9/drm-amd-display-add-refresh-rate-range-check.patch
new file mode 100644 (file)
index 0000000..15a0c0a
--- /dev/null
@@ -0,0 +1,50 @@
+From 4269a18689e6c6cb2cf58d6d79be95c82c76052d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 19 Jun 2024 14:03:55 +0800
+Subject: drm/amd/display: Add refresh rate range check
+
+From: Tom Chung <chiahsuan.chung@amd.com>
+
+[ Upstream commit 74ad26b36d303ac233eccadc5c3a8d7ee4709f31 ]
+
+[Why]
+We only enable the VRR while monitor usable refresh rate range
+is greater than 10 Hz.
+But we did not check the range in DRM_EDID_FEATURE_CONTINUOUS_FREQ
+case.
+
+[How]
+Add a refresh rate range check before set the freesync_capable flag
+in DRM_EDID_FEATURE_CONTINUOUS_FREQ case.
+
+Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
+Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
+Signed-off-by: Jerry Zuo <jerry.zuo@amd.com>
+Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+index 2152e40ee1c27..087d7aad8e6b4 100644
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+@@ -11289,9 +11289,11 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
+               if (is_dp_capable_without_timing_msa(adev->dm.dc,
+                                                    amdgpu_dm_connector)) {
+                       if (edid->features & DRM_EDID_FEATURE_CONTINUOUS_FREQ) {
+-                              freesync_capable = true;
+                               amdgpu_dm_connector->min_vfreq = connector->display_info.monitor_range.min_vfreq;
+                               amdgpu_dm_connector->max_vfreq = connector->display_info.monitor_range.max_vfreq;
++                              if (amdgpu_dm_connector->max_vfreq -
++                                  amdgpu_dm_connector->min_vfreq > 10)
++                                      freesync_capable = true;
+                       } else {
+                               edid_check_required = edid->version > 1 ||
+                                                     (edid->version == 1 &&
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-amd-display-change-dram_clock_latency-to-34us-fo.patch b/queue-6.9/drm-amd-display-change-dram_clock_latency-to-34us-fo.patch
new file mode 100644 (file)
index 0000000..a59d83f
--- /dev/null
@@ -0,0 +1,42 @@
+From f7540d4062c914bc412f039af3e38a541fffbeeb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 28 May 2024 16:17:17 -0400
+Subject: drm/amd/display: Change dram_clock_latency to 34us for dcn351
+
+From: Daniel Miess <daniel.miess@amd.com>
+
+[ Upstream commit c60e20f13c27662de36cd5538d6299760780db52 ]
+
+[Why]
+Intermittent underflow observed when using 4k144 display on
+dcn351
+
+[How]
+Update dram_clock_change_latency_us from 11.72us to 34us
+
+Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
+Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
+Signed-off-by: Daniel Miess <daniel.miess@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/display/dc/dml/dcn351/dcn351_fpu.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn351/dcn351_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn351/dcn351_fpu.c
+index b3ffab77cf889..40ca38dd1b23e 100644
+--- a/drivers/gpu/drm/amd/display/dc/dml/dcn351/dcn351_fpu.c
++++ b/drivers/gpu/drm/amd/display/dc/dml/dcn351/dcn351_fpu.c
+@@ -215,7 +215,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn3_51_soc = {
+       .urgent_latency_pixel_data_only_us = 4.0,
+       .urgent_latency_pixel_mixed_with_vm_data_us = 4.0,
+       .urgent_latency_vm_data_only_us = 4.0,
+-      .dram_clock_change_latency_us = 11.72,
++      .dram_clock_change_latency_us = 34,
+       .urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096,
+       .urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096,
+       .urgent_out_of_order_return_per_channel_vm_only_bytes = 4096,
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-amd-display-change-dram_clock_latency-to-34us-fo.patch-18657 b/queue-6.9/drm-amd-display-change-dram_clock_latency-to-34us-fo.patch-18657
new file mode 100644 (file)
index 0000000..55c7f87
--- /dev/null
@@ -0,0 +1,39 @@
+From 870b4b70ab4ceb563b966938aa675eb062385347 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 28 May 2024 14:36:00 +0800
+Subject: drm/amd/display: change dram_clock_latency to 34us for dcn35
+
+From: Paul Hsieh <paul.hsieh@amd.com>
+
+[ Upstream commit 6071607bfefefc50a3907c0ba88878846960d29a ]
+
+[Why & How]
+Current DRAM setting would cause underflow on customer platform.
+Modify dram_clock_change_latency_us from 11.72 to 34.0 us as per recommendation from HW team
+
+Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
+Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
+Signed-off-by: Paul Hsieh <paul.hsieh@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c b/drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c
+index 53e40d3c48d4b..6716696df7719 100644
+--- a/drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c
++++ b/drivers/gpu/drm/amd/display/dc/dml/dcn35/dcn35_fpu.c
+@@ -177,7 +177,7 @@ struct _vcs_dpi_soc_bounding_box_st dcn3_5_soc = {
+       .urgent_latency_pixel_data_only_us = 4.0,
+       .urgent_latency_pixel_mixed_with_vm_data_us = 4.0,
+       .urgent_latency_vm_data_only_us = 4.0,
+-      .dram_clock_change_latency_us = 11.72,
++      .dram_clock_change_latency_us = 34.0,
+       .urgent_out_of_order_return_per_channel_pixel_only_bytes = 4096,
+       .urgent_out_of_order_return_per_channel_pixel_and_vm_bytes = 4096,
+       .urgent_out_of_order_return_per_channel_vm_only_bytes = 4096,
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-amd-display-fix-array-index-out-of-bounds-in-dml.patch b/queue-6.9/drm-amd-display-fix-array-index-out-of-bounds-in-dml.patch
new file mode 100644 (file)
index 0000000..9fd17c7
--- /dev/null
@@ -0,0 +1,45 @@
+From bd8a1e52db66084c2af3c362696644c29318a516 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 26 Jun 2024 14:08:41 -0400
+Subject: drm/amd/display: Fix array-index-out-of-bounds in
+ dml2/FCLKChangeSupport
+
+From: Roman Li <Roman.Li@amd.com>
+
+[ Upstream commit 0ad4b4a2f6357c45fbe444ead1a929a0b4017d03 ]
+
+[Why]
+Potential out of bounds access in dml2_calculate_rq_and_dlg_params()
+because the value of out_lowest_state_idx used as an index for FCLKChangeSupport
+array can be greater than 1.
+
+[How]
+Currently dml2 core specifies identical values for all FCLKChangeSupport
+elements. Always use index 0 in the condition to avoid out of bounds access.
+
+Acked-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
+Signed-off-by: Jerry Zuo <jerry.zuo@amd.com>
+Signed-off-by: Roman Li <Roman.Li@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c b/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c
+index b72ed3e78df05..bb4e812248aec 100644
+--- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c
++++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c
+@@ -294,7 +294,7 @@ void dml2_calculate_rq_and_dlg_params(const struct dc *dc, struct dc_state *cont
+       context->bw_ctx.bw.dcn.clk.dcfclk_deep_sleep_khz = (unsigned int)in_ctx->v20.dml_core_ctx.mp.DCFCLKDeepSleep * 1000;
+       context->bw_ctx.bw.dcn.clk.dppclk_khz = 0;
+-      if (in_ctx->v20.dml_core_ctx.ms.support.FCLKChangeSupport[in_ctx->v20.scratch.mode_support_params.out_lowest_state_idx] == dml_fclock_change_unsupported)
++      if (in_ctx->v20.dml_core_ctx.ms.support.FCLKChangeSupport[0] == dml_fclock_change_unsupported)
+               context->bw_ctx.bw.dcn.clk.fclk_p_state_change_support = false;
+       else
+               context->bw_ctx.bw.dcn.clk.fclk_p_state_change_support = true;
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-amd-display-fix-refresh-rate-range-for-some-pane.patch b/queue-6.9/drm-amd-display-fix-refresh-rate-range-for-some-pane.patch
new file mode 100644 (file)
index 0000000..cd81697
--- /dev/null
@@ -0,0 +1,98 @@
+From 303894e22c26e943087a1387a81a7d8d1d7c544c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 14 Jun 2024 15:38:56 +0800
+Subject: drm/amd/display: Fix refresh rate range for some panel
+
+From: Tom Chung <chiahsuan.chung@amd.com>
+
+[ Upstream commit 9ef1548aeaa8858e7aee2152bf95cc71cdcd6dff ]
+
+[Why]
+Some of the panels does not have the refresh rate range info
+in base EDID and only have the refresh rate range info in
+DisplayID block.
+It will cause the max/min freesync refresh rate set to 0.
+
+[How]
+Try to parse the refresh rate range info from DisplayID if the
+max/min refresh rate is 0.
+
+Reviewed-by: Sun peng Li <sunpeng.li@amd.com>
+Signed-off-by: Jerry Zuo <jerry.zuo@amd.com>
+Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 48 +++++++++++++++++++
+ 1 file changed, 48 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+index 087d7aad8e6b4..c29d271579ad3 100644
+--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+@@ -11161,6 +11161,49 @@ static bool parse_edid_cea(struct amdgpu_dm_connector *aconnector,
+       return ret;
+ }
++static void parse_edid_displayid_vrr(struct drm_connector *connector,
++              struct edid *edid)
++{
++      u8 *edid_ext = NULL;
++      int i;
++      int j = 0;
++      u16 min_vfreq;
++      u16 max_vfreq;
++
++      if (edid == NULL || edid->extensions == 0)
++              return;
++
++      /* Find DisplayID extension */
++      for (i = 0; i < edid->extensions; i++) {
++              edid_ext = (void *)(edid + (i + 1));
++              if (edid_ext[0] == DISPLAYID_EXT)
++                      break;
++      }
++
++      if (edid_ext == NULL)
++              return;
++
++      while (j < EDID_LENGTH) {
++              /* Get dynamic video timing range from DisplayID if available */
++              if (EDID_LENGTH - j > 13 && edid_ext[j] == 0x25 &&
++                  (edid_ext[j+1] & 0xFE) == 0 && (edid_ext[j+2] == 9)) {
++                      min_vfreq = edid_ext[j+9];
++                      if (edid_ext[j+1] & 7)
++                              max_vfreq = edid_ext[j+10] + ((edid_ext[j+11] & 3) << 8);
++                      else
++                              max_vfreq = edid_ext[j+10];
++
++                      if (max_vfreq && min_vfreq) {
++                              connector->display_info.monitor_range.max_vfreq = max_vfreq;
++                              connector->display_info.monitor_range.min_vfreq = min_vfreq;
++
++                              return;
++                      }
++              }
++              j++;
++      }
++}
++
+ static int parse_amd_vsdb(struct amdgpu_dm_connector *aconnector,
+                         struct edid *edid, struct amdgpu_hdmi_vsdb_info *vsdb_info)
+ {
+@@ -11282,6 +11325,11 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector,
+       if (!adev->dm.freesync_module)
+               goto update;
++      /* Some eDP panels only have the refresh rate range info in DisplayID */
++      if ((connector->display_info.monitor_range.min_vfreq == 0 ||
++           connector->display_info.monitor_range.max_vfreq == 0))
++              parse_edid_displayid_vrr(connector, edid);
++
+       if (edid && (sink->sink_signal == SIGNAL_TYPE_DISPLAY_PORT ||
+                    sink->sink_signal == SIGNAL_TYPE_EDP)) {
+               bool edid_check_required = false;
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-amd-display-update-efficiency-bandwidth-for-dcn3.patch b/queue-6.9/drm-amd-display-update-efficiency-bandwidth-for-dcn3.patch
new file mode 100644 (file)
index 0000000..0724fcc
--- /dev/null
@@ -0,0 +1,35 @@
+From a5c746d41918374acefec2b5dd3e5f5489f995aa Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 26 Jun 2024 14:07:49 -0400
+Subject: drm/amd/display: Update efficiency bandwidth for dcn351
+
+From: Fangzhi Zuo <Jerry.Zuo@amd.com>
+
+[ Upstream commit 7ae37db29a8bc4d3d116a409308dd98fc3a0b1b3 ]
+
+Fix 4k240 underflow on dcn351
+
+Acked-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
+Signed-off-by: Fangzhi Zuo <Jerry.Zuo@amd.com>
+Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c b/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c
+index a20f28a5d2e7b..3af759dca6ebf 100644
+--- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c
++++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_translation_helper.c
+@@ -233,6 +233,7 @@ void dml2_init_socbb_params(struct dml2_context *dml2, const struct dc *in_dc, s
+               out->round_trip_ping_latency_dcfclk_cycles = 106;
+               out->smn_latency_us = 2;
+               out->dispclk_dppclk_vco_speed_mhz = 3600;
++              out->pct_ideal_dram_bw_after_urgent_pixel_only = 65.0;
+               break;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-amd-swsmu-add-mall-init-support-workaround-for-s.patch b/queue-6.9/drm-amd-swsmu-add-mall-init-support-workaround-for-s.patch
new file mode 100644 (file)
index 0000000..1cc2307
--- /dev/null
@@ -0,0 +1,220 @@
+From 73806e28bd4230fa4a812887921f0e805d626998 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 6 Jun 2024 20:25:34 +0800
+Subject: drm/amd/swsmu: add MALL init support workaround for smu_v14_0_1
+
+From: Li Ma <li.ma@amd.com>
+
+[ Upstream commit c223376b3019a00a0241faea0bc8c966738d1cc5 ]
+
+[Why]
+SMU firmware has not supported MALL PG.
+
+[How]
+Disable MALL PG and make it always on until SMU firmware is ready.
+
+Signed-off-by: Li Ma <li.ma@amd.com>
+Reviewed-by: Tim Huang <Tim.Huang@amd.com>
+Acked-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c     | 13 ++++
+ drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h |  5 ++
+ .../pm/swsmu/inc/pmfw_if/smu_v14_0_0_ppsmc.h  |  4 +-
+ drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h  |  4 +-
+ .../drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c  | 73 +++++++++++++++++++
+ 5 files changed, 96 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+index 65333141b1c1b..5a2247018229c 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c
+@@ -323,6 +323,18 @@ static int smu_dpm_set_umsch_mm_enable(struct smu_context *smu,
+       return ret;
+ }
++static int smu_set_mall_enable(struct smu_context *smu)
++{
++      int ret = 0;
++
++      if (!smu->ppt_funcs->set_mall_enable)
++              return 0;
++
++      ret = smu->ppt_funcs->set_mall_enable(smu);
++
++      return ret;
++}
++
+ /**
+  * smu_dpm_set_power_gate - power gate/ungate the specific IP block
+  *
+@@ -1785,6 +1797,7 @@ static int smu_hw_init(void *handle)
+               smu_dpm_set_jpeg_enable(smu, true);
+               smu_dpm_set_vpe_enable(smu, true);
+               smu_dpm_set_umsch_mm_enable(smu, true);
++              smu_set_mall_enable(smu);
+               smu_set_gfx_cgpg(smu, true);
+       }
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
+index 1fa81575788c5..8667e8c9d7e7c 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
++++ b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h
+@@ -1391,6 +1391,11 @@ struct pptable_funcs {
+        */
+       int (*dpm_set_umsch_mm_enable)(struct smu_context *smu, bool enable);
++      /**
++       * @set_mall_enable: Init MALL power gating control.
++       */
++      int (*set_mall_enable)(struct smu_context *smu);
++
+       /**
+        * @notify_rlc_state: Notify RLC power state to SMU.
+        */
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v14_0_0_ppsmc.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v14_0_0_ppsmc.h
+index c4dc5881d8df0..e7f5ef49049f9 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v14_0_0_ppsmc.h
++++ b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v14_0_0_ppsmc.h
+@@ -106,8 +106,8 @@
+ #define PPSMC_MSG_DisableLSdma                  0x35 ///< Disable LSDMA
+ #define PPSMC_MSG_SetSoftMaxVpe                 0x36 ///<
+ #define PPSMC_MSG_SetSoftMinVpe                 0x37 ///<
+-#define PPSMC_MSG_AllocMALLCache                0x38 ///< Allocating MALL Cache
+-#define PPSMC_MSG_ReleaseMALLCache              0x39 ///< Releasing MALL Cache
++#define PPSMC_MSG_MALLPowerController           0x38 ///< Set MALL control
++#define PPSMC_MSG_MALLPowerState                0x39 ///< Enter/Exit MALL PG
+ #define PPSMC_Message_Count                     0x3A ///< Total number of PPSMC messages
+ /** @}*/
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
+index af427cc7dbb84..4a7404856b960 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
++++ b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h
+@@ -272,7 +272,9 @@
+       __SMU_DUMMY_MAP(SetSoftMinVpe), \
+       __SMU_DUMMY_MAP(GetMetricsVersion), \
+       __SMU_DUMMY_MAP(EnableUCLKShadow), \
+-      __SMU_DUMMY_MAP(RmaDueToBadPageThreshold),
++      __SMU_DUMMY_MAP(RmaDueToBadPageThreshold), \
++      __SMU_DUMMY_MAP(MALLPowerController), \
++      __SMU_DUMMY_MAP(MALLPowerState),
+ #undef __SMU_DUMMY_MAP
+ #define __SMU_DUMMY_MAP(type) SMU_MSG_##type
+diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
+index 63399c00cc28f..20f3861b5eeac 100644
+--- a/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
++++ b/drivers/gpu/drm/amd/pm/swsmu/smu14/smu_v14_0_0_ppt.c
+@@ -52,6 +52,19 @@
+ #define mmMP1_SMN_C2PMSG_90                   0x029a
+ #define mmMP1_SMN_C2PMSG_90_BASE_IDX              0
++/* MALLPowerController message arguments (Defines for the Cache mode control) */
++#define SMU_MALL_PMFW_CONTROL 0
++#define SMU_MALL_DRIVER_CONTROL 1
++
++/*
++ * MALLPowerState message arguments
++ * (Defines for the Allocate/Release Cache mode if in driver mode)
++ */
++#define SMU_MALL_EXIT_PG 0
++#define SMU_MALL_ENTER_PG 1
++
++#define SMU_MALL_PG_CONFIG_DEFAULT SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_ON
++
+ #define FEATURE_MASK(feature) (1ULL << feature)
+ #define SMC_DPM_FEATURE ( \
+       FEATURE_MASK(FEATURE_CCLK_DPM_BIT) | \
+@@ -66,6 +79,12 @@
+       FEATURE_MASK(FEATURE_GFX_DPM_BIT)       | \
+       FEATURE_MASK(FEATURE_VPE_DPM_BIT))
++enum smu_mall_pg_config {
++      SMU_MALL_PG_CONFIG_PMFW_CONTROL = 0,
++      SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_ON = 1,
++      SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_OFF = 2,
++};
++
+ static struct cmn2asic_msg_mapping smu_v14_0_0_message_map[SMU_MSG_MAX_COUNT] = {
+       MSG_MAP(TestMessage,                    PPSMC_MSG_TestMessage,                          1),
+       MSG_MAP(GetSmuVersion,                  PPSMC_MSG_GetPmfwVersion,                       1),
+@@ -113,6 +132,8 @@ static struct cmn2asic_msg_mapping smu_v14_0_0_message_map[SMU_MSG_MAX_COUNT] =
+       MSG_MAP(PowerDownUmsch,                 PPSMC_MSG_PowerDownUmsch,                       1),
+       MSG_MAP(SetSoftMaxVpe,                  PPSMC_MSG_SetSoftMaxVpe,                        1),
+       MSG_MAP(SetSoftMinVpe,                  PPSMC_MSG_SetSoftMinVpe,                        1),
++      MSG_MAP(MALLPowerController,            PPSMC_MSG_MALLPowerController,          1),
++      MSG_MAP(MALLPowerState,                 PPSMC_MSG_MALLPowerState,                       1),
+ };
+ static struct cmn2asic_mapping smu_v14_0_0_feature_mask_map[SMU_FEATURE_COUNT] = {
+@@ -1417,6 +1438,57 @@ static int smu_v14_0_common_get_dpm_table(struct smu_context *smu, struct dpm_cl
+       return 0;
+ }
++static int smu_v14_0_1_init_mall_power_gating(struct smu_context *smu, enum smu_mall_pg_config pg_config)
++{
++      struct amdgpu_device *adev = smu->adev;
++      int ret = 0;
++
++      if (pg_config == SMU_MALL_PG_CONFIG_PMFW_CONTROL) {
++              ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_MALLPowerController,
++                                                              SMU_MALL_PMFW_CONTROL, NULL);
++              if (ret) {
++                      dev_err(adev->dev, "Init MALL PMFW CONTROL Failure\n");
++                      return ret;
++              }
++      } else {
++              ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_MALLPowerController,
++                                                              SMU_MALL_DRIVER_CONTROL, NULL);
++              if (ret) {
++                      dev_err(adev->dev, "Init MALL Driver CONTROL Failure\n");
++                      return ret;
++              }
++
++              if (pg_config == SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_ON) {
++                      ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_MALLPowerState,
++                                                                      SMU_MALL_EXIT_PG, NULL);
++                      if (ret) {
++                              dev_err(adev->dev, "EXIT MALL PG Failure\n");
++                              return ret;
++                      }
++              } else if (pg_config == SMU_MALL_PG_CONFIG_DRIVER_CONTROL_ALWAYS_OFF) {
++                      ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_MALLPowerState,
++                                                                      SMU_MALL_ENTER_PG, NULL);
++                      if (ret) {
++                              dev_err(adev->dev, "Enter MALL PG Failure\n");
++                              return ret;
++                      }
++              }
++      }
++
++      return ret;
++}
++
++static int smu_v14_0_common_set_mall_enable(struct smu_context *smu)
++{
++      enum smu_mall_pg_config pg_config = SMU_MALL_PG_CONFIG_DEFAULT;
++      int ret = 0;
++
++      if (amdgpu_ip_version(smu->adev, MP1_HWIP, 0) == IP_VERSION(14, 0, 1))
++              ret = smu_v14_0_1_init_mall_power_gating(smu, pg_config);
++
++      return ret;
++}
++
+ static const struct pptable_funcs smu_v14_0_0_ppt_funcs = {
+       .check_fw_status = smu_v14_0_check_fw_status,
+       .check_fw_version = smu_v14_0_check_fw_version,
+@@ -1448,6 +1520,7 @@ static const struct pptable_funcs smu_v14_0_0_ppt_funcs = {
+       .dpm_set_vpe_enable = smu_v14_0_0_set_vpe_enable,
+       .dpm_set_umsch_mm_enable = smu_v14_0_0_set_umsch_mm_enable,
+       .get_dpm_clock_table = smu_v14_0_common_get_dpm_table,
++      .set_mall_enable = smu_v14_0_common_set_mall_enable,
+ };
+ static void smu_v14_0_0_set_smu_mailbox_registers(struct smu_context *smu)
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-amdgpu-indicate-cu-havest-info-to-cp.patch b/queue-6.9/drm-amdgpu-indicate-cu-havest-info-to-cp.patch
new file mode 100644 (file)
index 0000000..4a1b1b0
--- /dev/null
@@ -0,0 +1,66 @@
+From c1f833778f614e1d3812dd889b08e287d439fdad Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 5 Jun 2024 09:30:50 -0400
+Subject: drm/amdgpu: Indicate CU havest info to CP
+
+From: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
+
+[ Upstream commit 49c9ffabde555c841392858d8b9e6cf58998a50c ]
+
+To achieve full occupancy CP hardware needs to know if CUs in SE are
+symmetrically or asymmetrically harvested
+
+v2: Reset is_symmetric_cus for each loop
+
+Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
+Acked-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 15 +++++++++++++--
+ 1 file changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
+index d89d6829f1df4..b10fdd8b54144 100644
+--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
+@@ -4187,9 +4187,10 @@ static u32 gfx_v9_4_3_get_cu_active_bitmap(struct amdgpu_device *adev, int xcc_i
+ static int gfx_v9_4_3_get_cu_info(struct amdgpu_device *adev,
+                                struct amdgpu_cu_info *cu_info)
+ {
+-      int i, j, k, counter, xcc_id, active_cu_number = 0;
+-      u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0;
++      int i, j, k, prev_counter, counter, xcc_id, active_cu_number = 0;
++      u32 mask, bitmap, ao_bitmap, ao_cu_mask = 0, tmp;
+       unsigned disable_masks[4 * 4];
++      bool is_symmetric_cus;
+       if (!adev || !cu_info)
+               return -EINVAL;
+@@ -4207,6 +4208,7 @@ static int gfx_v9_4_3_get_cu_info(struct amdgpu_device *adev,
+       mutex_lock(&adev->grbm_idx_mutex);
+       for (xcc_id = 0; xcc_id < NUM_XCC(adev->gfx.xcc_mask); xcc_id++) {
++              is_symmetric_cus = true;
+               for (i = 0; i < adev->gfx.config.max_shader_engines; i++) {
+                       for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) {
+                               mask = 1;
+@@ -4234,6 +4236,15 @@ static int gfx_v9_4_3_get_cu_info(struct amdgpu_device *adev,
+                                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
+                               cu_info->ao_cu_bitmap[i][j] = ao_bitmap;
+                       }
++                      if (i && is_symmetric_cus && prev_counter != counter)
++                              is_symmetric_cus = false;
++                      prev_counter = counter;
++              }
++              if (is_symmetric_cus) {
++                      tmp = RREG32_SOC15(GC, GET_INST(GC, xcc_id), regCP_CPC_DEBUG);
++                      tmp = REG_SET_FIELD(tmp, CP_CPC_DEBUG, CPC_HARVESTING_RELAUNCH_DISABLE, 1);
++                      tmp = REG_SET_FIELD(tmp, CP_CPC_DEBUG, CPC_HARVESTING_DISPATCH_DISABLE, 1);
++                      WREG32_SOC15(GC, GET_INST(GC, xcc_id), regCP_CPC_DEBUG, tmp);
+               }
+               gfx_v9_4_3_xcc_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff,
+                                           xcc_id);
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-amdgpu-init-ta-fw-for-psp-v14.patch b/queue-6.9/drm-amdgpu-init-ta-fw-for-psp-v14.patch
new file mode 100644 (file)
index 0000000..4caf57e
--- /dev/null
@@ -0,0 +1,46 @@
+From 46ab43557011f7036cbd6282fe54a9d02a021637 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 12 Jun 2024 14:30:40 +0800
+Subject: drm/amdgpu: init TA fw for psp v14
+
+From: Likun Gao <Likun.Gao@amd.com>
+
+[ Upstream commit ed5a4484f074aa2bfb1dad99ff3628ea8da4acdc ]
+
+Add support to init TA firmware for psp v14.
+
+Signed-off-by: Likun Gao <Likun.Gao@amd.com>
+Acked-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/amdgpu/psp_v14_0.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/amdgpu/psp_v14_0.c b/drivers/gpu/drm/amd/amdgpu/psp_v14_0.c
+index 78a95f8f370be..238abd98072ad 100644
+--- a/drivers/gpu/drm/amd/amdgpu/psp_v14_0.c
++++ b/drivers/gpu/drm/amd/amdgpu/psp_v14_0.c
+@@ -32,7 +32,9 @@
+ #include "mp/mp_14_0_2_sh_mask.h"
+ MODULE_FIRMWARE("amdgpu/psp_14_0_2_sos.bin");
++MODULE_FIRMWARE("amdgpu/psp_14_0_2_ta.bin");
+ MODULE_FIRMWARE("amdgpu/psp_14_0_3_sos.bin");
++MODULE_FIRMWARE("amdgpu/psp_14_0_3_ta.bin");
+ /* For large FW files the time to complete can be very long */
+ #define USBC_PD_POLLING_LIMIT_S 240
+@@ -64,6 +66,9 @@ static int psp_v14_0_init_microcode(struct psp_context *psp)
+       case IP_VERSION(14, 0, 2):
+       case IP_VERSION(14, 0, 3):
+               err = psp_init_sos_microcode(psp, ucode_prefix);
++              if (err)
++                      return err;
++              err = psp_init_ta_microcode(psp, ucode_prefix);
+               if (err)
+                       return err;
+               break;
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-amdgpu-pptable-fix-ubsan-array-index-out-of-boun.patch b/queue-6.9/drm-amdgpu-pptable-fix-ubsan-array-index-out-of-boun.patch
new file mode 100644 (file)
index 0000000..4ea80ab
--- /dev/null
@@ -0,0 +1,219 @@
+From 588ed475e3c45f92cab80da8b5115f8e1fe0203e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 31 May 2024 19:23:30 +0300
+Subject: drm/amdgpu/pptable: Fix UBSAN array-index-out-of-bounds
+
+From: Tasos Sahanidis <tasos@tasossah.com>
+
+[ Upstream commit c6c4dd54012551cce5cde408b35468f2c62b0cce ]
+
+Flexible arrays used [1] instead of []. Replace the former with the latter
+to resolve multiple UBSAN warnings observed on boot with a BONAIRE card.
+
+In addition, use the __counted_by attribute where possible to hint the
+length of the arrays to the compiler and any sanitizers.
+
+Signed-off-by: Tasos Sahanidis <tasos@tasossah.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/include/pptable.h | 91 ++++++++++++++-------------
+ 1 file changed, 49 insertions(+), 42 deletions(-)
+
+diff --git a/drivers/gpu/drm/amd/include/pptable.h b/drivers/gpu/drm/amd/include/pptable.h
+index 2e8e6c9875f6c..f83ace2d7ec30 100644
+--- a/drivers/gpu/drm/amd/include/pptable.h
++++ b/drivers/gpu/drm/amd/include/pptable.h
+@@ -477,31 +477,30 @@ typedef struct _ATOM_PPLIB_STATE_V2
+ } ATOM_PPLIB_STATE_V2;
+ typedef struct _StateArray{
+-    //how many states we have 
+-    UCHAR ucNumEntries;
+-    
+-    ATOM_PPLIB_STATE_V2 states[1];
++      //how many states we have
++      UCHAR ucNumEntries;
++
++      ATOM_PPLIB_STATE_V2 states[] /* __counted_by(ucNumEntries) */;
+ }StateArray;
+ typedef struct _ClockInfoArray{
+-    //how many clock levels we have
+-    UCHAR ucNumEntries;
+-    
+-    //sizeof(ATOM_PPLIB_CLOCK_INFO)
+-    UCHAR ucEntrySize;
+-    
+-    UCHAR clockInfo[];
++      //how many clock levels we have
++      UCHAR ucNumEntries;
++
++      //sizeof(ATOM_PPLIB_CLOCK_INFO)
++      UCHAR ucEntrySize;
++
++      UCHAR clockInfo[];
+ }ClockInfoArray;
+ typedef struct _NonClockInfoArray{
++      //how many non-clock levels we have. normally should be same as number of states
++      UCHAR ucNumEntries;
++      //sizeof(ATOM_PPLIB_NONCLOCK_INFO)
++      UCHAR ucEntrySize;
+-    //how many non-clock levels we have. normally should be same as number of states
+-    UCHAR ucNumEntries;
+-    //sizeof(ATOM_PPLIB_NONCLOCK_INFO)
+-    UCHAR ucEntrySize;
+-    
+-    ATOM_PPLIB_NONCLOCK_INFO nonClockInfo[];
++      ATOM_PPLIB_NONCLOCK_INFO nonClockInfo[] __counted_by(ucNumEntries);
+ }NonClockInfoArray;
+ typedef struct _ATOM_PPLIB_Clock_Voltage_Dependency_Record
+@@ -513,8 +512,10 @@ typedef struct _ATOM_PPLIB_Clock_Voltage_Dependency_Record
+ typedef struct _ATOM_PPLIB_Clock_Voltage_Dependency_Table
+ {
+-    UCHAR ucNumEntries;                                                // Number of entries.
+-    ATOM_PPLIB_Clock_Voltage_Dependency_Record entries[1];             // Dynamically allocate entries.
++      // Number of entries.
++      UCHAR ucNumEntries;
++      // Dynamically allocate entries.
++      ATOM_PPLIB_Clock_Voltage_Dependency_Record entries[] __counted_by(ucNumEntries);
+ }ATOM_PPLIB_Clock_Voltage_Dependency_Table;
+ typedef struct _ATOM_PPLIB_Clock_Voltage_Limit_Record
+@@ -529,8 +530,10 @@ typedef struct _ATOM_PPLIB_Clock_Voltage_Limit_Record
+ typedef struct _ATOM_PPLIB_Clock_Voltage_Limit_Table
+ {
+-    UCHAR ucNumEntries;                                                // Number of entries.
+-    ATOM_PPLIB_Clock_Voltage_Limit_Record entries[1];                  // Dynamically allocate entries.
++      // Number of entries.
++      UCHAR ucNumEntries;
++      // Dynamically allocate entries.
++      ATOM_PPLIB_Clock_Voltage_Limit_Record entries[] __counted_by(ucNumEntries);
+ }ATOM_PPLIB_Clock_Voltage_Limit_Table;
+ union _ATOM_PPLIB_CAC_Leakage_Record
+@@ -553,8 +556,10 @@ typedef union _ATOM_PPLIB_CAC_Leakage_Record ATOM_PPLIB_CAC_Leakage_Record;
+ typedef struct _ATOM_PPLIB_CAC_Leakage_Table
+ {
+-    UCHAR ucNumEntries;                                                 // Number of entries.
+-    ATOM_PPLIB_CAC_Leakage_Record entries[1];                           // Dynamically allocate entries.
++      // Number of entries.
++      UCHAR ucNumEntries;
++      // Dynamically allocate entries.
++      ATOM_PPLIB_CAC_Leakage_Record entries[] __counted_by(ucNumEntries);
+ }ATOM_PPLIB_CAC_Leakage_Table;
+ typedef struct _ATOM_PPLIB_PhaseSheddingLimits_Record
+@@ -568,8 +573,10 @@ typedef struct _ATOM_PPLIB_PhaseSheddingLimits_Record
+ typedef struct _ATOM_PPLIB_PhaseSheddingLimits_Table
+ {
+-    UCHAR ucNumEntries;                                                 // Number of entries.
+-    ATOM_PPLIB_PhaseSheddingLimits_Record entries[1];                   // Dynamically allocate entries.
++      // Number of entries.
++      UCHAR ucNumEntries;
++      // Dynamically allocate entries.
++      ATOM_PPLIB_PhaseSheddingLimits_Record entries[] __counted_by(ucNumEntries);
+ }ATOM_PPLIB_PhaseSheddingLimits_Table;
+ typedef struct _VCEClockInfo{
+@@ -580,8 +587,8 @@ typedef struct _VCEClockInfo{
+ }VCEClockInfo;
+ typedef struct _VCEClockInfoArray{
+-    UCHAR ucNumEntries;
+-    VCEClockInfo entries[1];
++      UCHAR ucNumEntries;
++      VCEClockInfo entries[] __counted_by(ucNumEntries);
+ }VCEClockInfoArray;
+ typedef struct _ATOM_PPLIB_VCE_Clock_Voltage_Limit_Record
+@@ -592,8 +599,8 @@ typedef struct _ATOM_PPLIB_VCE_Clock_Voltage_Limit_Record
+ typedef struct _ATOM_PPLIB_VCE_Clock_Voltage_Limit_Table
+ {
+-    UCHAR numEntries;
+-    ATOM_PPLIB_VCE_Clock_Voltage_Limit_Record entries[1];
++      UCHAR numEntries;
++      ATOM_PPLIB_VCE_Clock_Voltage_Limit_Record entries[] __counted_by(numEntries);
+ }ATOM_PPLIB_VCE_Clock_Voltage_Limit_Table;
+ typedef struct _ATOM_PPLIB_VCE_State_Record
+@@ -604,8 +611,8 @@ typedef struct _ATOM_PPLIB_VCE_State_Record
+ typedef struct _ATOM_PPLIB_VCE_State_Table
+ {
+-    UCHAR numEntries;
+-    ATOM_PPLIB_VCE_State_Record entries[1];
++      UCHAR numEntries;
++      ATOM_PPLIB_VCE_State_Record entries[] __counted_by(numEntries);
+ }ATOM_PPLIB_VCE_State_Table;
+@@ -626,8 +633,8 @@ typedef struct _UVDClockInfo{
+ }UVDClockInfo;
+ typedef struct _UVDClockInfoArray{
+-    UCHAR ucNumEntries;
+-    UVDClockInfo entries[1];
++      UCHAR ucNumEntries;
++      UVDClockInfo entries[] __counted_by(ucNumEntries);
+ }UVDClockInfoArray;
+ typedef struct _ATOM_PPLIB_UVD_Clock_Voltage_Limit_Record
+@@ -638,8 +645,8 @@ typedef struct _ATOM_PPLIB_UVD_Clock_Voltage_Limit_Record
+ typedef struct _ATOM_PPLIB_UVD_Clock_Voltage_Limit_Table
+ {
+-    UCHAR numEntries;
+-    ATOM_PPLIB_UVD_Clock_Voltage_Limit_Record entries[1];
++      UCHAR numEntries;
++      ATOM_PPLIB_UVD_Clock_Voltage_Limit_Record entries[] __counted_by(numEntries);
+ }ATOM_PPLIB_UVD_Clock_Voltage_Limit_Table;
+ typedef struct _ATOM_PPLIB_UVD_Table
+@@ -657,8 +664,8 @@ typedef struct _ATOM_PPLIB_SAMClk_Voltage_Limit_Record
+ }ATOM_PPLIB_SAMClk_Voltage_Limit_Record;
+ typedef struct _ATOM_PPLIB_SAMClk_Voltage_Limit_Table{
+-    UCHAR numEntries;
+-    ATOM_PPLIB_SAMClk_Voltage_Limit_Record entries[];
++      UCHAR numEntries;
++      ATOM_PPLIB_SAMClk_Voltage_Limit_Record entries[] __counted_by(numEntries);
+ }ATOM_PPLIB_SAMClk_Voltage_Limit_Table;
+ typedef struct _ATOM_PPLIB_SAMU_Table
+@@ -675,8 +682,8 @@ typedef struct _ATOM_PPLIB_ACPClk_Voltage_Limit_Record
+ }ATOM_PPLIB_ACPClk_Voltage_Limit_Record;
+ typedef struct _ATOM_PPLIB_ACPClk_Voltage_Limit_Table{
+-    UCHAR numEntries;
+-    ATOM_PPLIB_ACPClk_Voltage_Limit_Record entries[1];
++      UCHAR numEntries;
++      ATOM_PPLIB_ACPClk_Voltage_Limit_Record entries[] __counted_by(numEntries);
+ }ATOM_PPLIB_ACPClk_Voltage_Limit_Table;
+ typedef struct _ATOM_PPLIB_ACP_Table
+@@ -743,9 +750,9 @@ typedef struct ATOM_PPLIB_VQ_Budgeting_Record{
+ } ATOM_PPLIB_VQ_Budgeting_Record;
+ typedef struct ATOM_PPLIB_VQ_Budgeting_Table {
+-    UCHAR revid;
+-    UCHAR numEntries;
+-    ATOM_PPLIB_VQ_Budgeting_Record         entries[1];
++      UCHAR revid;
++      UCHAR numEntries;
++      ATOM_PPLIB_VQ_Budgeting_Record entries[] __counted_by(numEntries);
+ } ATOM_PPLIB_VQ_Budgeting_Table;
+ #pragma pack()
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-exynos-dp-drop-driver-owner-initialization.patch b/queue-6.9/drm-exynos-dp-drop-driver-owner-initialization.patch
new file mode 100644 (file)
index 0000000..e21c2fd
--- /dev/null
@@ -0,0 +1,35 @@
+From c30e69e3046bb52dd687c529c516e5aca1184d9f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 4 Jun 2024 15:11:29 +0200
+Subject: drm/exynos: dp: drop driver owner initialization
+
+From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+
+[ Upstream commit 1f3512cdf8299f9edaea9046d53ea324a7730bab ]
+
+Core in platform_driver_register() already sets the .owner, so driver
+does not need to.  Whatever is set here will be anyway overwritten by
+main driver calling platform_driver_register().
+
+Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Signed-off-by: Inki Dae <inki.dae@samsung.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/exynos/exynos_dp.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/exynos/exynos_dp.c b/drivers/gpu/drm/exynos/exynos_dp.c
+index f48c4343f4690..3e6d4c6aa877e 100644
+--- a/drivers/gpu/drm/exynos/exynos_dp.c
++++ b/drivers/gpu/drm/exynos/exynos_dp.c
+@@ -285,7 +285,6 @@ struct platform_driver dp_driver = {
+       .remove_new     = exynos_dp_remove,
+       .driver         = {
+               .name   = "exynos-dp",
+-              .owner  = THIS_MODULE,
+               .pm     = pm_ptr(&exynos_dp_pm_ops),
+               .of_match_table = exynos_dp_match,
+       },
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-mediatek-call-drm_atomic_helper_shutdown-at-shut.patch b/queue-6.9/drm-mediatek-call-drm_atomic_helper_shutdown-at-shut.patch
new file mode 100644 (file)
index 0000000..f52faa6
--- /dev/null
@@ -0,0 +1,65 @@
+From 1666ba655854c02f5510a9e0325651c51ddcf89d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 11 Jun 2024 10:27:44 -0700
+Subject: drm/mediatek: Call drm_atomic_helper_shutdown() at shutdown time
+
+From: Douglas Anderson <dianders@chromium.org>
+
+[ Upstream commit c38896ca6318c2df20bbe6c8e3f633e071fda910 ]
+
+Based on grepping through the source code this driver appears to be
+missing a call to drm_atomic_helper_shutdown() at system shutdown
+time. Among other things, this means that if a panel is in use that it
+won't be cleanly powered off at system shutdown time.
+
+The fact that we should call drm_atomic_helper_shutdown() in the case
+of OS shutdown/restart comes straight out of the kernel doc "driver
+instance overview" in drm_drv.c.
+
+This driver users the component model and shutdown happens in the base
+driver. The "drvdata" for this driver will always be valid if
+shutdown() is called and as of commit 2a073968289d
+("drm/atomic-helper: drm_atomic_helper_shutdown(NULL) should be a
+noop") we don't need to confirm that "drm" is non-NULL.
+
+Suggested-by: Maxime Ripard <mripard@kernel.org>
+Reviewed-by: Maxime Ripard <mripard@kernel.org>
+Reviewed-by: Fei Shao <fshao@chromium.org>
+Tested-by: Fei Shao <fshao@chromium.org>
+Signed-off-by: Douglas Anderson <dianders@chromium.org>
+Signed-off-by: Maxime Ripard <mripard@kernel.org>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240611102744.v2.1.I2b014f90afc4729b6ecc7b5ddd1f6dedcea4625b@changeid
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/mediatek/mtk_drm_drv.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+index 74832c2130921..0b570e194079a 100644
+--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
++++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+@@ -950,6 +950,13 @@ static void mtk_drm_remove(struct platform_device *pdev)
+               of_node_put(private->comp_node[i]);
+ }
++static void mtk_drm_shutdown(struct platform_device *pdev)
++{
++      struct mtk_drm_private *private = platform_get_drvdata(pdev);
++
++      drm_atomic_helper_shutdown(private->drm);
++}
++
+ static int mtk_drm_sys_prepare(struct device *dev)
+ {
+       struct mtk_drm_private *private = dev_get_drvdata(dev);
+@@ -981,6 +988,7 @@ static const struct dev_pm_ops mtk_drm_pm_ops = {
+ static struct platform_driver mtk_drm_platform_driver = {
+       .probe  = mtk_drm_probe,
+       .remove_new = mtk_drm_remove,
++      .shutdown = mtk_drm_shutdown,
+       .driver = {
+               .name   = "mediatek-drm",
+               .pm     = &mtk_drm_pm_ops,
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-panel-orientation-quirks-add-quirk-for-aya-neo-k.patch b/queue-6.9/drm-panel-orientation-quirks-add-quirk-for-aya-neo-k.patch
new file mode 100644 (file)
index 0000000..29f136c
--- /dev/null
@@ -0,0 +1,42 @@
+From fee75f8dd38aa53af5465fd62e9ff898b3d246f5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 10 Mar 2024 23:04:00 +0100
+Subject: drm: panel-orientation-quirks: Add quirk for Aya Neo KUN
+
+From: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
+
+[ Upstream commit f74fb5df429ebc6a614dc5aa9e44d7194d402e5a ]
+
+Similar to the other Aya Neo devices this one features
+again a portrait screen, here with a native resolution
+of 1600x2560.
+
+Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240310220401.895591-1-tjakobi@math.uni-bielefeld.de
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/drm_panel_orientation_quirks.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/drm/drm_panel_orientation_quirks.c
+index 426bbee2d9f5e..5db52d6c5c35c 100644
+--- a/drivers/gpu/drm/drm_panel_orientation_quirks.c
++++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c
+@@ -202,6 +202,12 @@ static const struct dmi_system_id orientation_data[] = {
+                 DMI_MATCH(DMI_BOARD_NAME, "NEXT"),
+               },
+               .driver_data = (void *)&lcd800x1280_rightside_up,
++      }, {    /* AYA NEO KUN */
++              .matches = {
++                DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
++                DMI_MATCH(DMI_BOARD_NAME, "KUN"),
++              },
++              .driver_data = (void *)&lcd1600x2560_rightside_up,
+       }, {    /* Chuwi HiBook (CWI514) */
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-radeon-check-bo_va-bo-is-non-null-before-using-i.patch b/queue-6.9/drm-radeon-check-bo_va-bo-is-non-null-before-using-i.patch
new file mode 100644 (file)
index 0000000..f8423af
--- /dev/null
@@ -0,0 +1,36 @@
+From 58021afff4a9f6c7d9db174b4d31bf7ae21a8614 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 25 Jun 2024 14:31:34 +0200
+Subject: drm/radeon: check bo_va->bo is non-NULL before using it
+
+From: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
+
+[ Upstream commit 6fb15dcbcf4f212930350eaee174bb60ed40a536 ]
+
+The call to radeon_vm_clear_freed might clear bo_va->bo, so
+we have to check it before dereferencing it.
+
+Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
+Acked-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/radeon/radeon_gem.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
+index 3fec3acdaf284..27225d1fe8d2e 100644
+--- a/drivers/gpu/drm/radeon/radeon_gem.c
++++ b/drivers/gpu/drm/radeon/radeon_gem.c
+@@ -641,7 +641,7 @@ static void radeon_gem_va_update_vm(struct radeon_device *rdev,
+       if (r)
+               goto error_unlock;
+-      if (bo_va->it.start)
++      if (bo_va->it.start && bo_va->bo)
+               r = radeon_vm_bo_update(rdev, bo_va, bo_va->bo->tbo.resource);
+ error_unlock:
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-renesas-shmobile-call-drm_atomic_helper_shutdown.patch b/queue-6.9/drm-renesas-shmobile-call-drm_atomic_helper_shutdown.patch
new file mode 100644 (file)
index 0000000..6d479fb
--- /dev/null
@@ -0,0 +1,67 @@
+From 4c312809f11ee5b75f767756642f594223f8e5c6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 12 Jun 2024 09:23:13 +0200
+Subject: drm: renesas: shmobile: Call drm_atomic_helper_shutdown() at shutdown
+ time
+
+From: Douglas Anderson <dianders@chromium.org>
+
+[ Upstream commit 0320ca14c6fb68ad19aa72e55a1a21c061b2946b ]
+
+Based on grepping through the source code, this driver appears to be
+missing a call to drm_atomic_helper_shutdown() at system shutdown time.
+This is important because drm_atomic_helper_shutdown() will cause
+panels to get disabled cleanly which may be important for their power
+sequencing.  Future changes will remove any custom powering off in
+individual panel drivers so the DRM drivers need to start getting this
+right.
+
+The fact that we should call drm_atomic_helper_shutdown() in the case of
+OS shutdown comes straight out of the kernel doc "driver instance
+overview" in drm_drv.c.
+
+[geert: shmob_drm_remove() already calls drm_atomic_helper_shutdown]
+
+Suggested-by: Maxime Ripard <mripard@kernel.org>
+Signed-off-by: Douglas Anderson <dianders@chromium.org>
+Link: https://lore.kernel.org/r/20230901164111.RFT.15.Iaf638a1d4c8b3c307a6192efabb4cbb06b195f15@changeid
+[geert: s/drm_helper_force_disable_all/drm_atomic_helper_shutdown/]
+Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
+Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Reviewed-by: Sui Jingfeng <sui.jingfeng@linux.dev>
+Signed-off-by: Maxime Ripard <mripard@kernel.org>
+Link: https://patchwork.freedesktop.org/patch/msgid/17c6a5a668e5975f871b77fb1fca6711a0799d9e.1718176895.git.geert+renesas@glider.be
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
+index e83c3e52251de..0250d5f00bf10 100644
+--- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
++++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
+@@ -171,6 +171,13 @@ static void shmob_drm_remove(struct platform_device *pdev)
+       drm_kms_helper_poll_fini(ddev);
+ }
++static void shmob_drm_shutdown(struct platform_device *pdev)
++{
++      struct shmob_drm_device *sdev = platform_get_drvdata(pdev);
++
++      drm_atomic_helper_shutdown(&sdev->ddev);
++}
++
+ static int shmob_drm_probe(struct platform_device *pdev)
+ {
+       struct shmob_drm_platform_data *pdata = pdev->dev.platform_data;
+@@ -273,6 +280,7 @@ static const struct of_device_id shmob_drm_of_table[] __maybe_unused = {
+ static struct platform_driver shmob_drm_platform_driver = {
+       .probe          = shmob_drm_probe,
+       .remove_new     = shmob_drm_remove,
++      .shutdown       = shmob_drm_shutdown,
+       .driver         = {
+               .name   = "shmob-drm",
+               .of_match_table = of_match_ptr(shmob_drm_of_table),
+-- 
+2.43.0
+
diff --git a/queue-6.9/drm-vmwgfx-fix-missing-hypervisor_guest-dependency.patch b/queue-6.9/drm-vmwgfx-fix-missing-hypervisor_guest-dependency.patch
new file mode 100644 (file)
index 0000000..d6f48fb
--- /dev/null
@@ -0,0 +1,41 @@
+From 660b31dc20ac3de4e9056396137549ee5f66d619 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 15 Jun 2024 18:25:10 -0700
+Subject: drm/vmwgfx: Fix missing HYPERVISOR_GUEST dependency
+
+From: Alexey Makhalov <alexey.makhalov@broadcom.com>
+
+[ Upstream commit 8c4d6945fe5bd04ff847c3c788abd34ca354ecee ]
+
+VMWARE_HYPERCALL alternative will not work as intended without VMware guest code
+initialization.
+
+  [ bp: note that this doesn't reproduce with newer gccs so it must be
+    something gcc-9-specific. ]
+
+Closes: https://lore.kernel.org/oe-kbuild-all/202406152104.FxakP1MB-lkp@intel.com/
+Reported-by: kernel test robot <lkp@intel.com>
+Signed-off-by: Alexey Makhalov <alexey.makhalov@broadcom.com>
+Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
+Link: https://lore.kernel.org/r/20240616012511.198243-1-alexey.makhalov@broadcom.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/vmwgfx/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/vmwgfx/Kconfig b/drivers/gpu/drm/vmwgfx/Kconfig
+index faddae3d6ac2e..6f1ac940cbae7 100644
+--- a/drivers/gpu/drm/vmwgfx/Kconfig
++++ b/drivers/gpu/drm/vmwgfx/Kconfig
+@@ -2,7 +2,7 @@
+ config DRM_VMWGFX
+       tristate "DRM driver for VMware Virtual GPU"
+       depends on DRM && PCI && MMU
+-      depends on X86 || ARM64
++      depends on (X86 && HYPERVISOR_GUEST) || ARM64
+       select DRM_TTM
+       select DRM_TTM_HELPER
+       select MAPPING_DIRTY_HELPERS
+-- 
+2.43.0
+
diff --git a/queue-6.9/efi-libstub-zboot.lds-discard-.discard-sections.patch b/queue-6.9/efi-libstub-zboot.lds-discard-.discard-sections.patch
new file mode 100644 (file)
index 0000000..b799661
--- /dev/null
@@ -0,0 +1,54 @@
+From 17bd8b2a2ca6ea7c51e8c5e19297f921f717d9c8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 22 May 2024 10:32:43 -0700
+Subject: efi/libstub: zboot.lds: Discard .discard sections
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+[ Upstream commit 5134acb15d9ef27aa2b90aad46d4e89fcef79fdc ]
+
+When building ARCH=loongarch defconfig + CONFIG_UNWINDER_ORC=y using
+LLVM, there is a warning from ld.lld when linking the EFI zboot image
+due to the use of unreachable() in number() in vsprintf.c:
+
+  ld.lld: warning: drivers/firmware/efi/libstub/lib.a(vsprintf.stub.o):(.discard.unreachable+0x0): has non-ABS relocation R_LARCH_32_PCREL against symbol ''
+
+If the compiler cannot eliminate the default case for any reason, the
+.discard.unreachable section will remain in the final binary but the
+entire point of any section prefixed with .discard is that it is only
+used at compile time, so it can be discarded via /DISCARD/ in a linker
+script. The asm-generic vmlinux.lds.h includes .discard and .discard.*
+in the COMMON_DISCARDS macro but that is not used for zboot.lds, as it
+is not a kernel image linker script.
+
+Add .discard and .discard.* to /DISCARD/ in zboot.lds, so that any
+sections meant to be discarded at link time are not included in the
+final zboot image. This issue is not specific to LoongArch, it is just
+the first architecture to select CONFIG_OBJTOOL, which defines
+annotate_unreachable() as an asm statement to add the
+.discard.unreachable section, and use the EFI stub.
+
+Closes: https://github.com/ClangBuiltLinux/linux/issues/2023
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Acked-by: Huacai Chen <chenhuacai@loongson.cn>
+Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/firmware/efi/libstub/zboot.lds | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/firmware/efi/libstub/zboot.lds b/drivers/firmware/efi/libstub/zboot.lds
+index ac8c0ef851581..af2c82f7bd902 100644
+--- a/drivers/firmware/efi/libstub/zboot.lds
++++ b/drivers/firmware/efi/libstub/zboot.lds
+@@ -41,6 +41,7 @@ SECTIONS
+       }
+       /DISCARD/ : {
++              *(.discard .discard.*)
+               *(.modinfo .init.modinfo)
+       }
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.9/erofs-ensure-m_llen-is-reset-to-0-if-metadata-is-inv.patch b/queue-6.9/erofs-ensure-m_llen-is-reset-to-0-if-metadata-is-inv.patch
new file mode 100644 (file)
index 0000000..3136e60
--- /dev/null
@@ -0,0 +1,44 @@
+From 0947e37453554abc32333d75ca0f14c25d45a0ce Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 30 Jun 2024 02:57:43 +0800
+Subject: erofs: ensure m_llen is reset to 0 if metadata is invalid
+
+From: Gao Xiang <hsiangkao@linux.alibaba.com>
+
+[ Upstream commit 9b32b063be1001e322c5f6e01f2a649636947851 ]
+
+Sometimes, the on-disk metadata might be invalid due to user
+interrupts, storage failures, or other unknown causes.
+
+In that case, z_erofs_map_blocks_iter() may still return a valid
+m_llen while other fields remain invalid (e.g., m_plen can be 0).
+
+Due to the return value of z_erofs_scan_folio() in some path will
+be ignored on purpose, the following z_erofs_scan_folio() could
+then use the invalid value by accident.
+
+Let's reset m_llen to 0 to prevent this.
+
+Link: https://lore.kernel.org/r/20240629185743.2819229-1-hsiangkao@linux.alibaba.com
+Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/erofs/zmap.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
+index e313c936351d5..6bd435a565f61 100644
+--- a/fs/erofs/zmap.c
++++ b/fs/erofs/zmap.c
+@@ -723,6 +723,8 @@ int z_erofs_map_blocks_iter(struct inode *inode, struct erofs_map_blocks *map,
+       err = z_erofs_do_map_blocks(inode, map, flags);
+ out:
++      if (err)
++              map->m_llen = 0;
+       trace_z_erofs_map_blocks_iter_exit(inode, map, flags, err);
+       return err;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.9/fs-better-handle-deep-ancestor-chains-in-is_subdir.patch b/queue-6.9/fs-better-handle-deep-ancestor-chains-in-is_subdir.patch
new file mode 100644 (file)
index 0000000..ddb4944
--- /dev/null
@@ -0,0 +1,80 @@
+From 52f2790b2a2e64af02322e8c5f5a5c89d4b51d99 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 2 Jul 2024 21:03:26 +0200
+Subject: fs: better handle deep ancestor chains in is_subdir()
+
+From: Christian Brauner <brauner@kernel.org>
+
+[ Upstream commit 391b59b045004d5b985d033263ccba3e941a7740 ]
+
+Jan reported that 'cd ..' may take a long time in deep directory
+hierarchies under a bind-mount. If concurrent renames happen it is
+possible to livelock in is_subdir() because it will keep retrying.
+
+Change is_subdir() from simply retrying over and over to retry once and
+then acquire the rename lock to handle deep ancestor chains better. The
+list of alternatives to this approach were less then pleasant. Change
+the scope of rcu lock to cover the whole walk while at it.
+
+A big thanks to Jan and Linus. Both Jan and Linus had proposed
+effectively the same thing just that one version ended up being slightly
+more elegant.
+
+Reported-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Christian Brauner <brauner@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/dcache.c | 31 ++++++++++++++-----------------
+ 1 file changed, 14 insertions(+), 17 deletions(-)
+
+diff --git a/fs/dcache.c b/fs/dcache.c
+index 66515fbc9dd70..4c144519aa709 100644
+--- a/fs/dcache.c
++++ b/fs/dcache.c
+@@ -3035,28 +3035,25 @@ EXPORT_SYMBOL(d_splice_alias);
+   
+ bool is_subdir(struct dentry *new_dentry, struct dentry *old_dentry)
+ {
+-      bool result;
++      bool subdir;
+       unsigned seq;
+       if (new_dentry == old_dentry)
+               return true;
+-      do {
+-              /* for restarting inner loop in case of seq retry */
+-              seq = read_seqbegin(&rename_lock);
+-              /*
+-               * Need rcu_readlock to protect against the d_parent trashing
+-               * due to d_move
+-               */
+-              rcu_read_lock();
+-              if (d_ancestor(old_dentry, new_dentry))
+-                      result = true;
+-              else
+-                      result = false;
+-              rcu_read_unlock();
+-      } while (read_seqretry(&rename_lock, seq));
+-
+-      return result;
++      /* Access d_parent under rcu as d_move() may change it. */
++      rcu_read_lock();
++      seq = read_seqbegin(&rename_lock);
++      subdir = d_ancestor(old_dentry, new_dentry);
++       /* Try lockless once... */
++      if (read_seqretry(&rename_lock, seq)) {
++              /* ...else acquire lock for progress even on deep chains. */
++              read_seqlock_excl(&rename_lock);
++              subdir = d_ancestor(old_dentry, new_dentry);
++              read_sequnlock_excl(&rename_lock);
++      }
++      rcu_read_unlock();
++      return subdir;
+ }
+ EXPORT_SYMBOL(is_subdir);
+-- 
+2.43.0
+
diff --git a/queue-6.9/fs-file-fix-the-check-in-find_next_fd.patch b/queue-6.9/fs-file-fix-the-check-in-find_next_fd.patch
new file mode 100644 (file)
index 0000000..bc4f871
--- /dev/null
@@ -0,0 +1,51 @@
+From c693d41540ee5a2fafcf0cc33f45ddbf7849dcc8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 30 May 2024 00:06:56 +0800
+Subject: fs/file: fix the check in find_next_fd()
+
+From: Yuntao Wang <yuntao.wang@linux.dev>
+
+[ Upstream commit ed8c7fbdfe117abbef81f65428ba263118ef298a ]
+
+The maximum possible return value of find_next_zero_bit(fdt->full_fds_bits,
+maxbit, bitbit) is maxbit. This return value, multiplied by BITS_PER_LONG,
+gives the value of bitbit, which can never be greater than maxfd, it can
+only be equal to maxfd at most, so the following check 'if (bitbit > maxfd)'
+will never be true.
+
+Moreover, when bitbit equals maxfd, it indicates that there are no unused
+fds, and the function can directly return.
+
+Fix this check.
+
+Signed-off-by: Yuntao Wang <yuntao.wang@linux.dev>
+Link: https://lore.kernel.org/r/20240529160656.209352-1-yuntao.wang@linux.dev
+Reviewed-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Christian Brauner <brauner@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/file.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/fs/file.c b/fs/file.c
+index 3b683b9101d84..005841dd35977 100644
+--- a/fs/file.c
++++ b/fs/file.c
+@@ -481,12 +481,12 @@ struct files_struct init_files = {
+ static unsigned int find_next_fd(struct fdtable *fdt, unsigned int start)
+ {
+-      unsigned int maxfd = fdt->max_fds;
++      unsigned int maxfd = fdt->max_fds; /* always multiple of BITS_PER_LONG */
+       unsigned int maxbit = maxfd / BITS_PER_LONG;
+       unsigned int bitbit = start / BITS_PER_LONG;
+       bitbit = find_next_zero_bit(fdt->full_fds_bits, maxbit, bitbit) * BITS_PER_LONG;
+-      if (bitbit > maxfd)
++      if (bitbit >= maxfd)
+               return maxfd;
+       if (bitbit > start)
+               start = bitbit;
+-- 
+2.43.0
+
diff --git a/queue-6.9/gpio-pca953x-fix-pca953x_irq_bus_sync_unlock-race.patch b/queue-6.9/gpio-pca953x-fix-pca953x_irq_bus_sync_unlock-race.patch
new file mode 100644 (file)
index 0000000..6f37b9e
--- /dev/null
@@ -0,0 +1,56 @@
+From bc9910d276993c92e401445f9a7b6d5c3847bdab Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Jun 2024 07:29:15 +0300
+Subject: gpio: pca953x: fix pca953x_irq_bus_sync_unlock race
+
+From: Ian Ray <ian.ray@gehealthcare.com>
+
+[ Upstream commit bfc6444b57dc7186b6acc964705d7516cbaf3904 ]
+
+Ensure that `i2c_lock' is held when setting interrupt latch and mask in
+pca953x_irq_bus_sync_unlock() in order to avoid races.
+
+The other (non-probe) call site pca953x_gpio_set_multiple() ensures the
+lock is held before calling pca953x_write_regs().
+
+The problem occurred when a request raced against irq_bus_sync_unlock()
+approximately once per thousand reboots on an i.MX8MP based system.
+
+ * Normal case
+
+   0-0022: write register AI|3a {03,02,00,00,01} Input latch P0
+   0-0022: write register AI|49 {fc,fd,ff,ff,fe} Interrupt mask P0
+   0-0022: write register AI|08 {ff,00,00,00,00} Output P3
+   0-0022: write register AI|12 {fc,00,00,00,00} Config P3
+
+ * Race case
+
+   0-0022: write register AI|08 {ff,00,00,00,00} Output P3
+   0-0022: write register AI|08 {03,02,00,00,01} *** Wrong register ***
+   0-0022: write register AI|12 {fc,00,00,00,00} Config P3
+   0-0022: write register AI|49 {fc,fd,ff,ff,fe} Interrupt mask P0
+
+Signed-off-by: Ian Ray <ian.ray@gehealthcare.com>
+Link: https://lore.kernel.org/r/20240620042915.2173-1-ian.ray@gehealthcare.com
+Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpio/gpio-pca953x.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
+index 00ffa168e4056..f2f40393e3695 100644
+--- a/drivers/gpio/gpio-pca953x.c
++++ b/drivers/gpio/gpio-pca953x.c
+@@ -758,6 +758,8 @@ static void pca953x_irq_bus_sync_unlock(struct irq_data *d)
+       int level;
+       if (chip->driver_data & PCA_PCAL) {
++              guard(mutex)(&chip->i2c_lock);
++
+               /* Enable latch on interrupt-enabled inputs */
+               pca953x_write_regs(chip, PCAL953X_IN_LATCH, chip->irq_mask);
+-- 
+2.43.0
+
diff --git a/queue-6.9/hfsplus-fix-uninit-value-in-copy_name.patch b/queue-6.9/hfsplus-fix-uninit-value-in-copy_name.patch
new file mode 100644 (file)
index 0000000..1a351ec
--- /dev/null
@@ -0,0 +1,70 @@
+From f9311de10d82f5068a98c5befa306a178f1d7710 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 May 2024 13:21:46 +0800
+Subject: hfsplus: fix uninit-value in copy_name
+
+From: Edward Adam Davis <eadavis@qq.com>
+
+[ Upstream commit 0570730c16307a72f8241df12363f76600baf57d ]
+
+[syzbot reported]
+BUG: KMSAN: uninit-value in sized_strscpy+0xc4/0x160
+ sized_strscpy+0xc4/0x160
+ copy_name+0x2af/0x320 fs/hfsplus/xattr.c:411
+ hfsplus_listxattr+0x11e9/0x1a50 fs/hfsplus/xattr.c:750
+ vfs_listxattr fs/xattr.c:493 [inline]
+ listxattr+0x1f3/0x6b0 fs/xattr.c:840
+ path_listxattr fs/xattr.c:864 [inline]
+ __do_sys_listxattr fs/xattr.c:876 [inline]
+ __se_sys_listxattr fs/xattr.c:873 [inline]
+ __x64_sys_listxattr+0x16b/0x2f0 fs/xattr.c:873
+ x64_sys_call+0x2ba0/0x3b50 arch/x86/include/generated/asm/syscalls_64.h:195
+ do_syscall_x64 arch/x86/entry/common.c:52 [inline]
+ do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83
+ entry_SYSCALL_64_after_hwframe+0x77/0x7f
+
+Uninit was created at:
+ slab_post_alloc_hook mm/slub.c:3877 [inline]
+ slab_alloc_node mm/slub.c:3918 [inline]
+ kmalloc_trace+0x57b/0xbe0 mm/slub.c:4065
+ kmalloc include/linux/slab.h:628 [inline]
+ hfsplus_listxattr+0x4cc/0x1a50 fs/hfsplus/xattr.c:699
+ vfs_listxattr fs/xattr.c:493 [inline]
+ listxattr+0x1f3/0x6b0 fs/xattr.c:840
+ path_listxattr fs/xattr.c:864 [inline]
+ __do_sys_listxattr fs/xattr.c:876 [inline]
+ __se_sys_listxattr fs/xattr.c:873 [inline]
+ __x64_sys_listxattr+0x16b/0x2f0 fs/xattr.c:873
+ x64_sys_call+0x2ba0/0x3b50 arch/x86/include/generated/asm/syscalls_64.h:195
+ do_syscall_x64 arch/x86/entry/common.c:52 [inline]
+ do_syscall_64+0xcf/0x1e0 arch/x86/entry/common.c:83
+ entry_SYSCALL_64_after_hwframe+0x77/0x7f
+[Fix]
+When allocating memory to strbuf, initialize memory to 0.
+
+Reported-and-tested-by: syzbot+efde959319469ff8d4d7@syzkaller.appspotmail.com
+Signed-off-by: Edward Adam Davis <eadavis@qq.com>
+Link: https://lore.kernel.org/r/tencent_8BBB6433BC9E1C1B7B4BDF1BF52574BA8808@qq.com
+Reported-and-tested-by: syzbot+01ade747b16e9c8030e0@syzkaller.appspotmail.com
+Signed-off-by: Christian Brauner <brauner@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/hfsplus/xattr.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c
+index 9c9ff6b8c6f7e..858029b1c1735 100644
+--- a/fs/hfsplus/xattr.c
++++ b/fs/hfsplus/xattr.c
+@@ -698,7 +698,7 @@ ssize_t hfsplus_listxattr(struct dentry *dentry, char *buffer, size_t size)
+               return err;
+       }
+-      strbuf = kmalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN +
++      strbuf = kzalloc(NLS_MAX_CHARSET_SIZE * HFSPLUS_ATTR_MAX_STRLEN +
+                       XATTR_MAC_OSX_PREFIX_LEN + 1, GFP_KERNEL);
+       if (!strbuf) {
+               res = -ENOMEM;
+-- 
+2.43.0
+
diff --git a/queue-6.9/hid-ignore-battery-for-elan-touchscreens-2f2c-and-41.patch b/queue-6.9/hid-ignore-battery-for-elan-touchscreens-2f2c-and-41.patch
new file mode 100644 (file)
index 0000000..152363b
--- /dev/null
@@ -0,0 +1,56 @@
+From 19876fb4f049ab527a4bfb791c5ace815191652e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 7 Jun 2024 16:53:43 +0200
+Subject: HID: Ignore battery for ELAN touchscreens 2F2C and 4116
+
+From: Louis Dalibard <ontake@ontake.dev>
+
+[ Upstream commit a3a5a37efba11b7cf1a86abe7bccfbcdb521764e ]
+
+At least ASUS Zenbook 14 (2023) and ASUS Zenbook 14 Pro (2023) are affected.
+
+The touchscreen reports a battery status of 0% and jumps to 1% when a
+stylus is used.
+
+The device ID was added and the battery ignore quirk was enabled for it.
+
+[jkosina@suse.com: reformatted changelog a bit]
+Signed-off-by: Louis Dalibard <ontake@ontake.dev>
+Signed-off-by: Jiri Kosina <jkosina@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hid/hid-ids.h   | 2 ++
+ drivers/hid/hid-input.c | 4 ++++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
+index 68b0f39deaa9a..8eb073dea3593 100644
+--- a/drivers/hid/hid-ids.h
++++ b/drivers/hid/hid-ids.h
+@@ -421,6 +421,8 @@
+ #define I2C_DEVICE_ID_HP_SPECTRE_X360_13_AW0020NG  0x29DF
+ #define I2C_DEVICE_ID_ASUS_TP420IA_TOUCHSCREEN 0x2BC8
+ #define I2C_DEVICE_ID_ASUS_GV301RA_TOUCHSCREEN 0x2C82
++#define I2C_DEVICE_ID_ASUS_UX3402_TOUCHSCREEN 0x2F2C
++#define I2C_DEVICE_ID_ASUS_UX6404_TOUCHSCREEN 0x4116
+ #define USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN        0x2544
+ #define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN  0x2706
+ #define I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN  0x261A
+diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
+index 8bb16e9b94aa5..c9094a4f281e9 100644
+--- a/drivers/hid/hid-input.c
++++ b/drivers/hid/hid-input.c
+@@ -377,6 +377,10 @@ static const struct hid_device_id hid_battery_quirks[] = {
+         HID_BATTERY_QUIRK_IGNORE },
+       { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_ASUS_GV301RA_TOUCHSCREEN),
+         HID_BATTERY_QUIRK_IGNORE },
++      { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_ASUS_UX3402_TOUCHSCREEN),
++        HID_BATTERY_QUIRK_IGNORE },
++      { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_ASUS_UX6404_TOUCHSCREEN),
++        HID_BATTERY_QUIRK_IGNORE },
+       { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN),
+         HID_BATTERY_QUIRK_IGNORE },
+       { HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN),
+-- 
+2.43.0
+
diff --git a/queue-6.9/ibmvnic-add-tx-check-to-prevent-skb-leak.patch b/queue-6.9/ibmvnic-add-tx-check-to-prevent-skb-leak.patch
new file mode 100644 (file)
index 0000000..7e19e7f
--- /dev/null
@@ -0,0 +1,63 @@
+From b647205cf2cf54be6d197a9bcce5b32aa0547739 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Jun 2024 10:23:11 -0500
+Subject: ibmvnic: Add tx check to prevent skb leak
+
+From: Nick Child <nnac123@linux.ibm.com>
+
+[ Upstream commit 0983d288caf984de0202c66641577b739caad561 ]
+
+Below is a summary of how the driver stores a reference to an skb during
+transmit:
+    tx_buff[free_map[consumer_index]]->skb = new_skb;
+    free_map[consumer_index] = IBMVNIC_INVALID_MAP;
+    consumer_index ++;
+Where variable data looks like this:
+    free_map == [4, IBMVNIC_INVALID_MAP, IBMVNIC_INVALID_MAP, 0, 3]
+                                                       consumer_index^
+    tx_buff == [skb=null, skb=<ptr>, skb=<ptr>, skb=null, skb=null]
+
+The driver has checks to ensure that free_map[consumer_index] pointed to
+a valid index but there was no check to ensure that this index pointed
+to an unused/null skb address. So, if, by some chance, our free_map and
+tx_buff lists become out of sync then we were previously risking an
+skb memory leak. This could then cause tcp congestion control to stop
+sending packets, eventually leading to ETIMEDOUT.
+
+Therefore, add a conditional to ensure that the skb address is null. If
+not then warn the user (because this is still a bug that should be
+patched) and free the old pointer to prevent memleak/tcp problems.
+
+Signed-off-by: Nick Child <nnac123@linux.ibm.com>
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/ibm/ibmvnic.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
+index 722bb724361c2..664baedfe7d13 100644
+--- a/drivers/net/ethernet/ibm/ibmvnic.c
++++ b/drivers/net/ethernet/ibm/ibmvnic.c
+@@ -2478,6 +2478,18 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
+           (tx_pool->consumer_index + 1) % tx_pool->num_buffers;
+       tx_buff = &tx_pool->tx_buff[bufidx];
++
++      /* Sanity checks on our free map to make sure it points to an index
++       * that is not being occupied by another skb. If skb memory is
++       * not freed then we see congestion control kick in and halt tx.
++       */
++      if (unlikely(tx_buff->skb)) {
++              dev_warn_ratelimited(dev, "TX free map points to untracked skb (%s %d idx=%d)\n",
++                                   skb_is_gso(skb) ? "tso_pool" : "tx_pool",
++                                   queue_num, bufidx);
++              dev_kfree_skb_any(tx_buff->skb);
++      }
++
+       tx_buff->skb = skb;
+       tx_buff->index = bufidx;
+       tx_buff->pool_index = queue_num;
+-- 
+2.43.0
+
diff --git a/queue-6.9/ila-block-bh-in-ila_output.patch b/queue-6.9/ila-block-bh-in-ila_output.patch
new file mode 100644 (file)
index 0000000..3c524d2
--- /dev/null
@@ -0,0 +1,60 @@
+From a262d3c07aac94db8db764a17409e3316cd32ad4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 31 May 2024 13:26:35 +0000
+Subject: ila: block BH in ila_output()
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit cf28ff8e4c02e1ffa850755288ac954b6ff0db8c ]
+
+As explained in commit 1378817486d6 ("tipc: block BH
+before using dst_cache"), net/core/dst_cache.c
+helpers need to be called with BH disabled.
+
+ila_output() is called from lwtunnel_output()
+possibly from process context, and under rcu_read_lock().
+
+We might be interrupted by a softirq, re-enter ila_output()
+and corrupt dst_cache data structures.
+
+Fix the race by using local_bh_disable().
+
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Acked-by: Paolo Abeni <pabeni@redhat.com>
+Link: https://lore.kernel.org/r/20240531132636.2637995-5-edumazet@google.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv6/ila/ila_lwt.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/net/ipv6/ila/ila_lwt.c b/net/ipv6/ila/ila_lwt.c
+index 0601bad798221..ff7e734e335b0 100644
+--- a/net/ipv6/ila/ila_lwt.c
++++ b/net/ipv6/ila/ila_lwt.c
+@@ -58,7 +58,9 @@ static int ila_output(struct net *net, struct sock *sk, struct sk_buff *skb)
+               return orig_dst->lwtstate->orig_output(net, sk, skb);
+       }
++      local_bh_disable();
+       dst = dst_cache_get(&ilwt->dst_cache);
++      local_bh_enable();
+       if (unlikely(!dst)) {
+               struct ipv6hdr *ip6h = ipv6_hdr(skb);
+               struct flowi6 fl6;
+@@ -86,8 +88,11 @@ static int ila_output(struct net *net, struct sock *sk, struct sk_buff *skb)
+                       goto drop;
+               }
+-              if (ilwt->connected)
++              if (ilwt->connected) {
++                      local_bh_disable();
+                       dst_cache_set_ip6(&ilwt->dst_cache, dst, &fl6.saddr);
++                      local_bh_enable();
++              }
+       }
+       skb_dst_set(skb, dst);
+-- 
+2.43.0
+
diff --git a/queue-6.9/input-add-event-code-for-accessibility-key.patch b/queue-6.9/input-add-event-code-for-accessibility-key.patch
new file mode 100644 (file)
index 0000000..26550dc
--- /dev/null
@@ -0,0 +1,63 @@
+From 07648ab525815cea8d19cb20d0ba4356409192ac Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 4 Jun 2024 23:10:47 +0000
+Subject: input: Add event code for accessibility key
+
+From: Aseda Aboagye <aaboagye@chromium.org>
+
+[ Upstream commit 0c7dd00de018ff70b3452c424901816e26366a8a ]
+
+HUTRR116 added support for a new usage titled "System Accessibility
+Binding" which toggles a system-wide bound accessibility UI or command.
+This commit simply adds a new event code for the usage.
+
+Signed-off-by: Aseda Aboagye <aaboagye@chromium.org>
+Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Link: https://lore.kernel.org/r/Zl-e97O9nvudco5z@google.com
+Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hid/hid-debug.c                | 1 +
+ drivers/hid/hid-input.c                | 1 +
+ include/uapi/linux/input-event-codes.h | 1 +
+ 3 files changed, 3 insertions(+)
+
+diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
+index 7dd83ec74f8a9..c629ab161d5b2 100644
+--- a/drivers/hid/hid-debug.c
++++ b/drivers/hid/hid-debug.c
+@@ -974,6 +974,7 @@ static const char *keys[KEY_MAX + 1] = {
+       [KEY_CAMERA_ACCESS_ENABLE] = "CameraAccessEnable",
+       [KEY_CAMERA_ACCESS_DISABLE] = "CameraAccessDisable",
+       [KEY_CAMERA_ACCESS_TOGGLE] = "CameraAccessToggle",
++      [KEY_ACCESSIBILITY] = "Accessibility",
+       [KEY_DICTATE] = "Dictate",
+       [KEY_MICMUTE] = "MicrophoneMute",
+       [KEY_BRIGHTNESS_MIN] = "BrightnessMin",
+diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
+index e03d300d2bac4..d5a6e89c3086e 100644
+--- a/drivers/hid/hid-input.c
++++ b/drivers/hid/hid-input.c
+@@ -836,6 +836,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
+               if ((usage->hid & 0xf0) == 0xa0) {      /* SystemControl */
+                       switch (usage->hid & 0xf) {
+                       case 0x9: map_key_clear(KEY_MICMUTE); break;
++                      case 0xa: map_key_clear(KEY_ACCESSIBILITY); break;
+                       default: goto ignore;
+                       }
+                       break;
+diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
+index 03edf2ccdf6c8..39f11ec676fae 100644
+--- a/include/uapi/linux/input-event-codes.h
++++ b/include/uapi/linux/input-event-codes.h
+@@ -618,6 +618,7 @@
+ #define KEY_CAMERA_ACCESS_ENABLE      0x24b   /* Enables programmatic access to camera devices. (HUTRR72) */
+ #define KEY_CAMERA_ACCESS_DISABLE     0x24c   /* Disables programmatic access to camera devices. (HUTRR72) */
+ #define KEY_CAMERA_ACCESS_TOGGLE      0x24d   /* Toggles the current state of the camera access control. (HUTRR72) */
++#define KEY_ACCESSIBILITY             0x24e   /* Toggles the system bound accessibility UI/command (HUTRR116) */
+ #define KEY_BRIGHTNESS_MIN            0x250   /* Set Brightness to Minimum */
+ #define KEY_BRIGHTNESS_MAX            0x251   /* Set Brightness to Maximum */
+-- 
+2.43.0
+
diff --git a/queue-6.9/input-add-support-for-do-not-disturb.patch b/queue-6.9/input-add-support-for-do-not-disturb.patch
new file mode 100644 (file)
index 0000000..f0cd2da
--- /dev/null
@@ -0,0 +1,70 @@
+From aa419fab91cda527a9e2dfb1bec2dc171d35cde6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 4 Jun 2024 23:16:32 +0000
+Subject: input: Add support for "Do Not Disturb"
+
+From: Aseda Aboagye <aaboagye@chromium.org>
+
+[ Upstream commit 22d6d060ac77955291deb43efc2f3f4f9632c6cb ]
+
+HUTRR94 added support for a new usage titled "System Do Not Disturb"
+which toggles a system-wide Do Not Disturb setting. This commit simply
+adds a new event code for the usage.
+
+Signed-off-by: Aseda Aboagye <aaboagye@chromium.org>
+Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Link: https://lore.kernel.org/r/Zl-gUHE70s7wCAoB@google.com
+Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/hid/hid-debug.c                | 1 +
+ drivers/hid/hid-input.c                | 8 ++++++++
+ include/uapi/linux/input-event-codes.h | 1 +
+ 3 files changed, 10 insertions(+)
+
+diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c
+index c629ab161d5b2..5302bfd527d86 100644
+--- a/drivers/hid/hid-debug.c
++++ b/drivers/hid/hid-debug.c
+@@ -975,6 +975,7 @@ static const char *keys[KEY_MAX + 1] = {
+       [KEY_CAMERA_ACCESS_DISABLE] = "CameraAccessDisable",
+       [KEY_CAMERA_ACCESS_TOGGLE] = "CameraAccessToggle",
+       [KEY_ACCESSIBILITY] = "Accessibility",
++      [KEY_DO_NOT_DISTURB] = "DoNotDisturb",
+       [KEY_DICTATE] = "Dictate",
+       [KEY_MICMUTE] = "MicrophoneMute",
+       [KEY_BRIGHTNESS_MIN] = "BrightnessMin",
+diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c
+index d5a6e89c3086e..8bb16e9b94aa5 100644
+--- a/drivers/hid/hid-input.c
++++ b/drivers/hid/hid-input.c
+@@ -833,6 +833,14 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
+                       break;
+               }
++              if ((usage->hid & 0xf0) == 0x90) { /* SystemControl*/
++                      switch (usage->hid & 0xf) {
++                      case 0xb: map_key_clear(KEY_DO_NOT_DISTURB); break;
++                      default: goto ignore;
++                      }
++                      break;
++              }
++
+               if ((usage->hid & 0xf0) == 0xa0) {      /* SystemControl */
+                       switch (usage->hid & 0xf) {
+                       case 0x9: map_key_clear(KEY_MICMUTE); break;
+diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
+index 39f11ec676fae..a4206723f5033 100644
+--- a/include/uapi/linux/input-event-codes.h
++++ b/include/uapi/linux/input-event-codes.h
+@@ -619,6 +619,7 @@
+ #define KEY_CAMERA_ACCESS_DISABLE     0x24c   /* Disables programmatic access to camera devices. (HUTRR72) */
+ #define KEY_CAMERA_ACCESS_TOGGLE      0x24d   /* Toggles the current state of the camera access control. (HUTRR72) */
+ #define KEY_ACCESSIBILITY             0x24e   /* Toggles the system bound accessibility UI/command (HUTRR116) */
++#define KEY_DO_NOT_DISTURB            0x24f   /* Toggles the system-wide "Do Not Disturb" control (HUTRR94)*/
+ #define KEY_BRIGHTNESS_MIN            0x250   /* Set Brightness to Minimum */
+ #define KEY_BRIGHTNESS_MAX            0x251   /* Set Brightness to Maximum */
+-- 
+2.43.0
+
diff --git a/queue-6.9/input-ads7846-use-spi_device_id-table.patch b/queue-6.9/input-ads7846-use-spi_device_id-table.patch
new file mode 100644 (file)
index 0000000..0711baf
--- /dev/null
@@ -0,0 +1,63 @@
+From bcfcda2dd1a48552a37ea319e22619e7caac5fca Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 19 Jun 2024 14:27:02 +0200
+Subject: Input: ads7846 - use spi_device_id table
+
+From: Alexander Stein <alexander.stein@ew.tq-group.com>
+
+[ Upstream commit 7c7b1be19b228b450c2945ec379d7fc6bfef9852 ]
+
+As the driver supports more devices over time the single MODULE_ALIAS
+is complete and raises several warnings:
+SPI driver ads7846 has no spi_device_id for ti,tsc2046
+SPI driver ads7846 has no spi_device_id for ti,ads7843
+SPI driver ads7846 has no spi_device_id for ti,ads7845
+SPI driver ads7846 has no spi_device_id for ti,ads7873
+
+Fix this by adding a spi_device_id table and removing the manual
+MODULE_ALIAS.
+
+Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
+Link: https://lore.kernel.org/r/20240619122703.2081476-1-alexander.stein@ew.tq-group.com
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/input/touchscreen/ads7846.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
+index d2bbb436a77df..4d13db13b9e57 100644
+--- a/drivers/input/touchscreen/ads7846.c
++++ b/drivers/input/touchscreen/ads7846.c
+@@ -1111,6 +1111,16 @@ static const struct of_device_id ads7846_dt_ids[] = {
+ };
+ MODULE_DEVICE_TABLE(of, ads7846_dt_ids);
++static const struct spi_device_id ads7846_spi_ids[] = {
++      { "tsc2046", 7846 },
++      { "ads7843", 7843 },
++      { "ads7845", 7845 },
++      { "ads7846", 7846 },
++      { "ads7873", 7873 },
++      { },
++};
++MODULE_DEVICE_TABLE(spi, ads7846_spi_ids);
++
+ static const struct ads7846_platform_data *ads7846_get_props(struct device *dev)
+ {
+       struct ads7846_platform_data *pdata;
+@@ -1386,10 +1396,10 @@ static struct spi_driver ads7846_driver = {
+       },
+       .probe          = ads7846_probe,
+       .remove         = ads7846_remove,
++      .id_table       = ads7846_spi_ids,
+ };
+ module_spi_driver(ads7846_driver);
+ MODULE_DESCRIPTION("ADS7846 TouchScreen Driver");
+ MODULE_LICENSE("GPL");
+-MODULE_ALIAS("spi:ads7846");
+-- 
+2.43.0
+
diff --git a/queue-6.9/input-elantech-fix-touchpad-state-on-resume-for-leno.patch b/queue-6.9/input-elantech-fix-touchpad-state-on-resume-for-leno.patch
new file mode 100644 (file)
index 0000000..b522436
--- /dev/null
@@ -0,0 +1,79 @@
+From 39dae60cb5cd831062abf82c6ed9c9a20739e784 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 3 May 2024 16:12:07 +0000
+Subject: Input: elantech - fix touchpad state on resume for Lenovo N24
+
+From: Jonathan Denose <jdenose@google.com>
+
+[ Upstream commit a69ce592cbe0417664bc5a075205aa75c2ec1273 ]
+
+The Lenovo N24 on resume becomes stuck in a state where it
+sends incorrect packets, causing elantech_packet_check_v4 to fail.
+The only way for the device to resume sending the correct packets is for
+it to be disabled and then re-enabled.
+
+This change adds a dmi check to trigger this behavior on resume.
+
+Signed-off-by: Jonathan Denose <jdenose@google.com>
+Link: https://lore.kernel.org/r/20240503155020.v2.1.Ifa0e25ebf968d8f307f58d678036944141ab17e6@changeid
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/input/mouse/elantech.c | 31 +++++++++++++++++++++++++++++++
+ 1 file changed, 31 insertions(+)
+
+diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c
+index 4e38229404b4b..b4723ea395eb9 100644
+--- a/drivers/input/mouse/elantech.c
++++ b/drivers/input/mouse/elantech.c
+@@ -1476,16 +1476,47 @@ static void elantech_disconnect(struct psmouse *psmouse)
+       psmouse->private = NULL;
+ }
++/*
++ * Some hw_version 4 models fail to properly activate absolute mode on
++ * resume without going through disable/enable cycle.
++ */
++static const struct dmi_system_id elantech_needs_reenable[] = {
++#if defined(CONFIG_DMI) && defined(CONFIG_X86)
++      {
++              /* Lenovo N24 */
++              .matches = {
++                      DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
++                      DMI_MATCH(DMI_PRODUCT_NAME, "81AF"),
++              },
++      },
++#endif
++      { }
++};
++
+ /*
+  * Put the touchpad back into absolute mode when reconnecting
+  */
+ static int elantech_reconnect(struct psmouse *psmouse)
+ {
++      int err;
++
+       psmouse_reset(psmouse);
+       if (elantech_detect(psmouse, 0))
+               return -1;
++      if (dmi_check_system(elantech_needs_reenable)) {
++              err = ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_DISABLE);
++              if (err)
++                      psmouse_warn(psmouse, "failed to deactivate mouse on %s: %d\n",
++                                   psmouse->ps2dev.serio->phys, err);
++
++              err = ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_ENABLE);
++              if (err)
++                      psmouse_warn(psmouse, "failed to reactivate mouse on %s: %d\n",
++                                   psmouse->ps2dev.serio->phys, err);
++      }
++
+       if (elantech_set_absolute_mode(psmouse)) {
+               psmouse_err(psmouse,
+                           "failed to put touchpad back into absolute mode.\n");
+-- 
+2.43.0
+
diff --git a/queue-6.9/input-i8042-add-ayaneo-kun-to-i8042-quirk-table.patch b/queue-6.9/input-i8042-add-ayaneo-kun-to-i8042-quirk-table.patch
new file mode 100644 (file)
index 0000000..733f355
--- /dev/null
@@ -0,0 +1,66 @@
+From 5aff9602579977e5210b2b550b38c4ddb6cbc074 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 31 May 2024 15:43:07 -0700
+Subject: Input: i8042 - add Ayaneo Kun to i8042 quirk table
+
+From: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
+
+[ Upstream commit 955af6355ddfe35140f9706a635838212a32513b ]
+
+See the added comment for details. Also fix a typo in the
+quirk's define.
+
+Signed-off-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
+Link: https://lore.kernel.org/r/20240531190100.3874731-1-tjakobi@math.uni-bielefeld.de
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/input/serio/i8042-acpipnpio.h | 18 ++++++++++++++++--
+ 1 file changed, 16 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/input/serio/i8042-acpipnpio.h b/drivers/input/serio/i8042-acpipnpio.h
+index dfc6c581873b7..5b50475ec4140 100644
+--- a/drivers/input/serio/i8042-acpipnpio.h
++++ b/drivers/input/serio/i8042-acpipnpio.h
+@@ -76,7 +76,7 @@ static inline void i8042_write_command(int val)
+ #define SERIO_QUIRK_PROBE_DEFER               BIT(5)
+ #define SERIO_QUIRK_RESET_ALWAYS      BIT(6)
+ #define SERIO_QUIRK_RESET_NEVER               BIT(7)
+-#define SERIO_QUIRK_DIECT             BIT(8)
++#define SERIO_QUIRK_DIRECT            BIT(8)
+ #define SERIO_QUIRK_DUMBKBD           BIT(9)
+ #define SERIO_QUIRK_NOLOOP            BIT(10)
+ #define SERIO_QUIRK_NOTIMEOUT         BIT(11)
+@@ -1332,6 +1332,20 @@ static const struct dmi_system_id i8042_dmi_quirk_table[] __initconst = {
+               .driver_data = (void *)(SERIO_QUIRK_NOMUX | SERIO_QUIRK_RESET_ALWAYS |
+                                       SERIO_QUIRK_NOLOOP | SERIO_QUIRK_NOPNP)
+       },
++      {
++              /*
++               * The Ayaneo Kun is a handheld device where some the buttons
++               * are handled by an AT keyboard. The keyboard is usually
++               * detected as raw, but sometimes, usually after a cold boot,
++               * it is detected as translated. Make sure that the keyboard
++               * is always in raw mode.
++               */
++              .matches = {
++                      DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
++                      DMI_MATCH(DMI_BOARD_NAME, "KUN"),
++              },
++              .driver_data = (void *)(SERIO_QUIRK_DIRECT)
++      },
+       { }
+ };
+@@ -1655,7 +1669,7 @@ static void __init i8042_check_quirks(void)
+               if (quirks & SERIO_QUIRK_RESET_NEVER)
+                       i8042_reset = I8042_RESET_NEVER;
+       }
+-      if (quirks & SERIO_QUIRK_DIECT)
++      if (quirks & SERIO_QUIRK_DIRECT)
+               i8042_direct = true;
+       if (quirks & SERIO_QUIRK_DUMBKBD)
+               i8042_dumbkbd = true;
+-- 
+2.43.0
+
diff --git a/queue-6.9/input-silead-always-support-10-fingers.patch b/queue-6.9/input-silead-always-support-10-fingers.patch
new file mode 100644 (file)
index 0000000..7a6769b
--- /dev/null
@@ -0,0 +1,100 @@
+From 964cd074f059762c9abcec344acab9cc560e1250 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 25 May 2024 21:38:53 +0200
+Subject: Input: silead - Always support 10 fingers
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+[ Upstream commit 38a38f5a36da9820680d413972cb733349400532 ]
+
+When support for Silead touchscreens was orginal added some touchscreens
+with older firmware versions only supported 5 fingers and this was made
+the default requiring the setting of a "silead,max-fingers=10" uint32
+device-property for all touchscreen models which do support 10 fingers.
+
+There are very few models with the old 5 finger fw, so in practice the
+setting of the "silead,max-fingers=10" is boilerplate which needs to
+be copy and pasted to every touchscreen config.
+
+Reporting that 10 fingers are supported on devices which only support
+5 fingers doesn't cause any problems for userspace in practice, since
+at max 4 finger gestures are supported anyways. Drop the max_fingers
+configuration and simply always assume 10 fingers.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Link: https://lore.kernel.org/r/20240525193854.39130-2-hdegoede@redhat.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/input/touchscreen/silead.c | 19 +++++--------------
+ 1 file changed, 5 insertions(+), 14 deletions(-)
+
+diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c
+index 62f562ad50263..050fa9ca4ec94 100644
+--- a/drivers/input/touchscreen/silead.c
++++ b/drivers/input/touchscreen/silead.c
+@@ -71,7 +71,6 @@ struct silead_ts_data {
+       struct regulator_bulk_data regulators[2];
+       char fw_name[64];
+       struct touchscreen_properties prop;
+-      u32 max_fingers;
+       u32 chip_id;
+       struct input_mt_pos pos[SILEAD_MAX_FINGERS];
+       int slots[SILEAD_MAX_FINGERS];
+@@ -136,7 +135,7 @@ static int silead_ts_request_input_dev(struct silead_ts_data *data)
+       touchscreen_parse_properties(data->input, true, &data->prop);
+       silead_apply_efi_fw_min_max(data);
+-      input_mt_init_slots(data->input, data->max_fingers,
++      input_mt_init_slots(data->input, SILEAD_MAX_FINGERS,
+                           INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED |
+                           INPUT_MT_TRACK);
+@@ -256,10 +255,10 @@ static void silead_ts_read_data(struct i2c_client *client)
+               return;
+       }
+-      if (buf[0] > data->max_fingers) {
++      if (buf[0] > SILEAD_MAX_FINGERS) {
+               dev_warn(dev, "More touches reported then supported %d > %d\n",
+-                       buf[0], data->max_fingers);
+-              buf[0] = data->max_fingers;
++                       buf[0], SILEAD_MAX_FINGERS);
++              buf[0] = SILEAD_MAX_FINGERS;
+       }
+       if (silead_ts_handle_pen_data(data, buf))
+@@ -315,7 +314,6 @@ static void silead_ts_read_data(struct i2c_client *client)
+ static int silead_ts_init(struct i2c_client *client)
+ {
+-      struct silead_ts_data *data = i2c_get_clientdata(client);
+       int error;
+       error = i2c_smbus_write_byte_data(client, SILEAD_REG_RESET,
+@@ -325,7 +323,7 @@ static int silead_ts_init(struct i2c_client *client)
+       usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
+       error = i2c_smbus_write_byte_data(client, SILEAD_REG_TOUCH_NR,
+-                                      data->max_fingers);
++                                        SILEAD_MAX_FINGERS);
+       if (error)
+               goto i2c_write_err;
+       usleep_range(SILEAD_CMD_SLEEP_MIN, SILEAD_CMD_SLEEP_MAX);
+@@ -591,13 +589,6 @@ static void silead_ts_read_props(struct i2c_client *client)
+       const char *str;
+       int error;
+-      error = device_property_read_u32(dev, "silead,max-fingers",
+-                                       &data->max_fingers);
+-      if (error) {
+-              dev_dbg(dev, "Max fingers read error %d\n", error);
+-              data->max_fingers = 5; /* Most devices handle up-to 5 fingers */
+-      }
+-
+       error = device_property_read_string(dev, "firmware-name", &str);
+       if (!error)
+               snprintf(data->fw_name, sizeof(data->fw_name),
+-- 
+2.43.0
+
diff --git a/queue-6.9/input-xpad-add-support-for-asus-rog-raikiri-pro.patch b/queue-6.9/input-xpad-add-support-for-asus-rog-raikiri-pro.patch
new file mode 100644 (file)
index 0000000..2b04d62
--- /dev/null
@@ -0,0 +1,34 @@
+From e8e5d6ca8e30f4ccb6e3c864213010763a51abef Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 7 Jun 2024 16:37:48 -0700
+Subject: Input: xpad - add support for ASUS ROG RAIKIRI PRO
+
+From: Luke D. Jones <luke@ljones.dev>
+
+[ Upstream commit cee77149ebe9cd971ba238d87aa10e09bd98f1c9 ]
+
+Add the VID/PID for ASUS ROG RAIKIRI PRO to the list of known devices.
+
+Signed-off-by: Luke D. Jones <luke@ljones.dev>
+Link: https://lore.kernel.org/r/20240607223722.1170776-1-luke@ljones.dev
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/input/joystick/xpad.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
+index 6fadaddb2b908..3a5af0909233a 100644
+--- a/drivers/input/joystick/xpad.c
++++ b/drivers/input/joystick/xpad.c
+@@ -209,6 +209,7 @@ static const struct xpad_device {
+       { 0x0738, 0xf738, "Super SFIV FightStick TE S", 0, XTYPE_XBOX360 },
+       { 0x07ff, 0xffff, "Mad Catz GamePad", 0, XTYPE_XBOX360 },
+       { 0x0b05, 0x1a38, "ASUS ROG RAIKIRI", 0, XTYPE_XBOXONE },
++      { 0x0b05, 0x1abb, "ASUS ROG RAIKIRI PRO", 0, XTYPE_XBOXONE },
+       { 0x0c12, 0x0005, "Intec wireless", 0, XTYPE_XBOX },
+       { 0x0c12, 0x8801, "Nyko Xbox Controller", 0, XTYPE_XBOX },
+       { 0x0c12, 0x8802, "Zeroplus Xbox Controller", 0, XTYPE_XBOX },
+-- 
+2.43.0
+
diff --git a/queue-6.9/io_uring-fix-possible-deadlock-in-io_register_iowq_m.patch b/queue-6.9/io_uring-fix-possible-deadlock-in-io_register_iowq_m.patch
new file mode 100644 (file)
index 0000000..a82f548
--- /dev/null
@@ -0,0 +1,59 @@
+From f5edadadcf48298c145d71e5d5bc57edeee2623d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 4 Jun 2024 13:05:27 +0000
+Subject: io_uring: fix possible deadlock in io_register_iowq_max_workers()
+
+From: Hagar Hemdan <hagarhem@amazon.com>
+
+[ Upstream commit 73254a297c2dd094abec7c9efee32455ae875bdf ]
+
+The io_register_iowq_max_workers() function calls io_put_sq_data(),
+which acquires the sqd->lock without releasing the uring_lock.
+Similar to the commit 009ad9f0c6ee ("io_uring: drop ctx->uring_lock
+before acquiring sqd->lock"), this can lead to a potential deadlock
+situation.
+
+To resolve this issue, the uring_lock is released before calling
+io_put_sq_data(), and then it is re-acquired after the function call.
+
+This change ensures that the locks are acquired in the correct
+order, preventing the possibility of a deadlock.
+
+Suggested-by: Maximilian Heyne <mheyne@amazon.de>
+Signed-off-by: Hagar Hemdan <hagarhem@amazon.com>
+Link: https://lore.kernel.org/r/20240604130527.3597-1-hagarhem@amazon.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ io_uring/register.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/io_uring/register.c b/io_uring/register.c
+index 99c37775f974c..1ae8491e35abb 100644
+--- a/io_uring/register.c
++++ b/io_uring/register.c
+@@ -355,8 +355,10 @@ static __cold int io_register_iowq_max_workers(struct io_ring_ctx *ctx,
+       }
+       if (sqd) {
++              mutex_unlock(&ctx->uring_lock);
+               mutex_unlock(&sqd->lock);
+               io_put_sq_data(sqd);
++              mutex_lock(&ctx->uring_lock);
+       }
+       if (copy_to_user(arg, new_count, sizeof(new_count)))
+@@ -381,8 +383,10 @@ static __cold int io_register_iowq_max_workers(struct io_ring_ctx *ctx,
+       return 0;
+ err:
+       if (sqd) {
++              mutex_unlock(&ctx->uring_lock);
+               mutex_unlock(&sqd->lock);
+               io_put_sq_data(sqd);
++              mutex_lock(&ctx->uring_lock);
+       }
+       return ret;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.9/iomap-fix-iomap_adjust_read_range-for-plen-calculati.patch b/queue-6.9/iomap-fix-iomap_adjust_read_range-for-plen-calculati.patch
new file mode 100644 (file)
index 0000000..210ae6d
--- /dev/null
@@ -0,0 +1,55 @@
+From 1de4705983158af6b2e7ddf798d34a46fabfaeee Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 7 May 2024 14:25:42 +0530
+Subject: iomap: Fix iomap_adjust_read_range for plen calculation
+
+From: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
+
+[ Upstream commit f5ceb1bbc98c69536d4673a97315e8427e67de1b ]
+
+If the extent spans the block that contains i_size, we need to handle
+both halves separately so that we properly zero data in the page cache
+for blocks that are entirely outside of i_size. But this is needed only
+when i_size is within the current folio under processing.
+"orig_pos + length > isize" can be true for all folios if the mapped
+extent length is greater than the folio size. That is making plen to
+break for every folio instead of only the last folio.
+
+So use orig_plen for checking if "orig_pos + orig_plen > isize".
+
+Signed-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
+Link: https://lore.kernel.org/r/a32e5f9a4fcfdb99077300c4020ed7ae61d6e0f9.1715067055.git.ritesh.list@gmail.com
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Darrick J. Wong <djwong@kernel.org>
+Reviewed-by: Jan Kara <jack@suse.cz>
+cc: Ojaswin Mujoo <ojaswin@linux.ibm.com>
+Signed-off-by: Christian Brauner <brauner@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/iomap/buffered-io.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c
+index 4ac6c8c403c26..248e615270ff7 100644
+--- a/fs/iomap/buffered-io.c
++++ b/fs/iomap/buffered-io.c
+@@ -241,6 +241,7 @@ static void iomap_adjust_read_range(struct inode *inode, struct folio *folio,
+       unsigned block_size = (1 << block_bits);
+       size_t poff = offset_in_folio(folio, *pos);
+       size_t plen = min_t(loff_t, folio_size(folio) - poff, length);
++      size_t orig_plen = plen;
+       unsigned first = poff >> block_bits;
+       unsigned last = (poff + plen - 1) >> block_bits;
+@@ -277,7 +278,7 @@ static void iomap_adjust_read_range(struct inode *inode, struct folio *folio,
+        * handle both halves separately so that we properly zero data in the
+        * page cache for blocks that are entirely outside of i_size.
+        */
+-      if (orig_pos <= isize && orig_pos + length > isize) {
++      if (orig_pos <= isize && orig_pos + orig_plen > isize) {
+               unsigned end = offset_in_folio(folio, isize - 1) >> block_bits;
+               if (first <= end && last > end)
+-- 
+2.43.0
+
diff --git a/queue-6.9/kconfig-gconf-give-a-proper-initial-state-to-the-sav.patch b/queue-6.9/kconfig-gconf-give-a-proper-initial-state-to-the-sav.patch
new file mode 100644 (file)
index 0000000..bf7746a
--- /dev/null
@@ -0,0 +1,46 @@
+From 58e9cb0c7b050b6e55cdf2a432383c0fb5d8d0e8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 2 Jun 2024 03:20:40 +0900
+Subject: kconfig: gconf: give a proper initial state to the Save button
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+[ Upstream commit 46edf4372e336ef3a61c3126e49518099d2e2e6d ]
+
+Currently, the initial state of the "Save" button is always active.
+
+If none of the CONFIG options are changed while loading the .config
+file, the "Save" button should be greyed out.
+
+This can be fixed by calling conf_read() after widget initialization.
+
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ scripts/kconfig/gconf.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
+index 9709aca3a30fe..9e52c7360e55b 100644
+--- a/scripts/kconfig/gconf.c
++++ b/scripts/kconfig/gconf.c
+@@ -1478,7 +1478,6 @@ int main(int ac, char *av[])
+       conf_parse(name);
+       fixup_rootmenu(&rootmenu);
+-      conf_read(NULL);
+       /* Load the interface and connect signals */
+       init_main_window(glade_file);
+@@ -1486,6 +1485,8 @@ int main(int ac, char *av[])
+       init_left_tree();
+       init_right_tree();
++      conf_read(NULL);
++
+       switch (view_mode) {
+       case SINGLE_VIEW:
+               display_tree_part();
+-- 
+2.43.0
+
diff --git a/queue-6.9/kconfig-remove-wrong-expr_trans_bool.patch b/queue-6.9/kconfig-remove-wrong-expr_trans_bool.patch
new file mode 100644 (file)
index 0000000..3ab4593
--- /dev/null
@@ -0,0 +1,158 @@
+From 8a0adc465f464a93dca153c7f89f9c35235af6f7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 4 Jun 2024 01:19:04 +0900
+Subject: kconfig: remove wrong expr_trans_bool()
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+[ Upstream commit 77a92660d8fe8d29503fae768d9f5eb529c88b36 ]
+
+expr_trans_bool() performs an incorrect transformation.
+
+[Test Code]
+
+    config MODULES
+            def_bool y
+            modules
+
+    config A
+            def_bool y
+            select C if B != n
+
+    config B
+            def_tristate m
+
+    config C
+            tristate
+
+[Result]
+
+    CONFIG_MODULES=y
+    CONFIG_A=y
+    CONFIG_B=m
+    CONFIG_C=m
+
+This output is incorrect because CONFIG_C=y is expected.
+
+Documentation/kbuild/kconfig-language.rst clearly explains the function
+of the '!=' operator:
+
+    If the values of both symbols are equal, it returns 'n',
+    otherwise 'y'.
+
+Therefore, the statement:
+
+    select C if B != n
+
+should be equivalent to:
+
+    select C if y
+
+Or, more simply:
+
+    select C
+
+Hence, the symbol C should be selected by the value of A, which is 'y'.
+
+However, expr_trans_bool() wrongly transforms it to:
+
+    select C if B
+
+Therefore, the symbol C is selected by (A && B), which is 'm'.
+
+The comment block of expr_trans_bool() correctly explains its intention:
+
+  * bool FOO!=n => FOO
+    ^^^^
+
+If FOO is bool, FOO!=n can be simplified into FOO. This is correct.
+
+However, the actual code performs this transformation when FOO is
+tristate:
+
+    if (e->left.sym->type == S_TRISTATE) {
+                             ^^^^^^^^^^
+
+While it can be fixed to S_BOOLEAN, there is no point in doing so
+because expr_tranform() already transforms FOO!=n to FOO when FOO is
+bool. (see the "case E_UNEQUAL" part)
+
+expr_trans_bool() is wrong and unnecessary.
+
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Acked-by: Randy Dunlap <rdunlap@infradead.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ scripts/kconfig/expr.c | 29 -----------------------------
+ scripts/kconfig/expr.h |  1 -
+ scripts/kconfig/menu.c |  2 --
+ 3 files changed, 32 deletions(-)
+
+diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c
+index a290de36307ba..7866167552177 100644
+--- a/scripts/kconfig/expr.c
++++ b/scripts/kconfig/expr.c
+@@ -396,35 +396,6 @@ static struct expr *expr_eliminate_yn(struct expr *e)
+       return e;
+ }
+-/*
+- * bool FOO!=n => FOO
+- */
+-struct expr *expr_trans_bool(struct expr *e)
+-{
+-      if (!e)
+-              return NULL;
+-      switch (e->type) {
+-      case E_AND:
+-      case E_OR:
+-      case E_NOT:
+-              e->left.expr = expr_trans_bool(e->left.expr);
+-              e->right.expr = expr_trans_bool(e->right.expr);
+-              break;
+-      case E_UNEQUAL:
+-              // FOO!=n -> FOO
+-              if (e->left.sym->type == S_TRISTATE) {
+-                      if (e->right.sym == &symbol_no) {
+-                              e->type = E_SYMBOL;
+-                              e->right.sym = NULL;
+-                      }
+-              }
+-              break;
+-      default:
+-              ;
+-      }
+-      return e;
+-}
+-
+ /*
+  * e1 || e2 -> ?
+  */
+diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
+index 0158f5eac4542..f015883519b39 100644
+--- a/scripts/kconfig/expr.h
++++ b/scripts/kconfig/expr.h
+@@ -288,7 +288,6 @@ void expr_free(struct expr *e);
+ void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
+ int expr_eq(struct expr *e1, struct expr *e2);
+ tristate expr_calc_value(struct expr *e);
+-struct expr *expr_trans_bool(struct expr *e);
+ struct expr *expr_eliminate_dups(struct expr *e);
+ struct expr *expr_transform(struct expr *e);
+ int expr_contains_symbol(struct expr *dep, struct symbol *sym);
+diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
+index 3b822cd110f47..8b48a80e7e168 100644
+--- a/scripts/kconfig/menu.c
++++ b/scripts/kconfig/menu.c
+@@ -379,8 +379,6 @@ static void _menu_finalize(struct menu *parent, bool inside_choice)
+                               dep = expr_transform(dep);
+                               dep = expr_alloc_and(expr_copy(basedep), dep);
+                               dep = expr_eliminate_dups(dep);
+-                              if (menu->sym && menu->sym->type != S_TRISTATE)
+-                                      dep = expr_trans_bool(dep);
+                               prop->visible.expr = dep;
+                               /*
+-- 
+2.43.0
+
diff --git a/queue-6.9/ksmbd-return-file_device_disk-instead-of-super-magic.patch b/queue-6.9/ksmbd-return-file_device_disk-instead-of-super-magic.patch
new file mode 100644 (file)
index 0000000..76af80b
--- /dev/null
@@ -0,0 +1,89 @@
+From 3a66f833ddb8be79b25a699a8106086dfbd45741 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 24 Jun 2024 08:39:23 +0900
+Subject: ksmbd: return FILE_DEVICE_DISK instead of super magic
+
+From: Namjae Jeon <linkinjeon@kernel.org>
+
+[ Upstream commit 25a6e135569b3901452e4863c94560df7c11c492 ]
+
+MS-SMB2 specification describes setting ->DeviceType to FILE_DEVICE_DISK
+or FILE_DEVICE_CD_ROM. Set FILE_DEVICE_DISK instead of super magic in
+FS_DEVICE_INFORMATION. And Set FILE_READ_ONLY_DEVICE for read-only share.
+
+Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
+Signed-off-by: Steve French <stfrench@microsoft.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/smb/common/smb2pdu.h | 34 ++++++++++++++++++++++++++++++++++
+ fs/smb/server/smb2pdu.c |  9 +++++++--
+ 2 files changed, 41 insertions(+), 2 deletions(-)
+
+diff --git a/fs/smb/common/smb2pdu.h b/fs/smb/common/smb2pdu.h
+index 202ff91281560..694d2b4a4ad99 100644
+--- a/fs/smb/common/smb2pdu.h
++++ b/fs/smb/common/smb2pdu.h
+@@ -917,6 +917,40 @@ struct smb2_query_directory_rsp {
+       __u8   Buffer[];
+ } __packed;
++/* DeviceType Flags */
++#define FILE_DEVICE_CD_ROM              0x00000002
++#define FILE_DEVICE_CD_ROM_FILE_SYSTEM  0x00000003
++#define FILE_DEVICE_DFS                 0x00000006
++#define FILE_DEVICE_DISK                0x00000007
++#define FILE_DEVICE_DISK_FILE_SYSTEM    0x00000008
++#define FILE_DEVICE_FILE_SYSTEM         0x00000009
++#define FILE_DEVICE_NAMED_PIPE          0x00000011
++#define FILE_DEVICE_NETWORK             0x00000012
++#define FILE_DEVICE_NETWORK_FILE_SYSTEM 0x00000014
++#define FILE_DEVICE_NULL                0x00000015
++#define FILE_DEVICE_PARALLEL_PORT       0x00000016
++#define FILE_DEVICE_PRINTER             0x00000018
++#define FILE_DEVICE_SERIAL_PORT         0x0000001b
++#define FILE_DEVICE_STREAMS             0x0000001e
++#define FILE_DEVICE_TAPE                0x0000001f
++#define FILE_DEVICE_TAPE_FILE_SYSTEM    0x00000020
++#define FILE_DEVICE_VIRTUAL_DISK        0x00000024
++#define FILE_DEVICE_NETWORK_REDIRECTOR  0x00000028
++
++/* Device Characteristics */
++#define FILE_REMOVABLE_MEDIA                  0x00000001
++#define FILE_READ_ONLY_DEVICE                 0x00000002
++#define FILE_FLOPPY_DISKETTE                  0x00000004
++#define FILE_WRITE_ONCE_MEDIA                 0x00000008
++#define FILE_REMOTE_DEVICE                    0x00000010
++#define FILE_DEVICE_IS_MOUNTED                        0x00000020
++#define FILE_VIRTUAL_VOLUME                   0x00000040
++#define FILE_DEVICE_SECURE_OPEN                       0x00000100
++#define FILE_CHARACTERISTIC_TS_DEVICE         0x00001000
++#define FILE_CHARACTERISTIC_WEBDAV_DEVICE     0x00002000
++#define FILE_PORTABLE_DEVICE                  0x00004000
++#define FILE_DEVICE_ALLOW_APPCONTAINER_TRAVERSAL 0x00020000
++
+ /*
+  * Maximum number of iovs we need for a set-info request.
+  * The largest one is rename/hardlink
+diff --git a/fs/smb/server/smb2pdu.c b/fs/smb/server/smb2pdu.c
+index 7d26fdcebbf98..840c71c66b30b 100644
+--- a/fs/smb/server/smb2pdu.c
++++ b/fs/smb/server/smb2pdu.c
+@@ -5323,8 +5323,13 @@ static int smb2_get_info_filesystem(struct ksmbd_work *work,
+               info = (struct filesystem_device_info *)rsp->Buffer;
+-              info->DeviceType = cpu_to_le32(stfs.f_type);
+-              info->DeviceCharacteristics = cpu_to_le32(0x00000020);
++              info->DeviceType = cpu_to_le32(FILE_DEVICE_DISK);
++              info->DeviceCharacteristics =
++                      cpu_to_le32(FILE_DEVICE_IS_MOUNTED);
++              if (!test_tree_conn_flag(work->tcon,
++                                       KSMBD_TREE_CONN_FLAG_WRITABLE))
++                      info->DeviceCharacteristics |=
++                              cpu_to_le32(FILE_READ_ONLY_DEVICE);
+               rsp->OutputBufferLength = cpu_to_le32(8);
+               break;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.9/kvm-ppc-book3s-hv-prevent-uaf-in-kvm_spapr_tce_attac.patch b/queue-6.9/kvm-ppc-book3s-hv-prevent-uaf-in-kvm_spapr_tce_attac.patch
new file mode 100644 (file)
index 0000000..a00bd8c
--- /dev/null
@@ -0,0 +1,148 @@
+From 32d8cdfb739c44146020530527cf7e1cbc7dfbaa Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 14 Jun 2024 22:29:10 +1000
+Subject: KVM: PPC: Book3S HV: Prevent UAF in
+ kvm_spapr_tce_attach_iommu_group()
+
+From: Michael Ellerman <mpe@ellerman.id.au>
+
+[ Upstream commit a986fa57fd81a1430e00b3c6cf8a325d6f894a63 ]
+
+Al reported a possible use-after-free (UAF) in kvm_spapr_tce_attach_iommu_group().
+
+It looks up `stt` from tablefd, but then continues to use it after doing
+fdput() on the returned fd. After the fdput() the tablefd is free to be
+closed by another thread. The close calls kvm_spapr_tce_release() and
+then release_spapr_tce_table() (via call_rcu()) which frees `stt`.
+
+Although there are calls to rcu_read_lock() in
+kvm_spapr_tce_attach_iommu_group() they are not sufficient to prevent
+the UAF, because `stt` is used outside the locked regions.
+
+With an artifcial delay after the fdput() and a userspace program which
+triggers the race, KASAN detects the UAF:
+
+  BUG: KASAN: slab-use-after-free in kvm_spapr_tce_attach_iommu_group+0x298/0x720 [kvm]
+  Read of size 4 at addr c000200027552c30 by task kvm-vfio/2505
+  CPU: 54 PID: 2505 Comm: kvm-vfio Not tainted 6.10.0-rc3-next-20240612-dirty #1
+  Hardware name: 8335-GTH POWER9 0x4e1202 opal:skiboot-v6.5.3-35-g1851b2a06 PowerNV
+  Call Trace:
+    dump_stack_lvl+0xb4/0x108 (unreliable)
+    print_report+0x2b4/0x6ec
+    kasan_report+0x118/0x2b0
+    __asan_load4+0xb8/0xd0
+    kvm_spapr_tce_attach_iommu_group+0x298/0x720 [kvm]
+    kvm_vfio_set_attr+0x524/0xac0 [kvm]
+    kvm_device_ioctl+0x144/0x240 [kvm]
+    sys_ioctl+0x62c/0x1810
+    system_call_exception+0x190/0x440
+    system_call_vectored_common+0x15c/0x2ec
+  ...
+  Freed by task 0:
+   ...
+   kfree+0xec/0x3e0
+   release_spapr_tce_table+0xd4/0x11c [kvm]
+   rcu_core+0x568/0x16a0
+   handle_softirqs+0x23c/0x920
+   do_softirq_own_stack+0x6c/0x90
+   do_softirq_own_stack+0x58/0x90
+   __irq_exit_rcu+0x218/0x2d0
+   irq_exit+0x30/0x80
+   arch_local_irq_restore+0x128/0x230
+   arch_local_irq_enable+0x1c/0x30
+   cpuidle_enter_state+0x134/0x5cc
+   cpuidle_enter+0x6c/0xb0
+   call_cpuidle+0x7c/0x100
+   do_idle+0x394/0x410
+   cpu_startup_entry+0x60/0x70
+   start_secondary+0x3fc/0x410
+   start_secondary_prolog+0x10/0x14
+
+Fix it by delaying the fdput() until `stt` is no longer in use, which
+is effectively the entire function. To keep the patch minimal add a call
+to fdput() at each of the existing return paths. Future work can convert
+the function to goto or __cleanup style cleanup.
+
+With the fix in place the test case no longer triggers the UAF.
+
+Reported-by: Al Viro <viro@zeniv.linux.org.uk>
+Closes: https://lore.kernel.org/all/20240610024437.GA1464458@ZenIV/
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://msgid.link/20240614122910.3499489-1-mpe@ellerman.id.au
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/kvm/book3s_64_vio.c | 18 +++++++++++++-----
+ 1 file changed, 13 insertions(+), 5 deletions(-)
+
+diff --git a/arch/powerpc/kvm/book3s_64_vio.c b/arch/powerpc/kvm/book3s_64_vio.c
+index b569ebaa590e2..3ff3de9a52acf 100644
+--- a/arch/powerpc/kvm/book3s_64_vio.c
++++ b/arch/powerpc/kvm/book3s_64_vio.c
+@@ -130,14 +130,16 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
+       }
+       rcu_read_unlock();
+-      fdput(f);
+-
+-      if (!found)
++      if (!found) {
++              fdput(f);
+               return -EINVAL;
++      }
+       table_group = iommu_group_get_iommudata(grp);
+-      if (WARN_ON(!table_group))
++      if (WARN_ON(!table_group)) {
++              fdput(f);
+               return -EFAULT;
++      }
+       for (i = 0; i < IOMMU_TABLE_GROUP_MAX_TABLES; ++i) {
+               struct iommu_table *tbltmp = table_group->tables[i];
+@@ -158,8 +160,10 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
+                       break;
+               }
+       }
+-      if (!tbl)
++      if (!tbl) {
++              fdput(f);
+               return -EINVAL;
++      }
+       rcu_read_lock();
+       list_for_each_entry_rcu(stit, &stt->iommu_tables, next) {
+@@ -170,6 +174,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
+                       /* stit is being destroyed */
+                       iommu_tce_table_put(tbl);
+                       rcu_read_unlock();
++                      fdput(f);
+                       return -ENOTTY;
+               }
+               /*
+@@ -177,6 +182,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
+                * its KVM reference counter and can return.
+                */
+               rcu_read_unlock();
++              fdput(f);
+               return 0;
+       }
+       rcu_read_unlock();
+@@ -184,6 +190,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
+       stit = kzalloc(sizeof(*stit), GFP_KERNEL);
+       if (!stit) {
+               iommu_tce_table_put(tbl);
++              fdput(f);
+               return -ENOMEM;
+       }
+@@ -192,6 +199,7 @@ long kvm_spapr_tce_attach_iommu_group(struct kvm *kvm, int tablefd,
+       list_add_rcu(&stit->next, &stt->iommu_tables);
++      fdput(f);
+       return 0;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.9/loongarch-fix-gmac-s-phy-mode-definitions-in-dts.patch b/queue-6.9/loongarch-fix-gmac-s-phy-mode-definitions-in-dts.patch
new file mode 100644 (file)
index 0000000..60a7b29
--- /dev/null
@@ -0,0 +1,81 @@
+From 17d7ab0442e21926c0c02abc0d15cd76680b9107 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 3 Jun 2024 15:45:53 +0800
+Subject: LoongArch: Fix GMAC's phy-mode definitions in dts
+
+From: Huacai Chen <chenhuacai@loongson.cn>
+
+[ Upstream commit eb36e520f4f1b690fd776f15cbac452f82ff7bfa ]
+
+The GMAC of Loongson chips cannot insert the correct 1.5-2ns delay. So
+we need the PHY to insert internal delays for both transmit and receive
+data lines from/to the PHY device. Fix this by changing the "phy-mode"
+from "rgmii" to "rgmii-id" in dts.
+
+Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/loongarch/boot/dts/loongson-2k0500-ref.dts | 4 ++--
+ arch/loongarch/boot/dts/loongson-2k1000-ref.dts | 4 ++--
+ arch/loongarch/boot/dts/loongson-2k2000-ref.dts | 2 +-
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/arch/loongarch/boot/dts/loongson-2k0500-ref.dts b/arch/loongarch/boot/dts/loongson-2k0500-ref.dts
+index 8aefb0c126722..a34734a6c3ce8 100644
+--- a/arch/loongarch/boot/dts/loongson-2k0500-ref.dts
++++ b/arch/loongarch/boot/dts/loongson-2k0500-ref.dts
+@@ -44,14 +44,14 @@ linux,cma {
+ &gmac0 {
+       status = "okay";
+-      phy-mode = "rgmii";
++      phy-mode = "rgmii-id";
+       bus_id = <0x0>;
+ };
+ &gmac1 {
+       status = "okay";
+-      phy-mode = "rgmii";
++      phy-mode = "rgmii-id";
+       bus_id = <0x1>;
+ };
+diff --git a/arch/loongarch/boot/dts/loongson-2k1000-ref.dts b/arch/loongarch/boot/dts/loongson-2k1000-ref.dts
+index ed4d324340411..aaf41b565805a 100644
+--- a/arch/loongarch/boot/dts/loongson-2k1000-ref.dts
++++ b/arch/loongarch/boot/dts/loongson-2k1000-ref.dts
+@@ -43,7 +43,7 @@ linux,cma {
+ &gmac0 {
+       status = "okay";
+-      phy-mode = "rgmii";
++      phy-mode = "rgmii-id";
+       phy-handle = <&phy0>;
+       mdio {
+               compatible = "snps,dwmac-mdio";
+@@ -58,7 +58,7 @@ phy0: ethernet-phy@0 {
+ &gmac1 {
+       status = "okay";
+-      phy-mode = "rgmii";
++      phy-mode = "rgmii-id";
+       phy-handle = <&phy1>;
+       mdio {
+               compatible = "snps,dwmac-mdio";
+diff --git a/arch/loongarch/boot/dts/loongson-2k2000-ref.dts b/arch/loongarch/boot/dts/loongson-2k2000-ref.dts
+index 74b99bd234cc3..ea9e6985d0e9f 100644
+--- a/arch/loongarch/boot/dts/loongson-2k2000-ref.dts
++++ b/arch/loongarch/boot/dts/loongson-2k2000-ref.dts
+@@ -92,7 +92,7 @@ phy1: ethernet-phy@1 {
+ &gmac2 {
+       status = "okay";
+-      phy-mode = "rgmii";
++      phy-mode = "rgmii-id";
+       phy-handle = <&phy2>;
+       mdio {
+               compatible = "snps,dwmac-mdio";
+-- 
+2.43.0
+
diff --git a/queue-6.9/loop-disable-fallocate-zero-and-discard-if-not-suppo.patch b/queue-6.9/loop-disable-fallocate-zero-and-discard-if-not-suppo.patch
new file mode 100644 (file)
index 0000000..4abf4e7
--- /dev/null
@@ -0,0 +1,96 @@
+From 6718aa792b7d297ece53024a138ea679e8153ea6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 13 Jun 2024 18:38:17 +0200
+Subject: loop: Disable fallocate() zero and discard if not supported
+
+From: Cyril Hrubis <chrubis@suse.cz>
+
+[ Upstream commit 5f75e081ab5cbfbe7aca2112a802e69576ee9778 ]
+
+If fallcate is implemented but zero and discard operations are not
+supported by the filesystem the backing file is on we continue to fill
+dmesg with errors from the blk_mq_end_request() since each time we call
+fallocate() on the loop device the EOPNOTSUPP error from lo_fallocate()
+ends up propagated into the block layer. In the end syscall succeeds
+since the blkdev_issue_zeroout() falls back to writing zeroes which
+makes the errors even more misleading and confusing.
+
+How to reproduce:
+
+1. make sure /tmp is mounted as tmpfs
+2. dd if=/dev/zero of=/tmp/disk.img bs=1M count=100
+3. losetup /dev/loop0 /tmp/disk.img
+4. mkfs.ext2 /dev/loop0
+5. dmesg |tail
+
+[710690.898214] operation not supported error, dev loop0, sector 204672 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio class 0
+[710690.898279] operation not supported error, dev loop0, sector 522 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio class 0
+[710690.898603] operation not supported error, dev loop0, sector 16906 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio class 0
+[710690.898917] operation not supported error, dev loop0, sector 32774 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio class 0
+[710690.899218] operation not supported error, dev loop0, sector 49674 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio class 0
+[710690.899484] operation not supported error, dev loop0, sector 65542 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio class 0
+[710690.899743] operation not supported error, dev loop0, sector 82442 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio class 0
+[710690.900015] operation not supported error, dev loop0, sector 98310 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio class 0
+[710690.900276] operation not supported error, dev loop0, sector 115210 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio class 0
+[710690.900546] operation not supported error, dev loop0, sector 131078 op 0x9:(WRITE_ZEROES) flags 0x8000800 phys_seg 0 prio class 0
+
+This patch changes the lo_fallocate() to clear the flags for zero and
+discard operations if we get EOPNOTSUPP from the backing file fallocate
+callback, that way we at least stop spewing errors after the first
+unsuccessful try.
+
+CC: Jan Kara <jack@suse.cz>
+Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Jan Kara <jack@suse.cz>
+Link: https://lore.kernel.org/r/20240613163817.22640-1-chrubis@suse.cz
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/loop.c | 23 +++++++++++++++++++++++
+ 1 file changed, 23 insertions(+)
+
+diff --git a/drivers/block/loop.c b/drivers/block/loop.c
+index 28a95fd366fea..95a468eaa7013 100644
+--- a/drivers/block/loop.c
++++ b/drivers/block/loop.c
+@@ -302,6 +302,21 @@ static int lo_read_simple(struct loop_device *lo, struct request *rq,
+       return 0;
+ }
++static void loop_clear_limits(struct loop_device *lo, int mode)
++{
++      struct queue_limits lim = queue_limits_start_update(lo->lo_queue);
++
++      if (mode & FALLOC_FL_ZERO_RANGE)
++              lim.max_write_zeroes_sectors = 0;
++
++      if (mode & FALLOC_FL_PUNCH_HOLE) {
++              lim.max_hw_discard_sectors = 0;
++              lim.discard_granularity = 0;
++      }
++
++      queue_limits_commit_update(lo->lo_queue, &lim);
++}
++
+ static int lo_fallocate(struct loop_device *lo, struct request *rq, loff_t pos,
+                       int mode)
+ {
+@@ -320,6 +335,14 @@ static int lo_fallocate(struct loop_device *lo, struct request *rq, loff_t pos,
+       ret = file->f_op->fallocate(file, mode, pos, blk_rq_bytes(rq));
+       if (unlikely(ret && ret != -EINVAL && ret != -EOPNOTSUPP))
+               return -EIO;
++
++      /*
++       * We initially configure the limits in a hope that fallocate is
++       * supported and clear them here if that turns out not to be true.
++       */
++      if (unlikely(ret == -EOPNOTSUPP))
++              loop_clear_limits(lo, mode);
++
+       return ret;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.9/mei-demote-client-disconnect-warning-on-suspend-to-d.patch b/queue-6.9/mei-demote-client-disconnect-warning-on-suspend-to-d.patch
new file mode 100644 (file)
index 0000000..8835b0e
--- /dev/null
@@ -0,0 +1,48 @@
+From 131246bdd1ff3bf33e2390949e810dd53dadc1b1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 30 May 2024 12:14:15 +0300
+Subject: mei: demote client disconnect warning on suspend to debug
+
+From: Alexander Usyskin <alexander.usyskin@intel.com>
+
+[ Upstream commit 1db5322b7e6b58e1b304ce69a50e9dca798ca95b ]
+
+Change level for the "not connected" client message in the write
+callback from error to debug.
+
+The MEI driver currently disconnects all clients upon system suspend.
+This behavior is by design and user-space applications with
+open connections before the suspend are expected to handle errors upon
+resume, by reopening their handles, reconnecting,
+and retrying their operations.
+
+However, the current driver implementation logs an error message every
+time a write operation is attempted on a disconnected client.
+Since this is a normal and expected flow after system resume
+logging this as an error can be misleading.
+
+Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
+Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
+Link: https://lore.kernel.org/r/20240530091415.725247-1-tomas.winkler@intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/misc/mei/main.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/misc/mei/main.c b/drivers/misc/mei/main.c
+index 79e6f3c1341fe..40c3fe26f76df 100644
+--- a/drivers/misc/mei/main.c
++++ b/drivers/misc/mei/main.c
+@@ -329,7 +329,7 @@ static ssize_t mei_write(struct file *file, const char __user *ubuf,
+       }
+       if (!mei_cl_is_connected(cl)) {
+-              cl_err(dev, cl, "is not connected");
++              cl_dbg(dev, cl, "is not connected");
+               rets = -ENODEV;
+               goto out;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.9/mips-fix-compat_sys_lseek-syscall.patch b/queue-6.9/mips-fix-compat_sys_lseek-syscall.patch
new file mode 100644 (file)
index 0000000..1ac2b4d
--- /dev/null
@@ -0,0 +1,38 @@
+From 08cf327ad8ed1215ab78d2f55f81f0881e920c11 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Jun 2024 18:23:04 +0200
+Subject: mips: fix compat_sys_lseek syscall
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit 0d5679a0aae2d8cda72169452c32e5cb88a7ab33 ]
+
+This is almost compatible, but passing a negative offset should result
+in a EINVAL error, but on mips o32 compat mode would seek to a large
+32-bit byte offset.
+
+Use compat_sys_lseek() to correctly sign-extend the argument.
+
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/mips/kernel/syscalls/syscall_o32.tbl | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/mips/kernel/syscalls/syscall_o32.tbl b/arch/mips/kernel/syscalls/syscall_o32.tbl
+index 0352c07c608e9..fe76282a353f5 100644
+--- a/arch/mips/kernel/syscalls/syscall_o32.tbl
++++ b/arch/mips/kernel/syscalls/syscall_o32.tbl
+@@ -27,7 +27,7 @@
+ 17    o32     break                           sys_ni_syscall
+ # 18 was sys_stat
+ 18    o32     unused18                        sys_ni_syscall
+-19    o32     lseek                           sys_lseek
++19    o32     lseek                           sys_lseek                       compat_sys_lseek
+ 20    o32     getpid                          sys_getpid
+ 21    o32     mount                           sys_mount
+ 22    o32     umount                          sys_oldumount
+-- 
+2.43.0
+
diff --git a/queue-6.9/net-ipv6-rpl_iptunnel-block-bh-in-rpl_output-and-rpl.patch b/queue-6.9/net-ipv6-rpl_iptunnel-block-bh-in-rpl_output-and-rpl.patch
new file mode 100644 (file)
index 0000000..68cef8f
--- /dev/null
@@ -0,0 +1,92 @@
+From 7d0847c3053f4025089f6cfd5c83d70c0b9d8afb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 31 May 2024 13:26:33 +0000
+Subject: net: ipv6: rpl_iptunnel: block BH in rpl_output() and rpl_input()
+
+From: Eric Dumazet <edumazet@google.com>
+
+[ Upstream commit db0090c6eb12c31246438b7fe2a8f1b833e7a653 ]
+
+As explained in commit 1378817486d6 ("tipc: block BH
+before using dst_cache"), net/core/dst_cache.c
+helpers need to be called with BH disabled.
+
+Disabling preemption in rpl_output() is not good enough,
+because rpl_output() is called from process context,
+lwtunnel_output() only uses rcu_read_lock().
+
+We might be interrupted by a softirq, re-enter rpl_output()
+and corrupt dst_cache data structures.
+
+Fix the race by using local_bh_disable() instead of
+preempt_disable().
+
+Apply a similar change in rpl_input().
+
+Signed-off-by: Eric Dumazet <edumazet@google.com>
+Cc: Alexander Aring <aahringo@redhat.com>
+Acked-by: Paolo Abeni <pabeni@redhat.com>
+Link: https://lore.kernel.org/r/20240531132636.2637995-3-edumazet@google.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv6/rpl_iptunnel.c | 14 ++++++--------
+ 1 file changed, 6 insertions(+), 8 deletions(-)
+
+diff --git a/net/ipv6/rpl_iptunnel.c b/net/ipv6/rpl_iptunnel.c
+index a013b92cbb860..2c83b7586422d 100644
+--- a/net/ipv6/rpl_iptunnel.c
++++ b/net/ipv6/rpl_iptunnel.c
+@@ -212,9 +212,9 @@ static int rpl_output(struct net *net, struct sock *sk, struct sk_buff *skb)
+       if (unlikely(err))
+               goto drop;
+-      preempt_disable();
++      local_bh_disable();
+       dst = dst_cache_get(&rlwt->cache);
+-      preempt_enable();
++      local_bh_enable();
+       if (unlikely(!dst)) {
+               struct ipv6hdr *hdr = ipv6_hdr(skb);
+@@ -234,9 +234,9 @@ static int rpl_output(struct net *net, struct sock *sk, struct sk_buff *skb)
+                       goto drop;
+               }
+-              preempt_disable();
++              local_bh_disable();
+               dst_cache_set_ip6(&rlwt->cache, dst, &fl6.saddr);
+-              preempt_enable();
++              local_bh_enable();
+       }
+       skb_dst_drop(skb);
+@@ -268,23 +268,21 @@ static int rpl_input(struct sk_buff *skb)
+               return err;
+       }
+-      preempt_disable();
++      local_bh_disable();
+       dst = dst_cache_get(&rlwt->cache);
+-      preempt_enable();
+       if (!dst) {
+               ip6_route_input(skb);
+               dst = skb_dst(skb);
+               if (!dst->error) {
+-                      preempt_disable();
+                       dst_cache_set_ip6(&rlwt->cache, dst,
+                                         &ipv6_hdr(skb)->saddr);
+-                      preempt_enable();
+               }
+       } else {
+               skb_dst_drop(skb);
+               skb_dst_set(skb, dst);
+       }
++      local_bh_enable();
+       err = skb_cow_head(skb, LL_RESERVED_SPACE(dst->dev));
+       if (unlikely(err))
+-- 
+2.43.0
+
diff --git a/queue-6.9/net-mac802154-fix-racy-device-stats-updates-by-dev_s.patch b/queue-6.9/net-mac802154-fix-racy-device-stats-updates-by-dev_s.patch
new file mode 100644 (file)
index 0000000..d2686cf
--- /dev/null
@@ -0,0 +1,51 @@
+From fa3cef048956b813a34c66bc12551499573742c1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 31 May 2024 16:07:39 +0800
+Subject: net: mac802154: Fix racy device stats updates by DEV_STATS_INC() and
+ DEV_STATS_ADD()
+
+From: Yunshui Jiang <jiangyunshui@kylinos.cn>
+
+[ Upstream commit b8ec0dc3845f6c9089573cb5c2c4b05f7fc10728 ]
+
+mac802154 devices update their dev->stats fields locklessly. Therefore
+these counters should be updated atomically. Adopt SMP safe DEV_STATS_INC()
+and DEV_STATS_ADD() to achieve this.
+
+Signed-off-by: Yunshui Jiang <jiangyunshui@kylinos.cn>
+Message-ID: <20240531080739.2608969-1-jiangyunshui@kylinos.cn>
+Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/mac802154/tx.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/net/mac802154/tx.c b/net/mac802154/tx.c
+index 2a6f1ed763c9b..6fbed5bb5c3e0 100644
+--- a/net/mac802154/tx.c
++++ b/net/mac802154/tx.c
+@@ -34,8 +34,8 @@ void ieee802154_xmit_sync_worker(struct work_struct *work)
+       if (res)
+               goto err_tx;
+-      dev->stats.tx_packets++;
+-      dev->stats.tx_bytes += skb->len;
++      DEV_STATS_INC(dev, tx_packets);
++      DEV_STATS_ADD(dev, tx_bytes, skb->len);
+       ieee802154_xmit_complete(&local->hw, skb, false);
+@@ -90,8 +90,8 @@ ieee802154_tx(struct ieee802154_local *local, struct sk_buff *skb)
+               if (ret)
+                       goto err_wake_netif_queue;
+-              dev->stats.tx_packets++;
+-              dev->stats.tx_bytes += len;
++              DEV_STATS_INC(dev, tx_packets);
++              DEV_STATS_ADD(dev, tx_bytes, len);
+       } else {
+               local->tx_skb = skb;
+               queue_work(local->workqueue, &local->sync_tx_work);
+-- 
+2.43.0
+
diff --git a/queue-6.9/net-mvpp2-fill-in-dev_port-attribute.patch b/queue-6.9/net-mvpp2-fill-in-dev_port-attribute.patch
new file mode 100644 (file)
index 0000000..70f99d3
--- /dev/null
@@ -0,0 +1,34 @@
+From 9a1c7c393811431f0e6ce4711cd4cd5b406cf11d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 20 Jun 2024 16:12:02 +1200
+Subject: net: mvpp2: fill-in dev_port attribute
+
+From: Aryan Srivastava <aryan.srivastava@alliedtelesis.co.nz>
+
+[ Upstream commit 00418d5530ca1f42d8721fe0a3e73d1ae477c223 ]
+
+Fill this in so user-space can identify multiple ports on the same CP
+unit.
+
+Signed-off-by: Aryan Srivastava <aryan.srivastava@alliedtelesis.co.nz>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+index cebc79a710ec2..6340e5e61a7da 100644
+--- a/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
++++ b/drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
+@@ -6906,6 +6906,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
+       /* 9704 == 9728 - 20 and rounding to 8 */
+       dev->max_mtu = MVPP2_BM_JUMBO_PKT_SIZE;
+       device_set_node(&dev->dev, port_fwnode);
++      dev->dev_port = port->id;
+       port->pcs_gmac.ops = &mvpp2_phylink_gmac_pcs_ops;
+       port->pcs_gmac.neg_mode = true;
+-- 
+2.43.0
+
diff --git a/queue-6.9/net-usb-qmi_wwan-add-telit-fn912-compositions.patch b/queue-6.9/net-usb-qmi_wwan-add-telit-fn912-compositions.patch
new file mode 100644 (file)
index 0000000..9c54765
--- /dev/null
@@ -0,0 +1,88 @@
+From b2ac263bf53c4ff5545609431469c8a0ab40cbc8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 25 Jun 2024 12:22:36 +0200
+Subject: net: usb: qmi_wwan: add Telit FN912 compositions
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Daniele Palmas <dnlplm@gmail.com>
+
+[ Upstream commit 77453e2b015b5ced5b3f45364dd5a72dfc3bdecb ]
+
+Add the following Telit FN912 compositions:
+
+0x3000: rmnet + tty (AT/NMEA) + tty (AT) + tty (diag)
+T:  Bus=03 Lev=01 Prnt=03 Port=07 Cnt=01 Dev#=  8 Spd=480  MxCh= 0
+D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
+P:  Vendor=1bc7 ProdID=3000 Rev=05.15
+S:  Manufacturer=Telit Cinterion
+S:  Product=FN912
+S:  SerialNumber=92c4c4d8
+C:  #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=500mA
+I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
+E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
+I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=60 Driver=option
+E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
+I:  If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
+E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=86(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
+I:  If#= 3 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
+E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+
+0x3001: rmnet + tty (AT) + tty (diag) + DPL (data packet logging) + adb
+T:  Bus=03 Lev=01 Prnt=03 Port=07 Cnt=01 Dev#=  7 Spd=480  MxCh= 0
+D:  Ver= 2.01 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
+P:  Vendor=1bc7 ProdID=3001 Rev=05.15
+S:  Manufacturer=Telit Cinterion
+S:  Product=FN912
+S:  SerialNumber=92c4c4d8
+C:  #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA
+I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=50 Driver=qmi_wwan
+E:  Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=82(I) Atr=03(Int.) MxPS=   8 Ivl=32ms
+I:  If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=40 Driver=option
+E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=83(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=84(I) Atr=03(Int.) MxPS=  10 Ivl=32ms
+I:  If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=30 Driver=option
+E:  Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=85(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:  If#= 3 Alt= 0 #EPs= 1 Cls=ff(vend.) Sub=ff Prot=80 Driver=(none)
+E:  Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+I:  If#= 4 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=usbfs
+E:  Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+E:  Ad=87(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
+
+Signed-off-by: Daniele Palmas <dnlplm@gmail.com>
+Acked-by: Bjørn Mork <bjorn@mork.no>
+Link: https://patch.msgid.link/20240625102236.69539-1-dnlplm@gmail.com
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/usb/qmi_wwan.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
+index a5469cf5cf670..befbca01bfe37 100644
+--- a/drivers/net/usb/qmi_wwan.c
++++ b/drivers/net/usb/qmi_wwan.c
+@@ -1380,6 +1380,8 @@ static const struct usb_device_id products[] = {
+       {QMI_QUIRK_SET_DTR(0x1bc7, 0x1260, 2)}, /* Telit LE910Cx */
+       {QMI_QUIRK_SET_DTR(0x1bc7, 0x1261, 2)}, /* Telit LE910Cx */
+       {QMI_QUIRK_SET_DTR(0x1bc7, 0x1900, 1)}, /* Telit LN940 series */
++      {QMI_QUIRK_SET_DTR(0x1bc7, 0x3000, 0)}, /* Telit FN912 series */
++      {QMI_QUIRK_SET_DTR(0x1bc7, 0x3001, 0)}, /* Telit FN912 series */
+       {QMI_FIXED_INTF(0x1c9e, 0x9801, 3)},    /* Telewell TW-3G HSPA+ */
+       {QMI_FIXED_INTF(0x1c9e, 0x9803, 4)},    /* Telewell TW-3G HSPA+ */
+       {QMI_FIXED_INTF(0x1c9e, 0x9b01, 3)},    /* XS Stick W100-2 from 4G Systems */
+-- 
+2.43.0
+
diff --git a/queue-6.9/nfs-avoid-flushing-many-pages-with-nfs_file_sync.patch b/queue-6.9/nfs-avoid-flushing-many-pages-with-nfs_file_sync.patch
new file mode 100644 (file)
index 0000000..7b8913b
--- /dev/null
@@ -0,0 +1,54 @@
+From 7c57aefbac10e7295d0ac5e041c3d2930f28ad9c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 24 May 2024 18:14:19 +0200
+Subject: nfs: Avoid flushing many pages with NFS_FILE_SYNC
+
+From: Jan Kara <jack@suse.cz>
+
+[ Upstream commit a527c3ba41c4c61e2069bfce4091e5515f06a8dd ]
+
+When we are doing WB_SYNC_ALL writeback, nfs submits write requests with
+NFS_FILE_SYNC flag to the server (which then generally treats it as an
+O_SYNC write). This helps to reduce latency for single requests but when
+submitting more requests, additional fsyncs on the server side hurt
+latency. NFS generally avoids this additional overhead by not setting
+NFS_FILE_SYNC if desc->pg_moreio is set.
+
+However this logic doesn't always work. When we do random 4k writes to a huge
+file and then call fsync(2), each page writeback is going to be sent with
+NFS_FILE_SYNC because after preparing one page for writeback, we start writing
+back next, nfs_do_writepage() will call nfs_pageio_cond_complete() which finds
+the page is not contiguous with previously prepared IO and submits is *without*
+setting desc->pg_moreio.  Hence NFS_FILE_SYNC is used resulting in poor
+performance.
+
+Fix the problem by setting desc->pg_moreio in nfs_pageio_cond_complete() before
+submitting outstanding IO. This improves throughput of
+fsync-after-random-writes on my test SSD from ~70MB/s to ~250MB/s.
+
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/pagelist.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c
+index 6efb5068c116e..040b6b79c75e5 100644
+--- a/fs/nfs/pagelist.c
++++ b/fs/nfs/pagelist.c
+@@ -1545,6 +1545,11 @@ void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index)
+                                       continue;
+                       } else if (index == prev->wb_index + 1)
+                               continue;
++                      /*
++                       * We will submit more requests after these. Indicate
++                       * this to the underlying layers.
++                       */
++                      desc->pg_moreio = 1;
+                       nfs_pageio_complete(desc);
+                       break;
+               }
+-- 
+2.43.0
+
diff --git a/queue-6.9/nfs-don-t-invalidate-dentries-on-transient-errors.patch b/queue-6.9/nfs-don-t-invalidate-dentries-on-transient-errors.patch
new file mode 100644 (file)
index 0000000..9e559de
--- /dev/null
@@ -0,0 +1,123 @@
+From 38360f5f1cfd16c335a9d0ed13e42f249a8b4a99 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 23 May 2024 15:01:22 -0400
+Subject: nfs: don't invalidate dentries on transient errors
+
+From: Scott Mayhew <smayhew@redhat.com>
+
+[ Upstream commit 0c8c7c559740d2d8b66048162af6c4dba8f0c88c ]
+
+This is a slight variation on a patch previously proposed by Neil Brown
+that never got merged.
+
+Prior to commit 5ceb9d7fdaaf ("NFS: Refactor nfs_lookup_revalidate()"),
+any error from nfs_lookup_verify_inode() other than -ESTALE would result
+in nfs_lookup_revalidate() returning that error (-ESTALE is mapped to
+zero).
+
+Since that commit, all errors result in nfs_lookup_revalidate()
+returning zero, resulting in dentries being invalidated where they
+previously were not (particularly in the case of -ERESTARTSYS).
+
+Fix it by passing the actual error code to nfs_lookup_revalidate_done(),
+and leaving the decision on whether to  map the error code to zero or
+one to nfs_lookup_revalidate_done().
+
+A simple reproducer is to run the following python code in a
+subdirectory of an NFS mount (not in the root of the NFS mount):
+
+---8<---
+import os
+import multiprocessing
+import time
+
+if __name__=="__main__":
+    multiprocessing.set_start_method("spawn")
+
+    count = 0
+    while True:
+        try:
+            os.getcwd()
+            pool = multiprocessing.Pool(10)
+            pool.close()
+            pool.terminate()
+            count += 1
+        except Exception as e:
+            print(f"Failed after {count} iterations")
+            print(e)
+            break
+---8<---
+
+Prior to commit 5ceb9d7fdaaf, the above code would run indefinitely.
+After commit 5ceb9d7fdaaf, it fails almost immediately with -ENOENT.
+
+Signed-off-by: Scott Mayhew <smayhew@redhat.com>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/dir.c | 27 +++++++++++++--------------
+ 1 file changed, 13 insertions(+), 14 deletions(-)
+
+diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
+index bdd6cb33a3708..375c08fdcf2f3 100644
+--- a/fs/nfs/dir.c
++++ b/fs/nfs/dir.c
+@@ -1625,7 +1625,16 @@ nfs_lookup_revalidate_done(struct inode *dir, struct dentry *dentry,
+       switch (error) {
+       case 1:
+               break;
+-      case 0:
++      case -ETIMEDOUT:
++              if (inode && (IS_ROOT(dentry) ||
++                            NFS_SERVER(inode)->flags & NFS_MOUNT_SOFTREVAL))
++                      error = 1;
++              break;
++      case -ESTALE:
++      case -ENOENT:
++              error = 0;
++              fallthrough;
++      default:
+               /*
+                * We can't d_drop the root of a disconnected tree:
+                * its d_hash is on the s_anon list and d_drop() would hide
+@@ -1680,18 +1689,8 @@ static int nfs_lookup_revalidate_dentry(struct inode *dir,
+       dir_verifier = nfs_save_change_attribute(dir);
+       ret = NFS_PROTO(dir)->lookup(dir, dentry, fhandle, fattr);
+-      if (ret < 0) {
+-              switch (ret) {
+-              case -ESTALE:
+-              case -ENOENT:
+-                      ret = 0;
+-                      break;
+-              case -ETIMEDOUT:
+-                      if (NFS_SERVER(inode)->flags & NFS_MOUNT_SOFTREVAL)
+-                              ret = 1;
+-              }
++      if (ret < 0)
+               goto out;
+-      }
+       /* Request help from readdirplus */
+       nfs_lookup_advise_force_readdirplus(dir, flags);
+@@ -1735,7 +1734,7 @@ nfs_do_lookup_revalidate(struct inode *dir, struct dentry *dentry,
+                        unsigned int flags)
+ {
+       struct inode *inode;
+-      int error;
++      int error = 0;
+       nfs_inc_stats(dir, NFSIOS_DENTRYREVALIDATE);
+       inode = d_inode(dentry);
+@@ -1780,7 +1779,7 @@ nfs_do_lookup_revalidate(struct inode *dir, struct dentry *dentry,
+ out_bad:
+       if (flags & LOOKUP_RCU)
+               return -ECHILD;
+-      return nfs_lookup_revalidate_done(dir, dentry, inode, 0);
++      return nfs_lookup_revalidate_done(dir, dentry, inode, error);
+ }
+ static int
+-- 
+2.43.0
+
diff --git a/queue-6.9/nfs-propagate-readlink-errors-in-nfs_symlink_filler.patch b/queue-6.9/nfs-propagate-readlink-errors-in-nfs_symlink_filler.patch
new file mode 100644 (file)
index 0000000..8f2ba9f
--- /dev/null
@@ -0,0 +1,40 @@
+From f9d2189d2d674a6b4371b16dee2dc4e483c0fd0f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 May 2024 15:58:40 +0300
+Subject: nfs: propagate readlink errors in nfs_symlink_filler
+
+From: Sagi Grimberg <sagi@grimberg.me>
+
+[ Upstream commit 134d0b3f2440cdddd12fc3444c9c0f62331ce6fc ]
+
+There is an inherent race where a symlink file may have been overriden
+(by a different client) between lookup and readlink, resulting in a
+spurious EIO error returned to userspace. Fix this by propagating back
+ESTALE errors such that the vfs will retry the lookup/get_link (similar
+to nfs4_file_open) at least once.
+
+Cc: Dan Aloni <dan.aloni@vastdata.com>
+Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
+Reviewed-by: Jeff Layton <jlayton@kernel.org>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/symlink.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c
+index 0e27a2e4e68b8..13818129d268f 100644
+--- a/fs/nfs/symlink.c
++++ b/fs/nfs/symlink.c
+@@ -41,7 +41,7 @@ static int nfs_symlink_filler(struct file *file, struct folio *folio)
+ error:
+       folio_set_error(folio);
+       folio_unlock(folio);
+-      return -EIO;
++      return error;
+ }
+ static const char *nfs_get_link(struct dentry *dentry,
+-- 
+2.43.0
+
diff --git a/queue-6.9/nfsv4-fix-memory-leak-in-nfs4_set_security_label.patch b/queue-6.9/nfsv4-fix-memory-leak-in-nfs4_set_security_label.patch
new file mode 100644 (file)
index 0000000..6a1b918
--- /dev/null
@@ -0,0 +1,33 @@
+From fd3b1a139ea7336763026cba466cdd3b34e26517 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 22 May 2024 10:45:24 +0300
+Subject: NFSv4: Fix memory leak in nfs4_set_security_label
+
+From: Dmitry Mastykin <mastichi@gmail.com>
+
+[ Upstream commit aad11473f8f4be3df86461081ce35ec5b145ba68 ]
+
+We leak nfs_fattr and nfs4_label every time we set a security xattr.
+
+Signed-off-by: Dmitry Mastykin <mastichi@gmail.com>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/nfs4proc.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
+index 3a816c4a6d5e2..a691fa10b3e95 100644
+--- a/fs/nfs/nfs4proc.c
++++ b/fs/nfs/nfs4proc.c
+@@ -6289,6 +6289,7 @@ nfs4_set_security_label(struct inode *inode, const void *buf, size_t buflen)
+       if (status == 0)
+               nfs_setsecurity(inode, fattr);
++      nfs_free_fattr(fattr);
+       return status;
+ }
+ #endif        /* CONFIG_NFS_V4_SECURITY_LABEL */
+-- 
+2.43.0
+
diff --git a/queue-6.9/null_blk-fix-validation-of-block-size.patch b/queue-6.9/null_blk-fix-validation-of-block-size.patch
new file mode 100644 (file)
index 0000000..300ba6c
--- /dev/null
@@ -0,0 +1,45 @@
+From 781cbd1726a43a950c4f0c863fafb8b124a3499b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 3 Jun 2024 21:26:45 +0200
+Subject: null_blk: fix validation of block size
+
+From: Andreas Hindborg <a.hindborg@samsung.com>
+
+[ Upstream commit c462ecd659b5fce731f1d592285832fd6ad54053 ]
+
+Block size should be between 512 and PAGE_SIZE and be a power of 2. The current
+check does not validate this, so update the check.
+
+Without this patch, null_blk would Oops due to a null pointer deref when
+loaded with bs=1536 [1].
+
+Link: https://lore.kernel.org/all/87wmn8mocd.fsf@metaspace.dk/
+
+Signed-off-by: Andreas Hindborg <a.hindborg@samsung.com>
+Reviewed-by: Ming Lei <ming.lei@redhat.com>
+Link: https://lore.kernel.org/r/20240603192645.977968-1-nmi@metaspace.dk
+[axboe: remove unnecessary braces and != 0 check]
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/null_blk/main.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
+index 620679a0ac381..26e2c22a87e1c 100644
+--- a/drivers/block/null_blk/main.c
++++ b/drivers/block/null_blk/main.c
+@@ -1810,8 +1810,8 @@ static int null_validate_conf(struct nullb_device *dev)
+               dev->queue_mode = NULL_Q_MQ;
+       }
+-      dev->blocksize = round_down(dev->blocksize, 512);
+-      dev->blocksize = clamp_t(unsigned int, dev->blocksize, 512, 4096);
++      if (blk_validate_block_size(dev->blocksize))
++              return -EINVAL;
+       if (dev->use_per_node_hctx) {
+               if (dev->submit_queues != nr_online_nodes)
+-- 
+2.43.0
+
diff --git a/queue-6.9/nvme-avoid-double-free-special-payload.patch b/queue-6.9/nvme-avoid-double-free-special-payload.patch
new file mode 100644 (file)
index 0000000..e6b2e9a
--- /dev/null
@@ -0,0 +1,37 @@
+From 7b10475f8b9bb5746665a6dcbaa4be09cc85d187 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 11 Jun 2024 18:02:08 +0800
+Subject: nvme: avoid double free special payload
+
+From: Chunguang Xu <chunguang.xu@shopee.com>
+
+[ Upstream commit e5d574ab37f5f2e7937405613d9b1a724811e5ad ]
+
+If a discard request needs to be retried, and that retry may fail before
+a new special payload is added, a double free will result. Clear the
+RQF_SPECIAL_LOAD when the request is cleaned.
+
+Signed-off-by: Chunguang Xu <chunguang.xu@shopee.com>
+Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
+Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.com>
+Signed-off-by: Keith Busch <kbusch@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/nvme/host/core.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
+index d513fd27589df..36f30594b671f 100644
+--- a/drivers/nvme/host/core.c
++++ b/drivers/nvme/host/core.c
+@@ -998,6 +998,7 @@ void nvme_cleanup_cmd(struct request *req)
+                       clear_bit_unlock(0, &ctrl->discard_page_busy);
+               else
+                       kfree(bvec_virt(&req->special_vec));
++              req->rq_flags &= ~RQF_SPECIAL_PAYLOAD;
+       }
+ }
+ EXPORT_SYMBOL_GPL(nvme_cleanup_cmd);
+-- 
+2.43.0
+
diff --git a/queue-6.9/nvme-fabrics-use-reserved-tag-for-reg-read-write-com.patch b/queue-6.9/nvme-fabrics-use-reserved-tag-for-reg-read-write-com.patch
new file mode 100644 (file)
index 0000000..dba5364
--- /dev/null
@@ -0,0 +1,67 @@
+From cce3928acf431fe800676cc326724840522af912 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 31 May 2024 17:24:21 +0800
+Subject: nvme-fabrics: use reserved tag for reg read/write command
+
+From: Chunguang Xu <chunguang.xu@shopee.com>
+
+[ Upstream commit 7dc3bfcb4c9cc58970fff6aaa48172cb224d85aa ]
+
+In some scenarios, if too many commands are issued by nvme command in
+the same time by user tasks, this may exhaust all tags of admin_q. If
+a reset (nvme reset or IO timeout) occurs before these commands finish,
+reconnect routine may fail to update nvme regs due to insufficient tags,
+which will cause kernel hang forever. In order to workaround this issue,
+maybe we can let reg_read32()/reg_read64()/reg_write32() use reserved
+tags. This maybe safe for nvmf:
+
+1. For the disable ctrl path,  we will not issue connect command
+2. For the enable ctrl / fw activate path, since connect and reg_xx()
+   are called serially.
+
+So the reserved tags may still be enough while reg_xx() use reserved tags.
+
+Signed-off-by: Chunguang Xu <chunguang.xu@shopee.com>
+Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
+Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Keith Busch <kbusch@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/nvme/host/fabrics.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
+index 1f0ea1f32d22f..f6416f8553f03 100644
+--- a/drivers/nvme/host/fabrics.c
++++ b/drivers/nvme/host/fabrics.c
+@@ -180,7 +180,7 @@ int nvmf_reg_read32(struct nvme_ctrl *ctrl, u32 off, u32 *val)
+       cmd.prop_get.offset = cpu_to_le32(off);
+       ret = __nvme_submit_sync_cmd(ctrl->fabrics_q, &cmd, &res, NULL, 0,
+-                      NVME_QID_ANY, 0);
++                      NVME_QID_ANY, NVME_SUBMIT_RESERVED);
+       if (ret >= 0)
+               *val = le64_to_cpu(res.u64);
+@@ -226,7 +226,7 @@ int nvmf_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val)
+       cmd.prop_get.offset = cpu_to_le32(off);
+       ret = __nvme_submit_sync_cmd(ctrl->fabrics_q, &cmd, &res, NULL, 0,
+-                      NVME_QID_ANY, 0);
++                      NVME_QID_ANY, NVME_SUBMIT_RESERVED);
+       if (ret >= 0)
+               *val = le64_to_cpu(res.u64);
+@@ -271,7 +271,7 @@ int nvmf_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val)
+       cmd.prop_set.value = cpu_to_le64(val);
+       ret = __nvme_submit_sync_cmd(ctrl->fabrics_q, &cmd, NULL, NULL, 0,
+-                      NVME_QID_ANY, 0);
++                      NVME_QID_ANY, NVME_SUBMIT_RESERVED);
+       if (unlikely(ret))
+               dev_err(ctrl->device,
+                       "Property Set error: %d, offset %#x\n",
+-- 
+2.43.0
+
diff --git a/queue-6.9/nvme-fix-nvme_ns_deac-may-incorrectly-identifying-th.patch b/queue-6.9/nvme-fix-nvme_ns_deac-may-incorrectly-identifying-th.patch
new file mode 100644 (file)
index 0000000..0753d61
--- /dev/null
@@ -0,0 +1,39 @@
+From aaec9263ba7893c08f57968ffed292049900ba64 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 17 Jun 2024 21:11:44 +0800
+Subject: nvme: fix NVME_NS_DEAC may incorrectly identifying the disk as
+ EXT_LBA.
+
+From: Boyang Yu <yuboyang@dapustor.com>
+
+[ Upstream commit 9570a48847e3acfa1a741cef431c923325ddc637 ]
+
+The value of NVME_NS_DEAC is 3,
+which means NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS. Provide a
+unique value for this feature flag.
+
+Fixes 1b96f862eccc ("nvme: implement the DEAC bit for the Write Zeroes command")
+Signed-off-by: Boyang Yu <yuboyang@dapustor.com>
+Reviewed-by: Kanchan Joshi <joshi.k@samsung.com>
+Signed-off-by: Keith Busch <kbusch@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/nvme/host/nvme.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
+index d7bcc6d51e84e..3f2b0d41e4819 100644
+--- a/drivers/nvme/host/nvme.h
++++ b/drivers/nvme/host/nvme.h
+@@ -503,7 +503,7 @@ static inline bool nvme_ns_head_multipath(struct nvme_ns_head *head)
+ enum nvme_ns_features {
+       NVME_NS_EXT_LBAS = 1 << 0, /* support extended LBA format */
+       NVME_NS_METADATA_SUPPORTED = 1 << 1, /* support getting generated md */
+-      NVME_NS_DEAC,           /* DEAC bit in Write Zeores supported */
++      NVME_NS_DEAC = 1 << 2,          /* DEAC bit in Write Zeores supported */
+ };
+ struct nvme_ns {
+-- 
+2.43.0
+
diff --git a/queue-6.9/nvmet-always-initialize-cqe.result.patch b/queue-6.9/nvmet-always-initialize-cqe.result.patch
new file mode 100644 (file)
index 0000000..fbee60e
--- /dev/null
@@ -0,0 +1,87 @@
+From a75c57daad27818b3ec42a87075031ce0dd457ef Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 12 Jun 2024 16:11:59 +0200
+Subject: nvmet: always initialize cqe.result
+
+From: Daniel Wagner <dwagner@suse.de>
+
+[ Upstream commit cd0c1b8e045a8d2785342b385cb2684d9b48e426 ]
+
+The spec doesn't mandate that the first two double words (aka results)
+for the command queue entry need to be set to 0 when they are not
+used (not specified). Though, the target implemention returns 0 for TCP
+and FC but not for RDMA.
+
+Let's make RDMA behave the same and thus explicitly initializing the
+result field. This prevents leaking any data from the stack.
+
+Signed-off-by: Daniel Wagner <dwagner@suse.de>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Keith Busch <kbusch@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/nvme/target/core.c             | 1 +
+ drivers/nvme/target/fabrics-cmd-auth.c | 3 ---
+ drivers/nvme/target/fabrics-cmd.c      | 6 ------
+ 3 files changed, 1 insertion(+), 9 deletions(-)
+
+diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
+index 06f0c587f3437..4ff460ba28263 100644
+--- a/drivers/nvme/target/core.c
++++ b/drivers/nvme/target/core.c
+@@ -957,6 +957,7 @@ bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq,
+       req->metadata_sg_cnt = 0;
+       req->transfer_len = 0;
+       req->metadata_len = 0;
++      req->cqe->result.u64 = 0;
+       req->cqe->status = 0;
+       req->cqe->sq_head = 0;
+       req->ns = NULL;
+diff --git a/drivers/nvme/target/fabrics-cmd-auth.c b/drivers/nvme/target/fabrics-cmd-auth.c
+index eb7785be0ca77..ee76491e8b12c 100644
+--- a/drivers/nvme/target/fabrics-cmd-auth.c
++++ b/drivers/nvme/target/fabrics-cmd-auth.c
+@@ -332,7 +332,6 @@ void nvmet_execute_auth_send(struct nvmet_req *req)
+               pr_debug("%s: ctrl %d qid %d nvme status %x error loc %d\n",
+                        __func__, ctrl->cntlid, req->sq->qid,
+                        status, req->error_loc);
+-      req->cqe->result.u64 = 0;
+       if (req->sq->dhchap_step != NVME_AUTH_DHCHAP_MESSAGE_SUCCESS2 &&
+           req->sq->dhchap_step != NVME_AUTH_DHCHAP_MESSAGE_FAILURE2) {
+               unsigned long auth_expire_secs = ctrl->kato ? ctrl->kato : 120;
+@@ -515,8 +514,6 @@ void nvmet_execute_auth_receive(struct nvmet_req *req)
+       status = nvmet_copy_to_sgl(req, 0, d, al);
+       kfree(d);
+ done:
+-      req->cqe->result.u64 = 0;
+-
+       if (req->sq->dhchap_step == NVME_AUTH_DHCHAP_MESSAGE_SUCCESS2)
+               nvmet_auth_sq_free(req->sq);
+       else if (req->sq->dhchap_step == NVME_AUTH_DHCHAP_MESSAGE_FAILURE1) {
+diff --git a/drivers/nvme/target/fabrics-cmd.c b/drivers/nvme/target/fabrics-cmd.c
+index b23f4cf840bd5..f6714453b8bb3 100644
+--- a/drivers/nvme/target/fabrics-cmd.c
++++ b/drivers/nvme/target/fabrics-cmd.c
+@@ -226,9 +226,6 @@ static void nvmet_execute_admin_connect(struct nvmet_req *req)
+       if (status)
+               goto out;
+-      /* zero out initial completion result, assign values as needed */
+-      req->cqe->result.u32 = 0;
+-
+       if (c->recfmt != 0) {
+               pr_warn("invalid connect version (%d).\n",
+                       le16_to_cpu(c->recfmt));
+@@ -304,9 +301,6 @@ static void nvmet_execute_io_connect(struct nvmet_req *req)
+       if (status)
+               goto out;
+-      /* zero out initial completion result, assign values as needed */
+-      req->cqe->result.u32 = 0;
+-
+       if (c->recfmt != 0) {
+               pr_warn("invalid connect version (%d).\n",
+                       le16_to_cpu(c->recfmt));
+-- 
+2.43.0
+
diff --git a/queue-6.9/octeontx2-pf-fix-coverity-and-klockwork-issues-in-oc.patch b/queue-6.9/octeontx2-pf-fix-coverity-and-klockwork-issues-in-oc.patch
new file mode 100644 (file)
index 0000000..647a1e9
--- /dev/null
@@ -0,0 +1,170 @@
+From 0fd481e2516db0c0fa1dc79e1321f7e8ea1fffcf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 22 Jun 2024 12:14:37 +0530
+Subject: octeontx2-pf: Fix coverity and klockwork issues in octeon PF driver
+
+From: Ratheesh Kannoth <rkannoth@marvell.com>
+
+[ Upstream commit 02ea312055da84e08e3e5bce2539c1ff11c8b5f2 ]
+
+Fix unintended sign extension and klockwork issues. These are not real
+issue but for sanity checks.
+
+Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
+Signed-off-by: Suman Ghosh <sumang@marvell.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../marvell/octeontx2/nic/otx2_common.c       | 10 ++--
+ .../ethernet/marvell/octeontx2/nic/otx2_reg.h | 55 ++++++++++---------
+ .../marvell/octeontx2/nic/otx2_txrx.c         |  2 +-
+ .../net/ethernet/marvell/octeontx2/nic/qos.c  |  3 +-
+ 4 files changed, 35 insertions(+), 35 deletions(-)
+
+diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
+index a85ac039d779b..87d5776e3b88e 100644
+--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
++++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.c
+@@ -648,14 +648,14 @@ int otx2_txschq_config(struct otx2_nic *pfvf, int lvl, int prio, bool txschq_for
+       } else if (lvl == NIX_TXSCH_LVL_TL4) {
+               parent = schq_list[NIX_TXSCH_LVL_TL3][prio];
+               req->reg[0] = NIX_AF_TL4X_PARENT(schq);
+-              req->regval[0] = parent << 16;
++              req->regval[0] = (u64)parent << 16;
+               req->num_regs++;
+               req->reg[1] = NIX_AF_TL4X_SCHEDULE(schq);
+               req->regval[1] = dwrr_val;
+       } else if (lvl == NIX_TXSCH_LVL_TL3) {
+               parent = schq_list[NIX_TXSCH_LVL_TL2][prio];
+               req->reg[0] = NIX_AF_TL3X_PARENT(schq);
+-              req->regval[0] = parent << 16;
++              req->regval[0] = (u64)parent << 16;
+               req->num_regs++;
+               req->reg[1] = NIX_AF_TL3X_SCHEDULE(schq);
+               req->regval[1] = dwrr_val;
+@@ -670,11 +670,11 @@ int otx2_txschq_config(struct otx2_nic *pfvf, int lvl, int prio, bool txschq_for
+       } else if (lvl == NIX_TXSCH_LVL_TL2) {
+               parent = schq_list[NIX_TXSCH_LVL_TL1][prio];
+               req->reg[0] = NIX_AF_TL2X_PARENT(schq);
+-              req->regval[0] = parent << 16;
++              req->regval[0] = (u64)parent << 16;
+               req->num_regs++;
+               req->reg[1] = NIX_AF_TL2X_SCHEDULE(schq);
+-              req->regval[1] = TXSCH_TL1_DFLT_RR_PRIO << 24 | dwrr_val;
++              req->regval[1] = (u64)hw->txschq_aggr_lvl_rr_prio << 24 | dwrr_val;
+               if (lvl == hw->txschq_link_cfg_lvl) {
+                       req->num_regs++;
+@@ -698,7 +698,7 @@ int otx2_txschq_config(struct otx2_nic *pfvf, int lvl, int prio, bool txschq_for
+               req->num_regs++;
+               req->reg[1] = NIX_AF_TL1X_TOPOLOGY(schq);
+-              req->regval[1] = (TXSCH_TL1_DFLT_RR_PRIO << 1);
++              req->regval[1] = hw->txschq_aggr_lvl_rr_prio << 1;
+               req->num_regs++;
+               req->reg[2] = NIX_AF_TL1X_CIR(schq);
+diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_reg.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_reg.h
+index 45a32e4b49d1c..e3aee6e362151 100644
+--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_reg.h
++++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_reg.h
+@@ -139,33 +139,34 @@
+ #define       NIX_LF_CINTX_ENA_W1C(a)         (NIX_LFBASE | 0xD50 | (a) << 12)
+ /* NIX AF transmit scheduler registers */
+-#define NIX_AF_SMQX_CFG(a)            (0x700 | (a) << 16)
+-#define NIX_AF_TL1X_SCHEDULE(a)               (0xC00 | (a) << 16)
+-#define NIX_AF_TL1X_CIR(a)            (0xC20 | (a) << 16)
+-#define NIX_AF_TL1X_TOPOLOGY(a)               (0xC80 | (a) << 16)
+-#define NIX_AF_TL2X_PARENT(a)         (0xE88 | (a) << 16)
+-#define NIX_AF_TL2X_SCHEDULE(a)               (0xE00 | (a) << 16)
+-#define NIX_AF_TL2X_TOPOLOGY(a)               (0xE80 | (a) << 16)
+-#define NIX_AF_TL2X_CIR(a)              (0xE20 | (a) << 16)
+-#define NIX_AF_TL2X_PIR(a)              (0xE30 | (a) << 16)
+-#define NIX_AF_TL3X_PARENT(a)         (0x1088 | (a) << 16)
+-#define NIX_AF_TL3X_SCHEDULE(a)               (0x1000 | (a) << 16)
+-#define NIX_AF_TL3X_SHAPE(a)          (0x1010 | (a) << 16)
+-#define NIX_AF_TL3X_CIR(a)            (0x1020 | (a) << 16)
+-#define NIX_AF_TL3X_PIR(a)            (0x1030 | (a) << 16)
+-#define NIX_AF_TL3X_TOPOLOGY(a)               (0x1080 | (a) << 16)
+-#define NIX_AF_TL4X_PARENT(a)         (0x1288 | (a) << 16)
+-#define NIX_AF_TL4X_SCHEDULE(a)               (0x1200 | (a) << 16)
+-#define NIX_AF_TL4X_SHAPE(a)          (0x1210 | (a) << 16)
+-#define NIX_AF_TL4X_CIR(a)            (0x1220 | (a) << 16)
+-#define NIX_AF_TL4X_PIR(a)            (0x1230 | (a) << 16)
+-#define NIX_AF_TL4X_TOPOLOGY(a)               (0x1280 | (a) << 16)
+-#define NIX_AF_MDQX_SCHEDULE(a)               (0x1400 | (a) << 16)
+-#define NIX_AF_MDQX_SHAPE(a)          (0x1410 | (a) << 16)
+-#define NIX_AF_MDQX_CIR(a)            (0x1420 | (a) << 16)
+-#define NIX_AF_MDQX_PIR(a)            (0x1430 | (a) << 16)
+-#define NIX_AF_MDQX_PARENT(a)         (0x1480 | (a) << 16)
+-#define NIX_AF_TL3_TL2X_LINKX_CFG(a, b)       (0x1700 | (a) << 16 | (b) << 3)
++#define NIX_AF_SMQX_CFG(a)            (0x700 | (u64)(a) << 16)
++#define NIX_AF_TL4X_SDP_LINK_CFG(a)   (0xB10 | (u64)(a) << 16)
++#define NIX_AF_TL1X_SCHEDULE(a)               (0xC00 | (u64)(a) << 16)
++#define NIX_AF_TL1X_CIR(a)            (0xC20 | (u64)(a) << 16)
++#define NIX_AF_TL1X_TOPOLOGY(a)               (0xC80 | (u64)(a) << 16)
++#define NIX_AF_TL2X_PARENT(a)         (0xE88 | (u64)(a) << 16)
++#define NIX_AF_TL2X_SCHEDULE(a)               (0xE00 | (u64)(a) << 16)
++#define NIX_AF_TL2X_TOPOLOGY(a)               (0xE80 | (u64)(a) << 16)
++#define NIX_AF_TL2X_CIR(a)            (0xE20 | (u64)(a) << 16)
++#define NIX_AF_TL2X_PIR(a)            (0xE30 | (u64)(a) << 16)
++#define NIX_AF_TL3X_PARENT(a)         (0x1088 | (u64)(a) << 16)
++#define NIX_AF_TL3X_SCHEDULE(a)               (0x1000 | (u64)(a) << 16)
++#define NIX_AF_TL3X_SHAPE(a)          (0x1010 | (u64)(a) << 16)
++#define NIX_AF_TL3X_CIR(a)            (0x1020 | (u64)(a) << 16)
++#define NIX_AF_TL3X_PIR(a)            (0x1030 | (u64)(a) << 16)
++#define NIX_AF_TL3X_TOPOLOGY(a)               (0x1080 | (u64)(a) << 16)
++#define NIX_AF_TL4X_PARENT(a)         (0x1288 | (u64)(a) << 16)
++#define NIX_AF_TL4X_SCHEDULE(a)               (0x1200 | (u64)(a) << 16)
++#define NIX_AF_TL4X_SHAPE(a)          (0x1210 | (u64)(a) << 16)
++#define NIX_AF_TL4X_CIR(a)            (0x1220 | (u64)(a) << 16)
++#define NIX_AF_TL4X_PIR(a)            (0x1230 | (u64)(a) << 16)
++#define NIX_AF_TL4X_TOPOLOGY(a)               (0x1280 | (u64)(a) << 16)
++#define NIX_AF_MDQX_SCHEDULE(a)               (0x1400 | (u64)(a) << 16)
++#define NIX_AF_MDQX_SHAPE(a)          (0x1410 | (u64)(a) << 16)
++#define NIX_AF_MDQX_CIR(a)            (0x1420 | (u64)(a) << 16)
++#define NIX_AF_MDQX_PIR(a)            (0x1430 | (u64)(a) << 16)
++#define NIX_AF_MDQX_PARENT(a)         (0x1480 | (u64)(a) << 16)
++#define NIX_AF_TL3_TL2X_LINKX_CFG(a, b)       (0x1700 | (u64)(a) << 16 | (b) << 3)
+ /* LMT LF registers */
+ #define LMT_LFBASE                    BIT_ULL(RVU_FUNC_BLKADDR_SHIFT)
+diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
+index 04a49b9b545f3..0ca9f2ffd932d 100644
+--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
++++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c
+@@ -510,7 +510,7 @@ static int otx2_tx_napi_handler(struct otx2_nic *pfvf,
+ static void otx2_adjust_adaptive_coalese(struct otx2_nic *pfvf, struct otx2_cq_poll *cq_poll)
+ {
+-      struct dim_sample dim_sample;
++      struct dim_sample dim_sample = { 0 };
+       u64 rx_frames, rx_bytes;
+       u64 tx_frames, tx_bytes;
+diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/qos.c b/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
+index 6cddb4da85b71..4995a2d54d7d0 100644
+--- a/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
++++ b/drivers/net/ethernet/marvell/octeontx2/nic/qos.c
+@@ -153,7 +153,6 @@ static void __otx2_qos_txschq_cfg(struct otx2_nic *pfvf,
+               num_regs++;
+               otx2_config_sched_shaping(pfvf, node, cfg, &num_regs);
+-
+       } else if (level == NIX_TXSCH_LVL_TL4) {
+               otx2_config_sched_shaping(pfvf, node, cfg, &num_regs);
+       } else if (level == NIX_TXSCH_LVL_TL3) {
+@@ -176,7 +175,7 @@ static void __otx2_qos_txschq_cfg(struct otx2_nic *pfvf,
+               /* check if node is root */
+               if (node->qid == OTX2_QOS_QID_INNER && !node->parent) {
+                       cfg->reg[num_regs] = NIX_AF_TL2X_SCHEDULE(node->schq);
+-                      cfg->regval[num_regs] =  TXSCH_TL1_DFLT_RR_PRIO << 24 |
++                      cfg->regval[num_regs] =  (u64)hw->txschq_aggr_lvl_rr_prio << 24 |
+                                                mtu_to_dwrr_weight(pfvf,
+                                                                   pfvf->tx_max_pktlen);
+                       num_regs++;
+-- 
+2.43.0
+
diff --git a/queue-6.9/of-irq-factor-out-parsing-of-interrupt-map-parent-ph.patch b/queue-6.9/of-irq-factor-out-parsing-of-interrupt-map-parent-ph.patch
new file mode 100644 (file)
index 0000000..1d7caa6
--- /dev/null
@@ -0,0 +1,241 @@
+From 8515c56fb0a80fbba3610f6781c77859c9c3dd79 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 29 May 2024 14:59:20 -0500
+Subject: of/irq: Factor out parsing of interrupt-map parent phandle+args from
+ of_irq_parse_raw()
+
+From: Rob Herring (Arm) <robh@kernel.org>
+
+[ Upstream commit 935df1bd40d43c4ee91838c42a20e9af751885cc ]
+
+Factor out the parsing of interrupt-map interrupt parent phandle and its
+arg cells to a separate function, of_irq_parse_imap_parent(), so that it
+can be used in other parsing scenarios (e.g. fw_devlink).
+
+There was a refcount leak on non-matching entries when iterating thru
+"interrupt-map" which is fixed.
+
+Tested-by: Marc Zyngier <maz@kernel.org>
+Tested-by: Anup Patel <apatel@ventanamicro.com>
+Link: https://lore.kernel.org/r/20240529-dt-interrupt-map-fix-v2-1-ef86dc5bcd2a@kernel.org
+Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/of/irq.c        | 125 ++++++++++++++++++++++++----------------
+ drivers/of/of_private.h |   3 +
+ 2 files changed, 77 insertions(+), 51 deletions(-)
+
+diff --git a/drivers/of/irq.c b/drivers/of/irq.c
+index 174900072c18c..462375b293e47 100644
+--- a/drivers/of/irq.c
++++ b/drivers/of/irq.c
+@@ -25,6 +25,8 @@
+ #include <linux/string.h>
+ #include <linux/slab.h>
++#include "of_private.h"
++
+ /**
+  * irq_of_parse_and_map - Parse and map an interrupt into linux virq space
+  * @dev: Device node of the device whose interrupt is to be mapped
+@@ -96,6 +98,57 @@ static const char * const of_irq_imap_abusers[] = {
+       NULL,
+ };
++const __be32 *of_irq_parse_imap_parent(const __be32 *imap, int len, struct of_phandle_args *out_irq)
++{
++      u32 intsize, addrsize;
++      struct device_node *np;
++
++      /* Get the interrupt parent */
++      if (of_irq_workarounds & OF_IMAP_NO_PHANDLE)
++              np = of_node_get(of_irq_dflt_pic);
++      else
++              np = of_find_node_by_phandle(be32_to_cpup(imap));
++      imap++;
++
++      /* Check if not found */
++      if (!np) {
++              pr_debug(" -> imap parent not found !\n");
++              return NULL;
++      }
++
++      /* Get #interrupt-cells and #address-cells of new parent */
++      if (of_property_read_u32(np, "#interrupt-cells",
++                                      &intsize)) {
++              pr_debug(" -> parent lacks #interrupt-cells!\n");
++              of_node_put(np);
++              return NULL;
++      }
++      if (of_property_read_u32(np, "#address-cells",
++                                      &addrsize))
++              addrsize = 0;
++
++      pr_debug(" -> intsize=%d, addrsize=%d\n",
++              intsize, addrsize);
++
++      /* Check for malformed properties */
++      if (WARN_ON(addrsize + intsize > MAX_PHANDLE_ARGS)
++              || (len < (addrsize + intsize))) {
++              of_node_put(np);
++              return NULL;
++      }
++
++      pr_debug(" -> imaplen=%d\n", len);
++
++      imap += addrsize + intsize;
++
++      out_irq->np = np;
++      for (int i = 0; i < intsize; i++)
++              out_irq->args[i] = be32_to_cpup(imap - intsize + i);
++      out_irq->args_count = intsize;
++
++      return imap;
++}
++
+ /**
+  * of_irq_parse_raw - Low level interrupt tree parsing
+  * @addr:     address specifier (start of "reg" property of the device) in be32 format
+@@ -112,12 +165,12 @@ static const char * const of_irq_imap_abusers[] = {
+  */
+ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
+ {
+-      struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
++      struct device_node *ipar, *tnode, *old = NULL;
+       __be32 initial_match_array[MAX_PHANDLE_ARGS];
+       const __be32 *match_array = initial_match_array;
+-      const __be32 *tmp, *imap, *imask, dummy_imask[] = { [0 ... MAX_PHANDLE_ARGS] = cpu_to_be32(~0) };
+-      u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
+-      int imaplen, match, i, rc = -EINVAL;
++      const __be32 *tmp, dummy_imask[] = { [0 ... MAX_PHANDLE_ARGS] = cpu_to_be32(~0) };
++      u32 intsize = 1, addrsize;
++      int i, rc = -EINVAL;
+ #ifdef DEBUG
+       of_print_phandle_args("of_irq_parse_raw: ", out_irq);
+@@ -176,6 +229,9 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
+       /* Now start the actual "proper" walk of the interrupt tree */
+       while (ipar != NULL) {
++              int imaplen, match;
++              const __be32 *imap, *oldimap, *imask;
++              struct device_node *newpar;
+               /*
+                * Now check if cursor is an interrupt-controller and
+                * if it is then we are done, unless there is an
+@@ -216,7 +272,7 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
+               /* Parse interrupt-map */
+               match = 0;
+-              while (imaplen > (addrsize + intsize + 1) && !match) {
++              while (imaplen > (addrsize + intsize + 1)) {
+                       /* Compare specifiers */
+                       match = 1;
+                       for (i = 0; i < (addrsize + intsize); i++, imaplen--)
+@@ -224,48 +280,17 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
+                       pr_debug(" -> match=%d (imaplen=%d)\n", match, imaplen);
+-                      /* Get the interrupt parent */
+-                      if (of_irq_workarounds & OF_IMAP_NO_PHANDLE)
+-                              newpar = of_node_get(of_irq_dflt_pic);
+-                      else
+-                              newpar = of_find_node_by_phandle(be32_to_cpup(imap));
+-                      imap++;
+-                      --imaplen;
+-
+-                      /* Check if not found */
+-                      if (newpar == NULL) {
+-                              pr_debug(" -> imap parent not found !\n");
+-                              goto fail;
+-                      }
+-
+-                      if (!of_device_is_available(newpar))
+-                              match = 0;
+-
+-                      /* Get #interrupt-cells and #address-cells of new
+-                       * parent
+-                       */
+-                      if (of_property_read_u32(newpar, "#interrupt-cells",
+-                                               &newintsize)) {
+-                              pr_debug(" -> parent lacks #interrupt-cells!\n");
+-                              goto fail;
+-                      }
+-                      if (of_property_read_u32(newpar, "#address-cells",
+-                                               &newaddrsize))
+-                              newaddrsize = 0;
+-
+-                      pr_debug(" -> newintsize=%d, newaddrsize=%d\n",
+-                          newintsize, newaddrsize);
+-
+-                      /* Check for malformed properties */
+-                      if (WARN_ON(newaddrsize + newintsize > MAX_PHANDLE_ARGS)
+-                          || (imaplen < (newaddrsize + newintsize))) {
+-                              rc = -EFAULT;
++                      oldimap = imap;
++                      imap = of_irq_parse_imap_parent(oldimap, imaplen, out_irq);
++                      if (!imap)
+                               goto fail;
+-                      }
+-                      imap += newaddrsize + newintsize;
+-                      imaplen -= newaddrsize + newintsize;
++                      match &= of_device_is_available(out_irq->np);
++                      if (match)
++                              break;
++                      of_node_put(out_irq->np);
++                      imaplen -= imap - oldimap;
+                       pr_debug(" -> imaplen=%d\n", imaplen);
+               }
+               if (!match) {
+@@ -287,11 +312,11 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
+                * Successfully parsed an interrupt-map translation; copy new
+                * interrupt specifier into the out_irq structure
+                */
+-              match_array = imap - newaddrsize - newintsize;
+-              for (i = 0; i < newintsize; i++)
+-                      out_irq->args[i] = be32_to_cpup(imap - newintsize + i);
+-              out_irq->args_count = intsize = newintsize;
+-              addrsize = newaddrsize;
++              match_array = oldimap + 1;
++
++              newpar = out_irq->np;
++              intsize = out_irq->args_count;
++              addrsize = (imap - match_array) - intsize;
+               if (ipar == newpar) {
+                       pr_debug("%pOF interrupt-map entry to self\n", ipar);
+@@ -300,7 +325,6 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
+       skiplevel:
+               /* Iterate again with new parent */
+-              out_irq->np = newpar;
+               pr_debug(" -> new parent: %pOF\n", newpar);
+               of_node_put(ipar);
+               ipar = newpar;
+@@ -310,7 +334,6 @@ int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq)
+  fail:
+       of_node_put(ipar);
+-      of_node_put(newpar);
+       return rc;
+ }
+diff --git a/drivers/of/of_private.h b/drivers/of/of_private.h
+index 485483524b7f1..b0609de49c7c4 100644
+--- a/drivers/of/of_private.h
++++ b/drivers/of/of_private.h
+@@ -158,6 +158,9 @@ extern void __of_sysfs_remove_bin_file(struct device_node *np,
+ extern int of_bus_n_addr_cells(struct device_node *np);
+ extern int of_bus_n_size_cells(struct device_node *np);
++const __be32 *of_irq_parse_imap_parent(const __be32 *imap, int len,
++                                     struct of_phandle_args *out_irq);
++
+ struct bus_dma_region;
+ #if defined(CONFIG_OF_ADDRESS) && defined(CONFIG_HAS_DMA)
+ int of_dma_get_range(struct device_node *np,
+-- 
+2.43.0
+
diff --git a/queue-6.9/parport-amiga-mark-driver-struct-with-__refdata-to-p.patch b/queue-6.9/parport-amiga-mark-driver-struct-with-__refdata-to-p.patch
new file mode 100644 (file)
index 0000000..28315b1
--- /dev/null
@@ -0,0 +1,51 @@
+From 3c07d3665e2749032705fcea3cafdce3cea395b6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 13 May 2024 09:52:06 +0200
+Subject: parport: amiga: Mark driver struct with __refdata to prevent section
+ mismatch
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+
+[ Upstream commit 73fedc31fed38cb6039fd8a7efea1774143b68b0 ]
+
+As described in the added code comment, a reference to .exit.text is ok
+for drivers registered via module_platform_driver_probe(). Make this
+explicit to prevent the following section mismatch warning
+
+       WARNING: modpost: drivers/parport/parport_amiga: section mismatch in reference: amiga_parallel_driver+0x8 (section: .data) -> amiga_parallel_remove (section: .exit.text)
+
+that triggers on an allmodconfig W=1 build.
+
+Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Link: https://lore.kernel.org/r/20240513075206.2337310-2-u.kleine-koenig@pengutronix.de
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/parport/parport_amiga.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/parport/parport_amiga.c b/drivers/parport/parport_amiga.c
+index e6dc857aac3fe..e06c7b2aac5c4 100644
+--- a/drivers/parport/parport_amiga.c
++++ b/drivers/parport/parport_amiga.c
+@@ -229,7 +229,13 @@ static void __exit amiga_parallel_remove(struct platform_device *pdev)
+       parport_put_port(port);
+ }
+-static struct platform_driver amiga_parallel_driver = {
++/*
++ * amiga_parallel_remove() lives in .exit.text. For drivers registered via
++ * module_platform_driver_probe() this is ok because they cannot get unbound at
++ * runtime. So mark the driver struct with __refdata to prevent modpost
++ * triggering a section mismatch warning.
++ */
++static struct platform_driver amiga_parallel_driver __refdata = {
+       .remove_new = __exit_p(amiga_parallel_remove),
+       .driver   = {
+               .name   = "amiga-parallel",
+-- 
+2.43.0
+
diff --git a/queue-6.9/platform-mellanox-nvsw-sn2201-add-check-for-platform.patch b/queue-6.9/platform-mellanox-nvsw-sn2201-add-check-for-platform.patch
new file mode 100644 (file)
index 0000000..d0758cc
--- /dev/null
@@ -0,0 +1,49 @@
+From 6856b74c2815665125a66b2b3df1b4a22128a255 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 5 Jun 2024 11:27:45 +0800
+Subject: platform/mellanox: nvsw-sn2201: Add check for
+ platform_device_add_resources
+
+From: Chen Ni <nichen@iscas.ac.cn>
+
+[ Upstream commit d56fbfbaf592a115b2e11c1044829afba34069d2 ]
+
+Add check for the return value of platform_device_add_resources() and
+return the error if it fails in order to catch the error.
+
+Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
+Link: https://lore.kernel.org/r/20240605032745.2916183-1-nichen@iscas.ac.cn
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/platform/mellanox/nvsw-sn2201.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/platform/mellanox/nvsw-sn2201.c b/drivers/platform/mellanox/nvsw-sn2201.c
+index 3ef655591424c..abe7be602f846 100644
+--- a/drivers/platform/mellanox/nvsw-sn2201.c
++++ b/drivers/platform/mellanox/nvsw-sn2201.c
+@@ -1198,6 +1198,7 @@ static int nvsw_sn2201_config_pre_init(struct nvsw_sn2201 *nvsw_sn2201)
+ static int nvsw_sn2201_probe(struct platform_device *pdev)
+ {
+       struct nvsw_sn2201 *nvsw_sn2201;
++      int ret;
+       nvsw_sn2201 = devm_kzalloc(&pdev->dev, sizeof(*nvsw_sn2201), GFP_KERNEL);
+       if (!nvsw_sn2201)
+@@ -1205,8 +1206,10 @@ static int nvsw_sn2201_probe(struct platform_device *pdev)
+       nvsw_sn2201->dev = &pdev->dev;
+       platform_set_drvdata(pdev, nvsw_sn2201);
+-      platform_device_add_resources(pdev, nvsw_sn2201_lpc_io_resources,
++      ret = platform_device_add_resources(pdev, nvsw_sn2201_lpc_io_resources,
+                                     ARRAY_SIZE(nvsw_sn2201_lpc_io_resources));
++      if (ret)
++              return ret;
+       nvsw_sn2201->main_mux_deferred_nr = NVSW_SN2201_MAIN_MUX_DEFER_NR;
+       nvsw_sn2201->main_mux_devs = nvsw_sn2201_main_mux_brdinfo;
+-- 
+2.43.0
+
diff --git a/queue-6.9/platform-x86-amd-hsmp-check-hsmp-support-on-amd-fami.patch b/queue-6.9/platform-x86-amd-hsmp-check-hsmp-support-on-amd-fami.patch
new file mode 100644 (file)
index 0000000..0cedf14
--- /dev/null
@@ -0,0 +1,102 @@
+From 137d99d8a96545b99cab2bfe589813f0df91a35f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 3 Jun 2024 08:15:12 +0000
+Subject: platform/x86/amd/hsmp: Check HSMP support on AMD family of processors
+
+From: Suma Hegde <suma.hegde@amd.com>
+
+[ Upstream commit 77f1972bdcf7513293e8bbe376b9fe837310ee9c ]
+
+HSMP interface is supported only on few x86 processors from AMD.
+Accessing HSMP registers on rest of the platforms might cause
+unexpected behaviour. So add a check.
+
+Also unavailability of this interface on rest of the processors
+is not an error. Hence, use pr_info() instead of the pr_err() to
+log the message.
+
+Signed-off-by: Suma Hegde <suma.hegde@amd.com>
+Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
+Link: https://lore.kernel.org/r/20240603081512.142909-1-suma.hegde@amd.com
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/platform/x86/amd/hsmp.c | 50 ++++++++++++++++++++++++++++-----
+ 1 file changed, 43 insertions(+), 7 deletions(-)
+
+diff --git a/drivers/platform/x86/amd/hsmp.c b/drivers/platform/x86/amd/hsmp.c
+index 1927be901108e..272d32a95e216 100644
+--- a/drivers/platform/x86/amd/hsmp.c
++++ b/drivers/platform/x86/amd/hsmp.c
+@@ -907,16 +907,44 @@ static int hsmp_plat_dev_register(void)
+       return ret;
+ }
++/*
++ * This check is only needed for backward compatibility of previous platforms.
++ * All new platforms are expected to support ACPI based probing.
++ */
++static bool legacy_hsmp_support(void)
++{
++      if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD)
++              return false;
++
++      switch (boot_cpu_data.x86) {
++      case 0x19:
++              switch (boot_cpu_data.x86_model) {
++              case 0x00 ... 0x1F:
++              case 0x30 ... 0x3F:
++              case 0x90 ... 0x9F:
++              case 0xA0 ... 0xAF:
++                      return true;
++              default:
++                      return false;
++              }
++      case 0x1A:
++              switch (boot_cpu_data.x86_model) {
++              case 0x00 ... 0x1F:
++                      return true;
++              default:
++                      return false;
++              }
++      default:
++              return false;
++      }
++
++      return false;
++}
++
+ static int __init hsmp_plt_init(void)
+ {
+       int ret = -ENODEV;
+-      if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD || boot_cpu_data.x86 < 0x19) {
+-              pr_err("HSMP is not supported on Family:%x model:%x\n",
+-                     boot_cpu_data.x86, boot_cpu_data.x86_model);
+-              return ret;
+-      }
+-
+       /*
+        * amd_nb_num() returns number of SMN/DF interfaces present in the system
+        * if we have N SMN/DF interfaces that ideally means N sockets
+@@ -930,7 +958,15 @@ static int __init hsmp_plt_init(void)
+               return ret;
+       if (!plat_dev.is_acpi_device) {
+-              ret = hsmp_plat_dev_register();
++              if (legacy_hsmp_support()) {
++                      /* Not ACPI device, but supports HSMP, register a plat_dev */
++                      ret = hsmp_plat_dev_register();
++              } else {
++                      /* Not ACPI, Does not support HSMP */
++                      pr_info("HSMP is not supported on Family:%x model:%x\n",
++                              boot_cpu_data.x86, boot_cpu_data.x86_model);
++                      ret = -ENODEV;
++              }
+               if (ret)
+                       platform_driver_unregister(&amd_hsmp_driver);
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.9/platform-x86-lg-laptop-change-acpi-device-id.patch b/queue-6.9/platform-x86-lg-laptop-change-acpi-device-id.patch
new file mode 100644 (file)
index 0000000..fcc6f93
--- /dev/null
@@ -0,0 +1,46 @@
+From d7917a858129145f694b6831d4f7e1f2f8a09c2a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 7 Jun 2024 01:35:39 +0200
+Subject: platform/x86: lg-laptop: Change ACPI device id
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Armin Wolf <W_Armin@gmx.de>
+
+[ Upstream commit 58a54f27a0dac81f7fd3514be01012635219a53c ]
+
+The LGEX0815 ACPI device id is used for handling hotkey events, but
+this functionality is already handled by the wireless-hotkey driver.
+
+The LGEX0820 ACPI device id however is used to manage various
+platform features using the WMAB/WMBB ACPI methods. Use this ACPI
+device id to avoid blocking the wireless-hotkey driver from probing.
+
+Tested-by: Agathe Boutmy <agathe@boutmy.com>
+Signed-off-by: Armin Wolf <W_Armin@gmx.de>
+Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Link: https://lore.kernel.org/r/20240606233540.9774-4-W_Armin@gmx.de
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/platform/x86/lg-laptop.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/platform/x86/lg-laptop.c b/drivers/platform/x86/lg-laptop.c
+index 5d4df782ce8e1..c19c866361beb 100644
+--- a/drivers/platform/x86/lg-laptop.c
++++ b/drivers/platform/x86/lg-laptop.c
+@@ -768,7 +768,7 @@ static void acpi_remove(struct acpi_device *device)
+ }
+ static const struct acpi_device_id device_ids[] = {
+-      {"LGEX0815", 0},
++      {"LGEX0820", 0},
+       {"", 0}
+ };
+ MODULE_DEVICE_TABLE(acpi, device_ids);
+-- 
+2.43.0
+
diff --git a/queue-6.9/platform-x86-lg-laptop-remove-lgex0815-hotkey-handli.patch b/queue-6.9/platform-x86-lg-laptop-remove-lgex0815-hotkey-handli.patch
new file mode 100644 (file)
index 0000000..4cc142a
--- /dev/null
@@ -0,0 +1,60 @@
+From 9515535ab93c743a9f9b831dfbb649a1ec7a4862 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 7 Jun 2024 01:35:38 +0200
+Subject: platform/x86: lg-laptop: Remove LGEX0815 hotkey handling
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Armin Wolf <W_Armin@gmx.de>
+
+[ Upstream commit 413c204595ca98a4f33414a948c18d7314087342 ]
+
+The rfkill hotkey handling is already provided by the wireless-hotkey
+driver. Remove the now unnecessary rfkill hotkey handling to avoid
+duplicating functionality.
+
+The ACPI notify handler still prints debugging information when
+receiving ACPI notifications to aid in reverse-engineering.
+
+Tested-by: Agathe Boutmy <agathe@boutmy.com>
+Signed-off-by: Armin Wolf <W_Armin@gmx.de>
+Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Link: https://lore.kernel.org/r/20240606233540.9774-3-W_Armin@gmx.de
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/platform/x86/lg-laptop.c | 8 --------
+ 1 file changed, 8 deletions(-)
+
+diff --git a/drivers/platform/x86/lg-laptop.c b/drivers/platform/x86/lg-laptop.c
+index e714ee6298dda..5d4df782ce8e1 100644
+--- a/drivers/platform/x86/lg-laptop.c
++++ b/drivers/platform/x86/lg-laptop.c
+@@ -84,7 +84,6 @@ static const struct key_entry wmi_keymap[] = {
+                                         * this key both sends an event and
+                                         * changes backlight level.
+                                         */
+-      {KE_KEY, 0x80, {KEY_RFKILL} },
+       {KE_END, 0}
+ };
+@@ -272,14 +271,7 @@ static void wmi_input_setup(void)
+ static void acpi_notify(struct acpi_device *device, u32 event)
+ {
+-      struct key_entry *key;
+-
+       acpi_handle_debug(device->handle, "notify: %d\n", event);
+-      if (inited & INIT_SPARSE_KEYMAP) {
+-              key = sparse_keymap_entry_from_scancode(wmi_input_dev, 0x80);
+-              if (key && key->type == KE_KEY)
+-                      sparse_keymap_report_entry(wmi_input_dev, key, 1, true);
+-      }
+ }
+ static ssize_t fan_mode_store(struct device *dev,
+-- 
+2.43.0
+
diff --git a/queue-6.9/platform-x86-lg-laptop-use-acpi-device-handle-when-e.patch b/queue-6.9/platform-x86-lg-laptop-use-acpi-device-handle-when-e.patch
new file mode 100644 (file)
index 0000000..2e92b30
--- /dev/null
@@ -0,0 +1,311 @@
+From 2fa85eb2067222f6b6cfdf6a702a8761b6b93be1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 7 Jun 2024 01:35:40 +0200
+Subject: platform/x86: lg-laptop: Use ACPI device handle when evaluating
+ WMAB/WMBB
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Armin Wolf <W_Armin@gmx.de>
+
+[ Upstream commit b27ea279556121b54d3f45d0529706cf100cdb3a ]
+
+On the LG Gram 16Z90S, the WMAB and WMBB ACPI methods are not mapped
+under \XINI, but instead are mapped under \_SB.XINI.
+
+The reason for this is that the LGEX0820 ACPI device used by this
+driver is mapped at \_SB.XINI, so the ACPI methods where moved as well
+to appear below the LGEX0820 ACPI device.
+
+Fix this by using the ACPI handle from the ACPI device when evaluating
+both methods.
+
+Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218901
+Tested-by: Agathe Boutmy <agathe@boutmy.com>
+Signed-off-by: Armin Wolf <W_Armin@gmx.de>
+Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Link: https://lore.kernel.org/r/20240606233540.9774-5-W_Armin@gmx.de
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/platform/x86/lg-laptop.c | 79 +++++++++++++-------------------
+ 1 file changed, 33 insertions(+), 46 deletions(-)
+
+diff --git a/drivers/platform/x86/lg-laptop.c b/drivers/platform/x86/lg-laptop.c
+index c19c866361beb..78c48a1f9c68a 100644
+--- a/drivers/platform/x86/lg-laptop.c
++++ b/drivers/platform/x86/lg-laptop.c
+@@ -39,8 +39,6 @@ MODULE_LICENSE("GPL");
+ #define WMI_METHOD_WMBB "2B4F501A-BD3C-4394-8DCF-00A7D2BC8210"
+ #define WMI_EVENT_GUID  WMI_EVENT_GUID0
+-#define WMAB_METHOD     "\\XINI.WMAB"
+-#define WMBB_METHOD     "\\XINI.WMBB"
+ #define SB_GGOV_METHOD  "\\_SB.GGOV"
+ #define GOV_TLED        0x2020008
+ #define WM_GET          1
+@@ -74,7 +72,7 @@ static u32 inited;
+ static int battery_limit_use_wmbb;
+ static struct led_classdev kbd_backlight;
+-static enum led_brightness get_kbd_backlight_level(void);
++static enum led_brightness get_kbd_backlight_level(struct device *dev);
+ static const struct key_entry wmi_keymap[] = {
+       {KE_KEY, 0x70, {KEY_F15} },      /* LG control panel (F1) */
+@@ -127,11 +125,10 @@ static int ggov(u32 arg0)
+       return res;
+ }
+-static union acpi_object *lg_wmab(u32 method, u32 arg1, u32 arg2)
++static union acpi_object *lg_wmab(struct device *dev, u32 method, u32 arg1, u32 arg2)
+ {
+       union acpi_object args[3];
+       acpi_status status;
+-      acpi_handle handle;
+       struct acpi_object_list arg;
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+@@ -142,29 +139,22 @@ static union acpi_object *lg_wmab(u32 method, u32 arg1, u32 arg2)
+       args[2].type = ACPI_TYPE_INTEGER;
+       args[2].integer.value = arg2;
+-      status = acpi_get_handle(NULL, (acpi_string) WMAB_METHOD, &handle);
+-      if (ACPI_FAILURE(status)) {
+-              pr_err("Cannot get handle");
+-              return NULL;
+-      }
+-
+       arg.count = 3;
+       arg.pointer = args;
+-      status = acpi_evaluate_object(handle, NULL, &arg, &buffer);
++      status = acpi_evaluate_object(ACPI_HANDLE(dev), "WMAB", &arg, &buffer);
+       if (ACPI_FAILURE(status)) {
+-              acpi_handle_err(handle, "WMAB: call failed.\n");
++              dev_err(dev, "WMAB: call failed.\n");
+               return NULL;
+       }
+       return buffer.pointer;
+ }
+-static union acpi_object *lg_wmbb(u32 method_id, u32 arg1, u32 arg2)
++static union acpi_object *lg_wmbb(struct device *dev, u32 method_id, u32 arg1, u32 arg2)
+ {
+       union acpi_object args[3];
+       acpi_status status;
+-      acpi_handle handle;
+       struct acpi_object_list arg;
+       struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
+       u8 buf[32];
+@@ -180,18 +170,12 @@ static union acpi_object *lg_wmbb(u32 method_id, u32 arg1, u32 arg2)
+       args[2].buffer.length = 32;
+       args[2].buffer.pointer = buf;
+-      status = acpi_get_handle(NULL, (acpi_string)WMBB_METHOD, &handle);
+-      if (ACPI_FAILURE(status)) {
+-              pr_err("Cannot get handle");
+-              return NULL;
+-      }
+-
+       arg.count = 3;
+       arg.pointer = args;
+-      status = acpi_evaluate_object(handle, NULL, &arg, &buffer);
++      status = acpi_evaluate_object(ACPI_HANDLE(dev), "WMBB", &arg, &buffer);
+       if (ACPI_FAILURE(status)) {
+-              acpi_handle_err(handle, "WMAB: call failed.\n");
++              dev_err(dev, "WMBB: call failed.\n");
+               return NULL;
+       }
+@@ -222,7 +206,7 @@ static void wmi_notify(u32 value, void *context)
+               if (eventcode == 0x10000000) {
+                       led_classdev_notify_brightness_hw_changed(
+-                              &kbd_backlight, get_kbd_backlight_level());
++                              &kbd_backlight, get_kbd_backlight_level(kbd_backlight.dev->parent));
+               } else {
+                       key = sparse_keymap_entry_from_scancode(
+                               wmi_input_dev, eventcode);
+@@ -287,7 +271,7 @@ static ssize_t fan_mode_store(struct device *dev,
+       if (ret)
+               return ret;
+-      r = lg_wmab(WM_FAN_MODE, WM_GET, 0);
++      r = lg_wmab(dev, WM_FAN_MODE, WM_GET, 0);
+       if (!r)
+               return -EIO;
+@@ -298,9 +282,9 @@ static ssize_t fan_mode_store(struct device *dev,
+       m = r->integer.value;
+       kfree(r);
+-      r = lg_wmab(WM_FAN_MODE, WM_SET, (m & 0xffffff0f) | (value << 4));
++      r = lg_wmab(dev, WM_FAN_MODE, WM_SET, (m & 0xffffff0f) | (value << 4));
+       kfree(r);
+-      r = lg_wmab(WM_FAN_MODE, WM_SET, (m & 0xfffffff0) | value);
++      r = lg_wmab(dev, WM_FAN_MODE, WM_SET, (m & 0xfffffff0) | value);
+       kfree(r);
+       return count;
+@@ -312,7 +296,7 @@ static ssize_t fan_mode_show(struct device *dev,
+       unsigned int status;
+       union acpi_object *r;
+-      r = lg_wmab(WM_FAN_MODE, WM_GET, 0);
++      r = lg_wmab(dev, WM_FAN_MODE, WM_GET, 0);
+       if (!r)
+               return -EIO;
+@@ -339,7 +323,7 @@ static ssize_t usb_charge_store(struct device *dev,
+       if (ret)
+               return ret;
+-      r = lg_wmbb(WMBB_USB_CHARGE, WM_SET, value);
++      r = lg_wmbb(dev, WMBB_USB_CHARGE, WM_SET, value);
+       if (!r)
+               return -EIO;
+@@ -353,7 +337,7 @@ static ssize_t usb_charge_show(struct device *dev,
+       unsigned int status;
+       union acpi_object *r;
+-      r = lg_wmbb(WMBB_USB_CHARGE, WM_GET, 0);
++      r = lg_wmbb(dev, WMBB_USB_CHARGE, WM_GET, 0);
+       if (!r)
+               return -EIO;
+@@ -381,7 +365,7 @@ static ssize_t reader_mode_store(struct device *dev,
+       if (ret)
+               return ret;
+-      r = lg_wmab(WM_READER_MODE, WM_SET, value);
++      r = lg_wmab(dev, WM_READER_MODE, WM_SET, value);
+       if (!r)
+               return -EIO;
+@@ -395,7 +379,7 @@ static ssize_t reader_mode_show(struct device *dev,
+       unsigned int status;
+       union acpi_object *r;
+-      r = lg_wmab(WM_READER_MODE, WM_GET, 0);
++      r = lg_wmab(dev, WM_READER_MODE, WM_GET, 0);
+       if (!r)
+               return -EIO;
+@@ -423,7 +407,7 @@ static ssize_t fn_lock_store(struct device *dev,
+       if (ret)
+               return ret;
+-      r = lg_wmab(WM_FN_LOCK, WM_SET, value);
++      r = lg_wmab(dev, WM_FN_LOCK, WM_SET, value);
+       if (!r)
+               return -EIO;
+@@ -437,7 +421,7 @@ static ssize_t fn_lock_show(struct device *dev,
+       unsigned int status;
+       union acpi_object *r;
+-      r = lg_wmab(WM_FN_LOCK, WM_GET, 0);
++      r = lg_wmab(dev, WM_FN_LOCK, WM_GET, 0);
+       if (!r)
+               return -EIO;
+@@ -467,9 +451,9 @@ static ssize_t charge_control_end_threshold_store(struct device *dev,
+               union acpi_object *r;
+               if (battery_limit_use_wmbb)
+-                      r = lg_wmbb(WMBB_BATT_LIMIT, WM_SET, value);
++                      r = lg_wmbb(&pf_device->dev, WMBB_BATT_LIMIT, WM_SET, value);
+               else
+-                      r = lg_wmab(WM_BATT_LIMIT, WM_SET, value);
++                      r = lg_wmab(&pf_device->dev, WM_BATT_LIMIT, WM_SET, value);
+               if (!r)
+                       return -EIO;
+@@ -488,7 +472,7 @@ static ssize_t charge_control_end_threshold_show(struct device *device,
+       union acpi_object *r;
+       if (battery_limit_use_wmbb) {
+-              r = lg_wmbb(WMBB_BATT_LIMIT, WM_GET, 0);
++              r = lg_wmbb(&pf_device->dev, WMBB_BATT_LIMIT, WM_GET, 0);
+               if (!r)
+                       return -EIO;
+@@ -499,7 +483,7 @@ static ssize_t charge_control_end_threshold_show(struct device *device,
+               status = r->buffer.pointer[0x10];
+       } else {
+-              r = lg_wmab(WM_BATT_LIMIT, WM_GET, 0);
++              r = lg_wmab(&pf_device->dev, WM_BATT_LIMIT, WM_GET, 0);
+               if (!r)
+                       return -EIO;
+@@ -578,7 +562,7 @@ static void tpad_led_set(struct led_classdev *cdev,
+ {
+       union acpi_object *r;
+-      r = lg_wmab(WM_TLED, WM_SET, brightness > LED_OFF);
++      r = lg_wmab(cdev->dev->parent, WM_TLED, WM_SET, brightness > LED_OFF);
+       kfree(r);
+ }
+@@ -600,16 +584,16 @@ static void kbd_backlight_set(struct led_classdev *cdev,
+               val = 0;
+       if (brightness >= LED_FULL)
+               val = 0x24;
+-      r = lg_wmab(WM_KEY_LIGHT, WM_SET, val);
++      r = lg_wmab(cdev->dev->parent, WM_KEY_LIGHT, WM_SET, val);
+       kfree(r);
+ }
+-static enum led_brightness get_kbd_backlight_level(void)
++static enum led_brightness get_kbd_backlight_level(struct device *dev)
+ {
+       union acpi_object *r;
+       int val;
+-      r = lg_wmab(WM_KEY_LIGHT, WM_GET, 0);
++      r = lg_wmab(dev, WM_KEY_LIGHT, WM_GET, 0);
+       if (!r)
+               return LED_OFF;
+@@ -637,7 +621,7 @@ static enum led_brightness get_kbd_backlight_level(void)
+ static enum led_brightness kbd_backlight_get(struct led_classdev *cdev)
+ {
+-      return get_kbd_backlight_level();
++      return get_kbd_backlight_level(cdev->dev->parent);
+ }
+ static LED_DEVICE(kbd_backlight, 255, LED_BRIGHT_HW_CHANGED);
+@@ -664,6 +648,11 @@ static struct platform_driver pf_driver = {
+ static int acpi_add(struct acpi_device *device)
+ {
++      struct platform_device_info pdev_info = {
++              .fwnode = acpi_fwnode_handle(device),
++              .name = PLATFORM_NAME,
++              .id = PLATFORM_DEVID_NONE,
++      };
+       int ret;
+       const char *product;
+       int year = 2017;
+@@ -675,9 +664,7 @@ static int acpi_add(struct acpi_device *device)
+       if (ret)
+               return ret;
+-      pf_device = platform_device_register_simple(PLATFORM_NAME,
+-                                                  PLATFORM_DEVID_NONE,
+-                                                  NULL, 0);
++      pf_device = platform_device_register_full(&pdev_info);
+       if (IS_ERR(pf_device)) {
+               ret = PTR_ERR(pf_device);
+               pf_device = NULL;
+-- 
+2.43.0
+
diff --git a/queue-6.9/platform-x86-wireless-hotkey-add-support-for-lg-airp.patch b/queue-6.9/platform-x86-wireless-hotkey-add-support-for-lg-airp.patch
new file mode 100644 (file)
index 0000000..31d6cde
--- /dev/null
@@ -0,0 +1,53 @@
+From 7c899743cbf8a8c0d0ee937f7552b209f927e62e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 7 Jun 2024 01:35:37 +0200
+Subject: platform/x86: wireless-hotkey: Add support for LG Airplane Button
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Armin Wolf <W_Armin@gmx.de>
+
+[ Upstream commit 151e78a0b89ee6dec93382dbdf5b1ef83f9c4716 ]
+
+The LGEX0815 ACPI device is used by the "LG Airplane Mode Button"
+Windows driver for handling rfkill requests. When the ACPI device
+receives an 0x80 ACPI notification, an rfkill event is to be
+send to userspace.
+
+Add support for the LGEX0815 ACPI device to the driver.
+
+Tested-by: Agathe Boutmy <agathe@boutmy.com>
+Signed-off-by: Armin Wolf <W_Armin@gmx.de>
+Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Link: https://lore.kernel.org/r/20240606233540.9774-2-W_Armin@gmx.de
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/platform/x86/wireless-hotkey.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/drivers/platform/x86/wireless-hotkey.c b/drivers/platform/x86/wireless-hotkey.c
+index 4422863f47bbe..01feb6e6787f2 100644
+--- a/drivers/platform/x86/wireless-hotkey.c
++++ b/drivers/platform/x86/wireless-hotkey.c
+@@ -19,6 +19,7 @@ MODULE_AUTHOR("Alex Hung");
+ MODULE_ALIAS("acpi*:HPQ6001:*");
+ MODULE_ALIAS("acpi*:WSTADEF:*");
+ MODULE_ALIAS("acpi*:AMDI0051:*");
++MODULE_ALIAS("acpi*:LGEX0815:*");
+ struct wl_button {
+       struct input_dev *input_dev;
+@@ -29,6 +30,7 @@ static const struct acpi_device_id wl_ids[] = {
+       {"HPQ6001", 0},
+       {"WSTADEF", 0},
+       {"AMDI0051", 0},
++      {"LGEX0815", 0},
+       {"", 0},
+ };
+-- 
+2.43.0
+
diff --git a/queue-6.9/pnp-hide-pnp_bus_type-from-the-non-pnp-code.patch b/queue-6.9/pnp-hide-pnp_bus_type-from-the-non-pnp-code.patch
new file mode 100644 (file)
index 0000000..10be8b0
--- /dev/null
@@ -0,0 +1,51 @@
+From 3b324fcdc6d517efa322c94f6c87407a6acc303d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 28 May 2024 13:25:03 +0300
+Subject: PNP: Hide pnp_bus_type from the non-PNP code
+
+From: Andy Shevchenko <andy.shevchenko@gmail.com>
+
+[ Upstream commit edcde848c01eb071a91d479a6b3101d9cf48e905 ]
+
+The pnp_bus_type is defined only when CONFIG_PNP=y, while being
+not guarded by ifdeffery in the header. Moreover, it's not used
+outside of the PNP code. Move it to the internal header to make
+sure no-one will try to (ab)use it.
+
+Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/pnp/base.h  | 1 +
+ include/linux/pnp.h | 2 --
+ 2 files changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
+index e74a0f6a31572..4e80273dfb1ec 100644
+--- a/drivers/pnp/base.h
++++ b/drivers/pnp/base.h
+@@ -6,6 +6,7 @@
+ extern struct mutex pnp_lock;
+ extern const struct attribute_group *pnp_dev_groups[];
++extern const struct bus_type pnp_bus_type;
+ int pnp_register_protocol(struct pnp_protocol *protocol);
+ void pnp_unregister_protocol(struct pnp_protocol *protocol);
+diff --git a/include/linux/pnp.h b/include/linux/pnp.h
+index ddbe7c3ca4ce2..314892a6de8a0 100644
+--- a/include/linux/pnp.h
++++ b/include/linux/pnp.h
+@@ -435,8 +435,6 @@ struct pnp_protocol {
+ #define protocol_for_each_dev(protocol, dev)  \
+       list_for_each_entry(dev, &(protocol)->devices, protocol_list)
+-extern const struct bus_type pnp_bus_type;
+-
+ #if defined(CONFIG_PNP)
+ /* device management */
+-- 
+2.43.0
+
diff --git a/queue-6.9/powerpc-eeh-avoid-possible-crash-when-edev-pdev-chan.patch b/queue-6.9/powerpc-eeh-avoid-possible-crash-when-edev-pdev-chan.patch
new file mode 100644 (file)
index 0000000..4430462
--- /dev/null
@@ -0,0 +1,50 @@
+From bf461f1882f9df63fd779ecf69704eb367c6dbf3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 17 Jun 2024 19:32:40 +0530
+Subject: powerpc/eeh: avoid possible crash when edev->pdev changes
+
+From: Ganesh Goudar <ganeshgr@linux.ibm.com>
+
+[ Upstream commit a1216e62d039bf63a539bbe718536ec789a853dd ]
+
+If a PCI device is removed during eeh_pe_report_edev(), edev->pdev
+will change and can cause a crash, hold the PCI rescan/remove lock
+while taking a copy of edev->pdev->bus.
+
+Signed-off-by: Ganesh Goudar <ganeshgr@linux.ibm.com>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://msgid.link/20240617140240.580453-1-ganeshgr@linux.ibm.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/kernel/eeh_pe.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/arch/powerpc/kernel/eeh_pe.c b/arch/powerpc/kernel/eeh_pe.c
+index e0ce812796241..7d1b50599dd6c 100644
+--- a/arch/powerpc/kernel/eeh_pe.c
++++ b/arch/powerpc/kernel/eeh_pe.c
+@@ -849,6 +849,7 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe)
+ {
+       struct eeh_dev *edev;
+       struct pci_dev *pdev;
++      struct pci_bus *bus = NULL;
+       if (pe->type & EEH_PE_PHB)
+               return pe->phb->bus;
+@@ -859,9 +860,11 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe)
+       /* Retrieve the parent PCI bus of first (top) PCI device */
+       edev = list_first_entry_or_null(&pe->edevs, struct eeh_dev, entry);
++      pci_lock_rescan_remove();
+       pdev = eeh_dev_to_pci_dev(edev);
+       if (pdev)
+-              return pdev->bus;
++              bus = pdev->bus;
++      pci_unlock_rescan_remove();
+-      return NULL;
++      return bus;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.9/powerpc-pseries-whitelist-dtl-slub-object-for-copyin.patch b/queue-6.9/powerpc-pseries-whitelist-dtl-slub-object-for-copyin.patch
new file mode 100644 (file)
index 0000000..309ce14
--- /dev/null
@@ -0,0 +1,77 @@
+From 6fc7239f43ec4c32b3e6d22b2bdc6ad7434018ba Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 14 Jun 2024 23:08:44 +0530
+Subject: powerpc/pseries: Whitelist dtl slub object for copying to userspace
+
+From: Anjali K <anjalik@linux.ibm.com>
+
+[ Upstream commit 1a14150e1656f7a332a943154fc486504db4d586 ]
+
+Reading the dispatch trace log from /sys/kernel/debug/powerpc/dtl/cpu-*
+results in a BUG() when the config CONFIG_HARDENED_USERCOPY is enabled as
+shown below.
+
+    kernel BUG at mm/usercopy.c:102!
+    Oops: Exception in kernel mode, sig: 5 [#1]
+    LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
+    Modules linked in: xfs libcrc32c dm_service_time sd_mod t10_pi sg ibmvfc
+    scsi_transport_fc ibmveth pseries_wdt dm_multipath dm_mirror dm_region_hash dm_log dm_mod fuse
+    CPU: 27 PID: 1815 Comm: python3 Not tainted 6.10.0-rc3 #85
+    Hardware name: IBM,9040-MRX POWER10 (raw) 0x800200 0xf000006 of:IBM,FW1060.00 (NM1060_042) hv:phyp pSeries
+    NIP:  c0000000005d23d4 LR: c0000000005d23d0 CTR: 00000000006ee6f8
+    REGS: c000000120c078c0 TRAP: 0700   Not tainted  (6.10.0-rc3)
+    MSR:  8000000000029033 <SF,EE,ME,IR,DR,RI,LE>  CR: 2828220f  XER: 0000000e
+    CFAR: c0000000001fdc80 IRQMASK: 0
+    [ ... GPRs omitted ... ]
+    NIP [c0000000005d23d4] usercopy_abort+0x78/0xb0
+    LR [c0000000005d23d0] usercopy_abort+0x74/0xb0
+    Call Trace:
+     usercopy_abort+0x74/0xb0 (unreliable)
+     __check_heap_object+0xf8/0x120
+     check_heap_object+0x218/0x240
+     __check_object_size+0x84/0x1a4
+     dtl_file_read+0x17c/0x2c4
+     full_proxy_read+0x8c/0x110
+     vfs_read+0xdc/0x3a0
+     ksys_read+0x84/0x144
+     system_call_exception+0x124/0x330
+     system_call_vectored_common+0x15c/0x2ec
+    --- interrupt: 3000 at 0x7fff81f3ab34
+
+Commit 6d07d1cd300f ("usercopy: Restrict non-usercopy caches to size 0")
+requires that only whitelisted areas in slab/slub objects can be copied to
+userspace when usercopy hardening is enabled using CONFIG_HARDENED_USERCOPY.
+Dtl contains hypervisor dispatch events which are expected to be read by
+privileged users. Hence mark this safe for user access.
+Specify useroffset=0 and usersize=DISPATCH_LOG_BYTES to whitelist the
+entire object.
+
+Co-developed-by: Vishal Chourasia <vishalc@linux.ibm.com>
+Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com>
+Signed-off-by: Anjali K <anjalik@linux.ibm.com>
+Reviewed-by: Srikar Dronamraju <srikar@linux.ibm.com>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://msgid.link/20240614173844.746818-1-anjalik@linux.ibm.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/platforms/pseries/setup.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
+index b44de0f0822f0..b10a253252387 100644
+--- a/arch/powerpc/platforms/pseries/setup.c
++++ b/arch/powerpc/platforms/pseries/setup.c
+@@ -343,8 +343,8 @@ static int alloc_dispatch_log_kmem_cache(void)
+ {
+       void (*ctor)(void *) = get_dtl_cache_ctor();
+-      dtl_cache = kmem_cache_create("dtl", DISPATCH_LOG_BYTES,
+-                                              DISPATCH_LOG_BYTES, 0, ctor);
++      dtl_cache = kmem_cache_create_usercopy("dtl", DISPATCH_LOG_BYTES,
++                                              DISPATCH_LOG_BYTES, 0, 0, DISPATCH_LOG_BYTES, ctor);
+       if (!dtl_cache) {
+               pr_warn("Failed to create dispatch trace log buffer cache\n");
+               pr_warn("Stolen time statistics will be unreliable\n");
+-- 
+2.43.0
+
diff --git a/queue-6.9/riscv-stacktrace-fix-usage-of-ftrace_graph_ret_addr.patch b/queue-6.9/riscv-stacktrace-fix-usage-of-ftrace_graph_ret_addr.patch
new file mode 100644 (file)
index 0000000..cacecdc
--- /dev/null
@@ -0,0 +1,49 @@
+From 7cc44a71f7380c836632e551d0e813ae80983e4f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 18 Jun 2024 14:58:20 +0000
+Subject: riscv: stacktrace: fix usage of ftrace_graph_ret_addr()
+
+From: Puranjay Mohan <puranjay@kernel.org>
+
+[ Upstream commit 393da6cbb2ff89aadc47683a85269f913aa1c139 ]
+
+ftrace_graph_ret_addr() takes an `idx` integer pointer that is used to
+optimize the stack unwinding. Pass it a valid pointer to utilize the
+optimizations that might be available in the future.
+
+The commit is making riscv's usage of ftrace_graph_ret_addr() match
+x86_64.
+
+Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
+Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Link: https://lore.kernel.org/r/20240618145820.62112-1-puranjay@kernel.org
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/riscv/kernel/stacktrace.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
+index 0d3f00eb0baee..10e311b2759d3 100644
+--- a/arch/riscv/kernel/stacktrace.c
++++ b/arch/riscv/kernel/stacktrace.c
+@@ -32,6 +32,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
+                            bool (*fn)(void *, unsigned long), void *arg)
+ {
+       unsigned long fp, sp, pc;
++      int graph_idx = 0;
+       int level = 0;
+       if (regs) {
+@@ -68,7 +69,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
+                       pc = regs->ra;
+               } else {
+                       fp = frame->fp;
+-                      pc = ftrace_graph_ret_addr(current, NULL, frame->ra,
++                      pc = ftrace_graph_ret_addr(current, &graph_idx, frame->ra,
+                                                  &frame->ra);
+                       if (pc == (unsigned long)ret_from_exception) {
+                               if (unlikely(!__kernel_text_address(pc) || !fn(arg, pc)))
+-- 
+2.43.0
+
diff --git a/queue-6.9/s390-sclp-fix-sclp_init-cleanup-on-failure.patch b/queue-6.9/s390-sclp-fix-sclp_init-cleanup-on-failure.patch
new file mode 100644 (file)
index 0000000..dc16adf
--- /dev/null
@@ -0,0 +1,57 @@
+From 4c45fcf6692e1a50b33ed03a08d6a5019a01419d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 14 Jun 2024 18:09:01 +0200
+Subject: s390/sclp: Fix sclp_init() cleanup on failure
+
+From: Heiko Carstens <hca@linux.ibm.com>
+
+[ Upstream commit 6434b33faaa063df500af355ee6c3942e0f8d982 ]
+
+If sclp_init() fails it only partially cleans up: if there are multiple
+failing calls to sclp_init() sclp_state_change_event will be added several
+times to sclp_reg_list, which results in the following warning:
+
+------------[ cut here ]------------
+list_add double add: new=000003ffe1598c10, prev=000003ffe1598bf0, next=000003ffe1598c10.
+WARNING: CPU: 0 PID: 1 at lib/list_debug.c:35 __list_add_valid_or_report+0xde/0xf8
+CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.10.0-rc3
+Krnl PSW : 0404c00180000000 000003ffe0d6076a (__list_add_valid_or_report+0xe2/0xf8)
+           R:0 T:1 IO:0 EX:0 Key:0 M:1 W:0 P:0 AS:3 CC:0 PM:0 RI:0 EA:3
+...
+Call Trace:
+ [<000003ffe0d6076a>] __list_add_valid_or_report+0xe2/0xf8
+([<000003ffe0d60766>] __list_add_valid_or_report+0xde/0xf8)
+ [<000003ffe0a8d37e>] sclp_init+0x40e/0x450
+ [<000003ffe00009f2>] do_one_initcall+0x42/0x1e0
+ [<000003ffe15b77a6>] do_initcalls+0x126/0x150
+ [<000003ffe15b7a0a>] kernel_init_freeable+0x1ba/0x1f8
+ [<000003ffe0d6650e>] kernel_init+0x2e/0x180
+ [<000003ffe000301c>] __ret_from_fork+0x3c/0x60
+ [<000003ffe0d759ca>] ret_from_fork+0xa/0x30
+
+Fix this by removing sclp_state_change_event from sclp_reg_list when
+sclp_init() fails.
+
+Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
+Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
+Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/s390/char/sclp.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c
+index d53ee34d398f6..fbe29cabcbb83 100644
+--- a/drivers/s390/char/sclp.c
++++ b/drivers/s390/char/sclp.c
+@@ -1293,6 +1293,7 @@ sclp_init(void)
+ fail_unregister_reboot_notifier:
+       unregister_reboot_notifier(&sclp_reboot_notifier);
+ fail_init_state_uninitialized:
++      list_del(&sclp_state_change_event.list);
+       sclp_init_state = sclp_init_state_uninitialized;
+       free_page((unsigned long) sclp_read_sccb);
+       free_page((unsigned long) sclp_init_sccb);
+-- 
+2.43.0
+
diff --git a/queue-6.9/scsi-core-alua-i-o-errors-for-alua-state-transitions.patch b/queue-6.9/scsi-core-alua-i-o-errors-for-alua-state-transitions.patch
new file mode 100644 (file)
index 0000000..1b3b9df
--- /dev/null
@@ -0,0 +1,110 @@
+From 349cde62c6ba8f2a7909df7846c57dadcf0dae9b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 14 May 2024 16:03:44 +0200
+Subject: scsi: core: alua: I/O errors for ALUA state transitions
+
+From: Martin Wilck <martin.wilck@suse.com>
+
+[ Upstream commit 10157b1fc1a762293381e9145041253420dfc6ad ]
+
+When a host is configured with a few LUNs and I/O is running, injecting FC
+faults repeatedly leads to path recovery problems.  The LUNs have 4 paths
+each and 3 of them come back active after say an FC fault which makes 2 of
+the paths go down, instead of all 4. This happens after several iterations
+of continuous FC faults.
+
+Reason here is that we're returning an I/O error whenever we're
+encountering sense code 06/04/0a (LOGICAL UNIT NOT ACCESSIBLE, ASYMMETRIC
+ACCESS STATE TRANSITION) instead of retrying.
+
+[mwilck: The original patch was developed by Rajashekhar M A and Hannes
+Reinecke. I moved the code to alua_check_sense() as suggested by Mike
+Christie [1]. Evan Milne had raised the question whether pg->state should
+be set to transitioning in the UA case [2]. I believe that doing this is
+correct. SCSI_ACCESS_STATE_TRANSITIONING by itself doesn't cause I/O
+errors. Our handler schedules an RTPG, which will only result in an I/O
+error condition if the transitioning timeout expires.]
+
+[1] https://lore.kernel.org/all/0bc96e82-fdda-4187-148d-5b34f81d4942@oracle.com/
+[2] https://lore.kernel.org/all/CAGtn9r=kicnTDE2o7Gt5Y=yoidHYD7tG8XdMHEBJTBraVEoOCw@mail.gmail.com/
+
+Co-developed-by: Rajashekhar M A <rajs@netapp.com>
+Co-developed-by: Hannes Reinecke <hare@suse.de>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+Signed-off-by: Martin Wilck <martin.wilck@suse.com>
+Link: https://lore.kernel.org/r/20240514140344.19538-1-mwilck@suse.com
+Reviewed-by: Damien Le Moal <dlemoal@kernel.org>
+Reviewed-by: Christoph Hellwig <hch@lst.de>
+Reviewed-by: Mike Christie <michael.christie@oracle.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/device_handler/scsi_dh_alua.c | 31 +++++++++++++++-------
+ 1 file changed, 22 insertions(+), 9 deletions(-)
+
+diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
+index a226dc1b65d71..4eb0837298d4d 100644
+--- a/drivers/scsi/device_handler/scsi_dh_alua.c
++++ b/drivers/scsi/device_handler/scsi_dh_alua.c
+@@ -414,28 +414,40 @@ static char print_alua_state(unsigned char state)
+       }
+ }
+-static enum scsi_disposition alua_check_sense(struct scsi_device *sdev,
+-                                            struct scsi_sense_hdr *sense_hdr)
++static void alua_handle_state_transition(struct scsi_device *sdev)
+ {
+       struct alua_dh_data *h = sdev->handler_data;
+       struct alua_port_group *pg;
++      rcu_read_lock();
++      pg = rcu_dereference(h->pg);
++      if (pg)
++              pg->state = SCSI_ACCESS_STATE_TRANSITIONING;
++      rcu_read_unlock();
++      alua_check(sdev, false);
++}
++
++static enum scsi_disposition alua_check_sense(struct scsi_device *sdev,
++                                            struct scsi_sense_hdr *sense_hdr)
++{
+       switch (sense_hdr->sense_key) {
+       case NOT_READY:
+               if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0a) {
+                       /*
+                        * LUN Not Accessible - ALUA state transition
+                        */
+-                      rcu_read_lock();
+-                      pg = rcu_dereference(h->pg);
+-                      if (pg)
+-                              pg->state = SCSI_ACCESS_STATE_TRANSITIONING;
+-                      rcu_read_unlock();
+-                      alua_check(sdev, false);
++                      alua_handle_state_transition(sdev);
+                       return NEEDS_RETRY;
+               }
+               break;
+       case UNIT_ATTENTION:
++              if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0a) {
++                      /*
++                       * LUN Not Accessible - ALUA state transition
++                       */
++                      alua_handle_state_transition(sdev);
++                      return NEEDS_RETRY;
++              }
+               if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00) {
+                       /*
+                        * Power On, Reset, or Bus Device Reset.
+@@ -502,7 +514,8 @@ static int alua_tur(struct scsi_device *sdev)
+       retval = scsi_test_unit_ready(sdev, ALUA_FAILOVER_TIMEOUT * HZ,
+                                     ALUA_FAILOVER_RETRIES, &sense_hdr);
+-      if (sense_hdr.sense_key == NOT_READY &&
++      if ((sense_hdr.sense_key == NOT_READY ||
++           sense_hdr.sense_key == UNIT_ATTENTION) &&
+           sense_hdr.asc == 0x04 && sense_hdr.ascq == 0x0a)
+               return SCSI_DH_RETRY;
+       else if (retval)
+-- 
+2.43.0
+
diff --git a/queue-6.9/scsi-libsas-fix-exp-attached-device-scan-after-probe.patch b/queue-6.9/scsi-libsas-fix-exp-attached-device-scan-after-probe.patch
new file mode 100644 (file)
index 0000000..1185de4
--- /dev/null
@@ -0,0 +1,75 @@
+From e667914bc05eba9e2ea884c88c22be6f77caa7ad Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 19 Jun 2024 09:17:42 +0000
+Subject: scsi: libsas: Fix exp-attached device scan after probe failure
+ scanned in again after probe failed
+
+From: Xingui Yang <yangxingui@huawei.com>
+
+[ Upstream commit ab2068a6fb84751836a84c26ca72b3beb349619d ]
+
+The expander phy will be treated as broadcast flutter in the next
+revalidation after the exp-attached end device probe failed, as follows:
+
+[78779.654026] sas: broadcast received: 0
+[78779.654037] sas: REVALIDATING DOMAIN on port 0, pid:10
+[78779.654680] sas: ex 500e004aaaaaaa1f phy05 change count has changed
+[78779.662977] sas: ex 500e004aaaaaaa1f phy05 originated BROADCAST(CHANGE)
+[78779.662986] sas: ex 500e004aaaaaaa1f phy05 new device attached
+[78779.663079] sas: ex 500e004aaaaaaa1f phy05:U:8 attached: 500e004aaaaaaa05 (stp)
+[78779.693542] hisi_sas_v3_hw 0000:b4:02.0: dev[16:5] found
+[78779.701155] sas: done REVALIDATING DOMAIN on port 0, pid:10, res 0x0
+[78779.707864] sas: Enter sas_scsi_recover_host busy: 0 failed: 0
+...
+[78835.161307] sas: --- Exit sas_scsi_recover_host: busy: 0 failed: 0 tries: 1
+[78835.171344] sas: sas_probe_sata: for exp-attached device 500e004aaaaaaa05 returned -19
+[78835.180879] hisi_sas_v3_hw 0000:b4:02.0: dev[16:5] is gone
+[78835.187487] sas: broadcast received: 0
+[78835.187504] sas: REVALIDATING DOMAIN on port 0, pid:10
+[78835.188263] sas: ex 500e004aaaaaaa1f phy05 change count has changed
+[78835.195870] sas: ex 500e004aaaaaaa1f phy05 originated BROADCAST(CHANGE)
+[78835.195875] sas: ex 500e004aaaaaaa1f rediscovering phy05
+[78835.196022] sas: ex 500e004aaaaaaa1f phy05:U:A attached: 500e004aaaaaaa05 (stp)
+[78835.196026] sas: ex 500e004aaaaaaa1f phy05 broadcast flutter
+[78835.197615] sas: done REVALIDATING DOMAIN on port 0, pid:10, res 0x0
+
+The cause of the problem is that the related ex_phy's attached_sas_addr was
+not cleared after the end device probe failed, so reset it.
+
+Signed-off-by: Xingui Yang <yangxingui@huawei.com>
+Link: https://lore.kernel.org/r/20240619091742.25465-1-yangxingui@huawei.com
+Reviewed-by: John Garry <john.g.garry@oracle.com>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/libsas/sas_internal.h | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/drivers/scsi/libsas/sas_internal.h b/drivers/scsi/libsas/sas_internal.h
+index 3804aef165adb..164086c5824ec 100644
+--- a/drivers/scsi/libsas/sas_internal.h
++++ b/drivers/scsi/libsas/sas_internal.h
+@@ -145,6 +145,20 @@ static inline void sas_fail_probe(struct domain_device *dev, const char *func, i
+               func, dev->parent ? "exp-attached" :
+               "direct-attached",
+               SAS_ADDR(dev->sas_addr), err);
++
++      /*
++       * If the device probe failed, the expander phy attached address
++       * needs to be reset so that the phy will not be treated as flutter
++       * in the next revalidation
++       */
++      if (dev->parent && !dev_is_expander(dev->dev_type)) {
++              struct sas_phy *phy = dev->phy;
++              struct domain_device *parent = dev->parent;
++              struct ex_phy *ex_phy = &parent->ex_dev.ex_phy[phy->number];
++
++              memset(ex_phy->attached_sas_addr, 0, SAS_ADDR_SIZE);
++      }
++
+       sas_unregister_dev(dev->port, dev);
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.9/scsi-qedf-don-t-process-stag-work-during-unload-and-.patch b/queue-6.9/scsi-qedf-don-t-process-stag-work-during-unload-and-.patch
new file mode 100644 (file)
index 0000000..d76b7df
--- /dev/null
@@ -0,0 +1,51 @@
+From 437ef129962af062c0453af0061a9e38dc473830 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 15 May 2024 14:40:59 +0530
+Subject: scsi: qedf: Don't process stag work during unload and recovery
+
+From: Saurav Kashyap <skashyap@marvell.com>
+
+[ Upstream commit 51071f0831ea975fc045526dd7e17efe669dc6e1 ]
+
+Stag work can cause issues during unload and recovery, hence don't process
+it.
+
+Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
+Signed-off-by: Nilesh Javali <njavali@marvell.com>
+Link: https://lore.kernel.org/r/20240515091101.18754-2-skashyap@marvell.com
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/qedf/qedf_main.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
+index a58353b7b4e8b..e882aec867653 100644
+--- a/drivers/scsi/qedf/qedf_main.c
++++ b/drivers/scsi/qedf/qedf_main.c
+@@ -3997,6 +3997,22 @@ void qedf_stag_change_work(struct work_struct *work)
+       struct qedf_ctx *qedf =
+           container_of(work, struct qedf_ctx, stag_work.work);
++      if (!qedf) {
++              QEDF_ERR(&qedf->dbg_ctx, "qedf is NULL");
++              return;
++      }
++
++      if (test_bit(QEDF_IN_RECOVERY, &qedf->flags)) {
++              QEDF_ERR(&qedf->dbg_ctx,
++                       "Already is in recovery, hence not calling software context reset.\n");
++              return;
++      }
++
++      if (test_bit(QEDF_UNLOADING, &qedf->flags)) {
++              QEDF_ERR(&qedf->dbg_ctx, "Driver unloading\n");
++              return;
++      }
++
+       printk_ratelimited("[%s]:[%s:%d]:%d: Performing software context reset.",
+                       dev_name(&qedf->pdev->dev), __func__, __LINE__,
+                       qedf->dbg_ctx.host_no);
+-- 
+2.43.0
+
diff --git a/queue-6.9/scsi-qedf-set-qed_slowpath_params-to-zero-before-use.patch b/queue-6.9/scsi-qedf-set-qed_slowpath_params-to-zero-before-use.patch
new file mode 100644 (file)
index 0000000..abf7a48
--- /dev/null
@@ -0,0 +1,35 @@
+From e0fdf77bbe9eceb5baeee68a6e57d9696e6a5da5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 15 May 2024 14:41:01 +0530
+Subject: scsi: qedf: Set qed_slowpath_params to zero before use
+
+From: Saurav Kashyap <skashyap@marvell.com>
+
+[ Upstream commit 6c3bb589debd763dc4b94803ddf3c13b4fcca776 ]
+
+Zero qed_slowpath_params before use.
+
+Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
+Signed-off-by: Nilesh Javali <njavali@marvell.com>
+Link: https://lore.kernel.org/r/20240515091101.18754-4-skashyap@marvell.com
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/qedf/qedf_main.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
+index c98cc666e3e9c..b97a8712d3f66 100644
+--- a/drivers/scsi/qedf/qedf_main.c
++++ b/drivers/scsi/qedf/qedf_main.c
+@@ -3473,6 +3473,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
+       }
+       /* Start the Slowpath-process */
++      memset(&slowpath_params, 0, sizeof(struct qed_slowpath_params));
+       slowpath_params.int_mode = QED_INT_MODE_MSIX;
+       slowpath_params.drv_major = QEDF_DRIVER_MAJOR_VER;
+       slowpath_params.drv_minor = QEDF_DRIVER_MINOR_VER;
+-- 
+2.43.0
+
diff --git a/queue-6.9/scsi-qedf-wait-for-stag-work-during-unload.patch b/queue-6.9/scsi-qedf-wait-for-stag-work-during-unload.patch
new file mode 100644 (file)
index 0000000..1c5d294
--- /dev/null
@@ -0,0 +1,130 @@
+From dce85be2ae822e299852b425c06933e7073437e2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 15 May 2024 14:41:00 +0530
+Subject: scsi: qedf: Wait for stag work during unload
+
+From: Saurav Kashyap <skashyap@marvell.com>
+
+[ Upstream commit 78e88472b60936025b83eba57cffa59d3501dc07 ]
+
+If stag work is already scheduled and unload is called, it can lead to
+issues as unload cleans up the work element. Wait for stag work to get
+completed before cleanup during unload.
+
+Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
+Signed-off-by: Nilesh Javali <njavali@marvell.com>
+Link: https://lore.kernel.org/r/20240515091101.18754-3-skashyap@marvell.com
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/scsi/qedf/qedf.h      |  1 +
+ drivers/scsi/qedf/qedf_main.c | 30 +++++++++++++++++++++++++++---
+ 2 files changed, 28 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h
+index 5058e01b65a27..98afdfe636003 100644
+--- a/drivers/scsi/qedf/qedf.h
++++ b/drivers/scsi/qedf/qedf.h
+@@ -363,6 +363,7 @@ struct qedf_ctx {
+ #define QEDF_IN_RECOVERY              5
+ #define QEDF_DBG_STOP_IO              6
+ #define QEDF_PROBING                  8
++#define QEDF_STAG_IN_PROGRESS         9
+       unsigned long flags; /* Miscellaneous state flags */
+       int fipvlan_retries;
+       u8 num_queues;
+diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
+index e882aec867653..c98cc666e3e9c 100644
+--- a/drivers/scsi/qedf/qedf_main.c
++++ b/drivers/scsi/qedf/qedf_main.c
+@@ -318,11 +318,18 @@ static struct fc_seq *qedf_elsct_send(struct fc_lport *lport, u32 did,
+        */
+       if (resp == fc_lport_flogi_resp) {
+               qedf->flogi_cnt++;
++              qedf->flogi_pending++;
++
++              if (test_bit(QEDF_UNLOADING, &qedf->flags)) {
++                      QEDF_ERR(&qedf->dbg_ctx, "Driver unloading\n");
++                      qedf->flogi_pending = 0;
++              }
++
+               if (qedf->flogi_pending >= QEDF_FLOGI_RETRY_CNT) {
+                       schedule_delayed_work(&qedf->stag_work, 2);
+                       return NULL;
+               }
+-              qedf->flogi_pending++;
++
+               return fc_elsct_send(lport, did, fp, op, qedf_flogi_resp,
+                   arg, timeout);
+       }
+@@ -912,13 +919,14 @@ void qedf_ctx_soft_reset(struct fc_lport *lport)
+       struct qedf_ctx *qedf;
+       struct qed_link_output if_link;
++      qedf = lport_priv(lport);
++
+       if (lport->vport) {
++              clear_bit(QEDF_STAG_IN_PROGRESS, &qedf->flags);
+               printk_ratelimited("Cannot issue host reset on NPIV port.\n");
+               return;
+       }
+-      qedf = lport_priv(lport);
+-
+       qedf->flogi_pending = 0;
+       /* For host reset, essentially do a soft link up/down */
+       atomic_set(&qedf->link_state, QEDF_LINK_DOWN);
+@@ -938,6 +946,7 @@ void qedf_ctx_soft_reset(struct fc_lport *lport)
+       if (!if_link.link_up) {
+               QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_DISC,
+                         "Physical link is not up.\n");
++              clear_bit(QEDF_STAG_IN_PROGRESS, &qedf->flags);
+               return;
+       }
+       /* Flush and wait to make sure link down is processed */
+@@ -950,6 +959,7 @@ void qedf_ctx_soft_reset(struct fc_lport *lport)
+                 "Queue link up work.\n");
+       queue_delayed_work(qedf->link_update_wq, &qedf->link_update,
+           0);
++      clear_bit(QEDF_STAG_IN_PROGRESS, &qedf->flags);
+ }
+ /* Reset the host by gracefully logging out and then logging back in */
+@@ -3721,6 +3731,7 @@ static void __qedf_remove(struct pci_dev *pdev, int mode)
+ {
+       struct qedf_ctx *qedf;
+       int rc;
++      int cnt = 0;
+       if (!pdev) {
+               QEDF_ERR(NULL, "pdev is NULL.\n");
+@@ -3738,6 +3749,17 @@ static void __qedf_remove(struct pci_dev *pdev, int mode)
+               return;
+       }
++stag_in_prog:
++      if (test_bit(QEDF_STAG_IN_PROGRESS, &qedf->flags)) {
++              QEDF_ERR(&qedf->dbg_ctx, "Stag in progress, cnt=%d.\n", cnt);
++              cnt++;
++
++              if (cnt < 5) {
++                      msleep(500);
++                      goto stag_in_prog;
++              }
++      }
++
+       if (mode != QEDF_MODE_RECOVERY)
+               set_bit(QEDF_UNLOADING, &qedf->flags);
+@@ -4013,6 +4035,8 @@ void qedf_stag_change_work(struct work_struct *work)
+               return;
+       }
++      set_bit(QEDF_STAG_IN_PROGRESS, &qedf->flags);
++
+       printk_ratelimited("[%s]:[%s:%d]:%d: Performing software context reset.",
+                       dev_name(&qedf->pdev->dev), __func__, __LINE__,
+                       qedf->dbg_ctx.host_no);
+-- 
+2.43.0
+
diff --git a/queue-6.9/scsi-sr-fix-unintentional-arithmetic-wraparound.patch b/queue-6.9/scsi-sr-fix-unintentional-arithmetic-wraparound.patch
new file mode 100644 (file)
index 0000000..0a419c5
--- /dev/null
@@ -0,0 +1,136 @@
+From cdd41fc45ba9ae87cd9e8a3eb9d33c75a3e0dfa8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 8 May 2024 17:22:51 +0000
+Subject: scsi: sr: Fix unintentional arithmetic wraparound
+
+From: Justin Stitt <justinstitt@google.com>
+
+[ Upstream commit 9fad9d560af5c654bb38e0b07ee54a4e9acdc5cd ]
+
+Running syzkaller with the newly reintroduced signed integer overflow
+sanitizer produces this report:
+
+[   65.194362] ------------[ cut here ]------------
+[   65.197752] UBSAN: signed-integer-overflow in ../drivers/scsi/sr_ioctl.c:436:9
+[   65.203607] -2147483648 * 177 cannot be represented in type 'int'
+[   65.207911] CPU: 2 PID: 10416 Comm: syz-executor.1 Not tainted 6.8.0-rc2-00035-gb3ef86b5a957 #1
+[   65.213585] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014
+[   65.219923] Call Trace:
+[   65.221556]  <TASK>
+[   65.223029]  dump_stack_lvl+0x93/0xd0
+[   65.225573]  handle_overflow+0x171/0x1b0
+[   65.228219]  sr_select_speed+0xeb/0xf0
+[   65.230786]  ? __pm_runtime_resume+0xe6/0x130
+[   65.233606]  sr_block_ioctl+0x15d/0x1d0
+...
+
+Historically, the signed integer overflow sanitizer did not work in the
+kernel due to its interaction with `-fwrapv` but this has since been
+changed [1] in the newest version of Clang. It was re-enabled in the kernel
+with Commit 557f8c582a9b ("ubsan: Reintroduce signed overflow sanitizer").
+
+Firstly, let's change the type of "speed" to unsigned long as
+sr_select_speed()'s only caller passes in an unsigned long anyways.
+
+$ git grep '\.select_speed'
+|      drivers/scsi/sr.c:      .select_speed           = sr_select_speed,
+...
+|      static int cdrom_ioctl_select_speed(struct cdrom_device_info *cdi,
+|                      unsigned long arg)
+|      {
+|              ...
+|              return cdi->ops->select_speed(cdi, arg);
+|      }
+
+Next, let's add an extra check to make sure we don't exceed 0xffff/177
+(350) since 0xffff is the max speed. This has two benefits: 1) we deal
+with integer overflow before it happens and 2) we properly respect the
+max speed of 0xffff. There are some "magic" numbers here but I did not
+want to change more than what was necessary.
+
+Link: https://github.com/llvm/llvm-project/pull/82432 [1]
+Closes: https://github.com/KSPP/linux/issues/357
+Cc: linux-hardening@vger.kernel.org
+Signed-off-by: Justin Stitt <justinstitt@google.com>
+Link: https://lore.kernel.org/r/20240508-b4-b4-sio-sr_select_speed-v2-1-00b68f724290@google.com
+Reviewed-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ Documentation/cdrom/cdrom-standard.rst | 4 ++--
+ drivers/scsi/sr.h                      | 2 +-
+ drivers/scsi/sr_ioctl.c                | 5 ++++-
+ include/linux/cdrom.h                  | 2 +-
+ 4 files changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/Documentation/cdrom/cdrom-standard.rst b/Documentation/cdrom/cdrom-standard.rst
+index 7964fe134277b..6c1303cff159e 100644
+--- a/Documentation/cdrom/cdrom-standard.rst
++++ b/Documentation/cdrom/cdrom-standard.rst
+@@ -217,7 +217,7 @@ current *struct* is::
+               int (*media_changed)(struct cdrom_device_info *, int);
+               int (*tray_move)(struct cdrom_device_info *, int);
+               int (*lock_door)(struct cdrom_device_info *, int);
+-              int (*select_speed)(struct cdrom_device_info *, int);
++              int (*select_speed)(struct cdrom_device_info *, unsigned long);
+               int (*get_last_session) (struct cdrom_device_info *,
+                                        struct cdrom_multisession *);
+               int (*get_mcn)(struct cdrom_device_info *, struct cdrom_mcn *);
+@@ -396,7 +396,7 @@ action need be taken, and the return value should be 0.
+ ::
+-      int select_speed(struct cdrom_device_info *cdi, int speed)
++      int select_speed(struct cdrom_device_info *cdi, unsigned long speed)
+ Some CD-ROM drives are capable of changing their head-speed. There
+ are several reasons for changing the speed of a CD-ROM drive. Badly
+diff --git a/drivers/scsi/sr.h b/drivers/scsi/sr.h
+index 1175f2e213b56..dc899277b3a44 100644
+--- a/drivers/scsi/sr.h
++++ b/drivers/scsi/sr.h
+@@ -65,7 +65,7 @@ int sr_disk_status(struct cdrom_device_info *);
+ int sr_get_last_session(struct cdrom_device_info *, struct cdrom_multisession *);
+ int sr_get_mcn(struct cdrom_device_info *, struct cdrom_mcn *);
+ int sr_reset(struct cdrom_device_info *);
+-int sr_select_speed(struct cdrom_device_info *cdi, int speed);
++int sr_select_speed(struct cdrom_device_info *cdi, unsigned long speed);
+ int sr_audio_ioctl(struct cdrom_device_info *, unsigned int, void *);
+ int sr_is_xa(Scsi_CD *);
+diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c
+index 5b0b35e60e61f..a0d2556a27bba 100644
+--- a/drivers/scsi/sr_ioctl.c
++++ b/drivers/scsi/sr_ioctl.c
+@@ -425,11 +425,14 @@ int sr_reset(struct cdrom_device_info *cdi)
+       return 0;
+ }
+-int sr_select_speed(struct cdrom_device_info *cdi, int speed)
++int sr_select_speed(struct cdrom_device_info *cdi, unsigned long speed)
+ {
+       Scsi_CD *cd = cdi->handle;
+       struct packet_command cgc;
++      /* avoid exceeding the max speed or overflowing integer bounds */
++      speed = clamp(0, speed, 0xffff / 177);
++
+       if (speed == 0)
+               speed = 0xffff; /* set to max */
+       else
+diff --git a/include/linux/cdrom.h b/include/linux/cdrom.h
+index 98c6fd0b39b63..fdfb61ccf55ae 100644
+--- a/include/linux/cdrom.h
++++ b/include/linux/cdrom.h
+@@ -77,7 +77,7 @@ struct cdrom_device_ops {
+                                     unsigned int clearing, int slot);
+       int (*tray_move) (struct cdrom_device_info *, int);
+       int (*lock_door) (struct cdrom_device_info *, int);
+-      int (*select_speed) (struct cdrom_device_info *, int);
++      int (*select_speed) (struct cdrom_device_info *, unsigned long);
+       int (*get_last_session) (struct cdrom_device_info *,
+                                struct cdrom_multisession *);
+       int (*get_mcn) (struct cdrom_device_info *,
+-- 
+2.43.0
+
diff --git a/queue-6.9/selftest-timerns-fix-clang-build-failures-for-abs-ca.patch b/queue-6.9/selftest-timerns-fix-clang-build-failures-for-abs-ca.patch
new file mode 100644 (file)
index 0000000..d138da2
--- /dev/null
@@ -0,0 +1,114 @@
+From 13dba7e4174b6441e42b95b61c3f831627830802 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 Jul 2024 19:52:47 -0700
+Subject: selftest/timerns: fix clang build failures for abs() calls
+
+From: John Hubbard <jhubbard@nvidia.com>
+
+[ Upstream commit f76f9bc616b7320df6789241ca7d26cedcf03cf3 ]
+
+When building with clang, via:
+
+    make LLVM=1 -C tools/testing/selftests
+
+...clang warns about mismatches between the expected and required
+integer length being supplied to abs(3).
+
+Fix this by using the correct variant of abs(3): labs(3) or llabs(3), in
+these cases.
+
+Reviewed-by: Dmitry Safonov <dima@arista.com>
+Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
+Signed-off-by: John Hubbard <jhubbard@nvidia.com>
+Acked-by: Andrei Vagin <avagin@google.com>
+Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/timens/exec.c       | 6 +++---
+ tools/testing/selftests/timens/timer.c      | 2 +-
+ tools/testing/selftests/timens/timerfd.c    | 2 +-
+ tools/testing/selftests/timens/vfork_exec.c | 4 ++--
+ 4 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/tools/testing/selftests/timens/exec.c b/tools/testing/selftests/timens/exec.c
+index e40dc5be2f668..d12ff955de0d8 100644
+--- a/tools/testing/selftests/timens/exec.c
++++ b/tools/testing/selftests/timens/exec.c
+@@ -30,7 +30,7 @@ int main(int argc, char *argv[])
+               for (i = 0; i < 2; i++) {
+                       _gettime(CLOCK_MONOTONIC, &tst, i);
+-                      if (abs(tst.tv_sec - now.tv_sec) > 5)
++                      if (labs(tst.tv_sec - now.tv_sec) > 5)
+                               return pr_fail("%ld %ld\n", now.tv_sec, tst.tv_sec);
+               }
+               return 0;
+@@ -50,7 +50,7 @@ int main(int argc, char *argv[])
+       for (i = 0; i < 2; i++) {
+               _gettime(CLOCK_MONOTONIC, &tst, i);
+-              if (abs(tst.tv_sec - now.tv_sec) > 5)
++              if (labs(tst.tv_sec - now.tv_sec) > 5)
+                       return pr_fail("%ld %ld\n",
+                                       now.tv_sec, tst.tv_sec);
+       }
+@@ -70,7 +70,7 @@ int main(int argc, char *argv[])
+               /* Check that a child process is in the new timens. */
+               for (i = 0; i < 2; i++) {
+                       _gettime(CLOCK_MONOTONIC, &tst, i);
+-                      if (abs(tst.tv_sec - now.tv_sec - OFFSET) > 5)
++                      if (labs(tst.tv_sec - now.tv_sec - OFFSET) > 5)
+                               return pr_fail("%ld %ld\n",
+                                               now.tv_sec + OFFSET, tst.tv_sec);
+               }
+diff --git a/tools/testing/selftests/timens/timer.c b/tools/testing/selftests/timens/timer.c
+index 5e7f0051bd7be..5b939f59dfa4d 100644
+--- a/tools/testing/selftests/timens/timer.c
++++ b/tools/testing/selftests/timens/timer.c
+@@ -56,7 +56,7 @@ int run_test(int clockid, struct timespec now)
+                       return pr_perror("timerfd_gettime");
+               elapsed = new_value.it_value.tv_sec;
+-              if (abs(elapsed - 3600) > 60) {
++              if (llabs(elapsed - 3600) > 60) {
+                       ksft_test_result_fail("clockid: %d elapsed: %lld\n",
+                                             clockid, elapsed);
+                       return 1;
+diff --git a/tools/testing/selftests/timens/timerfd.c b/tools/testing/selftests/timens/timerfd.c
+index 9edd43d6b2c13..a4196bbd6e33f 100644
+--- a/tools/testing/selftests/timens/timerfd.c
++++ b/tools/testing/selftests/timens/timerfd.c
+@@ -61,7 +61,7 @@ int run_test(int clockid, struct timespec now)
+                       return pr_perror("timerfd_gettime(%d)", clockid);
+               elapsed = new_value.it_value.tv_sec;
+-              if (abs(elapsed - 3600) > 60) {
++              if (llabs(elapsed - 3600) > 60) {
+                       ksft_test_result_fail("clockid: %d elapsed: %lld\n",
+                                             clockid, elapsed);
+                       return 1;
+diff --git a/tools/testing/selftests/timens/vfork_exec.c b/tools/testing/selftests/timens/vfork_exec.c
+index beb7614941fb1..5b8907bf451dd 100644
+--- a/tools/testing/selftests/timens/vfork_exec.c
++++ b/tools/testing/selftests/timens/vfork_exec.c
+@@ -32,7 +32,7 @@ static void *tcheck(void *_args)
+       for (i = 0; i < 2; i++) {
+               _gettime(CLOCK_MONOTONIC, &tst, i);
+-              if (abs(tst.tv_sec - now->tv_sec) > 5) {
++              if (labs(tst.tv_sec - now->tv_sec) > 5) {
+                       pr_fail("%s: in-thread: unexpected value: %ld (%ld)\n",
+                               args->tst_name, tst.tv_sec, now->tv_sec);
+                       return (void *)1UL;
+@@ -64,7 +64,7 @@ static int check(char *tst_name, struct timespec *now)
+       for (i = 0; i < 2; i++) {
+               _gettime(CLOCK_MONOTONIC, &tst, i);
+-              if (abs(tst.tv_sec - now->tv_sec) > 5)
++              if (labs(tst.tv_sec - now->tv_sec) > 5)
+                       return pr_fail("%s: unexpected value: %ld (%ld)\n",
+                                       tst_name, tst.tv_sec, now->tv_sec);
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.9/selftests-bpf-extend-tcx-tests-to-cover-late-tcx_ent.patch b/queue-6.9/selftests-bpf-extend-tcx-tests-to-cover-late-tcx_ent.patch
new file mode 100644 (file)
index 0000000..6ab83a2
--- /dev/null
@@ -0,0 +1,142 @@
+From 875b5efdb785188f24804e0429c0606ca51a80f5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 8 Jul 2024 15:31:30 +0200
+Subject: selftests/bpf: Extend tcx tests to cover late tcx_entry release
+
+From: Daniel Borkmann <daniel@iogearbox.net>
+
+[ Upstream commit 5f1d18de79180deac2822c93e431bbe547f7d3ce ]
+
+Add a test case which replaces an active ingress qdisc while keeping the
+miniq in-tact during the transition period to the new clsact qdisc.
+
+  # ./vmtest.sh -- ./test_progs -t tc_link
+  [...]
+  ./test_progs -t tc_link
+  [    3.412871] bpf_testmod: loading out-of-tree module taints kernel.
+  [    3.413343] bpf_testmod: module verification failed: signature and/or required key missing - tainting kernel
+  #332     tc_links_after:OK
+  #333     tc_links_append:OK
+  #334     tc_links_basic:OK
+  #335     tc_links_before:OK
+  #336     tc_links_chain_classic:OK
+  #337     tc_links_chain_mixed:OK
+  #338     tc_links_dev_chain0:OK
+  #339     tc_links_dev_cleanup:OK
+  #340     tc_links_dev_mixed:OK
+  #341     tc_links_ingress:OK
+  #342     tc_links_invalid:OK
+  #343     tc_links_prepend:OK
+  #344     tc_links_replace:OK
+  #345     tc_links_revision:OK
+  Summary: 14/0 PASSED, 0 SKIPPED, 0 FAILED
+
+Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
+Cc: Martin KaFai Lau <martin.lau@kernel.org>
+Link: https://lore.kernel.org/r/20240708133130.11609-2-daniel@iogearbox.net
+Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/bpf/config            |  3 +
+ .../selftests/bpf/prog_tests/tc_links.c       | 61 +++++++++++++++++++
+ 2 files changed, 64 insertions(+)
+
+diff --git a/tools/testing/selftests/bpf/config b/tools/testing/selftests/bpf/config
+index 01f241ea2c67b..dec9fd7ebba7f 100644
+--- a/tools/testing/selftests/bpf/config
++++ b/tools/testing/selftests/bpf/config
+@@ -53,9 +53,12 @@ CONFIG_MPLS=y
+ CONFIG_MPLS_IPTUNNEL=y
+ CONFIG_MPLS_ROUTING=y
+ CONFIG_MPTCP=y
++CONFIG_NET_ACT_SKBMOD=y
++CONFIG_NET_CLS=y
+ CONFIG_NET_CLS_ACT=y
+ CONFIG_NET_CLS_BPF=y
+ CONFIG_NET_CLS_FLOWER=y
++CONFIG_NET_CLS_MATCHALL=y
+ CONFIG_NET_FOU=y
+ CONFIG_NET_FOU_IP_TUNNELS=y
+ CONFIG_NET_IPGRE=y
+diff --git a/tools/testing/selftests/bpf/prog_tests/tc_links.c b/tools/testing/selftests/bpf/prog_tests/tc_links.c
+index bc98411446855..1af9ec1149aab 100644
+--- a/tools/testing/selftests/bpf/prog_tests/tc_links.c
++++ b/tools/testing/selftests/bpf/prog_tests/tc_links.c
+@@ -9,6 +9,8 @@
+ #define ping_cmd "ping -q -c1 -w1 127.0.0.1 > /dev/null"
+ #include "test_tc_link.skel.h"
++
++#include "netlink_helpers.h"
+ #include "tc_helpers.h"
+ void serial_test_tc_links_basic(void)
+@@ -1787,6 +1789,65 @@ void serial_test_tc_links_ingress(void)
+       test_tc_links_ingress(BPF_TCX_INGRESS, false, false);
+ }
++struct qdisc_req {
++      struct nlmsghdr  n;
++      struct tcmsg     t;
++      char             buf[1024];
++};
++
++static int qdisc_replace(int ifindex, const char *kind, bool block)
++{
++      struct rtnl_handle rth = { .fd = -1 };
++      struct qdisc_req req;
++      int err;
++
++      err = rtnl_open(&rth, 0);
++      if (!ASSERT_OK(err, "open_rtnetlink"))
++              return err;
++
++      memset(&req, 0, sizeof(req));
++      req.n.nlmsg_len = NLMSG_LENGTH(sizeof(struct tcmsg));
++      req.n.nlmsg_flags = NLM_F_CREATE | NLM_F_REPLACE | NLM_F_REQUEST;
++      req.n.nlmsg_type = RTM_NEWQDISC;
++      req.t.tcm_family = AF_UNSPEC;
++      req.t.tcm_ifindex = ifindex;
++      req.t.tcm_parent = 0xfffffff1;
++
++      addattr_l(&req.n, sizeof(req), TCA_KIND, kind, strlen(kind) + 1);
++      if (block)
++              addattr32(&req.n, sizeof(req), TCA_INGRESS_BLOCK, 1);
++
++      err = rtnl_talk(&rth, &req.n, NULL);
++      ASSERT_OK(err, "talk_rtnetlink");
++      rtnl_close(&rth);
++      return err;
++}
++
++void serial_test_tc_links_dev_chain0(void)
++{
++      int err, ifindex;
++
++      ASSERT_OK(system("ip link add dev foo type veth peer name bar"), "add veth");
++      ifindex = if_nametoindex("foo");
++      ASSERT_NEQ(ifindex, 0, "non_zero_ifindex");
++      err = qdisc_replace(ifindex, "ingress", true);
++      if (!ASSERT_OK(err, "attaching ingress"))
++              goto cleanup;
++      ASSERT_OK(system("tc filter add block 1 matchall action skbmod swap mac"), "add block");
++      err = qdisc_replace(ifindex, "clsact", false);
++      if (!ASSERT_OK(err, "attaching clsact"))
++              goto cleanup;
++      /* Heuristic: kern_sync_rcu() alone does not work; a wait-time of ~5s
++       * triggered the issue without the fix reliably 100% of the time.
++       */
++      sleep(5);
++      ASSERT_OK(system("tc filter add dev foo ingress matchall action skbmod swap mac"), "add filter");
++cleanup:
++      ASSERT_OK(system("ip link del dev foo"), "del veth");
++      ASSERT_EQ(if_nametoindex("foo"), 0, "foo removed");
++      ASSERT_EQ(if_nametoindex("bar"), 0, "bar removed");
++}
++
+ static void test_tc_links_dev_mixed(int target)
+ {
+       LIBBPF_OPTS(bpf_tc_opts, tc_opts, .handle = 1, .priority = 1);
+-- 
+2.43.0
+
diff --git a/queue-6.9/selftests-cachestat-fix-build-warnings-on-ppc64.patch b/queue-6.9/selftests-cachestat-fix-build-warnings-on-ppc64.patch
new file mode 100644 (file)
index 0000000..e0aa82b
--- /dev/null
@@ -0,0 +1,41 @@
+From 1d910501dec4801d5abe214b8aa23a130b4568a7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 May 2024 13:01:11 +1000
+Subject: selftests: cachestat: Fix build warnings on ppc64
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Michael Ellerman <mpe@ellerman.id.au>
+
+[ Upstream commit bc4d5f5d2debf8bb65fba188313481549ead8576 ]
+
+Fix warnings like:
+  test_cachestat.c: In function â€˜print_cachestat’:
+  test_cachestat.c:30:38: warning: format â€˜%llu’ expects argument of
+  type â€˜long long unsigned int’, but argument 2 has type â€˜__u64’ {aka
+  â€˜long unsigned int’} [-Wformat=]
+
+By switching to unsigned long long for u64 for ppc64 builds.
+
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/cachestat/test_cachestat.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tools/testing/selftests/cachestat/test_cachestat.c b/tools/testing/selftests/cachestat/test_cachestat.c
+index b171fd53b004e..632ab44737ec3 100644
+--- a/tools/testing/selftests/cachestat/test_cachestat.c
++++ b/tools/testing/selftests/cachestat/test_cachestat.c
+@@ -1,5 +1,6 @@
+ // SPDX-License-Identifier: GPL-2.0
+ #define _GNU_SOURCE
++#define __SANE_USERSPACE_TYPES__ // Use ll64
+ #include <stdio.h>
+ #include <stdbool.h>
+-- 
+2.43.0
+
diff --git a/queue-6.9/selftests-futex-pass-_gnu_source-without-a-value-to-.patch b/queue-6.9/selftests-futex-pass-_gnu_source-without-a-value-to-.patch
new file mode 100644 (file)
index 0000000..21082f7
--- /dev/null
@@ -0,0 +1,53 @@
+From f19d252de50b13b840135194af6a6f1c5e645961 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 28 May 2024 19:29:38 -0700
+Subject: selftests/futex: pass _GNU_SOURCE without a value to the compiler
+
+From: John Hubbard <jhubbard@nvidia.com>
+
+[ Upstream commit cb708ab9f584f159798b60853edcf0c8b67ce295 ]
+
+It's slightly better to set _GNU_SOURCE in the source code, but if one
+must do it via the compiler invocation, then the best way to do so is
+this:
+
+    $(CC) -D_GNU_SOURCE=
+
+...because otherwise, if this form is used:
+
+    $(CC) -D_GNU_SOURCE
+
+...then that leads the compiler to set a value, as if you had passed in:
+
+    $(CC) -D_GNU_SOURCE=1
+
+That, in turn, leads to warnings under both gcc and clang, like this:
+
+    futex_requeue_pi.c:20: warning: "_GNU_SOURCE" redefined
+
+Fix this by using the "-D_GNU_SOURCE=" form.
+
+Reviewed-by: Edward Liaw <edliaw@google.com>
+Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
+Signed-off-by: John Hubbard <jhubbard@nvidia.com>
+Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/futex/functional/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/testing/selftests/futex/functional/Makefile b/tools/testing/selftests/futex/functional/Makefile
+index a392d0917b4e5..994fa3468f170 100644
+--- a/tools/testing/selftests/futex/functional/Makefile
++++ b/tools/testing/selftests/futex/functional/Makefile
+@@ -1,6 +1,6 @@
+ # SPDX-License-Identifier: GPL-2.0
+ INCLUDES := -I../include -I../../ $(KHDR_INCLUDES)
+-CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE -pthread $(INCLUDES) $(KHDR_INCLUDES)
++CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE= -pthread $(INCLUDES) $(KHDR_INCLUDES)
+ LDLIBS := -lpthread -lrt
+ LOCAL_HDRS := \
+-- 
+2.43.0
+
diff --git a/queue-6.9/selftests-openat2-fix-build-warnings-on-ppc64.patch b/queue-6.9/selftests-openat2-fix-build-warnings-on-ppc64.patch
new file mode 100644 (file)
index 0000000..fe79bb0
--- /dev/null
@@ -0,0 +1,44 @@
+From e1ba04ba448a736237b0aa06cef8d051862984aa Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 May 2024 13:03:25 +1000
+Subject: selftests/openat2: Fix build warnings on ppc64
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Michael Ellerman <mpe@ellerman.id.au>
+
+[ Upstream commit 84b6df4c49a1cc2854a16937acd5fd3e6315d083 ]
+
+Fix warnings like:
+
+  openat2_test.c: In function â€˜test_openat2_flags’:
+  openat2_test.c:303:73: warning: format â€˜%llX’ expects argument of type
+  â€˜long long unsigned int’, but argument 5 has type â€˜__u64’ {aka â€˜long
+  unsigned int’} [-Wformat=]
+
+By switching to unsigned long long for u64 for ppc64 builds.
+
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
+Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/openat2/openat2_test.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tools/testing/selftests/openat2/openat2_test.c b/tools/testing/selftests/openat2/openat2_test.c
+index 9024754530b23..5790ab446527f 100644
+--- a/tools/testing/selftests/openat2/openat2_test.c
++++ b/tools/testing/selftests/openat2/openat2_test.c
+@@ -5,6 +5,7 @@
+  */
+ #define _GNU_SOURCE
++#define __SANE_USERSPACE_TYPES__ // Use ll64
+ #include <fcntl.h>
+ #include <sched.h>
+ #include <sys/stat.h>
+-- 
+2.43.0
+
diff --git a/queue-6.9/selftests-openvswitch-set-value-to-nla-flags.patch b/queue-6.9/selftests-openvswitch-set-value-to-nla-flags.patch
new file mode 100644 (file)
index 0000000..e69be53
--- /dev/null
@@ -0,0 +1,71 @@
+From d2a3cdd9c8e55e345445bc1ffbc748a303ae5f97 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 18 Jun 2024 09:29:21 +0200
+Subject: selftests: openvswitch: Set value to nla flags.
+
+From: Adrian Moreno <amorenoz@redhat.com>
+
+[ Upstream commit a8763466669d21b570b26160d0a5e0a2ee529d22 ]
+
+Netlink flags, although they don't have payload at the netlink level,
+are represented as having "True" as value in pyroute2.
+
+Without it, trying to add a flow with a flag-type action (e.g: pop_vlan)
+fails with the following traceback:
+
+Traceback (most recent call last):
+  File "[...]/ovs-dpctl.py", line 2498, in <module>
+    sys.exit(main(sys.argv))
+             ^^^^^^^^^^^^^^
+  File "[...]/ovs-dpctl.py", line 2487, in main
+    ovsflow.add_flow(rep["dpifindex"], flow)
+  File "[...]/ovs-dpctl.py", line 2136, in add_flow
+    reply = self.nlm_request(
+            ^^^^^^^^^^^^^^^^^
+  File "[...]/pyroute2/netlink/nlsocket.py", line 822, in nlm_request
+    return tuple(self._genlm_request(*argv, **kwarg))
+                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+  File "[...]/pyroute2/netlink/generic/__init__.py", line 126, in
+nlm_request
+    return tuple(super().nlm_request(*argv, **kwarg))
+           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+  File "[...]/pyroute2/netlink/nlsocket.py", line 1124, in nlm_request
+    self.put(msg, msg_type, msg_flags, msg_seq=msg_seq)
+  File "[...]/pyroute2/netlink/nlsocket.py", line 389, in put
+    self.sendto_gate(msg, addr)
+  File "[...]/pyroute2/netlink/nlsocket.py", line 1056, in sendto_gate
+    msg.encode()
+  File "[...]/pyroute2/netlink/__init__.py", line 1245, in encode
+    offset = self.encode_nlas(offset)
+             ^^^^^^^^^^^^^^^^^^^^^^^^
+  File "[...]/pyroute2/netlink/__init__.py", line 1560, in encode_nlas
+    nla_instance.setvalue(cell[1])
+  File "[...]/pyroute2/netlink/__init__.py", line 1265, in setvalue
+    nlv.setvalue(nla_tuple[1])
+                 ~~~~~~~~~^^^
+IndexError: list index out of range
+
+Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
+Acked-by: Aaron Conole <aconole@redhat.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/net/openvswitch/ovs-dpctl.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/testing/selftests/net/openvswitch/ovs-dpctl.py b/tools/testing/selftests/net/openvswitch/ovs-dpctl.py
+index 5e0e539a323d5..8b120718768ec 100644
+--- a/tools/testing/selftests/net/openvswitch/ovs-dpctl.py
++++ b/tools/testing/selftests/net/openvswitch/ovs-dpctl.py
+@@ -531,7 +531,7 @@ class ovsactions(nla):
+             for flat_act in parse_flat_map:
+                 if parse_starts_block(actstr, flat_act[0], False):
+                     actstr = actstr[len(flat_act[0]):]
+-                    self["attrs"].append([flat_act[1]])
++                    self["attrs"].append([flat_act[1], True])
+                     actstr = actstr[strspn(actstr, ", ") :]
+                     parsed = True
+-- 
+2.43.0
+
diff --git a/queue-6.9/selftests-overlayfs-fix-build-error-on-ppc64.patch b/queue-6.9/selftests-overlayfs-fix-build-error-on-ppc64.patch
new file mode 100644 (file)
index 0000000..f03b2ef
--- /dev/null
@@ -0,0 +1,41 @@
+From 11c1b72dbd805d108f1081cb0b5174a392a1094c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 May 2024 12:26:16 +1000
+Subject: selftests/overlayfs: Fix build error on ppc64
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Michael Ellerman <mpe@ellerman.id.au>
+
+[ Upstream commit e8b8c5264d4ebd248f60a5cef077fe615806e7a0 ]
+
+Fix build error on ppc64:
+  dev_in_maps.c: In function â€˜get_file_dev_and_inode’:
+  dev_in_maps.c:60:59: error: format â€˜%llu’ expects argument of type
+  â€˜long long unsigned int *’, but argument 7 has type â€˜__u64 *’ {aka â€˜long
+  unsigned int *’} [-Werror=format=]
+
+By switching to unsigned long long for u64 for ppc64 builds.
+
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c b/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c
+index 759f86e7d263e..2862aae58b79a 100644
+--- a/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c
++++ b/tools/testing/selftests/filesystems/overlayfs/dev_in_maps.c
+@@ -1,5 +1,6 @@
+ // SPDX-License-Identifier: GPL-2.0
+ #define _GNU_SOURCE
++#define __SANE_USERSPACE_TYPES__ // Use ll64
+ #include <inttypes.h>
+ #include <unistd.h>
+-- 
+2.43.0
+
diff --git a/queue-6.9/selftests-vdso-fix-clang-build-errors-and-warnings.patch b/queue-6.9/selftests-vdso-fix-clang-build-errors-and-warnings.patch
new file mode 100644 (file)
index 0000000..aeceb28
--- /dev/null
@@ -0,0 +1,123 @@
+From 934632be3f70dca8288bf6aa36d79019c0794e06 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 5 Jul 2024 09:57:34 -1000
+Subject: selftests/vDSO: fix clang build errors and warnings
+
+From: John Hubbard <jhubbard@nvidia.com>
+
+[ Upstream commit 73810cd45b99c6c418e1c6a487b52c1e74edb20d ]
+
+When building with clang, via:
+
+    make LLVM=1 -C tools/testing/selftests
+
+...there are several warnings, and an error. This fixes all of those and
+allows these tests to run and pass.
+
+1. Fix linker error (undefined reference to memcpy) by providing a local
+   version of memcpy.
+
+2. clang complains about using this form:
+
+    if (g = h & 0xf0000000)
+
+...so factor out the assignment into a separate step.
+
+3. The code is passing a signed const char* to elf_hash(), which expects
+   a const unsigned char *. There are several callers, so fix this at
+   the source by allowing the function to accept a signed argument, and
+   then converting to unsigned operations, once inside the function.
+
+4. clang doesn't have __attribute__((externally_visible)) and generates
+   a warning to that effect. Fortunately, gcc 12 and gcc 13 do not seem
+   to require that attribute in order to build, run and pass tests here,
+   so remove it.
+
+Reviewed-by: Carlos Llamas <cmllamas@google.com>
+Reviewed-by: Edward Liaw <edliaw@google.com>
+Reviewed-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
+Tested-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
+Signed-off-by: John Hubbard <jhubbard@nvidia.com>
+Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/vDSO/parse_vdso.c      | 16 +++++++++++-----
+ .../selftests/vDSO/vdso_standalone_test_x86.c  | 18 ++++++++++++++++--
+ 2 files changed, 27 insertions(+), 7 deletions(-)
+
+diff --git a/tools/testing/selftests/vDSO/parse_vdso.c b/tools/testing/selftests/vDSO/parse_vdso.c
+index 413f75620a35b..4ae417372e9eb 100644
+--- a/tools/testing/selftests/vDSO/parse_vdso.c
++++ b/tools/testing/selftests/vDSO/parse_vdso.c
+@@ -55,14 +55,20 @@ static struct vdso_info
+       ELF(Verdef) *verdef;
+ } vdso_info;
+-/* Straight from the ELF specification. */
+-static unsigned long elf_hash(const unsigned char *name)
++/*
++ * Straight from the ELF specification...and then tweaked slightly, in order to
++ * avoid a few clang warnings.
++ */
++static unsigned long elf_hash(const char *name)
+ {
+       unsigned long h = 0, g;
+-      while (*name)
++      const unsigned char *uch_name = (const unsigned char *)name;
++
++      while (*uch_name)
+       {
+-              h = (h << 4) + *name++;
+-              if (g = h & 0xf0000000)
++              h = (h << 4) + *uch_name++;
++              g = h & 0xf0000000;
++              if (g)
+                       h ^= g >> 24;
+               h &= ~g;
+       }
+diff --git a/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c b/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c
+index 8a44ff973ee17..27f6fdf119691 100644
+--- a/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c
++++ b/tools/testing/selftests/vDSO/vdso_standalone_test_x86.c
+@@ -18,7 +18,7 @@
+ #include "parse_vdso.h"
+-/* We need a libc functions... */
++/* We need some libc functions... */
+ int strcmp(const char *a, const char *b)
+ {
+       /* This implementation is buggy: it never returns -1. */
+@@ -34,6 +34,20 @@ int strcmp(const char *a, const char *b)
+       return 0;
+ }
++/*
++ * The clang build needs this, although gcc does not.
++ * Stolen from lib/string.c.
++ */
++void *memcpy(void *dest, const void *src, size_t count)
++{
++      char *tmp = dest;
++      const char *s = src;
++
++      while (count--)
++              *tmp++ = *s++;
++      return dest;
++}
++
+ /* ...and two syscalls.  This is x86-specific. */
+ static inline long x86_syscall3(long nr, long a0, long a1, long a2)
+ {
+@@ -70,7 +84,7 @@ void to_base10(char *lastdig, time_t n)
+       }
+ }
+-__attribute__((externally_visible)) void c_main(void **stack)
++void c_main(void **stack)
+ {
+       /* Parse the stack */
+       long argc = (long)*stack;
+-- 
+2.43.0
+
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..94a46a4634d6387518208976a75861f200c9d08d 100644 (file)
@@ -0,0 +1,152 @@
+scsi-core-alua-i-o-errors-for-alua-state-transitions.patch
+scsi-sr-fix-unintentional-arithmetic-wraparound.patch
+scsi-qedf-don-t-process-stag-work-during-unload-and-.patch
+scsi-qedf-wait-for-stag-work-during-unload.patch
+scsi-qedf-set-qed_slowpath_params-to-zero-before-use.patch
+efi-libstub-zboot.lds-discard-.discard-sections.patch
+acpi-ec-abort-address-space-access-upon-error.patch
+acpi-ec-avoid-returning-ae_ok-on-errors-in-address-s.patch
+btrfs-ensure-fast-fsync-waits-for-ordered-extents-af.patch
+tools-power-cpupower-fix-pstate-frequency-reporting-.patch
+pnp-hide-pnp_bus_type-from-the-non-pnp-code.patch
+acpi-ac-properly-notify-powermanagement-core-about-c.patch
+wifi-mac80211-mesh-init-nonpeer_pm-to-active-by-defa.patch
+wifi-mac80211-apply-mcast-rate-only-if-interface-is-.patch
+wifi-mac80211-handle-tasklet-frames-before-stopping.patch
+wifi-cfg80211-fix-6-ghz-scan-request-building.patch
+wifi-iwlwifi-mvm-d3-fix-wowlan-command-version-looku.patch
+wifi-iwlwifi-mvm-remove-stale-sta-link-data-during-r.patch
+wifi-iwlwifi-mvm-handle-bigtk-cipher-in-kek_kck-cmd.patch
+wifi-iwlwifi-mvm-handle-ba-session-teardown-in-rf-ki.patch
+wifi-iwlwifi-mvm-properly-set-6-ghz-channel-direct-p.patch
+wifi-iwlwifi-mvm-fix-scan-abort-handling-with-hw-rfk.patch
+wifi-mac80211-fix-ubsan-noise-in-ieee80211_prep_hw_s.patch
+selftests-cachestat-fix-build-warnings-on-ppc64.patch
+selftests-openat2-fix-build-warnings-on-ppc64.patch
+selftests-overlayfs-fix-build-error-on-ppc64.patch
+selftests-futex-pass-_gnu_source-without-a-value-to-.patch
+of-irq-factor-out-parsing-of-interrupt-map-parent-ph.patch
+nvme-fabrics-use-reserved-tag-for-reg-read-write-com.patch
+loongarch-fix-gmac-s-phy-mode-definitions-in-dts.patch
+input-silead-always-support-10-fingers.patch
+platform-x86-amd-hsmp-check-hsmp-support-on-amd-fami.patch
+net-ipv6-rpl_iptunnel-block-bh-in-rpl_output-and-rpl.patch
+ila-block-bh-in-ila_output.patch
+io_uring-fix-possible-deadlock-in-io_register_iowq_m.patch
+arm64-armv8_deprecated-fix-warning-in-isndep-cpuhp-s.patch
+drm-amdgpu-pptable-fix-ubsan-array-index-out-of-boun.patch
+null_blk-fix-validation-of-block-size.patch
+kconfig-gconf-give-a-proper-initial-state-to-the-sav.patch
+kconfig-remove-wrong-expr_trans_bool.patch
+input-add-event-code-for-accessibility-key.patch
+input-add-support-for-do-not-disturb.patch
+hid-ignore-battery-for-elan-touchscreens-2f2c-and-41.patch
+nfsv4-fix-memory-leak-in-nfs4_set_security_label.patch
+nfs-propagate-readlink-errors-in-nfs_symlink_filler.patch
+nfs-avoid-flushing-many-pages-with-nfs_file_sync.patch
+nfs-don-t-invalidate-dentries-on-transient-errors.patch
+cachefiles-add-consistency-check-for-copen-cread.patch
+cachefiles-set-object-to-close-if-ondemand_id-0-in-c.patch
+cachefiles-make-on-demand-read-killable.patch
+fs-file-fix-the-check-in-find_next_fd.patch
+vfio-create-vfio_fs_type-with-inode-per-device.patch
+vfio-pci-use-unmap_mapping_range.patch
+mei-demote-client-disconnect-warning-on-suspend-to-d.patch
+parport-amiga-mark-driver-struct-with-__refdata-to-p.patch
+iomap-fix-iomap_adjust_read_range-for-plen-calculati.patch
+drm-exynos-dp-drop-driver-owner-initialization.patch
+drm-panel-orientation-quirks-add-quirk-for-aya-neo-k.patch
+drm-renesas-shmobile-call-drm_atomic_helper_shutdown.patch
+drm-mediatek-call-drm_atomic_helper_shutdown-at-shut.patch
+nvme-avoid-double-free-special-payload.patch
+nvmet-always-initialize-cqe.result.patch
+vfio-pci-insert-full-vma-on-mmap-d-mmio-fault.patch
+loop-disable-fallocate-zero-and-discard-if-not-suppo.patch
+alsa-hda-cs35l56-fix-lifecycle-of-codec-pointer.patch
+wifi-cfg80211-wext-add-extra-siocsiwscan-data-check.patch
+alsa-hda-cs35l41-support-lenovo-thinkbook-16p-gen-5.patch
+alsa-hda-cs35l41-support-lenovo-thinkbook-13x-gen-4.patch
+alsa-hda-realtek-support-lenovo-thinkbook-16p-gen-5.patch
+alsa-hda-realtek-support-lenovo-thinkbook-13x-gen-4.patch
+wifi-mac80211-avoid-address-calculations-via-out-of-.patch
+kvm-ppc-book3s-hv-prevent-uaf-in-kvm_spapr_tce_attac.patch
+drm-vmwgfx-fix-missing-hypervisor_guest-dependency.patch
+alsa-hda-realtek-add-more-codec-id-to-no-shutup-pins.patch
+spi-fix-octal-mode-support.patch
+cpumask-limit-force_nr_cpus-to-just-the-up-case.patch
+selftests-openvswitch-set-value-to-nla-flags.patch
+drm-amdgpu-indicate-cu-havest-info-to-cp.patch
+drm-amd-display-change-dram_clock_latency-to-34us-fo.patch
+drm-amd-display-change-dram_clock_latency-to-34us-fo.patch-18657
+drm-amdgpu-init-ta-fw-for-psp-v14.patch
+alsa-hda-cs35l56-select-serial_multi_instantiate.patch
+mips-fix-compat_sys_lseek-syscall.patch
+closures-change-bug_on-to-warn_on.patch
+workqueue-refactor-worker-id-formatting-and-make-wq_.patch
+input-elantech-fix-touchpad-state-on-resume-for-leno.patch
+input-i8042-add-ayaneo-kun-to-i8042-quirk-table.patch
+asoc-rt722-sdca-sdw-add-silence-detection-register-a.patch
+asoc-codecs-es8326-solve-headphone-detection-issue.patch
+input-xpad-add-support-for-asus-rog-raikiri-pro.patch
+asoc-topology-fix-references-to-freed-memory.patch
+asoc-intel-avs-fix-route-override.patch
+asoc-topology-do-not-assign-fields-that-are-already-.patch
+bytcr_rt5640-inverse-jack-detect-for-archos-101-cesi.patch
+alsa-dmaengine-synchronize-dma-channel-after-drop.patch
+asoc-ti-davinci-mcasp-set-min-period-size-using-fifo.patch
+asoc-ti-omap-hdmi-fix-too-long-driver-name.patch
+asoc-sof-sof-audio-skip-unprepare-for-in-use-widgets.patch
+asoc-rt722-sdca-sdw-add-debounce-time-for-type-detec.patch
+asoc-cs35l56-disconnect-asp1-tx-sources-when-asp1-da.patch
+nvme-fix-nvme_ns_deac-may-incorrectly-identifying-th.patch
+input-ads7846-use-spi_device_id-table.patch
+can-kvaser_usb-fix-return-value-for-hif_usb_send_reg.patch
+net-mvpp2-fill-in-dev_port-attribute.patch
+gpio-pca953x-fix-pca953x_irq_bus_sync_unlock-race.patch
+octeontx2-pf-fix-coverity-and-klockwork-issues-in-oc.patch
+s390-sclp-fix-sclp_init-cleanup-on-failure.patch
+platform-mellanox-nvsw-sn2201-add-check-for-platform.patch
+platform-x86-wireless-hotkey-add-support-for-lg-airp.patch
+platform-x86-lg-laptop-remove-lgex0815-hotkey-handli.patch
+platform-x86-lg-laptop-change-acpi-device-id.patch
+platform-x86-lg-laptop-use-acpi-device-handle-when-e.patch
+btrfs-scrub-handle-rst-lookup-error-correctly.patch
+btrfs-qgroup-fix-quota-root-leak-after-quota-disable.patch
+ibmvnic-add-tx-check-to-prevent-skb-leak.patch
+alsa-pcm-allow-resume-only-for-suspended-streams.patch
+alsa-hda-relatek-enable-mute-led-on-hp-laptop-15-gw0.patch
+alsa-dmaengine_pcm-terminate-dmaengine-before-synchr.patch
+drm-amd-swsmu-add-mall-init-support-workaround-for-s.patch
+asoc-amd-yc-fix-non-functional-mic-on-asus-m5602ra.patch
+net-usb-qmi_wwan-add-telit-fn912-compositions.patch
+clk-qcom-apss-ipq-pll-remove-config_ctl_hi_val-from-.patch
+net-mac802154-fix-racy-device-stats-updates-by-dev_s.patch
+powerpc-pseries-whitelist-dtl-slub-object-for-copyin.patch
+powerpc-eeh-avoid-possible-crash-when-edev-pdev-chan.patch
+scsi-libsas-fix-exp-attached-device-scan-after-probe.patch
+tee-optee-ffa-fix-missing-field-initializers-warning.patch
+bluetooth-hci_core-cancel-all-works-upon-hci_unregis.patch
+bluetooth-btnxpuart-enable-power-save-feature-on-sta.patch
+bluetooth-l2cap-sync-sock-recv-cb-and-release.patch
+erofs-ensure-m_llen-is-reset-to-0-if-metadata-is-inv.patch
+drm-amd-display-add-refresh-rate-range-check.patch
+drm-amd-display-account-for-cursor-prefetch-bw-in-dm.patch
+drm-amd-display-fix-refresh-rate-range-for-some-pane.patch
+drm-amd-display-update-efficiency-bandwidth-for-dcn3.patch
+drm-amd-display-fix-array-index-out-of-bounds-in-dml.patch
+drm-radeon-check-bo_va-bo-is-non-null-before-using-i.patch
+btrfs-fix-uninitialized-return-value-in-the-ref-veri.patch
+fs-better-handle-deep-ancestor-chains-in-is_subdir.patch
+wifi-iwlwifi-properly-set-wiphy_flag_supports_ext_ke.patch
+drivers-perf-riscv-reset-the-counter-to-hpmevent-map.patch
+riscv-stacktrace-fix-usage-of-ftrace_graph_ret_addr.patch
+spi-imx-don-t-expect-dma-for-i.mx-25-35-50-51-53-csp.patch
+spi-davinci-unset-powerdown-bit-when-releasing-resou.patch
+ksmbd-return-file_device_disk-instead-of-super-magic.patch
+asoc-sof-intel-hda-pcm-limit-the-maximum-number-of-p.patch
+selftest-timerns-fix-clang-build-failures-for-abs-ca.patch
+selftests-vdso-fix-clang-build-errors-and-warnings.patch
+hfsplus-fix-uninit-value-in-copy_name.patch
+selftests-bpf-extend-tcx-tests-to-cover-late-tcx_ent.patch
+spi-mux-set-ctlr-bits_per_word_mask.patch
+alsa-hda-use-imply-for-suggesting-config_serial_mult.patch
diff --git a/queue-6.9/spi-davinci-unset-powerdown-bit-when-releasing-resou.patch b/queue-6.9/spi-davinci-unset-powerdown-bit-when-releasing-resou.patch
new file mode 100644 (file)
index 0000000..40632ce
--- /dev/null
@@ -0,0 +1,55 @@
+From 068f6dda9789b0c804e5456ec56e897c033d4d85 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 24 Jun 2024 09:17:45 +0200
+Subject: spi: davinci: Unset POWERDOWN bit when releasing resources
+
+From: Bastien Curutchet <bastien.curutchet@bootlin.com>
+
+[ Upstream commit 1762dc01fc78ef5f19693e9317eae7491c6c7e1b ]
+
+On the OMAPL138, the SPI reference clock is provided by the Power and
+Sleep Controller (PSC). The PSC's datasheet says that 'some peripherals
+have special programming requirements and additional recommended steps
+you must take before you can invoke the PSC module state transition'. I
+didn't find more details in documentation but it appears that PSC needs
+the SPI to clear the POWERDOWN bit before disabling the clock. Indeed,
+when this bit is set, the PSC gets stuck in transitions from enable to
+disable state.
+
+Clear the POWERDOWN bit when releasing driver's resources
+
+Signed-off-by: Bastien Curutchet <bastien.curutchet@bootlin.com>
+Link: https://patch.msgid.link/20240624071745.17409-1-bastien.curutchet@bootlin.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-davinci.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c
+index be3998104bfbb..f7e8b5efa50e5 100644
+--- a/drivers/spi/spi-davinci.c
++++ b/drivers/spi/spi-davinci.c
+@@ -984,6 +984,9 @@ static int davinci_spi_probe(struct platform_device *pdev)
+       return ret;
+ free_dma:
++      /* This bit needs to be cleared to disable dpsi->clk */
++      clear_io_bits(dspi->base + SPIGCR1, SPIGCR1_POWERDOWN_MASK);
++
+       if (dspi->dma_rx) {
+               dma_release_channel(dspi->dma_rx);
+               dma_release_channel(dspi->dma_tx);
+@@ -1013,6 +1016,9 @@ static void davinci_spi_remove(struct platform_device *pdev)
+       spi_bitbang_stop(&dspi->bitbang);
++      /* This bit needs to be cleared to disable dpsi->clk */
++      clear_io_bits(dspi->base + SPIGCR1, SPIGCR1_POWERDOWN_MASK);
++
+       if (dspi->dma_rx) {
+               dma_release_channel(dspi->dma_rx);
+               dma_release_channel(dspi->dma_tx);
+-- 
+2.43.0
+
diff --git a/queue-6.9/spi-fix-octal-mode-support.patch b/queue-6.9/spi-fix-octal-mode-support.patch
new file mode 100644 (file)
index 0000000..9e352b0
--- /dev/null
@@ -0,0 +1,68 @@
+From 64ed80ce43ab28356af99b98439a77f9102963f4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 18 Jun 2024 15:29:51 +0200
+Subject: spi: Fix OCTAL mode support
+
+From: Patrice Chotard <patrice.chotard@foss.st.com>
+
+[ Upstream commit d6a711a898672dd873aab3844f754a3ca40723a5 ]
+
+Add OCTAL mode support.
+Issue detected using "--octal" spidev_test's option.
+
+Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
+Link: https://msgid.link/r/20240618132951.2743935-4-patrice.chotard@foss.st.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi.c       | 6 ++++--
+ include/linux/spi/spi.h | 5 +++--
+ 2 files changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
+index 9304fd03bf764..fcc39523d6857 100644
+--- a/drivers/spi/spi.c
++++ b/drivers/spi/spi.c
+@@ -4152,7 +4152,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
+                               return -EINVAL;
+                       if (xfer->tx_nbits != SPI_NBITS_SINGLE &&
+                               xfer->tx_nbits != SPI_NBITS_DUAL &&
+-                              xfer->tx_nbits != SPI_NBITS_QUAD)
++                              xfer->tx_nbits != SPI_NBITS_QUAD &&
++                              xfer->tx_nbits != SPI_NBITS_OCTAL)
+                               return -EINVAL;
+                       if ((xfer->tx_nbits == SPI_NBITS_DUAL) &&
+                               !(spi->mode & (SPI_TX_DUAL | SPI_TX_QUAD)))
+@@ -4167,7 +4168,8 @@ static int __spi_validate(struct spi_device *spi, struct spi_message *message)
+                               return -EINVAL;
+                       if (xfer->rx_nbits != SPI_NBITS_SINGLE &&
+                               xfer->rx_nbits != SPI_NBITS_DUAL &&
+-                              xfer->rx_nbits != SPI_NBITS_QUAD)
++                              xfer->rx_nbits != SPI_NBITS_QUAD &&
++                              xfer->rx_nbits != SPI_NBITS_OCTAL)
+                               return -EINVAL;
+                       if ((xfer->rx_nbits == SPI_NBITS_DUAL) &&
+                               !(spi->mode & (SPI_RX_DUAL | SPI_RX_QUAD)))
+diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
+index 64a4deb18dd00..afe6631da1bc6 100644
+--- a/include/linux/spi/spi.h
++++ b/include/linux/spi/spi.h
+@@ -1089,12 +1089,13 @@ struct spi_transfer {
+       unsigned        dummy_data:1;
+       unsigned        cs_off:1;
+       unsigned        cs_change:1;
+-      unsigned        tx_nbits:3;
+-      unsigned        rx_nbits:3;
++      unsigned        tx_nbits:4;
++      unsigned        rx_nbits:4;
+       unsigned        timestamped:1;
+ #define       SPI_NBITS_SINGLE        0x01 /* 1-bit transfer */
+ #define       SPI_NBITS_DUAL          0x02 /* 2-bit transfer */
+ #define       SPI_NBITS_QUAD          0x04 /* 4-bit transfer */
++#define       SPI_NBITS_OCTAL 0x08 /* 8-bit transfer */
+       u8              bits_per_word;
+       struct spi_delay        delay;
+       struct spi_delay        cs_change_delay;
+-- 
+2.43.0
+
diff --git a/queue-6.9/spi-imx-don-t-expect-dma-for-i.mx-25-35-50-51-53-csp.patch b/queue-6.9/spi-imx-don-t-expect-dma-for-i.mx-25-35-50-51-53-csp.patch
new file mode 100644 (file)
index 0000000..b42f628
--- /dev/null
@@ -0,0 +1,50 @@
+From 467c3f7d549a1a334445a9041909c4dc9ccd31cc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 8 May 2024 11:56:10 +0200
+Subject: spi: imx: Don't expect DMA for i.MX{25,35,50,51,53} cspi devices
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+
+[ Upstream commit ce1dac560a74220f2e53845ec0723b562288aed4 ]
+
+While in commit 2dd33f9cec90 ("spi: imx: support DMA for imx35") it was
+claimed that DMA works on i.MX25, i.MX31 and i.MX35 the respective
+device trees don't add DMA channels. The Reference manuals of i.MX31 and
+i.MX25 also don't mention the CSPI core being DMA capable. (I didn't
+check the others.)
+
+Since commit e267a5b3ec59 ("spi: spi-imx: Use dev_err_probe for failed
+DMA channel requests") this results in an error message
+
+       spi_imx 43fa4000.spi: error -ENODEV: can't get the TX DMA channel!
+
+during boot. However that isn't fatal and the driver gets loaded just
+fine, just without using DMA.
+
+Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
+Link: https://patch.msgid.link/20240508095610.2146640-2-u.kleine-koenig@pengutronix.de
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-imx.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/spi/spi-imx.c b/drivers/spi/spi-imx.c
+index 09b6c1b45f1a1..09c676e50fe0e 100644
+--- a/drivers/spi/spi-imx.c
++++ b/drivers/spi/spi-imx.c
+@@ -1050,7 +1050,7 @@ static struct spi_imx_devtype_data imx35_cspi_devtype_data = {
+       .rx_available = mx31_rx_available,
+       .reset = mx31_reset,
+       .fifo_size = 8,
+-      .has_dmamode = true,
++      .has_dmamode = false,
+       .dynamic_burst = false,
+       .has_targetmode = false,
+       .devtype = IMX35_CSPI,
+-- 
+2.43.0
+
diff --git a/queue-6.9/spi-mux-set-ctlr-bits_per_word_mask.patch b/queue-6.9/spi-mux-set-ctlr-bits_per_word_mask.patch
new file mode 100644 (file)
index 0000000..166e6b3
--- /dev/null
@@ -0,0 +1,36 @@
+From 30742b45b00017a84994bcc4219825b4fae4650a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 8 Jul 2024 20:05:30 -0500
+Subject: spi: mux: set ctlr->bits_per_word_mask
+
+From: David Lechner <dlechner@baylibre.com>
+
+[ Upstream commit c8bd922d924bb4ab6c6c488310157d1a27996f31 ]
+
+Like other SPI controller flags, bits_per_word_mask may be used by a
+peripheral driver, so it needs to reflect the capabilities of the
+underlying controller.
+
+Signed-off-by: David Lechner <dlechner@baylibre.com>
+Link: https://patch.msgid.link/20240708-spi-mux-fix-v1-3-6c8845193128@baylibre.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/spi/spi-mux.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/spi/spi-mux.c b/drivers/spi/spi-mux.c
+index 031b5795d1060..a8bb07b38ec64 100644
+--- a/drivers/spi/spi-mux.c
++++ b/drivers/spi/spi-mux.c
+@@ -156,6 +156,7 @@ static int spi_mux_probe(struct spi_device *spi)
+       /* supported modes are the same as our parent's */
+       ctlr->mode_bits = spi->controller->mode_bits;
+       ctlr->flags = spi->controller->flags;
++      ctlr->bits_per_word_mask = spi->controller->bits_per_word_mask;
+       ctlr->transfer_one_message = spi_mux_transfer_one_message;
+       ctlr->setup = spi_mux_setup;
+       ctlr->num_chipselect = mux_control_states(priv->mux);
+-- 
+2.43.0
+
diff --git a/queue-6.9/tee-optee-ffa-fix-missing-field-initializers-warning.patch b/queue-6.9/tee-optee-ffa-fix-missing-field-initializers-warning.patch
new file mode 100644 (file)
index 0000000..ac6c9be
--- /dev/null
@@ -0,0 +1,63 @@
+From b1e37f0c6fd39cc3ed82cf11126681b0ebe1f68d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 27 Jun 2024 14:59:09 +0800
+Subject: tee: optee: ffa: Fix missing-field-initializers warning
+
+From: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
+
+[ Upstream commit e0556255a53d6d3d406a28362dffd972018a997c ]
+
+The 'missing-field-initializers' warning was reported
+when building with W=2.
+This patch use designated initializers for
+'struct ffa_send_direct_data' to suppress the warning
+and clarify the initialization intent.
+
+Signed-off-by: ming-jen.chang <ming-jen.chang@mediatek.com>
+Signed-off-by: Mark-PK Tsai <mark-pk.tsai@mediatek.com>
+Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/tee/optee/ffa_abi.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c
+index ecb5eb079408e..c5a3e25c55dab 100644
+--- a/drivers/tee/optee/ffa_abi.c
++++ b/drivers/tee/optee/ffa_abi.c
+@@ -660,7 +660,9 @@ static bool optee_ffa_api_is_compatbile(struct ffa_device *ffa_dev,
+                                       const struct ffa_ops *ops)
+ {
+       const struct ffa_msg_ops *msg_ops = ops->msg_ops;
+-      struct ffa_send_direct_data data = { OPTEE_FFA_GET_API_VERSION };
++      struct ffa_send_direct_data data = {
++              .data0 = OPTEE_FFA_GET_API_VERSION,
++      };
+       int rc;
+       msg_ops->mode_32bit_set(ffa_dev);
+@@ -677,7 +679,9 @@ static bool optee_ffa_api_is_compatbile(struct ffa_device *ffa_dev,
+               return false;
+       }
+-      data = (struct ffa_send_direct_data){ OPTEE_FFA_GET_OS_VERSION };
++      data = (struct ffa_send_direct_data){
++              .data0 = OPTEE_FFA_GET_OS_VERSION,
++      };
+       rc = msg_ops->sync_send_receive(ffa_dev, &data);
+       if (rc) {
+               pr_err("Unexpected error %d\n", rc);
+@@ -698,7 +702,9 @@ static bool optee_ffa_exchange_caps(struct ffa_device *ffa_dev,
+                                   unsigned int *rpc_param_count,
+                                   unsigned int *max_notif_value)
+ {
+-      struct ffa_send_direct_data data = { OPTEE_FFA_EXCHANGE_CAPABILITIES };
++      struct ffa_send_direct_data data = {
++              .data0 = OPTEE_FFA_EXCHANGE_CAPABILITIES,
++      };
+       int rc;
+       rc = ops->msg_ops->sync_send_receive(ffa_dev, &data);
+-- 
+2.43.0
+
diff --git a/queue-6.9/tools-power-cpupower-fix-pstate-frequency-reporting-.patch b/queue-6.9/tools-power-cpupower-fix-pstate-frequency-reporting-.patch
new file mode 100644 (file)
index 0000000..d26c483
--- /dev/null
@@ -0,0 +1,82 @@
+From d3e0c415f3a22ff5dbdc72d602f13096f3174a4d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 30 Apr 2024 14:07:06 +0530
+Subject: tools/power/cpupower: Fix Pstate frequency reporting on AMD Family
+ 1Ah CPUs
+
+From: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
+
+[ Upstream commit 43cad521c6d228ea0c51e248f8e5b3a6295a2849 ]
+
+Update cpupower's P-State frequency calculation and reporting with AMD
+Family 1Ah+ processors, when using the acpi-cpufreq driver. This is due
+to a change in the PStateDef MSR layout in AMD Family 1Ah+.
+
+Tested on 4th and 5th Gen AMD EPYC system
+
+Signed-off-by: Ananth Narayan <Ananth.Narayan@amd.com>
+Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
+Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
+Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/power/cpupower/utils/helpers/amd.c | 26 +++++++++++++++++++++---
+ 1 file changed, 23 insertions(+), 3 deletions(-)
+
+diff --git a/tools/power/cpupower/utils/helpers/amd.c b/tools/power/cpupower/utils/helpers/amd.c
+index c519cc89c97f4..0a56e22240fc8 100644
+--- a/tools/power/cpupower/utils/helpers/amd.c
++++ b/tools/power/cpupower/utils/helpers/amd.c
+@@ -41,6 +41,16 @@ union core_pstate {
+               unsigned res1:31;
+               unsigned en:1;
+       } pstatedef;
++      /* since fam 1Ah: */
++      struct {
++              unsigned fid:12;
++              unsigned res1:2;
++              unsigned vid:8;
++              unsigned iddval:8;
++              unsigned idddiv:2;
++              unsigned res2:31;
++              unsigned en:1;
++      } pstatedef2;
+       unsigned long long val;
+ };
+@@ -48,6 +58,10 @@ static int get_did(union core_pstate pstate)
+ {
+       int t;
++      /* Fam 1Ah onward do not use did */
++      if (cpupower_cpu_info.family >= 0x1A)
++              return 0;
++
+       if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATEDEF)
+               t = pstate.pstatedef.did;
+       else if (cpupower_cpu_info.family == 0x12)
+@@ -61,12 +75,18 @@ static int get_did(union core_pstate pstate)
+ static int get_cof(union core_pstate pstate)
+ {
+       int t;
+-      int fid, did, cof;
++      int fid, did, cof = 0;
+       did = get_did(pstate);
+       if (cpupower_cpu_info.caps & CPUPOWER_CAP_AMD_PSTATEDEF) {
+-              fid = pstate.pstatedef.fid;
+-              cof = 200 * fid / did;
++              if (cpupower_cpu_info.family >= 0x1A) {
++                      fid = pstate.pstatedef2.fid;
++                      if (fid > 0x0f)
++                              cof = (fid * 5);
++              } else {
++                      fid = pstate.pstatedef.fid;
++                      cof = 200 * fid / did;
++              }
+       } else {
+               t = 0x10;
+               fid = pstate.pstate.fid;
+-- 
+2.43.0
+
diff --git a/queue-6.9/vfio-create-vfio_fs_type-with-inode-per-device.patch b/queue-6.9/vfio-create-vfio_fs_type-with-inode-per-device.patch
new file mode 100644 (file)
index 0000000..12c7f38
--- /dev/null
@@ -0,0 +1,172 @@
+From 71191dfc57aa6ab3c86357538793e6c901fa93d0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 29 May 2024 22:52:30 -0600
+Subject: vfio: Create vfio_fs_type with inode per device
+
+From: Alex Williamson <alex.williamson@redhat.com>
+
+[ Upstream commit b7c5e64fecfa88764791679cca4786ac65de739e ]
+
+By linking all the device fds we provide to userspace to an
+address space through a new pseudo fs, we can use tools like
+unmap_mapping_range() to zap all vmas associated with a device.
+
+Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
+Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
+Reviewed-by: Kevin Tian <kevin.tian@intel.com>
+Link: https://lore.kernel.org/r/20240530045236.1005864-2-alex.williamson@redhat.com
+Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/vfio/device_cdev.c |  7 ++++++
+ drivers/vfio/group.c       |  7 ++++++
+ drivers/vfio/vfio_main.c   | 44 ++++++++++++++++++++++++++++++++++++++
+ include/linux/vfio.h       |  1 +
+ 4 files changed, 59 insertions(+)
+
+diff --git a/drivers/vfio/device_cdev.c b/drivers/vfio/device_cdev.c
+index e75da0a70d1f8..bb1817bd4ff31 100644
+--- a/drivers/vfio/device_cdev.c
++++ b/drivers/vfio/device_cdev.c
+@@ -39,6 +39,13 @@ int vfio_device_fops_cdev_open(struct inode *inode, struct file *filep)
+       filep->private_data = df;
++      /*
++       * Use the pseudo fs inode on the device to link all mmaps
++       * to the same address space, allowing us to unmap all vmas
++       * associated to this device using unmap_mapping_range().
++       */
++      filep->f_mapping = device->inode->i_mapping;
++
+       return 0;
+ err_put_registration:
+diff --git a/drivers/vfio/group.c b/drivers/vfio/group.c
+index 610a429c61912..ded364588d297 100644
+--- a/drivers/vfio/group.c
++++ b/drivers/vfio/group.c
+@@ -286,6 +286,13 @@ static struct file *vfio_device_open_file(struct vfio_device *device)
+        */
+       filep->f_mode |= (FMODE_PREAD | FMODE_PWRITE);
++      /*
++       * Use the pseudo fs inode on the device to link all mmaps
++       * to the same address space, allowing us to unmap all vmas
++       * associated to this device using unmap_mapping_range().
++       */
++      filep->f_mapping = device->inode->i_mapping;
++
+       if (device->group->type == VFIO_NO_IOMMU)
+               dev_warn(device->dev, "vfio-noiommu device opened by user "
+                        "(%s:%d)\n", current->comm, task_pid_nr(current));
+diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c
+index e97d796a54fba..a5a62d9d963f7 100644
+--- a/drivers/vfio/vfio_main.c
++++ b/drivers/vfio/vfio_main.c
+@@ -22,8 +22,10 @@
+ #include <linux/list.h>
+ #include <linux/miscdevice.h>
+ #include <linux/module.h>
++#include <linux/mount.h>
+ #include <linux/mutex.h>
+ #include <linux/pci.h>
++#include <linux/pseudo_fs.h>
+ #include <linux/rwsem.h>
+ #include <linux/sched.h>
+ #include <linux/slab.h>
+@@ -43,9 +45,13 @@
+ #define DRIVER_AUTHOR "Alex Williamson <alex.williamson@redhat.com>"
+ #define DRIVER_DESC   "VFIO - User Level meta-driver"
++#define VFIO_MAGIC 0x5646494f /* "VFIO" */
++
+ static struct vfio {
+       struct class                    *device_class;
+       struct ida                      device_ida;
++      struct vfsmount                 *vfs_mount;
++      int                             fs_count;
+ } vfio;
+ #ifdef CONFIG_VFIO_NOIOMMU
+@@ -186,6 +192,8 @@ static void vfio_device_release(struct device *dev)
+       if (device->ops->release)
+               device->ops->release(device);
++      iput(device->inode);
++      simple_release_fs(&vfio.vfs_mount, &vfio.fs_count);
+       kvfree(device);
+ }
+@@ -228,6 +236,34 @@ struct vfio_device *_vfio_alloc_device(size_t size, struct device *dev,
+ }
+ EXPORT_SYMBOL_GPL(_vfio_alloc_device);
++static int vfio_fs_init_fs_context(struct fs_context *fc)
++{
++      return init_pseudo(fc, VFIO_MAGIC) ? 0 : -ENOMEM;
++}
++
++static struct file_system_type vfio_fs_type = {
++      .name = "vfio",
++      .owner = THIS_MODULE,
++      .init_fs_context = vfio_fs_init_fs_context,
++      .kill_sb = kill_anon_super,
++};
++
++static struct inode *vfio_fs_inode_new(void)
++{
++      struct inode *inode;
++      int ret;
++
++      ret = simple_pin_fs(&vfio_fs_type, &vfio.vfs_mount, &vfio.fs_count);
++      if (ret)
++              return ERR_PTR(ret);
++
++      inode = alloc_anon_inode(vfio.vfs_mount->mnt_sb);
++      if (IS_ERR(inode))
++              simple_release_fs(&vfio.vfs_mount, &vfio.fs_count);
++
++      return inode;
++}
++
+ /*
+  * Initialize a vfio_device so it can be registered to vfio core.
+  */
+@@ -246,6 +282,11 @@ static int vfio_init_device(struct vfio_device *device, struct device *dev,
+       init_completion(&device->comp);
+       device->dev = dev;
+       device->ops = ops;
++      device->inode = vfio_fs_inode_new();
++      if (IS_ERR(device->inode)) {
++              ret = PTR_ERR(device->inode);
++              goto out_inode;
++      }
+       if (ops->init) {
+               ret = ops->init(device);
+@@ -260,6 +301,9 @@ static int vfio_init_device(struct vfio_device *device, struct device *dev,
+       return 0;
+ out_uninit:
++      iput(device->inode);
++      simple_release_fs(&vfio.vfs_mount, &vfio.fs_count);
++out_inode:
+       vfio_release_device_set(device);
+       ida_free(&vfio.device_ida, device->index);
+       return ret;
+diff --git a/include/linux/vfio.h b/include/linux/vfio.h
+index 8b1a298204091..000a6cab2d318 100644
+--- a/include/linux/vfio.h
++++ b/include/linux/vfio.h
+@@ -64,6 +64,7 @@ struct vfio_device {
+       struct completion comp;
+       struct iommufd_access *iommufd_access;
+       void (*put_kvm)(struct kvm *kvm);
++      struct inode *inode;
+ #if IS_ENABLED(CONFIG_IOMMUFD)
+       struct iommufd_device *iommufd_device;
+       u8 iommufd_attached:1;
+-- 
+2.43.0
+
diff --git a/queue-6.9/vfio-pci-insert-full-vma-on-mmap-d-mmio-fault.patch b/queue-6.9/vfio-pci-insert-full-vma-on-mmap-d-mmio-fault.patch
new file mode 100644 (file)
index 0000000..2e0e60b
--- /dev/null
@@ -0,0 +1,73 @@
+From e3f50b0394a1223075984ff2c664150e9a77547a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 6 Jun 2024 21:52:07 -0600
+Subject: vfio/pci: Insert full vma on mmap'd MMIO fault
+
+From: Alex Williamson <alex.williamson@redhat.com>
+
+[ Upstream commit d71a989cf5d961989c273093cdff2550acdde314 ]
+
+In order to improve performance of typical scenarios we can try to insert
+the entire vma on fault.  This accelerates typical cases, such as when
+the MMIO region is DMA mapped by QEMU.  The vfio_iommu_type1 driver will
+fault in the entire DMA mapped range through fixup_user_fault().
+
+In synthetic testing, this improves the time required to walk a PCI BAR
+mapping from userspace by roughly 1/3rd.
+
+This is likely an interim solution until vmf_insert_pfn_{pmd,pud}() gain
+support for pfnmaps.
+
+Suggested-by: Yan Zhao <yan.y.zhao@intel.com>
+Link: https://lore.kernel.org/all/Zl6XdUkt%2FzMMGOLF@yzhao56-desk.sh.intel.com/
+Reviewed-by: Yan Zhao <yan.y.zhao@intel.com>
+Link: https://lore.kernel.org/r/20240607035213.2054226-1-alex.williamson@redhat.com
+Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/vfio/pci/vfio_pci_core.c | 19 +++++++++++++++++--
+ 1 file changed, 17 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
+index 727a51ce9ad71..680b15ca4fcea 100644
+--- a/drivers/vfio/pci/vfio_pci_core.c
++++ b/drivers/vfio/pci/vfio_pci_core.c
+@@ -1659,6 +1659,7 @@ static vm_fault_t vfio_pci_mmap_fault(struct vm_fault *vmf)
+       struct vm_area_struct *vma = vmf->vma;
+       struct vfio_pci_core_device *vdev = vma->vm_private_data;
+       unsigned long pfn, pgoff = vmf->pgoff - vma->vm_pgoff;
++      unsigned long addr = vma->vm_start;
+       vm_fault_t ret = VM_FAULT_SIGBUS;
+       pfn = vma_to_pfn(vma);
+@@ -1666,11 +1667,25 @@ static vm_fault_t vfio_pci_mmap_fault(struct vm_fault *vmf)
+       down_read(&vdev->memory_lock);
+       if (vdev->pm_runtime_engaged || !__vfio_pci_memory_enabled(vdev))
+-              goto out_disabled;
++              goto out_unlock;
+       ret = vmf_insert_pfn(vma, vmf->address, pfn + pgoff);
++      if (ret & VM_FAULT_ERROR)
++              goto out_unlock;
+-out_disabled:
++      /*
++       * Pre-fault the remainder of the vma, abort further insertions and
++       * supress error if fault is encountered during pre-fault.
++       */
++      for (; addr < vma->vm_end; addr += PAGE_SIZE, pfn++) {
++              if (addr == vmf->address)
++                      continue;
++
++              if (vmf_insert_pfn(vma, addr, pfn) & VM_FAULT_ERROR)
++                      break;
++      }
++
++out_unlock:
+       up_read(&vdev->memory_lock);
+       return ret;
+-- 
+2.43.0
+
diff --git a/queue-6.9/vfio-pci-use-unmap_mapping_range.patch b/queue-6.9/vfio-pci-use-unmap_mapping_range.patch
new file mode 100644 (file)
index 0000000..5dad949
--- /dev/null
@@ -0,0 +1,446 @@
+From a4ab0ae6619d9c3bb2a925b2483f1f5997e35a13 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 29 May 2024 22:52:31 -0600
+Subject: vfio/pci: Use unmap_mapping_range()
+
+From: Alex Williamson <alex.williamson@redhat.com>
+
+[ Upstream commit aac6db75a9fc2c7a6f73e152df8f15101dda38e6 ]
+
+With the vfio device fd tied to the address space of the pseudo fs
+inode, we can use the mm to track all vmas that might be mmap'ing
+device BARs, which removes our vma_list and all the complicated lock
+ordering necessary to manually zap each related vma.
+
+Note that we can no longer store the pfn in vm_pgoff if we want to use
+unmap_mapping_range() to zap a selective portion of the device fd
+corresponding to BAR mappings.
+
+This also converts our mmap fault handler to use vmf_insert_pfn()
+because we no longer have a vma_list to avoid the concurrency problem
+with io_remap_pfn_range().  The goal is to eventually use the vm_ops
+huge_fault handler to avoid the additional faulting overhead, but
+vmf_insert_pfn_{pmd,pud}() need to learn about pfnmaps first.
+
+Also, Jason notes that a race exists between unmap_mapping_range() and
+the fops mmap callback if we were to call io_remap_pfn_range() to
+populate the vma on mmap.  Specifically, mmap_region() does call_mmap()
+before it does vma_link_file() which gives a window where the vma is
+populated but invisible to unmap_mapping_range().
+
+Suggested-by: Jason Gunthorpe <jgg@nvidia.com>
+Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
+Reviewed-by: Kevin Tian <kevin.tian@intel.com>
+Link: https://lore.kernel.org/r/20240530045236.1005864-3-alex.williamson@redhat.com
+Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/vfio/pci/vfio_pci_core.c | 264 +++++++------------------------
+ include/linux/vfio_pci_core.h    |   2 -
+ 2 files changed, 55 insertions(+), 211 deletions(-)
+
+diff --git a/drivers/vfio/pci/vfio_pci_core.c b/drivers/vfio/pci/vfio_pci_core.c
+index ea36d2139590f..727a51ce9ad71 100644
+--- a/drivers/vfio/pci/vfio_pci_core.c
++++ b/drivers/vfio/pci/vfio_pci_core.c
+@@ -1607,100 +1607,20 @@ ssize_t vfio_pci_core_write(struct vfio_device *core_vdev, const char __user *bu
+ }
+ EXPORT_SYMBOL_GPL(vfio_pci_core_write);
+-/* Return 1 on zap and vma_lock acquired, 0 on contention (only with @try) */
+-static int vfio_pci_zap_and_vma_lock(struct vfio_pci_core_device *vdev, bool try)
++static void vfio_pci_zap_bars(struct vfio_pci_core_device *vdev)
+ {
+-      struct vfio_pci_mmap_vma *mmap_vma, *tmp;
++      struct vfio_device *core_vdev = &vdev->vdev;
++      loff_t start = VFIO_PCI_INDEX_TO_OFFSET(VFIO_PCI_BAR0_REGION_INDEX);
++      loff_t end = VFIO_PCI_INDEX_TO_OFFSET(VFIO_PCI_ROM_REGION_INDEX);
++      loff_t len = end - start;
+-      /*
+-       * Lock ordering:
+-       * vma_lock is nested under mmap_lock for vm_ops callback paths.
+-       * The memory_lock semaphore is used by both code paths calling
+-       * into this function to zap vmas and the vm_ops.fault callback
+-       * to protect the memory enable state of the device.
+-       *
+-       * When zapping vmas we need to maintain the mmap_lock => vma_lock
+-       * ordering, which requires using vma_lock to walk vma_list to
+-       * acquire an mm, then dropping vma_lock to get the mmap_lock and
+-       * reacquiring vma_lock.  This logic is derived from similar
+-       * requirements in uverbs_user_mmap_disassociate().
+-       *
+-       * mmap_lock must always be the top-level lock when it is taken.
+-       * Therefore we can only hold the memory_lock write lock when
+-       * vma_list is empty, as we'd need to take mmap_lock to clear
+-       * entries.  vma_list can only be guaranteed empty when holding
+-       * vma_lock, thus memory_lock is nested under vma_lock.
+-       *
+-       * This enables the vm_ops.fault callback to acquire vma_lock,
+-       * followed by memory_lock read lock, while already holding
+-       * mmap_lock without risk of deadlock.
+-       */
+-      while (1) {
+-              struct mm_struct *mm = NULL;
+-
+-              if (try) {
+-                      if (!mutex_trylock(&vdev->vma_lock))
+-                              return 0;
+-              } else {
+-                      mutex_lock(&vdev->vma_lock);
+-              }
+-              while (!list_empty(&vdev->vma_list)) {
+-                      mmap_vma = list_first_entry(&vdev->vma_list,
+-                                                  struct vfio_pci_mmap_vma,
+-                                                  vma_next);
+-                      mm = mmap_vma->vma->vm_mm;
+-                      if (mmget_not_zero(mm))
+-                              break;
+-
+-                      list_del(&mmap_vma->vma_next);
+-                      kfree(mmap_vma);
+-                      mm = NULL;
+-              }
+-              if (!mm)
+-                      return 1;
+-              mutex_unlock(&vdev->vma_lock);
+-
+-              if (try) {
+-                      if (!mmap_read_trylock(mm)) {
+-                              mmput(mm);
+-                              return 0;
+-                      }
+-              } else {
+-                      mmap_read_lock(mm);
+-              }
+-              if (try) {
+-                      if (!mutex_trylock(&vdev->vma_lock)) {
+-                              mmap_read_unlock(mm);
+-                              mmput(mm);
+-                              return 0;
+-                      }
+-              } else {
+-                      mutex_lock(&vdev->vma_lock);
+-              }
+-              list_for_each_entry_safe(mmap_vma, tmp,
+-                                       &vdev->vma_list, vma_next) {
+-                      struct vm_area_struct *vma = mmap_vma->vma;
+-
+-                      if (vma->vm_mm != mm)
+-                              continue;
+-
+-                      list_del(&mmap_vma->vma_next);
+-                      kfree(mmap_vma);
+-
+-                      zap_vma_ptes(vma, vma->vm_start,
+-                                   vma->vm_end - vma->vm_start);
+-              }
+-              mutex_unlock(&vdev->vma_lock);
+-              mmap_read_unlock(mm);
+-              mmput(mm);
+-      }
++      unmap_mapping_range(core_vdev->inode->i_mapping, start, len, true);
+ }
+ void vfio_pci_zap_and_down_write_memory_lock(struct vfio_pci_core_device *vdev)
+ {
+-      vfio_pci_zap_and_vma_lock(vdev, false);
+       down_write(&vdev->memory_lock);
+-      mutex_unlock(&vdev->vma_lock);
++      vfio_pci_zap_bars(vdev);
+ }
+ u16 vfio_pci_memory_lock_and_enable(struct vfio_pci_core_device *vdev)
+@@ -1722,99 +1642,41 @@ void vfio_pci_memory_unlock_and_restore(struct vfio_pci_core_device *vdev, u16 c
+       up_write(&vdev->memory_lock);
+ }
+-/* Caller holds vma_lock */
+-static int __vfio_pci_add_vma(struct vfio_pci_core_device *vdev,
+-                            struct vm_area_struct *vma)
+-{
+-      struct vfio_pci_mmap_vma *mmap_vma;
+-
+-      mmap_vma = kmalloc(sizeof(*mmap_vma), GFP_KERNEL_ACCOUNT);
+-      if (!mmap_vma)
+-              return -ENOMEM;
+-
+-      mmap_vma->vma = vma;
+-      list_add(&mmap_vma->vma_next, &vdev->vma_list);
+-
+-      return 0;
+-}
+-
+-/*
+- * Zap mmaps on open so that we can fault them in on access and therefore
+- * our vma_list only tracks mappings accessed since last zap.
+- */
+-static void vfio_pci_mmap_open(struct vm_area_struct *vma)
+-{
+-      zap_vma_ptes(vma, vma->vm_start, vma->vm_end - vma->vm_start);
+-}
+-
+-static void vfio_pci_mmap_close(struct vm_area_struct *vma)
++static unsigned long vma_to_pfn(struct vm_area_struct *vma)
+ {
+       struct vfio_pci_core_device *vdev = vma->vm_private_data;
+-      struct vfio_pci_mmap_vma *mmap_vma;
++      int index = vma->vm_pgoff >> (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT);
++      u64 pgoff;
+-      mutex_lock(&vdev->vma_lock);
+-      list_for_each_entry(mmap_vma, &vdev->vma_list, vma_next) {
+-              if (mmap_vma->vma == vma) {
+-                      list_del(&mmap_vma->vma_next);
+-                      kfree(mmap_vma);
+-                      break;
+-              }
+-      }
+-      mutex_unlock(&vdev->vma_lock);
++      pgoff = vma->vm_pgoff &
++              ((1U << (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT)) - 1);
++
++      return (pci_resource_start(vdev->pdev, index) >> PAGE_SHIFT) + pgoff;
+ }
+ static vm_fault_t vfio_pci_mmap_fault(struct vm_fault *vmf)
+ {
+       struct vm_area_struct *vma = vmf->vma;
+       struct vfio_pci_core_device *vdev = vma->vm_private_data;
+-      struct vfio_pci_mmap_vma *mmap_vma;
+-      vm_fault_t ret = VM_FAULT_NOPAGE;
++      unsigned long pfn, pgoff = vmf->pgoff - vma->vm_pgoff;
++      vm_fault_t ret = VM_FAULT_SIGBUS;
+-      mutex_lock(&vdev->vma_lock);
+-      down_read(&vdev->memory_lock);
++      pfn = vma_to_pfn(vma);
+-      /*
+-       * Memory region cannot be accessed if the low power feature is engaged
+-       * or memory access is disabled.
+-       */
+-      if (vdev->pm_runtime_engaged || !__vfio_pci_memory_enabled(vdev)) {
+-              ret = VM_FAULT_SIGBUS;
+-              goto up_out;
+-      }
++      down_read(&vdev->memory_lock);
+-      /*
+-       * We populate the whole vma on fault, so we need to test whether
+-       * the vma has already been mapped, such as for concurrent faults
+-       * to the same vma.  io_remap_pfn_range() will trigger a BUG_ON if
+-       * we ask it to fill the same range again.
+-       */
+-      list_for_each_entry(mmap_vma, &vdev->vma_list, vma_next) {
+-              if (mmap_vma->vma == vma)
+-                      goto up_out;
+-      }
++      if (vdev->pm_runtime_engaged || !__vfio_pci_memory_enabled(vdev))
++              goto out_disabled;
+-      if (io_remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
+-                             vma->vm_end - vma->vm_start,
+-                             vma->vm_page_prot)) {
+-              ret = VM_FAULT_SIGBUS;
+-              zap_vma_ptes(vma, vma->vm_start, vma->vm_end - vma->vm_start);
+-              goto up_out;
+-      }
++      ret = vmf_insert_pfn(vma, vmf->address, pfn + pgoff);
+-      if (__vfio_pci_add_vma(vdev, vma)) {
+-              ret = VM_FAULT_OOM;
+-              zap_vma_ptes(vma, vma->vm_start, vma->vm_end - vma->vm_start);
+-      }
+-
+-up_out:
++out_disabled:
+       up_read(&vdev->memory_lock);
+-      mutex_unlock(&vdev->vma_lock);
++
+       return ret;
+ }
+ static const struct vm_operations_struct vfio_pci_mmap_ops = {
+-      .open = vfio_pci_mmap_open,
+-      .close = vfio_pci_mmap_close,
+       .fault = vfio_pci_mmap_fault,
+ };
+@@ -1877,11 +1739,12 @@ int vfio_pci_core_mmap(struct vfio_device *core_vdev, struct vm_area_struct *vma
+       vma->vm_private_data = vdev;
+       vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+-      vma->vm_pgoff = (pci_resource_start(pdev, index) >> PAGE_SHIFT) + pgoff;
++      vma->vm_page_prot = pgprot_decrypted(vma->vm_page_prot);
+       /*
+-       * See remap_pfn_range(), called from vfio_pci_fault() but we can't
+-       * change vm_flags within the fault handler.  Set them now.
++       * Set vm_flags now, they should not be changed in the fault handler.
++       * We want the same flags and page protection (decrypted above) as
++       * io_remap_pfn_range() would set.
+        *
+        * VM_ALLOW_ANY_UNCACHED: The VMA flag is implemented for ARM64,
+        * allowing KVM stage 2 device mapping attributes to use Normal-NC
+@@ -2199,8 +2062,6 @@ int vfio_pci_core_init_dev(struct vfio_device *core_vdev)
+       mutex_init(&vdev->ioeventfds_lock);
+       INIT_LIST_HEAD(&vdev->dummy_resources_list);
+       INIT_LIST_HEAD(&vdev->ioeventfds_list);
+-      mutex_init(&vdev->vma_lock);
+-      INIT_LIST_HEAD(&vdev->vma_list);
+       INIT_LIST_HEAD(&vdev->sriov_pfs_item);
+       init_rwsem(&vdev->memory_lock);
+       xa_init(&vdev->ctx);
+@@ -2216,7 +2077,6 @@ void vfio_pci_core_release_dev(struct vfio_device *core_vdev)
+       mutex_destroy(&vdev->igate);
+       mutex_destroy(&vdev->ioeventfds_lock);
+-      mutex_destroy(&vdev->vma_lock);
+       kfree(vdev->region);
+       kfree(vdev->pm_save);
+ }
+@@ -2494,26 +2354,15 @@ static int vfio_pci_dev_set_pm_runtime_get(struct vfio_device_set *dev_set)
+       return ret;
+ }
+-/*
+- * We need to get memory_lock for each device, but devices can share mmap_lock,
+- * therefore we need to zap and hold the vma_lock for each device, and only then
+- * get each memory_lock.
+- */
+ static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set,
+                                     struct vfio_pci_group_info *groups,
+                                     struct iommufd_ctx *iommufd_ctx)
+ {
+-      struct vfio_pci_core_device *cur_mem;
+-      struct vfio_pci_core_device *cur_vma;
+-      struct vfio_pci_core_device *cur;
++      struct vfio_pci_core_device *vdev;
+       struct pci_dev *pdev;
+-      bool is_mem = true;
+       int ret;
+       mutex_lock(&dev_set->lock);
+-      cur_mem = list_first_entry(&dev_set->device_list,
+-                                 struct vfio_pci_core_device,
+-                                 vdev.dev_set_list);
+       pdev = vfio_pci_dev_set_resettable(dev_set);
+       if (!pdev) {
+@@ -2530,7 +2379,7 @@ static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set,
+       if (ret)
+               goto err_unlock;
+-      list_for_each_entry(cur_vma, &dev_set->device_list, vdev.dev_set_list) {
++      list_for_each_entry(vdev, &dev_set->device_list, vdev.dev_set_list) {
+               bool owned;
+               /*
+@@ -2554,38 +2403,38 @@ static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set,
+                * Otherwise, reset is not allowed.
+                */
+               if (iommufd_ctx) {
+-                      int devid = vfio_iommufd_get_dev_id(&cur_vma->vdev,
++                      int devid = vfio_iommufd_get_dev_id(&vdev->vdev,
+                                                           iommufd_ctx);
+                       owned = (devid > 0 || devid == -ENOENT);
+               } else {
+-                      owned = vfio_dev_in_groups(&cur_vma->vdev, groups);
++                      owned = vfio_dev_in_groups(&vdev->vdev, groups);
+               }
+               if (!owned) {
+                       ret = -EINVAL;
+-                      goto err_undo;
++                      break;
+               }
+               /*
+-               * Locking multiple devices is prone to deadlock, runaway and
+-               * unwind if we hit contention.
++               * Take the memory write lock for each device and zap BAR
++               * mappings to prevent the user accessing the device while in
++               * reset.  Locking multiple devices is prone to deadlock,
++               * runaway and unwind if we hit contention.
+                */
+-              if (!vfio_pci_zap_and_vma_lock(cur_vma, true)) {
++              if (!down_write_trylock(&vdev->memory_lock)) {
+                       ret = -EBUSY;
+-                      goto err_undo;
++                      break;
+               }
++
++              vfio_pci_zap_bars(vdev);
+       }
+-      cur_vma = NULL;
+-      list_for_each_entry(cur_mem, &dev_set->device_list, vdev.dev_set_list) {
+-              if (!down_write_trylock(&cur_mem->memory_lock)) {
+-                      ret = -EBUSY;
+-                      goto err_undo;
+-              }
+-              mutex_unlock(&cur_mem->vma_lock);
++      if (!list_entry_is_head(vdev,
++                              &dev_set->device_list, vdev.dev_set_list)) {
++              vdev = list_prev_entry(vdev, vdev.dev_set_list);
++              goto err_undo;
+       }
+-      cur_mem = NULL;
+       /*
+        * The pci_reset_bus() will reset all the devices in the bus.
+@@ -2596,25 +2445,22 @@ static int vfio_pci_dev_set_hot_reset(struct vfio_device_set *dev_set,
+        * cause the PCI config space reset without restoring the original
+        * state (saved locally in 'vdev->pm_save').
+        */
+-      list_for_each_entry(cur, &dev_set->device_list, vdev.dev_set_list)
+-              vfio_pci_set_power_state(cur, PCI_D0);
++      list_for_each_entry(vdev, &dev_set->device_list, vdev.dev_set_list)
++              vfio_pci_set_power_state(vdev, PCI_D0);
+       ret = pci_reset_bus(pdev);
++      vdev = list_last_entry(&dev_set->device_list,
++                             struct vfio_pci_core_device, vdev.dev_set_list);
++
+ err_undo:
+-      list_for_each_entry(cur, &dev_set->device_list, vdev.dev_set_list) {
+-              if (cur == cur_mem)
+-                      is_mem = false;
+-              if (cur == cur_vma)
+-                      break;
+-              if (is_mem)
+-                      up_write(&cur->memory_lock);
+-              else
+-                      mutex_unlock(&cur->vma_lock);
+-      }
++      list_for_each_entry_from_reverse(vdev, &dev_set->device_list,
++                                       vdev.dev_set_list)
++              up_write(&vdev->memory_lock);
++
++      list_for_each_entry(vdev, &dev_set->device_list, vdev.dev_set_list)
++              pm_runtime_put(&vdev->pdev->dev);
+-      list_for_each_entry(cur, &dev_set->device_list, vdev.dev_set_list)
+-              pm_runtime_put(&cur->pdev->dev);
+ err_unlock:
+       mutex_unlock(&dev_set->lock);
+       return ret;
+diff --git a/include/linux/vfio_pci_core.h b/include/linux/vfio_pci_core.h
+index a2c8b8bba7119..f87067438ed48 100644
+--- a/include/linux/vfio_pci_core.h
++++ b/include/linux/vfio_pci_core.h
+@@ -93,8 +93,6 @@ struct vfio_pci_core_device {
+       struct list_head                sriov_pfs_item;
+       struct vfio_pci_core_device     *sriov_pf_core_dev;
+       struct notifier_block   nb;
+-      struct mutex            vma_lock;
+-      struct list_head        vma_list;
+       struct rw_semaphore     memory_lock;
+ };
+-- 
+2.43.0
+
diff --git a/queue-6.9/wifi-cfg80211-fix-6-ghz-scan-request-building.patch b/queue-6.9/wifi-cfg80211-fix-6-ghz-scan-request-building.patch
new file mode 100644 (file)
index 0000000..3f90902
--- /dev/null
@@ -0,0 +1,165 @@
+From 42ac989c021d0122a3e96b3d03f7e7da1b38410e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 10 May 2024 11:37:38 +0200
+Subject: wifi: cfg80211: fix 6 GHz scan request building
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+[ Upstream commit f7a8b10bfd614d7a9a16fbe80d28ead4f063cb00 ]
+
+The 6 GHz scan request struct allocated by cfg80211_scan_6ghz() is
+meant to be formed this way:
+
+ [base struct][channels][ssids][6ghz_params]
+
+It is allocated with [channels] as the maximum number of channels
+supported by the driver in the 6 GHz band, since allocation is
+before knowing how many there will be.
+
+However, the inner pointers are set incorrectly: initially, the
+6 GHz scan parameters pointer is set:
+
+ [base struct][channels]
+                        ^ scan_6ghz_params
+
+and later the SSID pointer is set to the end of the actually
+_used_ channels.
+
+ [base struct][channels]
+                  ^ ssids
+
+If many APs were to be discovered, and many channels used, and
+there were many SSIDs, then the SSIDs could overlap the 6 GHz
+parameters.
+
+Additionally, the request->ssids for most of the function points
+to the original request still (given the struct copy) but is used
+normally, which is confusing.
+
+Clear this up, by actually using the allocated space for 6 GHz
+parameters _after_ the SSIDs, and set up the SSIDs initially so
+they are used more clearly. Just like in nl80211.c, set them
+only if there actually are SSIDs though.
+
+Finally, also copy the elements (ie/ie_len) so they're part of
+the same request, not pointing to the old request.
+
+Co-developed-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
+Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
+Reviewed-by: Ilan Peer <ilan.peer@intel.com>
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Link: https://msgid.link/20240510113738.4190692ef4ee.I0cb19188be17a8abd029805e3373c0a7777c214c@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/wireless/rdev-ops.h |  6 +++++-
+ net/wireless/scan.c     | 47 +++++++++++++++++++++++++++--------------
+ 2 files changed, 36 insertions(+), 17 deletions(-)
+
+diff --git a/net/wireless/rdev-ops.h b/net/wireless/rdev-ops.h
+index 43897a5269b6a..755af47b88b91 100644
+--- a/net/wireless/rdev-ops.h
++++ b/net/wireless/rdev-ops.h
+@@ -2,7 +2,7 @@
+ /*
+  * Portions of this file
+  * Copyright(c) 2016-2017 Intel Deutschland GmbH
+- * Copyright (C) 2018, 2021-2023 Intel Corporation
++ * Copyright (C) 2018, 2021-2024 Intel Corporation
+  */
+ #ifndef __CFG80211_RDEV_OPS
+ #define __CFG80211_RDEV_OPS
+@@ -458,6 +458,10 @@ static inline int rdev_scan(struct cfg80211_registered_device *rdev,
+                           struct cfg80211_scan_request *request)
+ {
+       int ret;
++
++      if (WARN_ON_ONCE(!request->n_ssids && request->ssids))
++              return -EINVAL;
++
+       trace_rdev_scan(&rdev->wiphy, request);
+       ret = rdev->ops->scan(&rdev->wiphy, request);
+       trace_rdev_return_int(&rdev->wiphy, ret);
+diff --git a/net/wireless/scan.c b/net/wireless/scan.c
+index ecea8c08e2701..0c0d54e40131d 100644
+--- a/net/wireless/scan.c
++++ b/net/wireless/scan.c
+@@ -812,6 +812,7 @@ static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev)
+       LIST_HEAD(coloc_ap_list);
+       bool need_scan_psc = true;
+       const struct ieee80211_sband_iftype_data *iftd;
++      size_t size, offs_ssids, offs_6ghz_params, offs_ies;
+       rdev_req->scan_6ghz = true;
+@@ -877,10 +878,15 @@ static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev)
+               spin_unlock_bh(&rdev->bss_lock);
+       }
+-      request = kzalloc(struct_size(request, channels, n_channels) +
+-                        sizeof(*request->scan_6ghz_params) * count +
+-                        sizeof(*request->ssids) * rdev_req->n_ssids,
+-                        GFP_KERNEL);
++      size = struct_size(request, channels, n_channels);
++      offs_ssids = size;
++      size += sizeof(*request->ssids) * rdev_req->n_ssids;
++      offs_6ghz_params = size;
++      size += sizeof(*request->scan_6ghz_params) * count;
++      offs_ies = size;
++      size += rdev_req->ie_len;
++
++      request = kzalloc(size, GFP_KERNEL);
+       if (!request) {
+               cfg80211_free_coloc_ap_list(&coloc_ap_list);
+               return -ENOMEM;
+@@ -888,8 +894,26 @@ static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev)
+       *request = *rdev_req;
+       request->n_channels = 0;
+-      request->scan_6ghz_params =
+-              (void *)&request->channels[n_channels];
++      request->n_6ghz_params = 0;
++      if (rdev_req->n_ssids) {
++              /*
++               * Add the ssids from the parent scan request to the new
++               * scan request, so the driver would be able to use them
++               * in its probe requests to discover hidden APs on PSC
++               * channels.
++               */
++              request->ssids = (void *)request + offs_ssids;
++              memcpy(request->ssids, rdev_req->ssids,
++                     sizeof(*request->ssids) * request->n_ssids);
++      }
++      request->scan_6ghz_params = (void *)request + offs_6ghz_params;
++
++      if (rdev_req->ie_len) {
++              void *ie = (void *)request + offs_ies;
++
++              memcpy(ie, rdev_req->ie, rdev_req->ie_len);
++              request->ie = ie;
++      }
+       /*
+        * PSC channels should not be scanned in case of direct scan with 1 SSID
+@@ -978,17 +1002,8 @@ static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev)
+       if (request->n_channels) {
+               struct cfg80211_scan_request *old = rdev->int_scan_req;
+-              rdev->int_scan_req = request;
+-              /*
+-               * Add the ssids from the parent scan request to the new scan
+-               * request, so the driver would be able to use them in its
+-               * probe requests to discover hidden APs on PSC channels.
+-               */
+-              request->ssids = (void *)&request->channels[request->n_channels];
+-              request->n_ssids = rdev_req->n_ssids;
+-              memcpy(request->ssids, rdev_req->ssids, sizeof(*request->ssids) *
+-                     request->n_ssids);
++              rdev->int_scan_req = request;
+               /*
+                * If this scan follows a previous scan, save the scan start
+-- 
+2.43.0
+
diff --git a/queue-6.9/wifi-cfg80211-wext-add-extra-siocsiwscan-data-check.patch b/queue-6.9/wifi-cfg80211-wext-add-extra-siocsiwscan-data-check.patch
new file mode 100644 (file)
index 0000000..302d4b3
--- /dev/null
@@ -0,0 +1,47 @@
+From 0c5349a2a36bfcb7eaed083871b8e1eafa4de87f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 31 May 2024 06:20:10 +0300
+Subject: wifi: cfg80211: wext: add extra SIOCSIWSCAN data check
+
+From: Dmitry Antipov <dmantipov@yandex.ru>
+
+[ Upstream commit 6ef09cdc5ba0f93826c09d810c141a8d103a80fc ]
+
+In 'cfg80211_wext_siwscan()', add extra check whether number of
+channels passed via 'ioctl(sock, SIOCSIWSCAN, ...)' doesn't exceed
+IW_MAX_FREQUENCIES and reject invalid request with -EINVAL otherwise.
+
+Reported-by: syzbot+253cd2d2491df77c93ac@syzkaller.appspotmail.com
+Closes: https://syzkaller.appspot.com/bug?extid=253cd2d2491df77c93ac
+Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
+Link: https://msgid.link/20240531032010.451295-1-dmantipov@yandex.ru
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/wireless/scan.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/net/wireless/scan.c b/net/wireless/scan.c
+index 0c0d54e40131d..a811ad02e6d1f 100644
+--- a/net/wireless/scan.c
++++ b/net/wireless/scan.c
+@@ -3411,10 +3411,14 @@ int cfg80211_wext_siwscan(struct net_device *dev,
+       wiphy = &rdev->wiphy;
+       /* Determine number of channels, needed to allocate creq */
+-      if (wreq && wreq->num_channels)
++      if (wreq && wreq->num_channels) {
++              /* Passed from userspace so should be checked */
++              if (unlikely(wreq->num_channels > IW_MAX_FREQUENCIES))
++                      return -EINVAL;
+               n_channels = wreq->num_channels;
+-      else
++      } else {
+               n_channels = ieee80211_get_num_supported_channels(wiphy);
++      }
+       creq = kzalloc(sizeof(*creq) + sizeof(struct cfg80211_ssid) +
+                      n_channels * sizeof(void *),
+-- 
+2.43.0
+
diff --git a/queue-6.9/wifi-iwlwifi-mvm-d3-fix-wowlan-command-version-looku.patch b/queue-6.9/wifi-iwlwifi-mvm-d3-fix-wowlan-command-version-looku.patch
new file mode 100644 (file)
index 0000000..9ceb29f
--- /dev/null
@@ -0,0 +1,42 @@
+From db0bd05b9beb42b043e5170f2b1544d14187c16b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 10 May 2024 17:06:29 +0300
+Subject: wifi: iwlwifi: mvm: d3: fix WoWLAN command version lookup
+
+From: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
+
+[ Upstream commit b7ffca99313d856f7d1cc89038d9061b128e8e97 ]
+
+After moving from commands to notificaitons in the d3 resume flow,
+removing the WOWLAN_GET_STATUSES and REPLY_OFFLOADS_QUERY_CMD causes
+the return of the default value when looking up their version.
+Returning zero here results in the driver sending the not supported
+NON_QOS_TX_COUNTER_CMD.
+
+Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
+Reviewed-by: Gregory Greenman <gregory.greenman@intel.com>
+Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
+Link: https://msgid.link/20240510170500.8cabfd580614.If3a0db9851f56041f8f5360959354abd5379224a@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+index 52518a47554e7..74743c3ceeefb 100644
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+@@ -2182,7 +2182,8 @@ static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm,
+ out:
+       if (iwl_fw_lookup_notif_ver(mvm->fw, LONG_GROUP,
+-                                  WOWLAN_GET_STATUSES, 0) < 10) {
++                                  WOWLAN_GET_STATUSES,
++                                  IWL_FW_CMD_VER_UNKNOWN) < 10) {
+               mvmvif->seqno_valid = true;
+               /* +0x10 because the set API expects next-to-use, not last-used */
+               mvmvif->seqno = status->non_qos_seq_ctr + 0x10;
+-- 
+2.43.0
+
diff --git a/queue-6.9/wifi-iwlwifi-mvm-fix-scan-abort-handling-with-hw-rfk.patch b/queue-6.9/wifi-iwlwifi-mvm-fix-scan-abort-handling-with-hw-rfk.patch
new file mode 100644 (file)
index 0000000..1a22c3c
--- /dev/null
@@ -0,0 +1,51 @@
+From 06d52c7dffefd34eecc67a31f982a3bdbf5c98ae Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 13 May 2024 13:27:13 +0300
+Subject: wifi: iwlwifi: mvm: Fix scan abort handling with HW rfkill
+
+From: Ilan Peer <ilan.peer@intel.com>
+
+[ Upstream commit e6dd2936ce7ce94a1915b799f8af8193ec628e87 ]
+
+When HW rfkill is toggled to disable the RF, the flow to stop scan is
+called. When trying to send the command to abort the scan, since
+HW rfkill is toggled, the command is not sent due to rfkill being
+asserted, and -ERFKILL is returned from iwl_trans_send_cmd(), but this
+is silently ignored in iwl_mvm_send_cmd() and thus the scan abort flow
+continues to wait for scan complete notification and fails. Since it
+fails, the UID to type mapping is not cleared, and thus a warning is
+later fired when trying to stop the interface.
+
+To fix this, modify the UMAC scan abort flow to force sending the
+scan abort command even when in rfkill, so stop the FW from accessing
+the radio etc.
+
+Signed-off-by: Ilan Peer <ilan.peer@intel.com>
+Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
+Link: https://msgid.link/20240513132416.8cbe2f8c1a97.Iffe235c12a919dafec88eef399eb1f7bae2c5bdb@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
+index e8d40e4a2f2ff..aa5fa6c657c02 100644
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
+@@ -3254,10 +3254,11 @@ static int iwl_mvm_umac_scan_abort(struct iwl_mvm *mvm, int type)
+       ret = iwl_mvm_send_cmd_pdu(mvm,
+                                  WIDE_ID(IWL_ALWAYS_LONG_GROUP, SCAN_ABORT_UMAC),
+-                                 0, sizeof(cmd), &cmd);
++                                 CMD_SEND_IN_RFKILL, sizeof(cmd), &cmd);
+       if (!ret)
+               mvm->scan_uid_status[uid] = type << IWL_MVM_SCAN_STOPPING_SHIFT;
++      IWL_DEBUG_SCAN(mvm, "Scan abort: ret=%d\n", ret);
+       return ret;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.9/wifi-iwlwifi-mvm-handle-ba-session-teardown-in-rf-ki.patch b/queue-6.9/wifi-iwlwifi-mvm-handle-ba-session-teardown-in-rf-ki.patch
new file mode 100644 (file)
index 0000000..9b7adc6
--- /dev/null
@@ -0,0 +1,95 @@
+From 4ddbc38a0c7b5dce6b3edbc5759609baa44feaba Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 13 May 2024 13:27:10 +0300
+Subject: wifi: iwlwifi: mvm: handle BA session teardown in RF-kill
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+[ Upstream commit 4d08c0b3357cba0aeffaf3abc62cae0c154f2816 ]
+
+When entering RF-kill, mac80211 tears down BA sessions, but
+due to RF-kill the commands aren't sent to the device. As a
+result, there can be frames pending on the reorder buffer or
+perhaps even received while doing so, leading to warnings.
+
+Avoid the warnings by doing the BA session teardown normally
+even in RF-kill, which also requires queue sync.
+
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
+Link: https://msgid.link/20240513132416.0762cd80fb3d.I43c5877f3b546159b2db4f36d6d956b333c41cf0@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c |  2 +-
+ drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c  |  3 ++-
+ drivers/net/wireless/intel/iwlwifi/mvm/sta.c      | 12 ++++++++----
+ 3 files changed, 11 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+index 3b61fe8ca47fa..d3db883dfaa5b 100644
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+@@ -6164,7 +6164,7 @@ void iwl_mvm_sync_rx_queues_internal(struct iwl_mvm *mvm,
+               .len[0] = sizeof(cmd),
+               .data[1] = data,
+               .len[1] = size,
+-              .flags = sync ? 0 : CMD_ASYNC,
++              .flags = CMD_SEND_IN_RFKILL | (sync ? 0 : CMD_ASYNC),
+       };
+       int ret;
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
+index a21e29947475f..dbe668db7ce37 100644
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
+@@ -1012,7 +1012,8 @@ static int iwl_mvm_mld_update_sta_baids(struct iwl_mvm *mvm,
+               cmd.modify.tid = cpu_to_le32(data->tid);
+-              ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, sizeof(cmd), &cmd);
++              ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, CMD_SEND_IN_RFKILL,
++                                         sizeof(cmd), &cmd);
+               data->sta_mask = new_sta_mask;
+               if (ret)
+                       return ret;
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+index 491c449fd4316..908d0bc474da6 100644
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+@@ -2836,7 +2836,12 @@ static int iwl_mvm_fw_baid_op_cmd(struct iwl_mvm *mvm,
+               .action = start ? cpu_to_le32(IWL_RX_BAID_ACTION_ADD) :
+                                 cpu_to_le32(IWL_RX_BAID_ACTION_REMOVE),
+       };
+-      u32 cmd_id = WIDE_ID(DATA_PATH_GROUP, RX_BAID_ALLOCATION_CONFIG_CMD);
++      struct iwl_host_cmd hcmd = {
++              .id = WIDE_ID(DATA_PATH_GROUP, RX_BAID_ALLOCATION_CONFIG_CMD),
++              .flags = CMD_SEND_IN_RFKILL,
++              .len[0] = sizeof(cmd),
++              .data[0] = &cmd,
++      };
+       int ret;
+       BUILD_BUG_ON(sizeof(struct iwl_rx_baid_cfg_resp) != sizeof(baid));
+@@ -2848,7 +2853,7 @@ static int iwl_mvm_fw_baid_op_cmd(struct iwl_mvm *mvm,
+               cmd.alloc.ssn = cpu_to_le16(ssn);
+               cmd.alloc.win_size = cpu_to_le16(buf_size);
+               baid = -EIO;
+-      } else if (iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 1) == 1) {
++      } else if (iwl_fw_lookup_cmd_ver(mvm->fw, hcmd.id, 1) == 1) {
+               cmd.remove_v1.baid = cpu_to_le32(baid);
+               BUILD_BUG_ON(sizeof(cmd.remove_v1) > sizeof(cmd.remove));
+       } else {
+@@ -2857,8 +2862,7 @@ static int iwl_mvm_fw_baid_op_cmd(struct iwl_mvm *mvm,
+               cmd.remove.tid = cpu_to_le32(tid);
+       }
+-      ret = iwl_mvm_send_cmd_pdu_status(mvm, cmd_id, sizeof(cmd),
+-                                        &cmd, &baid);
++      ret = iwl_mvm_send_cmd_status(mvm, &hcmd, &baid);
+       if (ret)
+               return ret;
+-- 
+2.43.0
+
diff --git a/queue-6.9/wifi-iwlwifi-mvm-handle-bigtk-cipher-in-kek_kck-cmd.patch b/queue-6.9/wifi-iwlwifi-mvm-handle-bigtk-cipher-in-kek_kck-cmd.patch
new file mode 100644 (file)
index 0000000..d703229
--- /dev/null
@@ -0,0 +1,58 @@
+From ba7a8afebd2eaa6f917bc4332cc62fb9fd794daf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 13 May 2024 13:27:09 +0300
+Subject: wifi: iwlwifi: mvm: Handle BIGTK cipher in kek_kck cmd
+
+From: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
+
+[ Upstream commit 08b16d1b5997dc378533318e2a9cd73c7a898284 ]
+
+The BIGTK cipher field was added to the kek_kck_material_cmd
+but wasn't assigned. Fix that by differentiating between the
+IGTK/BIGTK keys and assign the ciphers fields accordingly.
+
+Signed-off-by: Yedidya Benshimol <yedidya.ben.shimol@intel.com>
+Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
+Link: https://msgid.link/20240513132416.7fd0b22b7267.Ie9b581652b74bd7806980364d59e1b2e78e682c0@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/intel/iwlwifi/mvm/d3.c | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+index 74743c3ceeefb..6f16b5b33f0c0 100644
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/d3.c
+@@ -595,6 +595,12 @@ static void iwl_mvm_wowlan_gtk_type_iter(struct ieee80211_hw *hw,
+                                        void *_data)
+ {
+       struct wowlan_key_gtk_type_iter *data = _data;
++      __le32 *cipher = NULL;
++
++      if (key->keyidx == 4 || key->keyidx == 5)
++              cipher = &data->kek_kck_cmd->igtk_cipher;
++      if (key->keyidx == 6 || key->keyidx == 7)
++              cipher = &data->kek_kck_cmd->bigtk_cipher;
+       switch (key->cipher) {
+       default:
+@@ -606,10 +612,13 @@ static void iwl_mvm_wowlan_gtk_type_iter(struct ieee80211_hw *hw,
+               return;
+       case WLAN_CIPHER_SUITE_BIP_GMAC_256:
+       case WLAN_CIPHER_SUITE_BIP_GMAC_128:
+-              data->kek_kck_cmd->igtk_cipher = cpu_to_le32(STA_KEY_FLG_GCMP);
++              if (cipher)
++                      *cipher = cpu_to_le32(STA_KEY_FLG_GCMP);
+               return;
+       case WLAN_CIPHER_SUITE_AES_CMAC:
+-              data->kek_kck_cmd->igtk_cipher = cpu_to_le32(STA_KEY_FLG_CCM);
++      case WLAN_CIPHER_SUITE_BIP_CMAC_256:
++              if (cipher)
++                      *cipher = cpu_to_le32(STA_KEY_FLG_CCM);
+               return;
+       case WLAN_CIPHER_SUITE_CCMP:
+               if (!sta)
+-- 
+2.43.0
+
diff --git a/queue-6.9/wifi-iwlwifi-mvm-properly-set-6-ghz-channel-direct-p.patch b/queue-6.9/wifi-iwlwifi-mvm-properly-set-6-ghz-channel-direct-p.patch
new file mode 100644 (file)
index 0000000..2eaf099
--- /dev/null
@@ -0,0 +1,41 @@
+From ef374b429a67777f97f32d046c34b3cefa535c2c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 13 May 2024 13:27:11 +0300
+Subject: wifi: iwlwifi: mvm: properly set 6 GHz channel direct probe option
+
+From: Ayala Beker <ayala.beker@intel.com>
+
+[ Upstream commit 989830d1cf16bd149bf0690d889a9caef95fb5b1 ]
+
+Ensure that the 6 GHz channel is configured with a valid direct BSSID,
+avoiding any invalid or multicast BSSID addresses.
+
+Signed-off-by: Ayala Beker <ayala.beker@intel.com>
+Reviewed-by: Ilan Peer <ilan.peer@intel.com>
+Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
+Link: https://msgid.link/20240513132416.91a631a0fe60.I2ea2616af9b8a2eaf959b156c69cf65a2f1204d4@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
+index 525d8efcc1475..e8d40e4a2f2ff 100644
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c
+@@ -1717,7 +1717,10 @@ iwl_mvm_umac_scan_fill_6g_chan_list(struct iwl_mvm *mvm,
+                               break;
+               }
+-              if (k == idex_b && idex_b < SCAN_BSSID_MAX_SIZE) {
++              if (k == idex_b && idex_b < SCAN_BSSID_MAX_SIZE &&
++                  !WARN_ONCE(!is_valid_ether_addr(scan_6ghz_params[j].bssid),
++                             "scan: invalid BSSID at index %u, index_b=%u\n",
++                             j, idex_b)) {
+                       memcpy(&pp->bssid_array[idex_b++],
+                              scan_6ghz_params[j].bssid, ETH_ALEN);
+               }
+-- 
+2.43.0
+
diff --git a/queue-6.9/wifi-iwlwifi-mvm-remove-stale-sta-link-data-during-r.patch b/queue-6.9/wifi-iwlwifi-mvm-remove-stale-sta-link-data-during-r.patch
new file mode 100644 (file)
index 0000000..63ed629
--- /dev/null
@@ -0,0 +1,125 @@
+From 8d3e4e7f26649488540bbf4f7994e8c8637e2956 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 13 May 2024 13:27:08 +0300
+Subject: wifi: iwlwifi: mvm: remove stale STA link data during restart
+
+From: Benjamin Berg <benjamin.berg@intel.com>
+
+[ Upstream commit cc3ba78f202de9752aceb16342ab62bdfbffac7e ]
+
+If pre-recovery mac80211 tried to disable a link but this disablement
+failed, then there might be a mismatch between mac80211 assuming the
+link has been disabled and the driver still having the data around.
+During recover itself, that is not a problem, but should the link be
+activated again at a later point, iwlwifi will refuse the activation as
+it detects the inconsistent state.
+
+Solve this corner-case by iterating the station in the restart cleanup
+handler.
+
+Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
+Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
+Link: https://msgid.link/20240513132416.d2fd60338055.I840d4fdce5fd49fe69896d928b071067e3730259@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../net/wireless/intel/iwlwifi/mvm/mac80211.c | 37 +++++++++++++++++++
+ .../net/wireless/intel/iwlwifi/mvm/mld-sta.c  | 10 ++---
+ drivers/net/wireless/intel/iwlwifi/mvm/sta.h  |  5 +++
+ 3 files changed, 47 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+index 5f6b16d3fc8a3..3b61fe8ca47fa 100644
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+@@ -1115,6 +1115,39 @@ static void iwl_mvm_cleanup_iterator(void *data, u8 *mac,
+       RCU_INIT_POINTER(mvmvif->deflink.probe_resp_data, NULL);
+ }
++static void iwl_mvm_cleanup_sta_iterator(void *data, struct ieee80211_sta *sta)
++{
++      struct iwl_mvm *mvm = data;
++      struct iwl_mvm_sta *mvm_sta;
++      struct ieee80211_vif *vif;
++      int link_id;
++
++      mvm_sta = iwl_mvm_sta_from_mac80211(sta);
++      vif = mvm_sta->vif;
++
++      if (!sta->valid_links)
++              return;
++
++      for (link_id = 0; link_id < ARRAY_SIZE((sta)->link); link_id++) {
++              struct iwl_mvm_link_sta *mvm_link_sta;
++
++              mvm_link_sta =
++                      rcu_dereference_check(mvm_sta->link[link_id],
++                                            lockdep_is_held(&mvm->mutex));
++              if (mvm_link_sta && !(vif->active_links & BIT(link_id))) {
++                      /*
++                       * We have a link STA but the link is inactive in
++                       * mac80211. This will happen if we failed to
++                       * deactivate the link but mac80211 roll back the
++                       * deactivation of the link.
++                       * Delete the stale data to avoid issues later on.
++                       */
++                      iwl_mvm_mld_free_sta_link(mvm, mvm_sta, mvm_link_sta,
++                                                link_id, false);
++              }
++      }
++}
++
+ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm)
+ {
+       iwl_mvm_stop_device(mvm);
+@@ -1137,6 +1170,10 @@ static void iwl_mvm_restart_cleanup(struct iwl_mvm *mvm)
+        */
+       ieee80211_iterate_interfaces(mvm->hw, 0, iwl_mvm_cleanup_iterator, mvm);
++      /* cleanup stations as links may be gone after restart */
++      ieee80211_iterate_stations_atomic(mvm->hw,
++                                        iwl_mvm_cleanup_sta_iterator, mvm);
++
+       mvm->p2p_device_vif = NULL;
+       iwl_mvm_reset_phy_ctxts(mvm);
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
+index 36dc291d98dd6..a21e29947475f 100644
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mld-sta.c
+@@ -515,11 +515,11 @@ static int iwl_mvm_mld_cfg_sta(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
+       return iwl_mvm_mld_send_sta_cmd(mvm, &cmd);
+ }
+-static void iwl_mvm_mld_free_sta_link(struct iwl_mvm *mvm,
+-                                    struct iwl_mvm_sta *mvm_sta,
+-                                    struct iwl_mvm_link_sta *mvm_sta_link,
+-                                    unsigned int link_id,
+-                                    bool is_in_fw)
++void iwl_mvm_mld_free_sta_link(struct iwl_mvm *mvm,
++                             struct iwl_mvm_sta *mvm_sta,
++                             struct iwl_mvm_link_sta *mvm_sta_link,
++                             unsigned int link_id,
++                             bool is_in_fw)
+ {
+       RCU_INIT_POINTER(mvm->fw_id_to_mac_id[mvm_sta_link->sta_id],
+                        is_in_fw ? ERR_PTR(-EINVAL) : NULL);
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
+index b3450569864eb..7dd8f7f4b4492 100644
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.h
+@@ -638,6 +638,11 @@ int iwl_mvm_mld_update_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
+                          struct ieee80211_sta *sta);
+ int iwl_mvm_mld_rm_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
+                      struct ieee80211_sta *sta);
++void iwl_mvm_mld_free_sta_link(struct iwl_mvm *mvm,
++                             struct iwl_mvm_sta *mvm_sta,
++                             struct iwl_mvm_link_sta *mvm_sta_link,
++                             unsigned int link_id,
++                             bool is_in_fw);
+ int iwl_mvm_mld_rm_sta_id(struct iwl_mvm *mvm, u8 sta_id);
+ int iwl_mvm_mld_update_sta_links(struct iwl_mvm *mvm,
+                                struct ieee80211_vif *vif,
+-- 
+2.43.0
+
diff --git a/queue-6.9/wifi-iwlwifi-properly-set-wiphy_flag_supports_ext_ke.patch b/queue-6.9/wifi-iwlwifi-properly-set-wiphy_flag_supports_ext_ke.patch
new file mode 100644 (file)
index 0000000..4b7edb1
--- /dev/null
@@ -0,0 +1,39 @@
+From 7475af2f0902ec9ad1ac033aaadcf4779e12131d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 Jul 2024 06:43:13 +0300
+Subject: wifi: iwlwifi: properly set WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK
+
+From: Daniel Gabay <daniel.gabay@intel.com>
+
+[ Upstream commit 4ec17ce716bdaf680288ce680b4621b52483cc96 ]
+
+The WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK should be set based on the
+WOWLAN_KEK_KCK_MATERIAL command version. Currently, the command
+version in the firmware has advanced to 4, which prevents the
+flag from being set correctly, fix that.
+
+Signed-off-by: Daniel Gabay <daniel.gabay@intel.com>
+Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
+Link: https://patch.msgid.link/20240703064026.a0f162108575.If1a9785727d2a1b0197a396680965df1b53d4096@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+index d3db883dfaa5b..a61d5e7c08e04 100644
+--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
++++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+@@ -651,7 +651,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
+               hw->wiphy->features |= NL80211_FEATURE_WFA_TPC_IE_IN_PROBES;
+       if (iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_KEK_KCK_MATERIAL,
+-                                IWL_FW_CMD_VER_UNKNOWN) == 3)
++                                IWL_FW_CMD_VER_UNKNOWN) >= 3)
+               hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_EXT_KEK_KCK;
+       if (fw_has_api(&mvm->fw->ucode_capa,
+-- 
+2.43.0
+
diff --git a/queue-6.9/wifi-mac80211-apply-mcast-rate-only-if-interface-is-.patch b/queue-6.9/wifi-mac80211-apply-mcast-rate-only-if-interface-is-.patch
new file mode 100644 (file)
index 0000000..b95b961
--- /dev/null
@@ -0,0 +1,39 @@
+From 774067084cc423709b0abd9942ee39283dba0d78 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 15 May 2024 13:34:10 +0200
+Subject: wifi: mac80211: apply mcast rate only if interface is up
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+[ Upstream commit 02c665f048a439c0d58cc45334c94634bd7c18e6 ]
+
+If the interface isn't enabled, don't apply multicast
+rate changes immediately.
+
+Reported-by: syzbot+de87c09cc7b964ea2e23@syzkaller.appspotmail.com
+Link: https://msgid.link/20240515133410.d6cffe5756cc.I47b624a317e62bdb4609ff7fa79403c0c444d32d@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/mac80211/cfg.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
+index 51dc2d9dd6b84..d0feadfdb46e1 100644
+--- a/net/mac80211/cfg.c
++++ b/net/mac80211/cfg.c
+@@ -2954,8 +2954,9 @@ static int ieee80211_set_mcast_rate(struct wiphy *wiphy, struct net_device *dev,
+       memcpy(sdata->vif.bss_conf.mcast_rate, rate,
+              sizeof(int) * NUM_NL80211_BANDS);
+-      ieee80211_link_info_change_notify(sdata, &sdata->deflink,
+-                                        BSS_CHANGED_MCAST_RATE);
++      if (ieee80211_sdata_running(sdata))
++              ieee80211_link_info_change_notify(sdata, &sdata->deflink,
++                                                BSS_CHANGED_MCAST_RATE);
+       return 0;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.9/wifi-mac80211-avoid-address-calculations-via-out-of-.patch b/queue-6.9/wifi-mac80211-avoid-address-calculations-via-out-of-.patch
new file mode 100644 (file)
index 0000000..26aeab7
--- /dev/null
@@ -0,0 +1,99 @@
+From 07b79c7282a6a03a649f8111e1103ab0ef68e775 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 5 Jun 2024 11:22:18 -0400
+Subject: wifi: mac80211: Avoid address calculations via out of bounds array
+ indexing
+
+From: Kenton Groombridge <concord@gentoo.org>
+
+[ Upstream commit 2663d0462eb32ae7c9b035300ab6b1523886c718 ]
+
+req->n_channels must be set before req->channels[] can be used.
+
+This patch fixes one of the issues encountered in [1].
+
+[   83.964255] UBSAN: array-index-out-of-bounds in net/mac80211/scan.c:364:4
+[   83.964258] index 0 is out of range for type 'struct ieee80211_channel *[]'
+[...]
+[   83.964264] Call Trace:
+[   83.964267]  <TASK>
+[   83.964269]  dump_stack_lvl+0x3f/0xc0
+[   83.964274]  __ubsan_handle_out_of_bounds+0xec/0x110
+[   83.964278]  ieee80211_prep_hw_scan+0x2db/0x4b0
+[   83.964281]  __ieee80211_start_scan+0x601/0x990
+[   83.964291]  nl80211_trigger_scan+0x874/0x980
+[   83.964295]  genl_family_rcv_msg_doit+0xe8/0x160
+[   83.964298]  genl_rcv_msg+0x240/0x270
+[...]
+
+[1] https://bugzilla.kernel.org/show_bug.cgi?id=218810
+
+Co-authored-by: Kees Cook <keescook@chromium.org>
+Signed-off-by: Kees Cook <kees@kernel.org>
+Signed-off-by: Kenton Groombridge <concord@gentoo.org>
+Link: https://msgid.link/20240605152218.236061-1-concord@gentoo.org
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/mac80211/scan.c | 17 +++++++++--------
+ 1 file changed, 9 insertions(+), 8 deletions(-)
+
+diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
+index 8ecc4b710b0e6..b5f2df61c7f67 100644
+--- a/net/mac80211/scan.c
++++ b/net/mac80211/scan.c
+@@ -358,7 +358,8 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_sub_if_data *sdata)
+       struct cfg80211_scan_request *req;
+       struct cfg80211_chan_def chandef;
+       u8 bands_used = 0;
+-      int i, ielen, n_chans;
++      int i, ielen;
++      u32 *n_chans;
+       u32 flags = 0;
+       req = rcu_dereference_protected(local->scan_req,
+@@ -368,34 +369,34 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_sub_if_data *sdata)
+               return false;
+       if (ieee80211_hw_check(&local->hw, SINGLE_SCAN_ON_ALL_BANDS)) {
++              local->hw_scan_req->req.n_channels = req->n_channels;
++
+               for (i = 0; i < req->n_channels; i++) {
+                       local->hw_scan_req->req.channels[i] = req->channels[i];
+                       bands_used |= BIT(req->channels[i]->band);
+               }
+-
+-              n_chans = req->n_channels;
+       } else {
+               do {
+                       if (local->hw_scan_band == NUM_NL80211_BANDS)
+                               return false;
+-                      n_chans = 0;
++                      n_chans = &local->hw_scan_req->req.n_channels;
++                      *n_chans = 0;
+                       for (i = 0; i < req->n_channels; i++) {
+                               if (req->channels[i]->band !=
+                                   local->hw_scan_band)
+                                       continue;
+-                              local->hw_scan_req->req.channels[n_chans] =
++                              local->hw_scan_req->req.channels[(*n_chans)++] =
+                                                       req->channels[i];
+-                              n_chans++;
++
+                               bands_used |= BIT(req->channels[i]->band);
+                       }
+                       local->hw_scan_band++;
+-              } while (!n_chans);
++              } while (!*n_chans);
+       }
+-      local->hw_scan_req->req.n_channels = n_chans;
+       ieee80211_prepare_scan_chandef(&chandef);
+       if (req->flags & NL80211_SCAN_FLAG_MIN_PREQ_CONTENT)
+-- 
+2.43.0
+
diff --git a/queue-6.9/wifi-mac80211-fix-ubsan-noise-in-ieee80211_prep_hw_s.patch b/queue-6.9/wifi-mac80211-fix-ubsan-noise-in-ieee80211_prep_hw_s.patch
new file mode 100644 (file)
index 0000000..b341170
--- /dev/null
@@ -0,0 +1,80 @@
+From a28fa627dc54eb5d36468e203e4e01e5f6118518 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 17 May 2024 18:33:32 +0300
+Subject: wifi: mac80211: fix UBSAN noise in ieee80211_prep_hw_scan()
+
+From: Dmitry Antipov <dmantipov@yandex.ru>
+
+[ Upstream commit 92ecbb3ac6f3fe8ae9edf3226c76aa17b6800699 ]
+
+When testing the previous patch with CONFIG_UBSAN_BOUNDS, I've
+noticed the following:
+
+UBSAN: array-index-out-of-bounds in net/mac80211/scan.c:372:4
+index 0 is out of range for type 'struct ieee80211_channel *[]'
+CPU: 0 PID: 1435 Comm: wpa_supplicant Not tainted 6.9.0+ #1
+Hardware name: LENOVO 20UN005QRT/20UN005QRT <...BIOS details...>
+Call Trace:
+ <TASK>
+ dump_stack_lvl+0x2d/0x90
+ __ubsan_handle_out_of_bounds+0xe7/0x140
+ ? timerqueue_add+0x98/0xb0
+ ieee80211_prep_hw_scan+0x2db/0x480 [mac80211]
+ ? __kmalloc+0xe1/0x470
+ __ieee80211_start_scan+0x541/0x760 [mac80211]
+ rdev_scan+0x1f/0xe0 [cfg80211]
+ nl80211_trigger_scan+0x9b6/0xae0 [cfg80211]
+ ...<the rest is not too useful...>
+
+Since '__ieee80211_start_scan()' leaves 'hw_scan_req->req.n_channels'
+uninitialized, actual boundaries of 'hw_scan_req->req.channels' can't
+be checked in 'ieee80211_prep_hw_scan()'. Although an initialization
+of 'hw_scan_req->req.n_channels' introduces some confusion around
+allocated vs. used VLA members, this shouldn't be a problem since
+everything is correctly adjusted soon in 'ieee80211_prep_hw_scan()'.
+
+Cleanup 'kmalloc()' math in '__ieee80211_start_scan()' by using the
+convenient 'struct_size()' as well.
+
+Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
+Link: https://msgid.link/20240517153332.18271-2-dmantipov@yandex.ru
+[improve (imho) indentation a bit]
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/mac80211/scan.c | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
+index 3da1c5c450358..8ecc4b710b0e6 100644
+--- a/net/mac80211/scan.c
++++ b/net/mac80211/scan.c
+@@ -744,15 +744,21 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
+                       local->hw_scan_ies_bufsize *= n_bands;
+               }
+-              local->hw_scan_req = kmalloc(
+-                              sizeof(*local->hw_scan_req) +
+-                              req->n_channels * sizeof(req->channels[0]) +
+-                              local->hw_scan_ies_bufsize, GFP_KERNEL);
++              local->hw_scan_req = kmalloc(struct_size(local->hw_scan_req,
++                                                       req.channels,
++                                                       req->n_channels) +
++                                           local->hw_scan_ies_bufsize,
++                                           GFP_KERNEL);
+               if (!local->hw_scan_req)
+                       return -ENOMEM;
+               local->hw_scan_req->req.ssids = req->ssids;
+               local->hw_scan_req->req.n_ssids = req->n_ssids;
++              /* None of the channels are actually set
++               * up but let UBSAN know the boundaries.
++               */
++              local->hw_scan_req->req.n_channels = req->n_channels;
++
+               ies = (u8 *)local->hw_scan_req +
+                       sizeof(*local->hw_scan_req) +
+                       req->n_channels * sizeof(req->channels[0]);
+-- 
+2.43.0
+
diff --git a/queue-6.9/wifi-mac80211-handle-tasklet-frames-before-stopping.patch b/queue-6.9/wifi-mac80211-handle-tasklet-frames-before-stopping.patch
new file mode 100644 (file)
index 0000000..f2f4792
--- /dev/null
@@ -0,0 +1,83 @@
+From 13f51c4117a47962e16e3476e7c536d4b27864e0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 15 May 2024 13:53:19 +0200
+Subject: wifi: mac80211: handle tasklet frames before stopping
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+[ Upstream commit 177c6ae9725d783f9e96f02593ce8fb2639be22f ]
+
+The code itself doesn't want to handle frames from the driver
+if it's already stopped, but if the tasklet was queued before
+and runs after the stop, then all bets are off. Flush queues
+before actually stopping, RX should be off at this point since
+all the interfaces are removed already, etc.
+
+Reported-by: syzbot+8830db5d3593b5546d2e@syzkaller.appspotmail.com
+Link: https://msgid.link/20240515135318.b05f11385c9a.I41c1b33a2e1814c3a7ef352cd7f2951b91785617@changeid
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/mac80211/ieee80211_i.h |  2 ++
+ net/mac80211/main.c        | 10 ++++++++--
+ net/mac80211/util.c        |  2 ++
+ 3 files changed, 12 insertions(+), 2 deletions(-)
+
+diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
+index 70c67c860e995..48bf62e92e02e 100644
+--- a/net/mac80211/ieee80211_i.h
++++ b/net/mac80211/ieee80211_i.h
+@@ -1841,6 +1841,8 @@ void ieee80211_link_info_change_notify(struct ieee80211_sub_if_data *sdata,
+ void ieee80211_configure_filter(struct ieee80211_local *local);
+ u64 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
++void ieee80211_handle_queued_frames(struct ieee80211_local *local);
++
+ u64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local);
+ int ieee80211_attach_ack_skb(struct ieee80211_local *local, struct sk_buff *skb,
+                            u64 *cookie, gfp_t gfp);
+diff --git a/net/mac80211/main.c b/net/mac80211/main.c
+index 4eaea0a9975b4..1132dea0e290e 100644
+--- a/net/mac80211/main.c
++++ b/net/mac80211/main.c
+@@ -423,9 +423,8 @@ u64 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata)
+              BSS_CHANGED_ERP_SLOT;
+ }
+-static void ieee80211_tasklet_handler(struct tasklet_struct *t)
++void ieee80211_handle_queued_frames(struct ieee80211_local *local)
+ {
+-      struct ieee80211_local *local = from_tasklet(local, t, tasklet);
+       struct sk_buff *skb;
+       while ((skb = skb_dequeue(&local->skb_queue)) ||
+@@ -450,6 +449,13 @@ static void ieee80211_tasklet_handler(struct tasklet_struct *t)
+       }
+ }
++static void ieee80211_tasklet_handler(struct tasklet_struct *t)
++{
++      struct ieee80211_local *local = from_tasklet(local, t, tasklet);
++
++      ieee80211_handle_queued_frames(local);
++}
++
+ static void ieee80211_restart_work(struct work_struct *work)
+ {
+       struct ieee80211_local *local =
+diff --git a/net/mac80211/util.c b/net/mac80211/util.c
+index 0da5f6082d159..cc04b001f0c36 100644
+--- a/net/mac80211/util.c
++++ b/net/mac80211/util.c
+@@ -1567,6 +1567,8 @@ u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
+ void ieee80211_stop_device(struct ieee80211_local *local)
+ {
++      ieee80211_handle_queued_frames(local);
++
+       ieee80211_led_radio(local, false);
+       ieee80211_mod_tpt_led_trig(local, 0, IEEE80211_TPT_LEDTRIG_FL_RADIO);
+-- 
+2.43.0
+
diff --git a/queue-6.9/wifi-mac80211-mesh-init-nonpeer_pm-to-active-by-defa.patch b/queue-6.9/wifi-mac80211-mesh-init-nonpeer_pm-to-active-by-defa.patch
new file mode 100644 (file)
index 0000000..26be421
--- /dev/null
@@ -0,0 +1,53 @@
+From 1350a664cab8be64fce17762bce40aa8ec6cab2f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 27 May 2024 16:17:59 +0200
+Subject: wifi: mac80211: mesh: init nonpeer_pm to active by default in mesh
+ sdata
+
+From: Nicolas Escande <nico.escande@gmail.com>
+
+[ Upstream commit 6f6291f09a322c1c1578badac8072d049363f4e6 ]
+
+With a ath9k device I can see that:
+       iw phy phy0 interface add mesh0 type mp
+       ip link set mesh0 up
+       iw dev mesh0 scan
+
+Will start a scan with the Power Management bit set in the Frame Control Field.
+This is because we set this bit depending on the nonpeer_pm variable of the mesh
+iface sdata and when there are no active links on the interface it remains to
+NL80211_MESH_POWER_UNKNOWN.
+
+As soon as links starts to be established, it wil switch to
+NL80211_MESH_POWER_ACTIVE as it is the value set by befault on the per sta
+nonpeer_pm field.
+As we want no power save by default, (as expressed with the per sta ini values),
+lets init it to the expected default value of NL80211_MESH_POWER_ACTIVE.
+
+Also please note that we cannot change the default value from userspace prior to
+establishing a link as using NL80211_CMD_SET_MESH_CONFIG will not work before
+NL80211_CMD_JOIN_MESH has been issued. So too late for our initial scan.
+
+Signed-off-by: Nicolas Escande <nico.escande@gmail.com>
+Link: https://msgid.link/20240527141759.299411-1-nico.escande@gmail.com
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/mac80211/mesh.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
+index cbc9b5e40cb35..6d4510221c98e 100644
+--- a/net/mac80211/mesh.c
++++ b/net/mac80211/mesh.c
+@@ -1776,6 +1776,7 @@ void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
+       ifmsh->last_preq = jiffies;
+       ifmsh->next_perr = jiffies;
+       ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_NONE;
++      ifmsh->nonpeer_pm = NL80211_MESH_POWER_ACTIVE;
+       /* Allocate all mesh structures when creating the first mesh interface. */
+       if (!mesh_allocated)
+               ieee80211s_init();
+-- 
+2.43.0
+
diff --git a/queue-6.9/workqueue-refactor-worker-id-formatting-and-make-wq_.patch b/queue-6.9/workqueue-refactor-worker-id-formatting-and-make-wq_.patch
new file mode 100644 (file)
index 0000000..ecd4608
--- /dev/null
@@ -0,0 +1,171 @@
+From 91966dd143050080d1ca8388b26ffde2b4d2b20f Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 20 May 2024 13:28:33 -1000
+Subject: workqueue: Refactor worker ID formatting and make wq_worker_comm()
+ use full ID string
+
+From: Tejun Heo <tj@kernel.org>
+
+[ Upstream commit 2a1b02bcba78f8498ab00d6142e1238d85b01591 ]
+
+Currently, worker ID formatting is open coded in create_worker(),
+init_rescuer() and worker_thread() (for %WORKER_DIE case). The formatted ID
+is saved into task->comm and wq_worker_comm() uses it as the base name to
+append extra information to when generating the name to be shown to
+userspace.
+
+However, TASK_COMM_LEN is only 16 leading to badly truncated names for
+rescuers. For example, the rescuer for the inet_frag_wq workqueue becomes:
+
+  $ ps -ef | grep '[k]worker/R-inet'
+  root         483       2  0 Apr26 ?        00:00:00 [kworker/R-inet_]
+
+Even for non-rescue workers, it's easy to run over 15 characters on
+moderately large machines.
+
+Fit it by consolidating worker ID formatting into a new helper
+format_worker_id() and calling it from wq_worker_comm() to obtain the
+untruncated worker ID string.
+
+  $ ps -ef | grep '[k]worker/R-inet'
+  root          60       2  0 12:10 ?        00:00:00 [kworker/R-inet_frag_wq]
+
+Signed-off-by: Tejun Heo <tj@kernel.org>
+Reported-and-tested-by: Jan Engelhardt <jengelh@inai.de>
+Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/workqueue.c | 51 ++++++++++++++++++++++++++++++----------------
+ 1 file changed, 34 insertions(+), 17 deletions(-)
+
+diff --git a/kernel/workqueue.c b/kernel/workqueue.c
+index d2dbe099286b9..7634fc32ee05a 100644
+--- a/kernel/workqueue.c
++++ b/kernel/workqueue.c
+@@ -124,6 +124,7 @@ enum wq_internal_consts {
+       HIGHPRI_NICE_LEVEL      = MIN_NICE,
+       WQ_NAME_LEN             = 32,
++      WORKER_ID_LEN           = 10 + WQ_NAME_LEN, /* "kworker/R-" + WQ_NAME_LEN */
+ };
+ /*
+@@ -2778,6 +2779,26 @@ static void worker_detach_from_pool(struct worker *worker)
+               complete(detach_completion);
+ }
++static int format_worker_id(char *buf, size_t size, struct worker *worker,
++                          struct worker_pool *pool)
++{
++      if (worker->rescue_wq)
++              return scnprintf(buf, size, "kworker/R-%s",
++                               worker->rescue_wq->name);
++
++      if (pool) {
++              if (pool->cpu >= 0)
++                      return scnprintf(buf, size, "kworker/%d:%d%s",
++                                       pool->cpu, worker->id,
++                                       pool->attrs->nice < 0  ? "H" : "");
++              else
++                      return scnprintf(buf, size, "kworker/u%d:%d",
++                                       pool->id, worker->id);
++      } else {
++              return scnprintf(buf, size, "kworker/dying");
++      }
++}
++
+ /**
+  * create_worker - create a new workqueue worker
+  * @pool: pool the new worker will belong to
+@@ -2794,7 +2815,6 @@ static struct worker *create_worker(struct worker_pool *pool)
+ {
+       struct worker *worker;
+       int id;
+-      char id_buf[23];
+       /* ID is needed to determine kthread name */
+       id = ida_alloc(&pool->worker_ida, GFP_KERNEL);
+@@ -2813,17 +2833,14 @@ static struct worker *create_worker(struct worker_pool *pool)
+       worker->id = id;
+       if (!(pool->flags & POOL_BH)) {
+-              if (pool->cpu >= 0)
+-                      snprintf(id_buf, sizeof(id_buf), "%d:%d%s", pool->cpu, id,
+-                               pool->attrs->nice < 0  ? "H" : "");
+-              else
+-                      snprintf(id_buf, sizeof(id_buf), "u%d:%d", pool->id, id);
++              char id_buf[WORKER_ID_LEN];
++              format_worker_id(id_buf, sizeof(id_buf), worker, pool);
+               worker->task = kthread_create_on_node(worker_thread, worker,
+-                                      pool->node, "kworker/%s", id_buf);
++                                                    pool->node, "%s", id_buf);
+               if (IS_ERR(worker->task)) {
+                       if (PTR_ERR(worker->task) == -EINTR) {
+-                              pr_err("workqueue: Interrupted when creating a worker thread \"kworker/%s\"\n",
++                              pr_err("workqueue: Interrupted when creating a worker thread \"%s\"\n",
+                                      id_buf);
+                       } else {
+                               pr_err_once("workqueue: Failed to create a worker thread: %pe",
+@@ -3386,7 +3403,6 @@ static int worker_thread(void *__worker)
+               raw_spin_unlock_irq(&pool->lock);
+               set_pf_worker(false);
+-              set_task_comm(worker->task, "kworker/dying");
+               ida_free(&pool->worker_ida, worker->id);
+               worker_detach_from_pool(worker);
+               WARN_ON_ONCE(!list_empty(&worker->entry));
+@@ -5430,6 +5446,7 @@ static int wq_clamp_max_active(int max_active, unsigned int flags,
+ static int init_rescuer(struct workqueue_struct *wq)
+ {
+       struct worker *rescuer;
++      char id_buf[WORKER_ID_LEN];
+       int ret;
+       if (!(wq->flags & WQ_MEM_RECLAIM))
+@@ -5443,7 +5460,9 @@ static int init_rescuer(struct workqueue_struct *wq)
+       }
+       rescuer->rescue_wq = wq;
+-      rescuer->task = kthread_create(rescuer_thread, rescuer, "kworker/R-%s", wq->name);
++      format_worker_id(id_buf, sizeof(id_buf), rescuer, NULL);
++
++      rescuer->task = kthread_create(rescuer_thread, rescuer, "%s", id_buf);
+       if (IS_ERR(rescuer->task)) {
+               ret = PTR_ERR(rescuer->task);
+               pr_err("workqueue: Failed to create a rescuer kthread for wq \"%s\": %pe",
+@@ -6272,19 +6291,15 @@ void show_freezable_workqueues(void)
+ /* used to show worker information through /proc/PID/{comm,stat,status} */
+ void wq_worker_comm(char *buf, size_t size, struct task_struct *task)
+ {
+-      int off;
+-
+-      /* always show the actual comm */
+-      off = strscpy(buf, task->comm, size);
+-      if (off < 0)
+-              return;
+-
+       /* stabilize PF_WQ_WORKER and worker pool association */
+       mutex_lock(&wq_pool_attach_mutex);
+       if (task->flags & PF_WQ_WORKER) {
+               struct worker *worker = kthread_data(task);
+               struct worker_pool *pool = worker->pool;
++              int off;
++
++              off = format_worker_id(buf, size, worker, pool);
+               if (pool) {
+                       raw_spin_lock_irq(&pool->lock);
+@@ -6303,6 +6318,8 @@ void wq_worker_comm(char *buf, size_t size, struct task_struct *task)
+                       }
+                       raw_spin_unlock_irq(&pool->lock);
+               }
++      } else {
++              strscpy(buf, task->comm, size);
+       }
+       mutex_unlock(&wq_pool_attach_mutex);
+-- 
+2.43.0
+