]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 6.6
authorSasha Levin <sashal@kernel.org>
Mon, 3 Jun 2024 11:42:13 +0000 (07:42 -0400)
committerSasha Levin <sashal@kernel.org>
Mon, 3 Jun 2024 11:42:13 +0000 (07:42 -0400)
Signed-off-by: Sasha Levin <sashal@kernel.org>
114 files changed:
queue-6.6/af_unix-update-unix_sk-sk-oob_skb-under-sk_receive_q.patch [new file with mode: 0644]
queue-6.6/alsa-hda-cs35l56-fix-lifetime-of-cs_dsp-instance.patch [new file with mode: 0644]
queue-6.6/alsa-hda-cs35l56-initialize-all-asp1-registers.patch [new file with mode: 0644]
queue-6.6/alsa-hda-cs_dsp_ctl-use-private_free-for-control-cle.patch [new file with mode: 0644]
queue-6.6/arm64-asm-bug-add-.align-2-to-the-end-of-__bug_entry.patch [new file with mode: 0644]
queue-6.6/asoc-cs35l56-fix-to-ensure-asp1-registers-match-cach.patch [new file with mode: 0644]
queue-6.6/asoc-mediatek-mt8192-fix-register-configuration-for-.patch [new file with mode: 0644]
queue-6.6/asoc-tas2552-add-tx-path-for-capturing-audio-out-dat.patch [new file with mode: 0644]
queue-6.6/asoc-tas2781-fix-a-warning-reported-by-robot-kernel-.patch [new file with mode: 0644]
queue-6.6/asoc-tas2781-fix-wrong-loading-calibrated-data-seque.patch [new file with mode: 0644]
queue-6.6/blk-cgroup-fix-list-corruption-from-reorder-of-write.patch [new file with mode: 0644]
queue-6.6/blk-cgroup-fix-list-corruption-from-resetting-io-sta.patch [new file with mode: 0644]
queue-6.6/blk-cgroup-properly-propagate-the-iostat-update-up-t.patch [new file with mode: 0644]
queue-6.6/cxl-region-fix-cxlr_pmem-leaks.patch [new file with mode: 0644]
queue-6.6/cxl-trace-correct-dpa-field-masks-for-general_media-.patch [new file with mode: 0644]
queue-6.6/drivers-xen-improve-the-late-xenstore-init-protocol.patch [new file with mode: 0644]
queue-6.6/drm-amdgpu-fix-buffer-size-in-gfx_v9_4_3_init_-cp_co.patch [new file with mode: 0644]
queue-6.6/drm-amdgpu-init-microcode-chip-name-from-ip-versions.patch [new file with mode: 0644]
queue-6.6/drm-bridge-tc358775-fix-support-for-jeida-18-and-jei.patch [new file with mode: 0644]
queue-6.6/drm-mediatek-dp-fix-mtk_dp_aux_transfer-return-value.patch [new file with mode: 0644]
queue-6.6/drm-meson-gate-px_clk-when-setting-rate.patch [new file with mode: 0644]
queue-6.6/drm-msm-a6xx-avoid-a-nullptr-dereference-when-speedb.patch [new file with mode: 0644]
queue-6.6/drm-msm-dpu-add-callback-function-pointer-check-befo.patch [new file with mode: 0644]
queue-6.6/drm-msm-dpu-add-helper-to-get-irq-related-data.patch [new file with mode: 0644]
queue-6.6/drm-msm-dpu-always-flush-the-slave-intf-on-the-ctl.patch [new file with mode: 0644]
queue-6.6/drm-msm-dpu-extract-dpu_core_irq_is_valid-helper.patch [new file with mode: 0644]
queue-6.6/drm-msm-dpu-make-the-irq-table-size-static.patch [new file with mode: 0644]
queue-6.6/drm-msm-dpu-remove-irq_idx-argument-from-irq-callbac.patch [new file with mode: 0644]
queue-6.6/drm-msm-dpu-stop-using-raw-irq-indices-in-the-kernel.patch [new file with mode: 0644]
queue-6.6/drm-msm-dsi-print-dual-dsi-adjusted-pclk-instead-of-.patch [new file with mode: 0644]
queue-6.6/drm-nouveau-use-tile_mode-and-pte_kind-for-vm_bind-b.patch [new file with mode: 0644]
queue-6.6/drm-zynqmp_dpsub-always-register-bridge.patch [new file with mode: 0644]
queue-6.6/fs-ntfs3-check-folio-pointer-for-null.patch [new file with mode: 0644]
queue-6.6/fs-ntfs3-use-64-bit-variable-to-avoid-32-bit-overflo.patch [new file with mode: 0644]
queue-6.6/fs-ntfs3-use-variable-length-array-instead-of-fixed-.patch [new file with mode: 0644]
queue-6.6/i3c-add-actual_len-in-i3c_priv_xfer.patch [new file with mode: 0644]
queue-6.6/i3c-master-svc-change-enxio-to-eagain-when-ibi-occur.patch [new file with mode: 0644]
queue-6.6/i3c-master-svc-rename-read_len-as-actual_len.patch [new file with mode: 0644]
queue-6.6/i3c-master-svc-return-actual-transfer-data-len.patch [new file with mode: 0644]
queue-6.6/ice-interpret-.set_channels-input-differently.patch [new file with mode: 0644]
queue-6.6/input-cyapa-add-missing-input-core-locking-to-suspen.patch [new file with mode: 0644]
queue-6.6/input-ims-pcu-fix-printf-string-overflow.patch [new file with mode: 0644]
queue-6.6/input-pm8xxx-vibrator-correct-vib_max_levels-calcula.patch [new file with mode: 0644]
queue-6.6/ipv6-sr-fix-memleak-in-seg6_hmac_init_algo.patch [new file with mode: 0644]
queue-6.6/ipv6-sr-fix-missing-sk_buff-release-in-seg6_input_co.patch [new file with mode: 0644]
queue-6.6/kasan-fortify-properly-rename-memintrinsics.patch [new file with mode: 0644]
queue-6.6/media-cec-cec-adap-always-cancel-work-in-cec_transmi.patch [new file with mode: 0644]
queue-6.6/media-cec-cec-api-add-locking-in-cec_release.patch [new file with mode: 0644]
queue-6.6/media-cec-core-avoid-confusing-transmit-timed-out-me.patch [new file with mode: 0644]
queue-6.6/media-cec-core-avoid-recursive-cec_claim_log_addrs.patch [new file with mode: 0644]
queue-6.6/media-flexcop-usb-fix-sanity-check-of-bnumendpoints.patch [new file with mode: 0644]
queue-6.6/media-mediatek-vcodec-add-encoder-power-management-h.patch [new file with mode: 0644]
queue-6.6/media-mediatek-vcodec-fix-possible-unbalanced-pm-cou.patch [new file with mode: 0644]
queue-6.6/media-ov2680-allow-probing-if-link-frequencies-is-ab.patch [new file with mode: 0644]
queue-6.6/media-ov2680-clear-the-ret-variable-on-success.patch [new file with mode: 0644]
queue-6.6/media-ov2680-do-not-fail-if-data-lanes-property-is-a.patch [new file with mode: 0644]
queue-6.6/media-stk1160-fix-bounds-checking-in-stk1160_copy_vi.patch [new file with mode: 0644]
queue-6.6/media-sunxi-a83-mips-csi2-also-select-generic_phy.patch [new file with mode: 0644]
queue-6.6/media-v4l-don-t-turn-on-privacy-led-if-streamon-fail.patch [new file with mode: 0644]
queue-6.6/media-v4l2-subdev-document-and-enforce-.s_stream-req.patch [new file with mode: 0644]
queue-6.6/mmc-sdhci_am654-add-itapdlysel-in-sdhci_j721e_4bit_s.patch [new file with mode: 0644]
queue-6.6/mmc-sdhci_am654-add-otap-itap-delay-enable.patch [new file with mode: 0644]
queue-6.6/mmc-sdhci_am654-add-tuning-algorithm-for-delay-chain.patch [new file with mode: 0644]
queue-6.6/mmc-sdhci_am654-drop-lookup-for-deprecated-ti-otap-d.patch [new file with mode: 0644]
queue-6.6/mmc-sdhci_am654-fix-itapdly-for-hs400-timing.patch [new file with mode: 0644]
queue-6.6/mmc-sdhci_am654-write-itapdly-for-ddr52-timing.patch [new file with mode: 0644]
queue-6.6/net-always-descend-into-dsa-folder-with-config_net_d.patch [new file with mode: 0644]
queue-6.6/net-fec-avoid-lock-evasion-when-reading-pps_enable.patch [new file with mode: 0644]
queue-6.6/net-lan966x-remove-ptp-traps-in-case-the-ptp-is-not-.patch [new file with mode: 0644]
queue-6.6/net-relax-socket-state-check-at-accept-time.patch [new file with mode: 0644]
queue-6.6/nfc-nci-fix-handling-of-zero-length-payload-packets-.patch [new file with mode: 0644]
queue-6.6/nfc-nci-fix-uninit-value-in-nci_rx_work.patch [new file with mode: 0644]
queue-6.6/nfs-keep-server-info-for-remounts.patch [new file with mode: 0644]
queue-6.6/nfsv4-fixup-smatch-warning-for-ambiguous-return.patch [new file with mode: 0644]
queue-6.6/nilfs2-make-superblock-data-array-index-computation-.patch [new file with mode: 0644]
queue-6.6/nouveau-add-an-ioctl-to-report-vram-usage.patch [new file with mode: 0644]
queue-6.6/nouveau-add-an-ioctl-to-return-vram-bar-size.patch [new file with mode: 0644]
queue-6.6/null_blk-fix-the-warning-modpost-missing-module_desc.patch [new file with mode: 0644]
queue-6.6/openvswitch-set-the-skbuff-pkt_type-for-proper-pmtud.patch [new file with mode: 0644]
queue-6.6/perf-arm-dmc620-fix-lockdep-assert-in-event_init.patch [new file with mode: 0644]
queue-6.6/platform-x86-thinkpad_acpi-take-hotkey_mutex-during-.patch [new file with mode: 0644]
queue-6.6/pnfs-filelayout-fixup-pnfs-allocation-modes.patch [new file with mode: 0644]
queue-6.6/powerpc-pseries-add-failure-related-checks-for-h_get.patch [new file with mode: 0644]
queue-6.6/regulator-bd71828-don-t-overwrite-runtime-voltages.patch [new file with mode: 0644]
queue-6.6/regulator-pickable-ranges-don-t-always-cache-vsel.patch [new file with mode: 0644]
queue-6.6/regulator-tps6287x-force-writing-vsel-bit.patch [new file with mode: 0644]
queue-6.6/regulator-tps6594-regulator-correct-multi-phase-conf.patch [new file with mode: 0644]
queue-6.6/revert-drm-bridge-ti-sn65dsi83-fix-enable-error-path.patch [new file with mode: 0644]
queue-6.6/revert-ixgbe-manual-an-37-for-troublesome-link-partn.patch [new file with mode: 0644]
queue-6.6/riscv-cpufeature-fix-thead-vector-hwcap-removal.patch [new file with mode: 0644]
queue-6.6/riscv-stacktrace-fixed-walk_stackframe.patch [new file with mode: 0644]
queue-6.6/rpcrdma-fix-handling-for-rdma_cm_event_device_remova.patch [new file with mode: 0644]
queue-6.6/rv-update-rv_en-dis-able_monitor-doc-to-match-kernel.patch [new file with mode: 0644]
queue-6.6/selftests-net-kill-smcrouted-in-the-cleanup-logic-in.patch [new file with mode: 0644]
queue-6.6/selftests-powerpc-dexcr-add-no-pie-to-hashchk-tests.patch [new file with mode: 0644]
queue-6.6/series
queue-6.6/sunrpc-fix-nfsacl-rpc-retry-on-soft-mount.patch [new file with mode: 0644]
queue-6.6/tcp-fix-shift-out-of-bounds-in-dctcp_update_alpha.patch [new file with mode: 0644]
queue-6.6/tcp-remove-64-kbyte-limit-for-initial-tp-rcv_wnd-val.patch [new file with mode: 0644]
queue-6.6/tls-fix-missing-memory-barrier-in-tls_init.patch [new file with mode: 0644]
queue-6.6/tools-arch-x86-intel_sdsi-fix-maximum-meter-bundle-l.patch [new file with mode: 0644]
queue-6.6/tools-arch-x86-intel_sdsi-fix-meter_certificate-deco.patch [new file with mode: 0644]
queue-6.6/tools-arch-x86-intel_sdsi-fix-meter_show-display.patch [new file with mode: 0644]
queue-6.6/tpm_tis_spi-account-for-spi-header-when-allocating-t.patch [new file with mode: 0644]
queue-6.6/tracing-probes-fix-error-check-in-parse_btf_field.patch [new file with mode: 0644]
queue-6.6/um-add-winch-to-winch_handlers-before-registering-wi.patch [new file with mode: 0644]
queue-6.6/um-fix-return-value-in-ubd_init.patch [new file with mode: 0644]
queue-6.6/um-fix-the-declaration-of-kasan_map_memory.patch [new file with mode: 0644]
queue-6.6/um-fix-the-wmissing-prototypes-warning-for-__switch_.patch [new file with mode: 0644]
queue-6.6/um-fix-the-wmissing-prototypes-warning-for-get_threa.patch [new file with mode: 0644]
queue-6.6/um-vector-fix-bpfflash-parameter-evaluation.patch [new file with mode: 0644]
queue-6.6/virtio-delete-vq-in-vp_find_vqs_msix-when-request_ir.patch [new file with mode: 0644]
queue-6.6/x86-kconfig-select-arch_want_frame_pointers-again-wh.patch [new file with mode: 0644]
queue-6.6/xen-x86-add-extra-pages-to-unpopulated-alloc-if-avai.patch [new file with mode: 0644]

diff --git a/queue-6.6/af_unix-update-unix_sk-sk-oob_skb-under-sk_receive_q.patch b/queue-6.6/af_unix-update-unix_sk-sk-oob_skb-under-sk_receive_q.patch
new file mode 100644 (file)
index 0000000..a8ee616
--- /dev/null
@@ -0,0 +1,155 @@
+From 601bddbe95604a472d6759c63a772b5838d286c8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 16 May 2024 22:48:35 +0900
+Subject: af_unix: Update unix_sk(sk)->oob_skb under sk_receive_queue lock.
+
+From: Kuniyuki Iwashima <kuniyu@amazon.com>
+
+[ Upstream commit 9841991a446c87f90f66f4b9fee6fe934c1336a2 ]
+
+Billy Jheng Bing-Jhong reported a race between __unix_gc() and
+queue_oob().
+
+__unix_gc() tries to garbage-collect close()d inflight sockets,
+and then if the socket has MSG_OOB in unix_sk(sk)->oob_skb, GC
+will drop the reference and set NULL to it locklessly.
+
+However, the peer socket still can send MSG_OOB message and
+queue_oob() can update unix_sk(sk)->oob_skb concurrently, leading
+NULL pointer dereference. [0]
+
+To fix the issue, let's update unix_sk(sk)->oob_skb under the
+sk_receive_queue's lock and take it everywhere we touch oob_skb.
+
+Note that we defer kfree_skb() in manage_oob() to silence lockdep
+false-positive (See [1]).
+
+[0]:
+BUG: kernel NULL pointer dereference, address: 0000000000000008
+ PF: supervisor write access in kernel mode
+ PF: error_code(0x0002) - not-present page
+PGD 8000000009f5e067 P4D 8000000009f5e067 PUD 9f5d067 PMD 0
+Oops: 0002 [#1] PREEMPT SMP PTI
+CPU: 3 PID: 50 Comm: kworker/3:1 Not tainted 6.9.0-rc5-00191-gd091e579b864 #110
+Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
+Workqueue: events delayed_fput
+RIP: 0010:skb_dequeue (./include/linux/skbuff.h:2386 ./include/linux/skbuff.h:2402 net/core/skbuff.c:3847)
+Code: 39 e3 74 3e 8b 43 10 48 89 ef 83 e8 01 89 43 10 49 8b 44 24 08 49 c7 44 24 08 00 00 00 00 49 8b 14 24 49 c7 04 24 00 00 00 00 <48> 89 42 08 48 89 10 e8 e7 c5 42 00 4c 89 e0 5b 5d 41 5c c3 cc cc
+RSP: 0018:ffffc900001bfd48 EFLAGS: 00000002
+RAX: 0000000000000000 RBX: ffff8880088f5ae8 RCX: 00000000361289f9
+RDX: 0000000000000000 RSI: 0000000000000206 RDI: ffff8880088f5b00
+RBP: ffff8880088f5b00 R08: 0000000000080000 R09: 0000000000000001
+R10: 0000000000000003 R11: 0000000000000001 R12: ffff8880056b6a00
+R13: ffff8880088f5280 R14: 0000000000000001 R15: ffff8880088f5a80
+FS:  0000000000000000(0000) GS:ffff88807dd80000(0000) knlGS:0000000000000000
+CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+CR2: 0000000000000008 CR3: 0000000006314000 CR4: 00000000007506f0
+PKRU: 55555554
+Call Trace:
+ <TASK>
+ unix_release_sock (net/unix/af_unix.c:654)
+ unix_release (net/unix/af_unix.c:1050)
+ __sock_release (net/socket.c:660)
+ sock_close (net/socket.c:1423)
+ __fput (fs/file_table.c:423)
+ delayed_fput (fs/file_table.c:444 (discriminator 3))
+ process_one_work (kernel/workqueue.c:3259)
+ worker_thread (kernel/workqueue.c:3329 kernel/workqueue.c:3416)
+ kthread (kernel/kthread.c:388)
+ ret_from_fork (arch/x86/kernel/process.c:153)
+ ret_from_fork_asm (arch/x86/entry/entry_64.S:257)
+ </TASK>
+Modules linked in:
+CR2: 0000000000000008
+
+Link: https://lore.kernel.org/netdev/a00d3993-c461-43f2-be6d-07259c98509a@rbox.co/ [1]
+Fixes: 1279f9d9dec2 ("af_unix: Call kfree_skb() for dead unix_(sk)->oob_skb in GC.")
+Reported-by: Billy Jheng Bing-Jhong <billy@starlabs.sg>
+Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
+Link: https://lore.kernel.org/r/20240516134835.8332-1-kuniyu@amazon.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/unix/af_unix.c | 28 ++++++++++++++++++++++------
+ 1 file changed, 22 insertions(+), 6 deletions(-)
+
+diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
+index aaa4d7878b5de..a4c41906faec1 100644
+--- a/net/unix/af_unix.c
++++ b/net/unix/af_unix.c
+@@ -2147,13 +2147,15 @@ static int queue_oob(struct socket *sock, struct msghdr *msg, struct sock *other
+       maybe_add_creds(skb, sock, other);
+       skb_get(skb);
++      scm_stat_add(other, skb);
++
++      spin_lock(&other->sk_receive_queue.lock);
+       if (ousk->oob_skb)
+               consume_skb(ousk->oob_skb);
+-
+       WRITE_ONCE(ousk->oob_skb, skb);
++      __skb_queue_tail(&other->sk_receive_queue, skb);
++      spin_unlock(&other->sk_receive_queue.lock);
+-      scm_stat_add(other, skb);
+-      skb_queue_tail(&other->sk_receive_queue, skb);
+       sk_send_sigurg(other);
+       unix_state_unlock(other);
+       other->sk_data_ready(other);
+@@ -2538,8 +2540,10 @@ static int unix_stream_recv_urg(struct unix_stream_read_state *state)
+       mutex_lock(&u->iolock);
+       unix_state_lock(sk);
++      spin_lock(&sk->sk_receive_queue.lock);
+       if (sock_flag(sk, SOCK_URGINLINE) || !u->oob_skb) {
++              spin_unlock(&sk->sk_receive_queue.lock);
+               unix_state_unlock(sk);
+               mutex_unlock(&u->iolock);
+               return -EINVAL;
+@@ -2551,6 +2555,8 @@ static int unix_stream_recv_urg(struct unix_stream_read_state *state)
+               WRITE_ONCE(u->oob_skb, NULL);
+       else
+               skb_get(oob_skb);
++
++      spin_unlock(&sk->sk_receive_queue.lock);
+       unix_state_unlock(sk);
+       chunk = state->recv_actor(oob_skb, 0, chunk, state);
+@@ -2579,6 +2585,10 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk,
+               consume_skb(skb);
+               skb = NULL;
+       } else {
++              struct sk_buff *unlinked_skb = NULL;
++
++              spin_lock(&sk->sk_receive_queue.lock);
++
+               if (skb == u->oob_skb) {
+                       if (copied) {
+                               skb = NULL;
+@@ -2590,13 +2600,19 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk,
+                       } else if (flags & MSG_PEEK) {
+                               skb = NULL;
+                       } else {
+-                              skb_unlink(skb, &sk->sk_receive_queue);
++                              __skb_unlink(skb, &sk->sk_receive_queue);
+                               WRITE_ONCE(u->oob_skb, NULL);
+-                              if (!WARN_ON_ONCE(skb_unref(skb)))
+-                                      kfree_skb(skb);
++                              unlinked_skb = skb;
+                               skb = skb_peek(&sk->sk_receive_queue);
+                       }
+               }
++
++              spin_unlock(&sk->sk_receive_queue.lock);
++
++              if (unlinked_skb) {
++                      WARN_ON_ONCE(skb_unref(unlinked_skb));
++                      kfree_skb(unlinked_skb);
++              }
+       }
+       return skb;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.6/alsa-hda-cs35l56-fix-lifetime-of-cs_dsp-instance.patch b/queue-6.6/alsa-hda-cs35l56-fix-lifetime-of-cs_dsp-instance.patch
new file mode 100644 (file)
index 0000000..8fd1079
--- /dev/null
@@ -0,0 +1,75 @@
+From 1a4df1a20c61a1034c7de7e07d1346af0f58eeea Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 8 May 2024 11:08:11 +0100
+Subject: ALSA: hda: cs35l56: Fix lifetime of cs_dsp instance
+
+From: Richard Fitzgerald <rf@opensource.cirrus.com>
+
+[ Upstream commit d344873c4cbde249b7152d36a273bcc45864001e ]
+
+The cs_dsp instance is initialized in the driver probe() so it
+should be freed in the driver remove(). Also fix a missing call
+to cs_dsp_remove() in the error path of cs35l56_hda_common_probe().
+
+The call to cs_dsp_remove() was being done in the component unbind
+callback cs35l56_hda_unbind(). This meant that if the driver was
+unbound and then re-bound it would be using an uninitialized cs_dsp
+instance.
+
+It is best to initialize the cs_dsp instance in probe() so that it
+can return an error if it fails. The component binding API doesn't
+have any error handling so there's no way to handle a failure if
+cs_dsp was initialized in the bind.
+
+Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
+Fixes: 73cfbfa9caea ("ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier")
+Link: https://lore.kernel.org/r/20240508100811.49514-1-rf@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 | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/sound/pci/hda/cs35l56_hda.c b/sound/pci/hda/cs35l56_hda.c
+index e599b287f0961..15e20d9261393 100644
+--- a/sound/pci/hda/cs35l56_hda.c
++++ b/sound/pci/hda/cs35l56_hda.c
+@@ -699,8 +699,6 @@ static void cs35l56_hda_unbind(struct device *dev, struct device *master, void *
+       if (cs35l56->base.fw_patched)
+               cs_dsp_power_down(&cs35l56->cs_dsp);
+-      cs_dsp_remove(&cs35l56->cs_dsp);
+-
+       if (comps[cs35l56->index].dev == dev)
+               memset(&comps[cs35l56->index], 0, sizeof(*comps));
+@@ -984,7 +982,7 @@ int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int id)
+                              ARRAY_SIZE(cs35l56_hda_dai_config));
+       ret = cs35l56_force_sync_asp1_registers_from_cache(&cs35l56->base);
+       if (ret)
+-              goto err;
++              goto dsp_err;
+       /*
+        * By default only enable one ASP1TXn, where n=amplifier index,
+@@ -1010,6 +1008,8 @@ int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int id)
+ pm_err:
+       pm_runtime_disable(cs35l56->base.dev);
++dsp_err:
++      cs_dsp_remove(&cs35l56->cs_dsp);
+ err:
+       gpiod_set_value_cansleep(cs35l56->base.reset_gpio, 0);
+@@ -1027,6 +1027,8 @@ void cs35l56_hda_remove(struct device *dev)
+       component_del(cs35l56->base.dev, &cs35l56_hda_comp_ops);
++      cs_dsp_remove(&cs35l56->cs_dsp);
++
+       kfree(cs35l56->system_name);
+       pm_runtime_put_noidle(cs35l56->base.dev);
+-- 
+2.43.0
+
diff --git a/queue-6.6/alsa-hda-cs35l56-initialize-all-asp1-registers.patch b/queue-6.6/alsa-hda-cs35l56-initialize-all-asp1-registers.patch
new file mode 100644 (file)
index 0000000..6761748
--- /dev/null
@@ -0,0 +1,84 @@
+From b3e06bf8870e8ce3c8ad171e2639eda7ebf7df59 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 29 Jan 2024 16:27:28 +0000
+Subject: ALSA: hda: cs35l56: Initialize all ASP1 registers
+
+From: Richard Fitzgerald <rf@opensource.cirrus.com>
+
+[ Upstream commit 856ce8982169acb31a25c5f2ecd2570ab8a6af46 ]
+
+Add ASP1_FRAME_CONTROL1, ASP1_FRAME_CONTROL5 and the ASP1_TX?_INPUT
+registers to the sequence used to initialize the ASP configuration.
+Write this sequence to the cache and directly to the registers to
+ensure that they match.
+
+A system-specific firmware can patch these registers to values that are
+not the silicon default, so that the CS35L56 boots already in the
+configuration used by Windows or by "driverless" Windows setups such
+as factory tuning.
+
+These may not match how Linux is configuring the HDA codec. And anyway
+on Linux the ALSA controls are used to configure routing options.
+
+Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
+Fixes: 73cfbfa9caea ("ALSA: hda/cs35l56: Add driver for Cirrus Logic CS35L56 amplifier")
+Link: https://msgid.link/r/20240129162737.497-10-rf@opensource.cirrus.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Stable-dep-of: d344873c4cbd ("ALSA: hda: cs35l56: Fix lifetime of cs_dsp instance")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/cs35l56_hda.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+diff --git a/sound/pci/hda/cs35l56_hda.c b/sound/pci/hda/cs35l56_hda.c
+index 05b1412868fc0..e599b287f0961 100644
+--- a/sound/pci/hda/cs35l56_hda.c
++++ b/sound/pci/hda/cs35l56_hda.c
+@@ -29,14 +29,23 @@
+   *  ASP1_RX_WL = 24 bits per sample
+   *  ASP1_TX_WL = 24 bits per sample
+   *  ASP1_RXn_EN 1..3 and ASP1_TXn_EN 1..4 disabled
++  *
++  * Override any Windows-specific mixer settings applied by the firmware.
+   */
+ static const struct reg_sequence cs35l56_hda_dai_config[] = {
+       { CS35L56_ASP1_CONTROL1,        0x00000021 },
+       { CS35L56_ASP1_CONTROL2,        0x20200200 },
+       { CS35L56_ASP1_CONTROL3,        0x00000003 },
++      { CS35L56_ASP1_FRAME_CONTROL1,  0x03020100 },
++      { CS35L56_ASP1_FRAME_CONTROL5,  0x00020100 },
+       { CS35L56_ASP1_DATA_CONTROL5,   0x00000018 },
+       { CS35L56_ASP1_DATA_CONTROL1,   0x00000018 },
+       { CS35L56_ASP1_ENABLES1,        0x00000000 },
++      { CS35L56_ASP1TX1_INPUT,        0x00000018 },
++      { CS35L56_ASP1TX2_INPUT,        0x00000019 },
++      { CS35L56_ASP1TX3_INPUT,        0x00000020 },
++      { CS35L56_ASP1TX4_INPUT,        0x00000028 },
++
+ };
+ static void cs35l56_hda_play(struct cs35l56_hda *cs35l56)
+@@ -132,6 +141,10 @@ static int cs35l56_hda_runtime_resume(struct device *dev)
+               }
+       }
++      ret = cs35l56_force_sync_asp1_registers_from_cache(&cs35l56->base);
++      if (ret)
++              goto err;
++
+       return 0;
+ err:
+@@ -969,6 +982,9 @@ int cs35l56_hda_common_probe(struct cs35l56_hda *cs35l56, int id)
+       regmap_multi_reg_write(cs35l56->base.regmap, cs35l56_hda_dai_config,
+                              ARRAY_SIZE(cs35l56_hda_dai_config));
++      ret = cs35l56_force_sync_asp1_registers_from_cache(&cs35l56->base);
++      if (ret)
++              goto err;
+       /*
+        * By default only enable one ASP1TXn, where n=amplifier index,
+-- 
+2.43.0
+
diff --git a/queue-6.6/alsa-hda-cs_dsp_ctl-use-private_free-for-control-cle.patch b/queue-6.6/alsa-hda-cs_dsp_ctl-use-private_free-for-control-cle.patch
new file mode 100644 (file)
index 0000000..37efa6a
--- /dev/null
@@ -0,0 +1,146 @@
+From 517a6d8cc2397c4aeb9da9d845f7df522b4af141 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 8 May 2024 10:56:27 +0100
+Subject: ALSA: hda/cs_dsp_ctl: Use private_free for control cleanup
+
+From: Richard Fitzgerald <rf@opensource.cirrus.com>
+
+[ Upstream commit 172811e3a557d8681a5e2d0f871dc04a2d17eb13 ]
+
+Use the control private_free callback to free the associated data
+block. This ensures that the memory won't leak, whatever way the
+control gets destroyed.
+
+The original implementation didn't actually remove the ALSA
+controls in hda_cs_dsp_control_remove(). It only freed the internal
+tracking structure. This meant it was possible to remove/unload the
+amp driver while leaving its ALSA controls still present in the
+soundcard. Obviously attempting to access them could cause segfaults
+or at least dereferencing stale pointers.
+
+Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
+Fixes: 3233b978af23 ("ALSA: hda: hda_cs_dsp_ctl: Add Library to support CS_DSP ALSA controls")
+Link: https://lore.kernel.org/r/20240508095627.44476-1-rf@opensource.cirrus.com
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/pci/hda/hda_cs_dsp_ctl.c | 47 ++++++++++++++++++++++------------
+ 1 file changed, 31 insertions(+), 16 deletions(-)
+
+diff --git a/sound/pci/hda/hda_cs_dsp_ctl.c b/sound/pci/hda/hda_cs_dsp_ctl.c
+index 463ca06036bfe..9db45d7c17e5f 100644
+--- a/sound/pci/hda/hda_cs_dsp_ctl.c
++++ b/sound/pci/hda/hda_cs_dsp_ctl.c
+@@ -8,6 +8,7 @@
+ #include <linux/module.h>
+ #include <sound/soc.h>
++#include <linux/cleanup.h>
+ #include <linux/firmware/cirrus/cs_dsp.h>
+ #include <linux/firmware/cirrus/wmfw.h>
+ #include "hda_cs_dsp_ctl.h"
+@@ -97,11 +98,23 @@ static unsigned int wmfw_convert_flags(unsigned int in)
+       return out;
+ }
+-static void hda_cs_dsp_add_kcontrol(struct hda_cs_dsp_coeff_ctl *ctl, const char *name)
++static void hda_cs_dsp_free_kcontrol(struct snd_kcontrol *kctl)
+ {
++      struct hda_cs_dsp_coeff_ctl *ctl = (struct hda_cs_dsp_coeff_ctl *)snd_kcontrol_chip(kctl);
+       struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl;
++
++      /* NULL priv to prevent a double-free in hda_cs_dsp_control_remove() */
++      cs_ctl->priv = NULL;
++      kfree(ctl);
++}
++
++static void hda_cs_dsp_add_kcontrol(struct cs_dsp_coeff_ctl *cs_ctl,
++                                  const struct hda_cs_dsp_ctl_info *info,
++                                  const char *name)
++{
+       struct snd_kcontrol_new kcontrol = {0};
+       struct snd_kcontrol *kctl;
++      struct hda_cs_dsp_coeff_ctl *ctl __free(kfree) = NULL;
+       int ret = 0;
+       if (cs_ctl->len > ADSP_MAX_STD_CTRL_SIZE) {
+@@ -110,6 +123,13 @@ static void hda_cs_dsp_add_kcontrol(struct hda_cs_dsp_coeff_ctl *ctl, const char
+               return;
+       }
++      ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
++      if (!ctl)
++              return;
++
++      ctl->cs_ctl = cs_ctl;
++      ctl->card = info->card;
++
+       kcontrol.name = name;
+       kcontrol.info = hda_cs_dsp_coeff_info;
+       kcontrol.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
+@@ -117,20 +137,22 @@ static void hda_cs_dsp_add_kcontrol(struct hda_cs_dsp_coeff_ctl *ctl, const char
+       kcontrol.get = hda_cs_dsp_coeff_get;
+       kcontrol.put = hda_cs_dsp_coeff_put;
+-      /* Save ctl inside private_data, ctl is owned by cs_dsp,
+-       * and will be freed when cs_dsp removes the control */
+       kctl = snd_ctl_new1(&kcontrol, (void *)ctl);
+       if (!kctl)
+               return;
+-      ret = snd_ctl_add(ctl->card, kctl);
++      kctl->private_free = hda_cs_dsp_free_kcontrol;
++      ctl->kctl = kctl;
++
++      /* snd_ctl_add() calls our private_free on error, which will kfree(ctl) */
++      cs_ctl->priv = no_free_ptr(ctl);
++      ret = snd_ctl_add(info->card, kctl);
+       if (ret) {
+               dev_err(cs_ctl->dsp->dev, "Failed to add KControl %s = %d\n", kcontrol.name, ret);
+               return;
+       }
+       dev_dbg(cs_ctl->dsp->dev, "Added KControl: %s\n", kcontrol.name);
+-      ctl->kctl = kctl;
+ }
+ static void hda_cs_dsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl,
+@@ -138,7 +160,6 @@ static void hda_cs_dsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl,
+ {
+       struct cs_dsp *cs_dsp = cs_ctl->dsp;
+       char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
+-      struct hda_cs_dsp_coeff_ctl *ctl;
+       const char *region_name;
+       int ret;
+@@ -163,15 +184,7 @@ static void hda_cs_dsp_control_add(struct cs_dsp_coeff_ctl *cs_ctl,
+                        " %.*s", cs_ctl->subname_len - skip, cs_ctl->subname + skip);
+       }
+-      ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
+-      if (!ctl)
+-              return;
+-
+-      ctl->cs_ctl = cs_ctl;
+-      ctl->card = info->card;
+-      cs_ctl->priv = ctl;
+-
+-      hda_cs_dsp_add_kcontrol(ctl, name);
++      hda_cs_dsp_add_kcontrol(cs_ctl, info, name);
+ }
+ void hda_cs_dsp_add_controls(struct cs_dsp *dsp, const struct hda_cs_dsp_ctl_info *info)
+@@ -203,7 +216,9 @@ void hda_cs_dsp_control_remove(struct cs_dsp_coeff_ctl *cs_ctl)
+ {
+       struct hda_cs_dsp_coeff_ctl *ctl = cs_ctl->priv;
+-      kfree(ctl);
++      /* ctl and kctl may already have been removed by ALSA private_free */
++      if (ctl && ctl->kctl)
++              snd_ctl_remove(ctl->card, ctl->kctl);
+ }
+ EXPORT_SYMBOL_NS_GPL(hda_cs_dsp_control_remove, SND_HDA_CS_DSP_CONTROLS);
+-- 
+2.43.0
+
diff --git a/queue-6.6/arm64-asm-bug-add-.align-2-to-the-end-of-__bug_entry.patch b/queue-6.6/arm64-asm-bug-add-.align-2-to-the-end-of-__bug_entry.patch
new file mode 100644 (file)
index 0000000..bc07c2d
--- /dev/null
@@ -0,0 +1,160 @@
+From 0a267973d750542e61c87819e192e9c0dc29f51c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 20 May 2024 21:34:37 +0800
+Subject: arm64: asm-bug: Add .align 2 to the end of __BUG_ENTRY
+
+From: Jiangfeng Xiao <xiaojiangfeng@huawei.com>
+
+[ Upstream commit ffbf4fb9b5c12ff878a10ea17997147ea4ebea6f ]
+
+When CONFIG_DEBUG_BUGVERBOSE=n, we fail to add necessary padding bytes
+to bug_table entries, and as a result the last entry in a bug table will
+be ignored, potentially leading to an unexpected panic(). All prior
+entries in the table will be handled correctly.
+
+The arm64 ABI requires that struct fields of up to 8 bytes are
+naturally-aligned, with padding added within a struct such that struct
+are suitably aligned within arrays.
+
+When CONFIG_DEBUG_BUGVERPOSE=y, the layout of a bug_entry is:
+
+       struct bug_entry {
+               signed int      bug_addr_disp;  // 4 bytes
+               signed int      file_disp;      // 4 bytes
+               unsigned short  line;           // 2 bytes
+               unsigned short  flags;          // 2 bytes
+       }
+
+... with 12 bytes total, requiring 4-byte alignment.
+
+When CONFIG_DEBUG_BUGVERBOSE=n, the layout of a bug_entry is:
+
+       struct bug_entry {
+               signed int      bug_addr_disp;  // 4 bytes
+               unsigned short  flags;          // 2 bytes
+               < implicit padding >            // 2 bytes
+       }
+
+... with 8 bytes total, with 6 bytes of data and 2 bytes of trailing
+padding, requiring 4-byte alginment.
+
+When we create a bug_entry in assembly, we align the start of the entry
+to 4 bytes, which implicitly handles padding for any prior entries.
+However, we do not align the end of the entry, and so when
+CONFIG_DEBUG_BUGVERBOSE=n, the final entry lacks the trailing padding
+bytes.
+
+For the main kernel image this is not a problem as find_bug() doesn't
+depend on the trailing padding bytes when searching for entries:
+
+       for (bug = __start___bug_table; bug < __stop___bug_table; ++bug)
+               if (bugaddr == bug_addr(bug))
+                       return bug;
+
+However for modules, module_bug_finalize() depends on the trailing
+bytes when calculating the number of entries:
+
+       mod->num_bugs = sechdrs[i].sh_size / sizeof(struct bug_entry);
+
+... and as the last bug_entry lacks the necessary padding bytes, this entry
+will not be counted, e.g. in the case of a single entry:
+
+       sechdrs[i].sh_size == 6
+       sizeof(struct bug_entry) == 8;
+
+       sechdrs[i].sh_size / sizeof(struct bug_entry) == 0;
+
+Consequently module_find_bug() will miss the last bug_entry when it does:
+
+       for (i = 0; i < mod->num_bugs; ++i, ++bug)
+               if (bugaddr == bug_addr(bug))
+                       goto out;
+
+... which can lead to a kenrel panic due to an unhandled bug.
+
+This can be demonstrated with the following module:
+
+       static int __init buginit(void)
+       {
+               WARN(1, "hello\n");
+               return 0;
+       }
+
+       static void __exit bugexit(void)
+       {
+       }
+
+       module_init(buginit);
+       module_exit(bugexit);
+       MODULE_LICENSE("GPL");
+
+... which will trigger a kernel panic when loaded:
+
+       ------------[ cut here ]------------
+       hello
+       Unexpected kernel BRK exception at EL1
+       Internal error: BRK handler: 00000000f2000800 [#1] PREEMPT SMP
+       Modules linked in: hello(O+)
+       CPU: 0 PID: 50 Comm: insmod Tainted: G           O       6.9.1 #8
+       Hardware name: linux,dummy-virt (DT)
+       pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
+       pc : buginit+0x18/0x1000 [hello]
+       lr : buginit+0x18/0x1000 [hello]
+       sp : ffff800080533ae0
+       x29: ffff800080533ae0 x28: 0000000000000000 x27: 0000000000000000
+       x26: ffffaba8c4e70510 x25: ffff800080533c30 x24: ffffaba8c4a28a58
+       x23: 0000000000000000 x22: 0000000000000000 x21: ffff3947c0eab3c0
+       x20: ffffaba8c4e3f000 x19: ffffaba846464000 x18: 0000000000000006
+       x17: 0000000000000000 x16: ffffaba8c2492834 x15: 0720072007200720
+       x14: 0720072007200720 x13: ffffaba8c49b27c8 x12: 0000000000000312
+       x11: 0000000000000106 x10: ffffaba8c4a0a7c8 x9 : ffffaba8c49b27c8
+       x8 : 00000000ffffefff x7 : ffffaba8c4a0a7c8 x6 : 80000000fffff000
+       x5 : 0000000000000107 x4 : 0000000000000000 x3 : 0000000000000000
+       x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff3947c0eab3c0
+       Call trace:
+        buginit+0x18/0x1000 [hello]
+        do_one_initcall+0x80/0x1c8
+        do_init_module+0x60/0x218
+        load_module+0x1ba4/0x1d70
+        __do_sys_init_module+0x198/0x1d0
+        __arm64_sys_init_module+0x1c/0x28
+        invoke_syscall+0x48/0x114
+        el0_svc_common.constprop.0+0x40/0xe0
+        do_el0_svc+0x1c/0x28
+        el0_svc+0x34/0xd8
+        el0t_64_sync_handler+0x120/0x12c
+        el0t_64_sync+0x190/0x194
+       Code: d0ffffe0 910003fd 91000000 9400000b (d4210000)
+       ---[ end trace 0000000000000000 ]---
+       Kernel panic - not syncing: BRK handler: Fatal exception
+
+Fix this by always aligning the end of a bug_entry to 4 bytes, which is
+correct regardless of CONFIG_DEBUG_BUGVERBOSE.
+
+Fixes: 9fb7410f955f ("arm64/BUG: Use BRK instruction for generic BUG traps")
+
+Signed-off-by: Yuanbin Xie <xieyuanbin1@huawei.com>
+Signed-off-by: Jiangfeng Xiao <xiaojiangfeng@huawei.com>
+Reviewed-by: Mark Rutland <mark.rutland@arm.com>
+Link: https://lore.kernel.org/r/1716212077-43826-1-git-send-email-xiaojiangfeng@huawei.com
+Signed-off-by: Will Deacon <will@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/arm64/include/asm/asm-bug.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/arch/arm64/include/asm/asm-bug.h b/arch/arm64/include/asm/asm-bug.h
+index c762038ba4009..6e73809f6492a 100644
+--- a/arch/arm64/include/asm/asm-bug.h
++++ b/arch/arm64/include/asm/asm-bug.h
+@@ -28,6 +28,7 @@
+       14470:  .long 14471f - .;                       \
+ _BUGVERBOSE_LOCATION(__FILE__, __LINE__)              \
+               .short flags;                           \
++              .align 2;                               \
+               .popsection;                            \
+       14471:
+ #else
+-- 
+2.43.0
+
diff --git a/queue-6.6/asoc-cs35l56-fix-to-ensure-asp1-registers-match-cach.patch b/queue-6.6/asoc-cs35l56-fix-to-ensure-asp1-registers-match-cach.patch
new file mode 100644 (file)
index 0000000..22c4d7e
--- /dev/null
@@ -0,0 +1,172 @@
+From 5a2cccb4dd8a9bc756d5d80c0a38f8e70189ace0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 29 Jan 2024 16:27:26 +0000
+Subject: ASoC: cs35l56: Fix to ensure ASP1 registers match cache
+
+From: Richard Fitzgerald <rf@opensource.cirrus.com>
+
+[ Upstream commit 72a77d7631c6e392677c0134343cf5edcd3a4572 ]
+
+Add a dummy SUPPLY widget connected to the ASP that forces the
+chip registers to match the regmap cache when the ASP is
+powered-up.
+
+On a SoundWire system the ASP is free for use as a chip-to-chip
+interconnect. This can be either for the firmware on multiple
+CS35L56 to share reference audio; or as a bridge to another
+device. If it is a firmware interconnect it is owned by the
+firmware and the Linux driver should avoid writing the registers.
+However. If it is a bridge then Linux may take over and handle
+it as a normal codec-to-codec link.
+
+CS35L56 is designed for SDCA and a generic SDCA driver would
+know nothing about these chip-specific registers. So if the
+ASP is being used on a SoundWire system the firmware sets up the
+ASP registers. This means that we can't assume the default
+state of the ASP registers. But we don't know the initial state
+that the firmware set them to until after the firmware has been
+downloaded and booted, which can take several seconds when
+downloading multiple amps.
+
+To avoid blocking probe() for several seconds waiting for the
+firmware, the silicon defaults are assumed. This allows the machine
+driver to setup the ASP configuration during probe() without being
+blocked. If the ASP is hooked up and used, the SUPPLY widget
+ensures that the chip registers match what was configured in the
+regmap cache.
+
+If the machine driver does not hook up the ASP, it is assumed that
+it won't call any functions to configure the ASP DAI. Therefore
+the regmap cache will be clean for these registers so a
+regcache_sync() will not overwrite the chip registers. If the
+DAI is not hooked up, the dummy SUPPLY widget will not be
+invoked so it will never force-overwrite the chip registers.
+
+Backport note:
+This won't apply cleanly to kernels older than v6.6.
+
+Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
+Fixes: e49611252900 ("ASoC: cs35l56: Add driver for Cirrus Logic CS35L56")
+Link: https://msgid.link/r/20240129162737.497-8-rf@opensource.cirrus.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Stable-dep-of: d344873c4cbd ("ALSA: hda: cs35l56: Fix lifetime of cs_dsp instance")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/sound/cs35l56.h           |  1 +
+ sound/soc/codecs/cs35l56-shared.c | 41 +++++++++++++++++++++++++++++++
+ sound/soc/codecs/cs35l56.c        | 21 ++++++++++++++++
+ 3 files changed, 63 insertions(+)
+
+diff --git a/include/sound/cs35l56.h b/include/sound/cs35l56.h
+index 3950322bf3cbb..4e5f35dc042a1 100644
+--- a/include/sound/cs35l56.h
++++ b/include/sound/cs35l56.h
+@@ -273,6 +273,7 @@ extern const char * const cs35l56_tx_input_texts[CS35L56_NUM_INPUT_SRC];
+ extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC];
+ int cs35l56_set_patch(struct cs35l56_base *cs35l56_base);
++int cs35l56_force_sync_asp1_registers_from_cache(struct cs35l56_base *cs35l56_base);
+ int cs35l56_mbox_send(struct cs35l56_base *cs35l56_base, unsigned int command);
+ int cs35l56_firmware_shutdown(struct cs35l56_base *cs35l56_base);
+ int cs35l56_wait_for_firmware_boot(struct cs35l56_base *cs35l56_base);
+diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c
+index afd12d853ce4c..12291242362b4 100644
+--- a/sound/soc/codecs/cs35l56-shared.c
++++ b/sound/soc/codecs/cs35l56-shared.c
+@@ -194,6 +194,47 @@ static bool cs35l56_volatile_reg(struct device *dev, unsigned int reg)
+       }
+ }
++/*
++ * The firmware boot sequence can overwrite the ASP1 config registers so that
++ * they don't match regmap's view of their values. Rewrite the values from the
++ * regmap cache into the hardware registers.
++ */
++int cs35l56_force_sync_asp1_registers_from_cache(struct cs35l56_base *cs35l56_base)
++{
++      struct reg_sequence asp1_regs[] = {
++              { .reg = CS35L56_ASP1_ENABLES1 },
++              { .reg = CS35L56_ASP1_CONTROL1 },
++              { .reg = CS35L56_ASP1_CONTROL2 },
++              { .reg = CS35L56_ASP1_CONTROL3 },
++              { .reg = CS35L56_ASP1_FRAME_CONTROL1 },
++              { .reg = CS35L56_ASP1_FRAME_CONTROL5 },
++              { .reg = CS35L56_ASP1_DATA_CONTROL1 },
++              { .reg = CS35L56_ASP1_DATA_CONTROL5 },
++      };
++      int i, ret;
++
++      /* Read values from regmap cache into a write sequence */
++      for (i = 0; i < ARRAY_SIZE(asp1_regs); ++i) {
++              ret = regmap_read(cs35l56_base->regmap, asp1_regs[i].reg, &asp1_regs[i].def);
++              if (ret)
++                      goto err;
++      }
++
++      /* Write the values cache-bypassed so that they will be written to silicon */
++      ret = regmap_multi_reg_write_bypassed(cs35l56_base->regmap, asp1_regs,
++                                            ARRAY_SIZE(asp1_regs));
++      if (ret)
++              goto err;
++
++      return 0;
++
++err:
++      dev_err(cs35l56_base->dev, "Failed to sync ASP1 registers: %d\n", ret);
++
++      return ret;
++}
++EXPORT_SYMBOL_NS_GPL(cs35l56_force_sync_asp1_registers_from_cache, SND_SOC_CS35L56_SHARED);
++
+ int cs35l56_mbox_send(struct cs35l56_base *cs35l56_base, unsigned int command)
+ {
+       unsigned int val;
+diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c
+index 530f6e06b41d5..c855ef3ec665e 100644
+--- a/sound/soc/codecs/cs35l56.c
++++ b/sound/soc/codecs/cs35l56.c
+@@ -277,6 +277,21 @@ static SOC_VALUE_ENUM_SINGLE_DECL(cs35l56_sdw1tx4_enum,
+ static const struct snd_kcontrol_new sdw1_tx4_mux =
+       SOC_DAPM_ENUM("SDW1TX4 SRC", cs35l56_sdw1tx4_enum);
++static int cs35l56_asp1_cfg_event(struct snd_soc_dapm_widget *w,
++                                struct snd_kcontrol *kcontrol, int event)
++{
++      struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
++      struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(component);
++
++      switch (event) {
++      case SND_SOC_DAPM_PRE_PMU:
++              /* Override register values set by firmware boot */
++              return cs35l56_force_sync_asp1_registers_from_cache(&cs35l56->base);
++      default:
++              return 0;
++      }
++}
++
+ static int cs35l56_play_event(struct snd_soc_dapm_widget *w,
+                             struct snd_kcontrol *kcontrol, int event)
+ {
+@@ -313,6 +328,9 @@ static const struct snd_soc_dapm_widget cs35l56_dapm_widgets[] = {
+       SND_SOC_DAPM_REGULATOR_SUPPLY("VDD_B", 0, 0),
+       SND_SOC_DAPM_REGULATOR_SUPPLY("VDD_AMP", 0, 0),
++      SND_SOC_DAPM_SUPPLY("ASP1 CFG", SND_SOC_NOPM, 0, 0, cs35l56_asp1_cfg_event,
++                          SND_SOC_DAPM_PRE_PMU),
++
+       SND_SOC_DAPM_SUPPLY("PLAY", SND_SOC_NOPM, 0, 0, cs35l56_play_event,
+                           SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_POST_PMD),
+@@ -380,6 +398,9 @@ static const struct snd_soc_dapm_route cs35l56_audio_map[] = {
+       { "AMP", NULL, "VDD_B" },
+       { "AMP", NULL, "VDD_AMP" },
++      { "ASP1 Playback", NULL, "ASP1 CFG" },
++      { "ASP1 Capture", NULL, "ASP1 CFG" },
++
+       { "ASP1 Playback", NULL, "PLAY" },
+       { "SDW1 Playback", NULL, "PLAY" },
+-- 
+2.43.0
+
diff --git a/queue-6.6/asoc-mediatek-mt8192-fix-register-configuration-for-.patch b/queue-6.6/asoc-mediatek-mt8192-fix-register-configuration-for-.patch
new file mode 100644 (file)
index 0000000..05d02e3
--- /dev/null
@@ -0,0 +1,43 @@
+From 5befa5855802f71e0887c21533955bd4ef038081 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 9 May 2024 07:31:29 +0000
+Subject: ASoC: mediatek: mt8192: fix register configuration for tdm
+
+From: Hsin-Te Yuan <yuanhsinte@chromium.org>
+
+[ Upstream commit a85ed162f0efcfdd664954414a05d1d560cc95dc ]
+
+For DSP_A, data is a BCK cycle behind LRCK trigger edge. For DSP_B, this
+delay doesn't exist. Fix the delay configuration to match the standard.
+
+Fixes: 52fcd65414abfc ("ASoC: mediatek: mt8192: support tdm in platform driver")
+Signed-off-by: Hsin-Te Yuan <yuanhsinte@chromium.org>
+Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Reviewed-by: Chen-Yu Tsai <wenst@chromium.org>
+Link: https://lore.kernel.org/r/20240509-8192-tdm-v1-1-530b54645763@chromium.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/mediatek/mt8192/mt8192-dai-tdm.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c b/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c
+index 9ce06821c7d0f..49440db370af0 100644
+--- a/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c
++++ b/sound/soc/mediatek/mt8192/mt8192-dai-tdm.c
+@@ -566,10 +566,10 @@ static int mtk_dai_tdm_hw_params(struct snd_pcm_substream *substream,
+               tdm_con |= 1 << DELAY_DATA_SFT;
+               tdm_con |= get_tdm_lrck_width(format) << LRCK_TDM_WIDTH_SFT;
+       } else if (tdm_priv->tdm_out_mode == TDM_OUT_DSP_A) {
+-              tdm_con |= 0 << DELAY_DATA_SFT;
++              tdm_con |= 1 << DELAY_DATA_SFT;
+               tdm_con |= 0 << LRCK_TDM_WIDTH_SFT;
+       } else if (tdm_priv->tdm_out_mode == TDM_OUT_DSP_B) {
+-              tdm_con |= 1 << DELAY_DATA_SFT;
++              tdm_con |= 0 << DELAY_DATA_SFT;
+               tdm_con |= 0 << LRCK_TDM_WIDTH_SFT;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.6/asoc-tas2552-add-tx-path-for-capturing-audio-out-dat.patch b/queue-6.6/asoc-tas2552-add-tx-path-for-capturing-audio-out-dat.patch
new file mode 100644 (file)
index 0000000..6e75970
--- /dev/null
@@ -0,0 +1,76 @@
+From ba9ccbb55920f7a82b3fc346488fb6de4f9a471a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 18 May 2024 11:35:15 +0800
+Subject: ASoC: tas2552: Add TX path for capturing AUDIO-OUT data
+
+From: Shenghao Ding <shenghao-ding@ti.com>
+
+[ Upstream commit 7078ac4fd179a68d0bab448004fcd357e7a45f8d ]
+
+TAS2552 is a Smartamp with I/V sense data, add TX path
+to support capturing I/V data.
+
+Fixes: 38803ce7b53b ("ASoC: codecs: tas*: merge .digital_mute() into .mute_stream()")
+Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
+Link: https://msgid.link/r/20240518033515.866-1-shenghao-ding@ti.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/tas2552.c | 15 +++++++++++++--
+ 1 file changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/codecs/tas2552.c b/sound/soc/codecs/tas2552.c
+index 8c9dc318b0e82..c65a4219ecd6c 100644
+--- a/sound/soc/codecs/tas2552.c
++++ b/sound/soc/codecs/tas2552.c
+@@ -2,7 +2,8 @@
+ /*
+  * tas2552.c - ALSA SoC Texas Instruments TAS2552 Mono Audio Amplifier
+  *
+- * Copyright (C) 2014 Texas Instruments Incorporated -  https://www.ti.com
++ * Copyright (C) 2014 - 2024 Texas Instruments Incorporated -
++ *    https://www.ti.com
+  *
+  * Author: Dan Murphy <dmurphy@ti.com>
+  */
+@@ -119,12 +120,14 @@ static const struct snd_soc_dapm_widget tas2552_dapm_widgets[] =
+                        &tas2552_input_mux_control),
+       SND_SOC_DAPM_AIF_IN("DAC IN", "DAC Playback", 0, SND_SOC_NOPM, 0, 0),
++      SND_SOC_DAPM_AIF_OUT("ASI OUT", "DAC Capture", 0, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_DAC("DAC", NULL, SND_SOC_NOPM, 0, 0),
+       SND_SOC_DAPM_OUT_DRV("ClassD", TAS2552_CFG_2, 7, 0, NULL, 0),
+       SND_SOC_DAPM_SUPPLY("PLL", TAS2552_CFG_2, 3, 0, NULL, 0),
+       SND_SOC_DAPM_POST("Post Event", tas2552_post_event),
+-      SND_SOC_DAPM_OUTPUT("OUT")
++      SND_SOC_DAPM_OUTPUT("OUT"),
++      SND_SOC_DAPM_INPUT("DMIC")
+ };
+ static const struct snd_soc_dapm_route tas2552_audio_map[] = {
+@@ -134,6 +137,7 @@ static const struct snd_soc_dapm_route tas2552_audio_map[] = {
+       {"ClassD", NULL, "Input selection"},
+       {"OUT", NULL, "ClassD"},
+       {"ClassD", NULL, "PLL"},
++      {"ASI OUT", NULL, "DMIC"}
+ };
+ #ifdef CONFIG_PM
+@@ -538,6 +542,13 @@ static struct snd_soc_dai_driver tas2552_dai[] = {
+                       .rates = SNDRV_PCM_RATE_8000_192000,
+                       .formats = TAS2552_FORMATS,
+               },
++              .capture = {
++                      .stream_name = "Capture",
++                      .channels_min = 2,
++                      .channels_max = 2,
++                      .rates = SNDRV_PCM_RATE_8000_192000,
++                      .formats = TAS2552_FORMATS,
++              },
+               .ops = &tas2552_speaker_dai_ops,
+       },
+ };
+-- 
+2.43.0
+
diff --git a/queue-6.6/asoc-tas2781-fix-a-warning-reported-by-robot-kernel-.patch b/queue-6.6/asoc-tas2781-fix-a-warning-reported-by-robot-kernel-.patch
new file mode 100644 (file)
index 0000000..744b867
--- /dev/null
@@ -0,0 +1,50 @@
+From e316868e869a0afeaa11ea653d4868b33c7299a7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 5 May 2024 20:23:45 +0800
+Subject: ASoC: tas2781: Fix a warning reported by robot kernel test
+
+From: Shenghao Ding <shenghao-ding@ti.com>
+
+[ Upstream commit 1ae14f3520b1a0ad144610a3f592c81a3e81cd1b ]
+
+Fix a warning reported by robot kernel test that 'fw_entry' in function
+'tas2781_load_calibration' is used uninitialized with compiler
+sh4-linux-gcc (GCC) 13.2.0, an update of copyright and a correction of the
+comments.
+
+Fixes: ef3bcde75d06 ("ASoc: tas2781: Add tas2781 driver")
+Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
+Link: https://lore.kernel.org/r/20240505122346.1326-1-shenghao-ding@ti.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/codecs/tas2781-fmwlib.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/sound/soc/codecs/tas2781-fmwlib.c b/sound/soc/codecs/tas2781-fmwlib.c
+index 61b05629a9a9c..a7ae4005d83f4 100644
+--- a/sound/soc/codecs/tas2781-fmwlib.c
++++ b/sound/soc/codecs/tas2781-fmwlib.c
+@@ -1,8 +1,8 @@
+ // SPDX-License-Identifier: GPL-2.0
+ //
+-// tasdevice-fmw.c -- TASDEVICE firmware support
++// tas2781-fmwlib.c -- TASDEVICE firmware support
+ //
+-// Copyright 2023 Texas Instruments, Inc.
++// Copyright 2023 - 2024 Texas Instruments, Inc.
+ //
+ // Author: Shenghao Ding <shenghao-ding@ti.com>
+@@ -1908,7 +1908,7 @@ int tas2781_load_calibration(void *context, char *file_name,
+ {
+       struct tasdevice_priv *tas_priv = (struct tasdevice_priv *)context;
+       struct tasdevice *tasdev = &(tas_priv->tasdevice[i]);
+-      const struct firmware *fw_entry;
++      const struct firmware *fw_entry = NULL;
+       struct tasdevice_fw *tas_fmw;
+       struct firmware fmw;
+       int offset = 0;
+-- 
+2.43.0
+
diff --git a/queue-6.6/asoc-tas2781-fix-wrong-loading-calibrated-data-seque.patch b/queue-6.6/asoc-tas2781-fix-wrong-loading-calibrated-data-seque.patch
new file mode 100644 (file)
index 0000000..0564779
--- /dev/null
@@ -0,0 +1,222 @@
+From a83d81a13b9b2416b610ceb7302278b24b7b8f59 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 18 May 2024 22:15:46 +0800
+Subject: ASoC: tas2781: Fix wrong loading calibrated data sequence
+
+From: Shenghao Ding <shenghao-ding@ti.com>
+
+[ Upstream commit b195acf5266d2dee4067f89345c3e6b88d925311 ]
+
+Calibrated data will be set to default after loading DSP config params,
+which will cause speaker protection work abnormally. Reload calibrated
+data after loading DSP config params. Remove declaration of unused API
+which load calibrated data in wrong sequence, changed the copyright year
+and correct file name in license
+header.
+
+Fixes: ef3bcde75d06 ("ASoC: tas2781: Add tas2781 driver")
+Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
+Link: https://msgid.link/r/20240518141546.1742-1-shenghao-ding@ti.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/sound/tas2781-dsp.h       |   7 +-
+ sound/soc/codecs/tas2781-fmwlib.c | 103 ++++++++----------------------
+ sound/soc/codecs/tas2781-i2c.c    |   4 +-
+ 3 files changed, 32 insertions(+), 82 deletions(-)
+
+diff --git a/include/sound/tas2781-dsp.h b/include/sound/tas2781-dsp.h
+index bd1b72bf47a5e..4ef0f5c6fe6c0 100644
+--- a/include/sound/tas2781-dsp.h
++++ b/include/sound/tas2781-dsp.h
+@@ -2,7 +2,7 @@
+ //
+ // ALSA SoC Texas Instruments TAS2781 Audio Smart Amplifier
+ //
+-// Copyright (C) 2022 - 2023 Texas Instruments Incorporated
++// Copyright (C) 2022 - 2024 Texas Instruments Incorporated
+ // https://www.ti.com
+ //
+ // The TAS2781 driver implements a flexible and configurable
+@@ -13,8 +13,8 @@
+ // Author: Kevin Lu <kevin-lu@ti.com>
+ //
+-#ifndef __TASDEVICE_DSP_H__
+-#define __TASDEVICE_DSP_H__
++#ifndef __TAS2781_DSP_H__
++#define __TAS2781_DSP_H__
+ #define MAIN_ALL_DEVICES                      0x0d
+ #define MAIN_DEVICE_A                         0x01
+@@ -175,7 +175,6 @@ void tasdevice_calbin_remove(void *context);
+ int tasdevice_select_tuningprm_cfg(void *context, int prm,
+       int cfg_no, int rca_conf_no);
+ int tasdevice_prmg_load(void *context, int prm_no);
+-int tasdevice_prmg_calibdata_load(void *context, int prm_no);
+ void tasdevice_tuning_switch(void *context, int state);
+ int tas2781_load_calibration(void *context, char *file_name,
+       unsigned short i);
+diff --git a/sound/soc/codecs/tas2781-fmwlib.c b/sound/soc/codecs/tas2781-fmwlib.c
+index a7ae4005d83f4..c6c47297a4fe7 100644
+--- a/sound/soc/codecs/tas2781-fmwlib.c
++++ b/sound/soc/codecs/tas2781-fmwlib.c
+@@ -2181,6 +2181,24 @@ static int tasdevice_load_data(struct tasdevice_priv *tas_priv,
+       return ret;
+ }
++static void tasdev_load_calibrated_data(struct tasdevice_priv *priv, int i)
++{
++      struct tasdevice_calibration *cal;
++      struct tasdevice_fw *cal_fmw;
++
++      cal_fmw = priv->tasdevice[i].cali_data_fmw;
++
++      /* No calibrated data for current devices, playback will go ahead. */
++      if (!cal_fmw)
++              return;
++
++      cal = cal_fmw->calibrations;
++      if (cal)
++              return;
++
++      load_calib_data(priv, &cal->dev_data);
++}
++
+ int tasdevice_select_tuningprm_cfg(void *context, int prm_no,
+       int cfg_no, int rca_conf_no)
+ {
+@@ -2240,21 +2258,9 @@ int tasdevice_select_tuningprm_cfg(void *context, int prm_no,
+               for (i = 0; i < tas_priv->ndev; i++) {
+                       if (tas_priv->tasdevice[i].is_loaderr == true)
+                               continue;
+-                      else if (tas_priv->tasdevice[i].is_loaderr == false
+-                              && tas_priv->tasdevice[i].is_loading == true) {
+-                              struct tasdevice_fw *cal_fmw =
+-                                      tas_priv->tasdevice[i].cali_data_fmw;
+-
+-                              if (cal_fmw) {
+-                                      struct tasdevice_calibration
+-                                              *cal = cal_fmw->calibrations;
+-
+-                                      if (cal)
+-                                              load_calib_data(tas_priv,
+-                                                      &(cal->dev_data));
+-                              }
++                      if (tas_priv->tasdevice[i].is_loaderr == false &&
++                              tas_priv->tasdevice[i].is_loading == true)
+                               tas_priv->tasdevice[i].cur_prog = prm_no;
+-                      }
+               }
+       }
+@@ -2275,11 +2281,15 @@ int tasdevice_select_tuningprm_cfg(void *context, int prm_no,
+               tasdevice_load_data(tas_priv, &(conf->dev_data));
+               for (i = 0; i < tas_priv->ndev; i++) {
+                       if (tas_priv->tasdevice[i].is_loaderr == true) {
+-                              status |= 1 << (i + 4);
++                              status |= BIT(i + 4);
+                               continue;
+-                      } else if (tas_priv->tasdevice[i].is_loaderr == false
+-                              && tas_priv->tasdevice[i].is_loading == true)
++                      }
++
++                      if (tas_priv->tasdevice[i].is_loaderr == false &&
++                              tas_priv->tasdevice[i].is_loading == true) {
++                              tasdev_load_calibrated_data(tas_priv, i);
+                               tas_priv->tasdevice[i].cur_conf = cfg_no;
++                      }
+               }
+       } else
+               dev_dbg(tas_priv->dev, "%s: Unneeded loading dsp conf %d\n",
+@@ -2338,65 +2348,6 @@ int tasdevice_prmg_load(void *context, int prm_no)
+ }
+ EXPORT_SYMBOL_NS_GPL(tasdevice_prmg_load, SND_SOC_TAS2781_FMWLIB);
+-int tasdevice_prmg_calibdata_load(void *context, int prm_no)
+-{
+-      struct tasdevice_priv *tas_priv = (struct tasdevice_priv *) context;
+-      struct tasdevice_fw *tas_fmw = tas_priv->fmw;
+-      struct tasdevice_prog *program;
+-      int prog_status = 0;
+-      int i;
+-
+-      if (!tas_fmw) {
+-              dev_err(tas_priv->dev, "%s: Firmware is NULL\n", __func__);
+-              goto out;
+-      }
+-
+-      if (prm_no >= tas_fmw->nr_programs) {
+-              dev_err(tas_priv->dev,
+-                      "%s: prm(%d) is not in range of Programs %u\n",
+-                      __func__, prm_no, tas_fmw->nr_programs);
+-              goto out;
+-      }
+-
+-      for (i = 0, prog_status = 0; i < tas_priv->ndev; i++) {
+-              if (prm_no >= 0 && tas_priv->tasdevice[i].cur_prog != prm_no) {
+-                      tas_priv->tasdevice[i].cur_conf = -1;
+-                      tas_priv->tasdevice[i].is_loading = true;
+-                      prog_status++;
+-              }
+-              tas_priv->tasdevice[i].is_loaderr = false;
+-      }
+-
+-      if (prog_status) {
+-              program = &(tas_fmw->programs[prm_no]);
+-              tasdevice_load_data(tas_priv, &(program->dev_data));
+-              for (i = 0; i < tas_priv->ndev; i++) {
+-                      if (tas_priv->tasdevice[i].is_loaderr == true)
+-                              continue;
+-                      else if (tas_priv->tasdevice[i].is_loaderr == false
+-                              && tas_priv->tasdevice[i].is_loading == true) {
+-                              struct tasdevice_fw *cal_fmw =
+-                                      tas_priv->tasdevice[i].cali_data_fmw;
+-
+-                              if (cal_fmw) {
+-                                      struct tasdevice_calibration *cal =
+-                                              cal_fmw->calibrations;
+-
+-                                      if (cal)
+-                                              load_calib_data(tas_priv,
+-                                                      &(cal->dev_data));
+-                              }
+-                              tas_priv->tasdevice[i].cur_prog = prm_no;
+-                      }
+-              }
+-      }
+-
+-out:
+-      return prog_status;
+-}
+-EXPORT_SYMBOL_NS_GPL(tasdevice_prmg_calibdata_load,
+-      SND_SOC_TAS2781_FMWLIB);
+-
+ void tasdevice_tuning_switch(void *context, int state)
+ {
+       struct tasdevice_priv *tas_priv = (struct tasdevice_priv *) context;
+diff --git a/sound/soc/codecs/tas2781-i2c.c b/sound/soc/codecs/tas2781-i2c.c
+index 2f7f8b18c36fa..7327e9dcc8c02 100644
+--- a/sound/soc/codecs/tas2781-i2c.c
++++ b/sound/soc/codecs/tas2781-i2c.c
+@@ -2,7 +2,7 @@
+ //
+ // ALSA SoC Texas Instruments TAS2781 Audio Smart Amplifier
+ //
+-// Copyright (C) 2022 - 2023 Texas Instruments Incorporated
++// Copyright (C) 2022 - 2024 Texas Instruments Incorporated
+ // https://www.ti.com
+ //
+ // The TAS2781 driver implements a flexible and configurable
+@@ -412,7 +412,7 @@ static void tasdevice_fw_ready(const struct firmware *fmw,
+                               __func__, tas_priv->cal_binaryname[i]);
+       }
+-      tasdevice_prmg_calibdata_load(tas_priv, 0);
++      tasdevice_prmg_load(tas_priv, 0);
+       tas_priv->cur_prog = 0;
+ out:
+       if (tas_priv->fw_state == TASDEVICE_DSP_FW_FAIL) {
+-- 
+2.43.0
+
diff --git a/queue-6.6/blk-cgroup-fix-list-corruption-from-reorder-of-write.patch b/queue-6.6/blk-cgroup-fix-list-corruption-from-reorder-of-write.patch
new file mode 100644 (file)
index 0000000..92b2b2e
--- /dev/null
@@ -0,0 +1,54 @@
+From eeae27116d0da4a3fdca3acba622ee69e05bd68b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 15 May 2024 09:31:57 +0800
+Subject: blk-cgroup: fix list corruption from reorder of WRITE ->lqueued
+
+From: Ming Lei <ming.lei@redhat.com>
+
+[ Upstream commit d0aac2363549e12cc79b8e285f13d5a9f42fd08e ]
+
+__blkcg_rstat_flush() can be run anytime, especially when blk_cgroup_bio_start
+is being executed.
+
+If WRITE of `->lqueued` is re-ordered with READ of 'bisc->lnode.next' in
+the loop of __blkcg_rstat_flush(), `next_bisc` can be assigned with one
+stat instance being added in blk_cgroup_bio_start(), then the local
+list in __blkcg_rstat_flush() could be corrupted.
+
+Fix the issue by adding one barrier.
+
+Cc: Tejun Heo <tj@kernel.org>
+Cc: Waiman Long <longman@redhat.com>
+Fixes: 3b8cc6298724 ("blk-cgroup: Optimize blkcg_rstat_flush()")
+Signed-off-by: Ming Lei <ming.lei@redhat.com>
+Link: https://lore.kernel.org/r/20240515013157.443672-3-ming.lei@redhat.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ block/blk-cgroup.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
+index 9359b57545d22..8102a23b24871 100644
+--- a/block/blk-cgroup.c
++++ b/block/blk-cgroup.c
+@@ -1036,6 +1036,16 @@ static void __blkcg_rstat_flush(struct blkcg *blkcg, int cpu)
+               struct blkg_iostat cur;
+               unsigned int seq;
++              /*
++               * Order assignment of `next_bisc` from `bisc->lnode.next` in
++               * llist_for_each_entry_safe and clearing `bisc->lqueued` for
++               * avoiding to assign `next_bisc` with new next pointer added
++               * in blk_cgroup_bio_start() in case of re-ordering.
++               *
++               * The pair barrier is implied in llist_add() in blk_cgroup_bio_start().
++               */
++              smp_mb();
++
+               WRITE_ONCE(bisc->lqueued, false);
+               /* fetch the current per-cpu values */
+-- 
+2.43.0
+
diff --git a/queue-6.6/blk-cgroup-fix-list-corruption-from-resetting-io-sta.patch b/queue-6.6/blk-cgroup-fix-list-corruption-from-resetting-io-sta.patch
new file mode 100644 (file)
index 0000000..e15bf9d
--- /dev/null
@@ -0,0 +1,121 @@
+From f4eaa5f228e707f5dc85a43846aa6168c5a163ef Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 15 May 2024 09:31:56 +0800
+Subject: blk-cgroup: fix list corruption from resetting io stat
+
+From: Ming Lei <ming.lei@redhat.com>
+
+[ Upstream commit 6da6680632792709cecf2b006f2fe3ca7857e791 ]
+
+Since commit 3b8cc6298724 ("blk-cgroup: Optimize blkcg_rstat_flush()"),
+each iostat instance is added to blkcg percpu list, so blkcg_reset_stats()
+can't reset the stat instance by memset(), otherwise the llist may be
+corrupted.
+
+Fix the issue by only resetting the counter part.
+
+Cc: Tejun Heo <tj@kernel.org>
+Cc: Waiman Long <longman@redhat.com>
+Cc: Jay Shin <jaeshin@redhat.com>
+Fixes: 3b8cc6298724 ("blk-cgroup: Optimize blkcg_rstat_flush()")
+Signed-off-by: Ming Lei <ming.lei@redhat.com>
+Acked-by: Tejun Heo <tj@kernel.org>
+Reviewed-by: Waiman Long <longman@redhat.com>
+Link: https://lore.kernel.org/r/20240515013157.443672-2-ming.lei@redhat.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ block/blk-cgroup.c | 58 ++++++++++++++++++++++++++++------------------
+ 1 file changed, 35 insertions(+), 23 deletions(-)
+
+diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
+index 4c49a70b46bd1..9359b57545d22 100644
+--- a/block/blk-cgroup.c
++++ b/block/blk-cgroup.c
+@@ -619,12 +619,45 @@ static void blkg_destroy_all(struct gendisk *disk)
+       spin_unlock_irq(&q->queue_lock);
+ }
++static void blkg_iostat_set(struct blkg_iostat *dst, struct blkg_iostat *src)
++{
++      int i;
++
++      for (i = 0; i < BLKG_IOSTAT_NR; i++) {
++              dst->bytes[i] = src->bytes[i];
++              dst->ios[i] = src->ios[i];
++      }
++}
++
++static void __blkg_clear_stat(struct blkg_iostat_set *bis)
++{
++      struct blkg_iostat cur = {0};
++      unsigned long flags;
++
++      flags = u64_stats_update_begin_irqsave(&bis->sync);
++      blkg_iostat_set(&bis->cur, &cur);
++      blkg_iostat_set(&bis->last, &cur);
++      u64_stats_update_end_irqrestore(&bis->sync, flags);
++}
++
++static void blkg_clear_stat(struct blkcg_gq *blkg)
++{
++      int cpu;
++
++      for_each_possible_cpu(cpu) {
++              struct blkg_iostat_set *s = per_cpu_ptr(blkg->iostat_cpu, cpu);
++
++              __blkg_clear_stat(s);
++      }
++      __blkg_clear_stat(&blkg->iostat);
++}
++
+ static int blkcg_reset_stats(struct cgroup_subsys_state *css,
+                            struct cftype *cftype, u64 val)
+ {
+       struct blkcg *blkcg = css_to_blkcg(css);
+       struct blkcg_gq *blkg;
+-      int i, cpu;
++      int i;
+       mutex_lock(&blkcg_pol_mutex);
+       spin_lock_irq(&blkcg->lock);
+@@ -635,18 +668,7 @@ static int blkcg_reset_stats(struct cgroup_subsys_state *css,
+        * anyway.  If you get hit by a race, retry.
+        */
+       hlist_for_each_entry(blkg, &blkcg->blkg_list, blkcg_node) {
+-              for_each_possible_cpu(cpu) {
+-                      struct blkg_iostat_set *bis =
+-                              per_cpu_ptr(blkg->iostat_cpu, cpu);
+-                      memset(bis, 0, sizeof(*bis));
+-
+-                      /* Re-initialize the cleared blkg_iostat_set */
+-                      u64_stats_init(&bis->sync);
+-                      bis->blkg = blkg;
+-              }
+-              memset(&blkg->iostat, 0, sizeof(blkg->iostat));
+-              u64_stats_init(&blkg->iostat.sync);
+-
++              blkg_clear_stat(blkg);
+               for (i = 0; i < BLKCG_MAX_POLS; i++) {
+                       struct blkcg_policy *pol = blkcg_policy[i];
+@@ -949,16 +971,6 @@ void blkg_conf_exit(struct blkg_conf_ctx *ctx)
+ }
+ EXPORT_SYMBOL_GPL(blkg_conf_exit);
+-static void blkg_iostat_set(struct blkg_iostat *dst, struct blkg_iostat *src)
+-{
+-      int i;
+-
+-      for (i = 0; i < BLKG_IOSTAT_NR; i++) {
+-              dst->bytes[i] = src->bytes[i];
+-              dst->ios[i] = src->ios[i];
+-      }
+-}
+-
+ static void blkg_iostat_add(struct blkg_iostat *dst, struct blkg_iostat *src)
+ {
+       int i;
+-- 
+2.43.0
+
diff --git a/queue-6.6/blk-cgroup-properly-propagate-the-iostat-update-up-t.patch b/queue-6.6/blk-cgroup-properly-propagate-the-iostat-update-up-t.patch
new file mode 100644 (file)
index 0000000..c344bc8
--- /dev/null
@@ -0,0 +1,87 @@
+From 5b7a2ddaaf27f7d3c27825a26bec1d79ddd6d7fb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 15 May 2024 10:30:59 -0400
+Subject: blk-cgroup: Properly propagate the iostat update up the hierarchy
+
+From: Waiman Long <longman@redhat.com>
+
+[ Upstream commit 9d230c09964e6e18c8f6e4f0d41ee90eef45ec1c ]
+
+During a cgroup_rstat_flush() call, the lowest level of nodes are flushed
+first before their parents. Since commit 3b8cc6298724 ("blk-cgroup:
+Optimize blkcg_rstat_flush()"), iostat propagation was still done to
+the parent. Grandparent, however, may not get the iostat update if the
+parent has no blkg_iostat_set queued in its lhead lockless list.
+
+Fix this iostat propagation problem by queuing the parent's global
+blkg->iostat into one of its percpu lockless lists to make sure that
+the delta will always be propagated up to the grandparent and so on
+toward the root blkcg.
+
+Note that successive calls to __blkcg_rstat_flush() are serialized by
+the cgroup_rstat_lock. So no special barrier is used in the reading
+and writing of blkg->iostat.lqueued.
+
+Fixes: 3b8cc6298724 ("blk-cgroup: Optimize blkcg_rstat_flush()")
+Reported-by: Dan Schatzberg <schatzberg.dan@gmail.com>
+Closes: https://lore.kernel.org/lkml/ZkO6l%2FODzadSgdhC@dschatzberg-fedora-PF3DHTBV/
+Signed-off-by: Waiman Long <longman@redhat.com>
+Reviewed-by: Ming Lei <ming.lei@redhat.com>
+Acked-by: Tejun Heo <tj@kernel.org>
+Link: https://lore.kernel.org/r/20240515143059.276677-1-longman@redhat.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ block/blk-cgroup.c | 19 ++++++++++++++++++-
+ 1 file changed, 18 insertions(+), 1 deletion(-)
+
+diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c
+index 8102a23b24871..4fb045d26bd5a 100644
+--- a/block/blk-cgroup.c
++++ b/block/blk-cgroup.c
+@@ -323,6 +323,7 @@ static struct blkcg_gq *blkg_alloc(struct blkcg *blkcg, struct gendisk *disk,
+       blkg->q = disk->queue;
+       INIT_LIST_HEAD(&blkg->q_node);
+       blkg->blkcg = blkcg;
++      blkg->iostat.blkg = blkg;
+ #ifdef CONFIG_BLK_CGROUP_PUNT_BIO
+       spin_lock_init(&blkg->async_bio_lock);
+       bio_list_init(&blkg->async_bios);
+@@ -1047,6 +1048,8 @@ static void __blkcg_rstat_flush(struct blkcg *blkcg, int cpu)
+               smp_mb();
+               WRITE_ONCE(bisc->lqueued, false);
++              if (bisc == &blkg->iostat)
++                      goto propagate_up; /* propagate up to parent only */
+               /* fetch the current per-cpu values */
+               do {
+@@ -1056,10 +1059,24 @@ static void __blkcg_rstat_flush(struct blkcg *blkcg, int cpu)
+               blkcg_iostat_update(blkg, &cur, &bisc->last);
++propagate_up:
+               /* propagate global delta to parent (unless that's root) */
+-              if (parent && parent->parent)
++              if (parent && parent->parent) {
+                       blkcg_iostat_update(parent, &blkg->iostat.cur,
+                                           &blkg->iostat.last);
++                      /*
++                       * Queue parent->iostat to its blkcg's lockless
++                       * list to propagate up to the grandparent if the
++                       * iostat hasn't been queued yet.
++                       */
++                      if (!parent->iostat.lqueued) {
++                              struct llist_head *plhead;
++
++                              plhead = per_cpu_ptr(parent->blkcg->lhead, cpu);
++                              llist_add(&parent->iostat.lnode, plhead);
++                              parent->iostat.lqueued = true;
++                      }
++              }
+       }
+       raw_spin_unlock_irqrestore(&blkg_stat_lock, flags);
+ out:
+-- 
+2.43.0
+
diff --git a/queue-6.6/cxl-region-fix-cxlr_pmem-leaks.patch b/queue-6.6/cxl-region-fix-cxlr_pmem-leaks.patch
new file mode 100644 (file)
index 0000000..6cabed6
--- /dev/null
@@ -0,0 +1,38 @@
+From 845547486a117385c74519d30ee972358f272f42 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 28 Apr 2024 11:07:48 +0800
+Subject: cxl/region: Fix cxlr_pmem leaks
+
+From: Li Zhijian <lizhijian@fujitsu.com>
+
+[ Upstream commit 1c987cf22d6b65ade46145c03eef13f0e3e81d83 ]
+
+Before this error path, cxlr_pmem pointed to a kzalloc() memory, free
+it to avoid this memory leaking.
+
+Fixes: f17b558d6663 ("cxl/pmem: Refactor nvdimm device registration, delete the workqueue")
+Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
+Reviewed-by: Dan Williams <dan.j.williams@intel.com>
+Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Link: https://lore.kernel.org/r/20240428030748.318985-1-lizhijian@fujitsu.com
+Signed-off-by: Dave Jiang <dave.jiang@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/cxl/core/region.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
+index e2a82ee4ff0cf..c65ab42546238 100644
+--- a/drivers/cxl/core/region.c
++++ b/drivers/cxl/core/region.c
+@@ -2549,6 +2549,7 @@ static struct cxl_pmem_region *cxl_pmem_region_alloc(struct cxl_region *cxlr)
+               if (i == 0) {
+                       cxl_nvb = cxl_find_nvdimm_bridge(cxlmd);
+                       if (!cxl_nvb) {
++                              kfree(cxlr_pmem);
+                               cxlr_pmem = ERR_PTR(-ENODEV);
+                               goto out;
+                       }
+-- 
+2.43.0
+
diff --git a/queue-6.6/cxl-trace-correct-dpa-field-masks-for-general_media-.patch b/queue-6.6/cxl-trace-correct-dpa-field-masks-for-general_media-.patch
new file mode 100644 (file)
index 0000000..b27a2d5
--- /dev/null
@@ -0,0 +1,55 @@
+From daad1e332c2f6bae8f7c3e666de0885e3e0f6fc6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 30 Apr 2024 10:28:03 -0700
+Subject: cxl/trace: Correct DPA field masks for general_media & dram events
+
+From: Alison Schofield <alison.schofield@intel.com>
+
+[ Upstream commit 2042d11cb57b7e0cbda7910e5ff80e9e8bf0ae17 ]
+
+The length of Physical Address in General Media and DRAM event
+records is 64-bit, so the field mask for extracting the DPA should
+be 64-bit also, otherwise the trace event reports DPA's with the
+upper 32 bits of a DPA address masked off. If users do DPA-to-HPA
+translations this could lead to incorrect page retirement decisions.
+
+Use GENMASK_ULL() for CXL_DPA_MASK to get all the DPA address bits.
+
+Tidy up CXL_DPA_FLAGS_MASK by using GENMASK() to only mask the exact
+flag bits.
+
+These bits are defined as part of the event record physical address
+descriptions of General Media and DRAM events in CXL Spec 3.1
+Section 8.2.9.2 Events.
+
+Fixes: d54a531a430b ("cxl/mem: Trace General Media Event Record")
+Co-developed-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
+Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
+Signed-off-by: Alison Schofield <alison.schofield@intel.com>
+Reviewed-by: Ira Weiny <ira.weiny@intel.com>
+Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Link: https://lore.kernel.org/r/2867fc43c57720a4a15a3179431829b8dbd2dc16.1714496730.git.alison.schofield@intel.com
+Signed-off-by: Dave Jiang <dave.jiang@intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/cxl/core/trace.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h
+index f01d0709c9c32..bdf24867d5174 100644
+--- a/drivers/cxl/core/trace.h
++++ b/drivers/cxl/core/trace.h
+@@ -252,8 +252,8 @@ TRACE_EVENT(cxl_generic_event,
+  * DRAM Event Record
+  * CXL rev 3.0 section 8.2.9.2.1.2; Table 8-44
+  */
+-#define CXL_DPA_FLAGS_MASK                    0x3F
+-#define CXL_DPA_MASK                          (~CXL_DPA_FLAGS_MASK)
++#define CXL_DPA_FLAGS_MASK                    GENMASK(1, 0)
++#define CXL_DPA_MASK                          GENMASK_ULL(63, 6)
+ #define CXL_DPA_VOLATILE                      BIT(0)
+ #define CXL_DPA_NOT_REPAIRABLE                        BIT(1)
+-- 
+2.43.0
+
diff --git a/queue-6.6/drivers-xen-improve-the-late-xenstore-init-protocol.patch b/queue-6.6/drivers-xen-improve-the-late-xenstore-init-protocol.patch
new file mode 100644 (file)
index 0000000..8df48c8
--- /dev/null
@@ -0,0 +1,123 @@
+From f3dc3e0039e541cc9584e2ae879f6b15604680ce Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 17 May 2024 09:15:16 +0800
+Subject: drivers/xen: Improve the late XenStore init protocol
+
+From: Henry Wang <xin.wang2@amd.com>
+
+[ Upstream commit a3607581cd49c17128a486a526a36a97bafcb2bb ]
+
+Currently, the late XenStore init protocol is only triggered properly
+for the case that HVM_PARAM_STORE_PFN is ~0ULL (invalid). For the
+case that XenStore interface is allocated but not ready (the connection
+status is not XENSTORE_CONNECTED), Linux should also wait until the
+XenStore is set up properly.
+
+Introduce a macro to describe the XenStore interface is ready, use
+it in xenbus_probe_initcall() to select the code path of doing the
+late XenStore init protocol or not. Since now we have more than one
+condition for XenStore late init, rework the check in xenbus_probe()
+for the free_irq().
+
+Take the opportunity to enhance the check of the allocated XenStore
+interface can be properly mapped, and return error early if the
+memremap() fails.
+
+Fixes: 5b3353949e89 ("xen: add support for initializing xenstore later as HVM domain")
+Signed-off-by: Henry Wang <xin.wang2@amd.com>
+Signed-off-by: Michal Orzel <michal.orzel@amd.com>
+Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
+Link: https://lore.kernel.org/r/20240517011516.1451087-1-xin.wang2@amd.com
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/xen/xenbus/xenbus_probe.c | 36 ++++++++++++++++++++-----------
+ 1 file changed, 23 insertions(+), 13 deletions(-)
+
+diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
+index 3205e5d724c8c..1a9ded0cddcb0 100644
+--- a/drivers/xen/xenbus/xenbus_probe.c
++++ b/drivers/xen/xenbus/xenbus_probe.c
+@@ -65,13 +65,17 @@
+ #include "xenbus.h"
+-static int xs_init_irq;
++static int xs_init_irq = -1;
+ int xen_store_evtchn;
+ EXPORT_SYMBOL_GPL(xen_store_evtchn);
+ struct xenstore_domain_interface *xen_store_interface;
+ EXPORT_SYMBOL_GPL(xen_store_interface);
++#define XS_INTERFACE_READY \
++      ((xen_store_interface != NULL) && \
++       (xen_store_interface->connection == XENSTORE_CONNECTED))
++
+ enum xenstore_init xen_store_domain_type;
+ EXPORT_SYMBOL_GPL(xen_store_domain_type);
+@@ -751,19 +755,19 @@ static void xenbus_probe(void)
+ {
+       xenstored_ready = 1;
+-      if (!xen_store_interface) {
++      if (!xen_store_interface)
+               xen_store_interface = memremap(xen_store_gfn << XEN_PAGE_SHIFT,
+                                              XEN_PAGE_SIZE, MEMREMAP_WB);
+-              /*
+-               * Now it is safe to free the IRQ used for xenstore late
+-               * initialization. No need to unbind: it is about to be
+-               * bound again from xb_init_comms. Note that calling
+-               * unbind_from_irqhandler now would result in xen_evtchn_close()
+-               * being called and the event channel not being enabled again
+-               * afterwards, resulting in missed event notifications.
+-               */
++      /*
++       * Now it is safe to free the IRQ used for xenstore late
++       * initialization. No need to unbind: it is about to be
++       * bound again from xb_init_comms. Note that calling
++       * unbind_from_irqhandler now would result in xen_evtchn_close()
++       * being called and the event channel not being enabled again
++       * afterwards, resulting in missed event notifications.
++       */
++      if (xs_init_irq >= 0)
+               free_irq(xs_init_irq, &xb_waitq);
+-      }
+       /*
+        * In the HVM case, xenbus_init() deferred its call to
+@@ -822,7 +826,7 @@ static int __init xenbus_probe_initcall(void)
+       if (xen_store_domain_type == XS_PV ||
+           (xen_store_domain_type == XS_HVM &&
+            !xs_hvm_defer_init_for_callback() &&
+-           xen_store_interface != NULL))
++           XS_INTERFACE_READY))
+               xenbus_probe();
+       /*
+@@ -831,7 +835,7 @@ static int __init xenbus_probe_initcall(void)
+        * started, then probe.  It will be triggered when communication
+        * starts happening, by waiting on xb_waitq.
+        */
+-      if (xen_store_domain_type == XS_LOCAL || xen_store_interface == NULL) {
++      if (xen_store_domain_type == XS_LOCAL || !XS_INTERFACE_READY) {
+               struct task_struct *probe_task;
+               probe_task = kthread_run(xenbus_probe_thread, NULL,
+@@ -1014,6 +1018,12 @@ static int __init xenbus_init(void)
+                       xen_store_interface =
+                               memremap(xen_store_gfn << XEN_PAGE_SHIFT,
+                                        XEN_PAGE_SIZE, MEMREMAP_WB);
++                      if (!xen_store_interface) {
++                              pr_err("%s: cannot map HVM_PARAM_STORE_PFN=%llx\n",
++                                     __func__, v);
++                              err = -EINVAL;
++                              goto out_error;
++                      }
+                       if (xen_store_interface->connection != XENSTORE_CONNECTED)
+                               wait = true;
+               }
+-- 
+2.43.0
+
diff --git a/queue-6.6/drm-amdgpu-fix-buffer-size-in-gfx_v9_4_3_init_-cp_co.patch b/queue-6.6/drm-amdgpu-fix-buffer-size-in-gfx_v9_4_3_init_-cp_co.patch
new file mode 100644 (file)
index 0000000..94511bc
--- /dev/null
@@ -0,0 +1,81 @@
+From 692280c2a44b6942aecb7afa9c2e49b757e8bebb Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 25 Apr 2024 11:22:32 +0530
+Subject: drm/amdgpu: Fix buffer size in gfx_v9_4_3_init_
+ cp_compute_microcode() and rlc_microcode()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
+
+[ Upstream commit acce6479e30f73ab0872e93a75aed1fb791d04ec ]
+
+The function gfx_v9_4_3_init_microcode in gfx_v9_4_3.c was generating
+about potential truncation of output when using the snprintf function.
+The issue was due to the size of the buffer 'ucode_prefix' being too
+small to accommodate the maximum possible length of the string being
+written into it.
+
+The string being written is "amdgpu/%s_mec.bin" or "amdgpu/%s_rlc.bin",
+where %s is replaced by the value of 'chip_name'. The length of this
+string without the %s is 16 characters. The warning message indicated
+that 'chip_name' could be up to 29 characters long, resulting in a total
+of 45 characters, which exceeds the buffer size of 30 characters.
+
+To resolve this issue, the size of the 'ucode_prefix' buffer has been
+reduced from 30 to 15. This ensures that the maximum possible length of
+the string being written into the buffer will not exceed its size, thus
+preventing potential buffer overflow and truncation issues.
+
+Fixes the below with gcc W=1:
+drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c: In function â€˜gfx_v9_4_3_early_init’:
+drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:379:52: warning: â€˜%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
+  379 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
+      |                                                    ^~
+......
+  439 |         r = gfx_v9_4_3_init_rlc_microcode(adev, ucode_prefix);
+      |                                                 ~~~~~~~~~~~~
+drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:379:9: note: â€˜snprintf’ output between 16 and 45 bytes into a destination of size 30
+  379 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
+      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:413:52: warning: â€˜%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
+  413 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
+      |                                                    ^~
+......
+  443 |         r = gfx_v9_4_3_init_cp_compute_microcode(adev, ucode_prefix);
+      |                                                        ~~~~~~~~~~~~
+drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c:413:9: note: â€˜snprintf’ output between 16 and 45 bytes into a destination of size 30
+  413 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
+      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Fixes: 86301129698b ("drm/amdgpu: split gc v9_4_3 functionality from gc v9_0")
+Cc: Hawking Zhang <Hawking.Zhang@amd.com>
+Cc: Christian König <christian.koenig@amd.com>
+Cc: Alex Deucher <alexander.deucher@amd.com>
+Cc: Lijo Lazar <lijo.lazar@amd.com>
+Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
+Suggested-by: Lijo Lazar <lijo.lazar@amd.com>
+Reviewed-by: Lijo Lazar <lijo.lazar@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 | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+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 7c9a7ab9df3bb..af46823e43367 100644
+--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
+@@ -425,7 +425,7 @@ static int gfx_v9_4_3_init_cp_compute_microcode(struct amdgpu_device *adev,
+ static int gfx_v9_4_3_init_microcode(struct amdgpu_device *adev)
+ {
+-      char ucode_prefix[30];
++      char ucode_prefix[15];
+       int r;
+       amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
+-- 
+2.43.0
+
diff --git a/queue-6.6/drm-amdgpu-init-microcode-chip-name-from-ip-versions.patch b/queue-6.6/drm-amdgpu-init-microcode-chip-name-from-ip-versions.patch
new file mode 100644 (file)
index 0000000..48d9b5f
--- /dev/null
@@ -0,0 +1,49 @@
+From 0909e913eb5173353a986202394f1d2312c7a017 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 17 Apr 2024 17:57:52 +0800
+Subject: drm/amdgpu: init microcode chip name from ip versions
+
+From: Le Ma <le.ma@amd.com>
+
+[ Upstream commit 92ed1e9cd5f6cc4f8c9a9ba6c4d2d2bbc6221296 ]
+
+To adapt to different gc versions in gfx_v9_4_3.c file.
+
+Signed-off-by: Le Ma <le.ma@amd.com>
+Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
+Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Stable-dep-of: acce6479e30f ("drm/amdgpu: Fix buffer size in gfx_v9_4_3_init_ cp_compute_microcode() and rlc_microcode()")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 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 e481ef73af6e5..7c9a7ab9df3bb 100644
+--- a/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
++++ b/drivers/gpu/drm/amd/amdgpu/gfx_v9_4_3.c
+@@ -425,16 +425,16 @@ static int gfx_v9_4_3_init_cp_compute_microcode(struct amdgpu_device *adev,
+ static int gfx_v9_4_3_init_microcode(struct amdgpu_device *adev)
+ {
+-      const char *chip_name;
++      char ucode_prefix[30];
+       int r;
+-      chip_name = "gc_9_4_3";
++      amdgpu_ucode_ip_version_decode(adev, GC_HWIP, ucode_prefix, sizeof(ucode_prefix));
+-      r = gfx_v9_4_3_init_rlc_microcode(adev, chip_name);
++      r = gfx_v9_4_3_init_rlc_microcode(adev, ucode_prefix);
+       if (r)
+               return r;
+-      r = gfx_v9_4_3_init_cp_compute_microcode(adev, chip_name);
++      r = gfx_v9_4_3_init_cp_compute_microcode(adev, ucode_prefix);
+       if (r)
+               return r;
+-- 
+2.43.0
+
diff --git a/queue-6.6/drm-bridge-tc358775-fix-support-for-jeida-18-and-jei.patch b/queue-6.6/drm-bridge-tc358775-fix-support-for-jeida-18-and-jei.patch
new file mode 100644 (file)
index 0000000..f5fe5da
--- /dev/null
@@ -0,0 +1,75 @@
+From b0d07ae85fbd0411275a5fa5176380aaa530b5fe Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 25 Feb 2024 08:19:33 +0200
+Subject: drm/bridge: tc358775: fix support for jeida-18 and jeida-24
+
+From: Michael Walle <mwalle@kernel.org>
+
+[ Upstream commit 30ea09a182cb37c4921b9d477ed18107befe6d78 ]
+
+The bridge always uses 24bpp internally. Therefore, for jeida-18
+mapping we need to discard the lowest two bits for each channel and thus
+starting with LV_[RGB]2. jeida-24 has the same mapping but uses four
+lanes instead of three, with the forth pair transmitting the lowest two
+bits of each channel. Thus, the mapping between jeida-18 and jeida-24
+is actually the same, except that one channel is turned off (by
+selecting the RGB666 format in VPCTRL).
+
+While at it, remove the bogus comment about the hardware default because
+the default is overwritten in any case.
+
+Tested with a jeida-18 display (Evervision VGG644804).
+
+Fixes: b26975593b17 ("display/drm/bridge: TC358775 DSI/LVDS driver")
+Signed-off-by: Michael Walle <mwalle@kernel.org>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Reviewed-by: Robert Foss <rfoss@kernel.org>
+Signed-off-by: Robert Foss <rfoss@kernel.org>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240225062008.33191-5-tony@atomide.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/bridge/tc358775.c | 21 +++++++++------------
+ 1 file changed, 9 insertions(+), 12 deletions(-)
+
+diff --git a/drivers/gpu/drm/bridge/tc358775.c b/drivers/gpu/drm/bridge/tc358775.c
+index fea4f00a20f83..c737670631929 100644
+--- a/drivers/gpu/drm/bridge/tc358775.c
++++ b/drivers/gpu/drm/bridge/tc358775.c
+@@ -454,10 +454,6 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
+       dev_dbg(tc->dev, "bus_formats %04x bpc %d\n",
+               connector->display_info.bus_formats[0],
+               tc->bpc);
+-      /*
+-       * Default hardware register settings of tc358775 configured
+-       * with MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA jeida-24 format
+-       */
+       if (connector->display_info.bus_formats[0] ==
+               MEDIA_BUS_FMT_RGB888_1X7X4_SPWG) {
+               /* VESA-24 */
+@@ -468,14 +464,15 @@ static void tc_bridge_enable(struct drm_bridge *bridge)
+               d2l_write(tc->i2c, LV_MX1619, LV_MX(LVI_B6, LVI_B7, LVI_B1, LVI_B2));
+               d2l_write(tc->i2c, LV_MX2023, LV_MX(LVI_B3, LVI_B4, LVI_B5, LVI_L0));
+               d2l_write(tc->i2c, LV_MX2427, LV_MX(LVI_HS, LVI_VS, LVI_DE, LVI_R6));
+-      } else { /*  MEDIA_BUS_FMT_RGB666_1X7X3_SPWG - JEIDA-18 */
+-              d2l_write(tc->i2c, LV_MX0003, LV_MX(LVI_R0, LVI_R1, LVI_R2, LVI_R3));
+-              d2l_write(tc->i2c, LV_MX0407, LV_MX(LVI_R4, LVI_L0, LVI_R5, LVI_G0));
+-              d2l_write(tc->i2c, LV_MX0811, LV_MX(LVI_G1, LVI_G2, LVI_L0, LVI_L0));
+-              d2l_write(tc->i2c, LV_MX1215, LV_MX(LVI_G3, LVI_G4, LVI_G5, LVI_B0));
+-              d2l_write(tc->i2c, LV_MX1619, LV_MX(LVI_L0, LVI_L0, LVI_B1, LVI_B2));
+-              d2l_write(tc->i2c, LV_MX2023, LV_MX(LVI_B3, LVI_B4, LVI_B5, LVI_L0));
+-              d2l_write(tc->i2c, LV_MX2427, LV_MX(LVI_HS, LVI_VS, LVI_DE, LVI_L0));
++      } else {
++              /* JEIDA-18 and JEIDA-24 */
++              d2l_write(tc->i2c, LV_MX0003, LV_MX(LVI_R2, LVI_R3, LVI_R4, LVI_R5));
++              d2l_write(tc->i2c, LV_MX0407, LV_MX(LVI_R6, LVI_R1, LVI_R7, LVI_G2));
++              d2l_write(tc->i2c, LV_MX0811, LV_MX(LVI_G3, LVI_G4, LVI_G0, LVI_G1));
++              d2l_write(tc->i2c, LV_MX1215, LV_MX(LVI_G5, LVI_G6, LVI_G7, LVI_B2));
++              d2l_write(tc->i2c, LV_MX1619, LV_MX(LVI_B0, LVI_B1, LVI_B3, LVI_B4));
++              d2l_write(tc->i2c, LV_MX2023, LV_MX(LVI_B5, LVI_B6, LVI_B7, LVI_L0));
++              d2l_write(tc->i2c, LV_MX2427, LV_MX(LVI_HS, LVI_VS, LVI_DE, LVI_R0));
+       }
+       d2l_write(tc->i2c, VFUEN, VFUEN_EN);
+-- 
+2.43.0
+
diff --git a/queue-6.6/drm-mediatek-dp-fix-mtk_dp_aux_transfer-return-value.patch b/queue-6.6/drm-mediatek-dp-fix-mtk_dp_aux_transfer-return-value.patch
new file mode 100644 (file)
index 0000000..2415646
--- /dev/null
@@ -0,0 +1,43 @@
+From c19d2b2441a63ffb80f50ff6c7cc370364527a37 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 17 Apr 2024 10:38:19 +0000
+Subject: drm/mediatek: dp: Fix mtk_dp_aux_transfer return value
+
+From: Wojciech Macek <wmacek@chromium.org>
+
+[ Upstream commit 8431fff9e0f3fc1c5844cf99a73b49b63ceed481 ]
+
+In case there is no DP device attached to the port the
+transfer function should return IO error, similar to what
+other drivers do.
+In case EAGAIN is returned then any read from /dev/drm_dp_aux
+device ends up in an infinite loop as the upper layers
+constantly repeats the transfer request.
+
+Fixes: f70ac097a2cf ("drm/mediatek: Add MT8195 Embedded DisplayPort driver")
+Signed-off-by: Wojciech Macek <wmacek@chromium.org>
+Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Reviewed-by: CK Hu <ck.hu@mediatek.com>
+Link: https://patchwork.kernel.org/project/dri-devel/patch/20240417103819.990512-1-wmacek@chromium.org/
+Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/mediatek/mtk_dp.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c
+index 4052a3133b576..af03a22772fed 100644
+--- a/drivers/gpu/drm/mediatek/mtk_dp.c
++++ b/drivers/gpu/drm/mediatek/mtk_dp.c
+@@ -2080,7 +2080,7 @@ static ssize_t mtk_dp_aux_transfer(struct drm_dp_aux *mtk_aux,
+       if (mtk_dp->bridge.type != DRM_MODE_CONNECTOR_eDP &&
+           !mtk_dp->train_info.cable_plugged_in) {
+-              ret = -EAGAIN;
++              ret = -EIO;
+               goto err;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.6/drm-meson-gate-px_clk-when-setting-rate.patch b/queue-6.6/drm-meson-gate-px_clk-when-setting-rate.patch
new file mode 100644 (file)
index 0000000..f125453
--- /dev/null
@@ -0,0 +1,51 @@
+From 624959838aa10bf1a11a8092897f2d6b4e54609c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 3 Apr 2024 09:46:35 +0200
+Subject: drm/meson: gate px_clk when setting rate
+
+From: Neil Armstrong <neil.armstrong@linaro.org>
+
+[ Upstream commit 5c9837374ecf55a1fa3b7622d365a0456960270f ]
+
+Disable the px_clk when setting the rate to recover a fully
+configured and correctly reset VCLK clock tree after the rate
+is set.
+
+Fixes: 77d9e1e6b846 ("drm/meson: add support for MIPI-DSI transceiver")
+Reviewed-by: Nicolas Belin <nbelin@baylibre.com>
+Link: https://lore.kernel.org/r/20240403-amlogic-v6-4-upstream-dsi-ccf-vim3-v12-4-99ecdfdc87fc@linaro.org
+Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240403-amlogic-v6-4-upstream-dsi-ccf-vim3-v12-4-99ecdfdc87fc@linaro.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/meson/meson_dw_mipi_dsi.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c
+index e5fe4e994f43b..72abe2057ec31 100644
+--- a/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c
++++ b/drivers/gpu/drm/meson/meson_dw_mipi_dsi.c
+@@ -95,6 +95,7 @@ static int dw_mipi_dsi_phy_init(void *priv_data)
+               return ret;
+       }
++      clk_disable_unprepare(mipi_dsi->px_clk);
+       ret = clk_set_rate(mipi_dsi->px_clk, mipi_dsi->mode->clock * 1000);
+       if (ret) {
+@@ -103,6 +104,12 @@ static int dw_mipi_dsi_phy_init(void *priv_data)
+               return ret;
+       }
++      ret = clk_prepare_enable(mipi_dsi->px_clk);
++      if (ret) {
++              dev_err(mipi_dsi->dev, "Failed to enable DSI Pixel clock (ret %d)\n", ret);
++              return ret;
++      }
++
+       switch (mipi_dsi->dsi_device->format) {
+       case MIPI_DSI_FMT_RGB888:
+               dpi_data_format = DPI_COLOR_24BIT;
+-- 
+2.43.0
+
diff --git a/queue-6.6/drm-msm-a6xx-avoid-a-nullptr-dereference-when-speedb.patch b/queue-6.6/drm-msm-a6xx-avoid-a-nullptr-dereference-when-speedb.patch
new file mode 100644 (file)
index 0000000..9bcff99
--- /dev/null
@@ -0,0 +1,49 @@
+From 174a33d8d840c21741abdb96e9fee68fa12c754a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 12 Apr 2024 10:53:25 +0200
+Subject: drm/msm/a6xx: Avoid a nullptr dereference when speedbin setting fails
+
+From: Konrad Dybcio <konrad.dybcio@linaro.org>
+
+[ Upstream commit 46d4efcccc688cbacdd70a238bedca510acaa8e4 ]
+
+Calling a6xx_destroy() before adreno_gpu_init() leads to a null pointer
+dereference on:
+
+msm_gpu_cleanup() : platform_set_drvdata(gpu->pdev, NULL);
+
+as gpu->pdev is only assigned in:
+
+a6xx_gpu_init()
+|_ adreno_gpu_init
+    |_ msm_gpu_init()
+
+Instead of relying on handwavy null checks down the cleanup chain,
+explicitly de-allocate the LLC data and free a6xx_gpu instead.
+
+Fixes: 76efc2453d0e ("drm/msm/gpu: Fix crash during system suspend after unbind")
+Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
+Patchwork: https://patchwork.freedesktop.org/patch/588919/
+Signed-off-by: Rob Clark <robdclark@chromium.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+index 522ca7fe67625..3664c1476a83a 100644
+--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
++++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+@@ -2343,7 +2343,8 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev)
+       ret = a6xx_set_supported_hw(&pdev->dev, config->info);
+       if (ret) {
+-              a6xx_destroy(&(a6xx_gpu->base.base));
++              a6xx_llc_slices_destroy(a6xx_gpu);
++              kfree(a6xx_gpu);
+               return ERR_PTR(ret);
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.6/drm-msm-dpu-add-callback-function-pointer-check-befo.patch b/queue-6.6/drm-msm-dpu-add-callback-function-pointer-check-befo.patch
new file mode 100644 (file)
index 0000000..89dd176
--- /dev/null
@@ -0,0 +1,46 @@
+From 9b16b91eaf0920d9935d4c5f66ccfe54ba379714 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 8 Apr 2024 11:55:23 +0300
+Subject: drm/msm/dpu: Add callback function pointer check before its call
+
+From: Aleksandr Mishin <amishin@t-argos.ru>
+
+[ Upstream commit 530f272053a5e72243a9cb07bb1296af6c346002 ]
+
+In dpu_core_irq_callback_handler() callback function pointer is compared to NULL,
+but then callback function is unconditionally called by this pointer.
+Fix this bug by adding conditional return.
+
+Found by Linux Verification Center (linuxtesting.org) with SVACE.
+
+Fixes: c929ac60b3ed ("drm/msm/dpu: allow just single IRQ callback")
+Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
+Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Patchwork: https://patchwork.freedesktop.org/patch/588237/
+Link: https://lore.kernel.org/r/20240408085523.12231-1-amishin@t-argos.ru
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
+index c413e9917d7eb..41f7c86bc2db9 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
+@@ -221,9 +221,11 @@ static void dpu_core_irq_callback_handler(struct dpu_kms *dpu_kms, int irq_idx)
+       VERB("IRQ=[%d, %d]\n", DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
+-      if (!irq_entry->cb)
++      if (!irq_entry->cb) {
+               DRM_ERROR("no registered cb, IRQ=[%d, %d]\n",
+                         DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
++              return;
++      }
+       atomic_inc(&irq_entry->count);
+-- 
+2.43.0
+
diff --git a/queue-6.6/drm-msm-dpu-add-helper-to-get-irq-related-data.patch b/queue-6.6/drm-msm-dpu-add-helper-to-get-irq-related-data.patch
new file mode 100644 (file)
index 0000000..58c27f6
--- /dev/null
@@ -0,0 +1,203 @@
+From c213fb2f7a6a89d6edb193d43668bf12d4058de3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 2 Aug 2023 13:04:22 +0300
+Subject: drm/msm/dpu: add helper to get IRQ-related data
+
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+
+[ Upstream commit ea4842ed62f3556cf0a90f19d911ee03a4d0c844 ]
+
+In preparation to reworking IRQ indices, move irq_tbl access to
+a separate helper.
+
+Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Patchwork: https://patchwork.freedesktop.org/patch/550931/
+Link: https://lore.kernel.org/r/20230802100426.4184892-5-dmitry.baryshkov@linaro.org
+Stable-dep-of: 530f272053a5 ("drm/msm/dpu: Add callback function pointer check before its call")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 48 +++++++++++++------
+ .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h | 12 +++--
+ 2 files changed, 41 insertions(+), 19 deletions(-)
+
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
+index 81d03b6c67d12..14d374de30c52 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
+@@ -206,6 +206,12 @@ static inline bool dpu_core_irq_is_valid(struct dpu_hw_intr *intr,
+       return irq_idx >= 0 && irq_idx < intr->total_irqs;
+ }
++static inline struct dpu_hw_intr_entry *dpu_core_irq_get_entry(struct dpu_hw_intr *intr,
++                                                             int irq_idx)
++{
++      return &intr->irq_tbl[irq_idx];
++}
++
+ /**
+  * dpu_core_irq_callback_handler - dispatch core interrupts
+  * @dpu_kms:          Pointer to DPU's KMS structure
+@@ -213,17 +219,19 @@ static inline bool dpu_core_irq_is_valid(struct dpu_hw_intr *intr,
+  */
+ static void dpu_core_irq_callback_handler(struct dpu_kms *dpu_kms, int irq_idx)
+ {
++      struct dpu_hw_intr_entry *irq_entry = dpu_core_irq_get_entry(dpu_kms->hw_intr, irq_idx);
++
+       VERB("irq_idx=%d\n", irq_idx);
+-      if (!dpu_kms->hw_intr->irq_tbl[irq_idx].cb)
++      if (!irq_entry->cb)
+               DRM_ERROR("no registered cb, idx:%d\n", irq_idx);
+-      atomic_inc(&dpu_kms->hw_intr->irq_tbl[irq_idx].count);
++      atomic_inc(&irq_entry->count);
+       /*
+        * Perform registered function callback
+        */
+-      dpu_kms->hw_intr->irq_tbl[irq_idx].cb(dpu_kms->hw_intr->irq_tbl[irq_idx].arg);
++      irq_entry->cb(irq_entry->arg);
+ }
+ irqreturn_t dpu_core_irq(struct msm_kms *kms)
+@@ -510,6 +518,7 @@ int dpu_core_irq_register_callback(struct dpu_kms *dpu_kms, int irq_idx,
+               void (*irq_cb)(void *arg),
+               void *irq_arg)
+ {
++      struct dpu_hw_intr_entry *irq_entry;
+       unsigned long irq_flags;
+       int ret;
+@@ -527,15 +536,16 @@ int dpu_core_irq_register_callback(struct dpu_kms *dpu_kms, int irq_idx,
+       spin_lock_irqsave(&dpu_kms->hw_intr->irq_lock, irq_flags);
+-      if (unlikely(WARN_ON(dpu_kms->hw_intr->irq_tbl[irq_idx].cb))) {
++      irq_entry = dpu_core_irq_get_entry(dpu_kms->hw_intr, irq_idx);
++      if (unlikely(WARN_ON(irq_entry->cb))) {
+               spin_unlock_irqrestore(&dpu_kms->hw_intr->irq_lock, irq_flags);
+               return -EBUSY;
+       }
+       trace_dpu_core_irq_register_callback(irq_idx, irq_cb);
+-      dpu_kms->hw_intr->irq_tbl[irq_idx].arg = irq_arg;
+-      dpu_kms->hw_intr->irq_tbl[irq_idx].cb = irq_cb;
++      irq_entry->arg = irq_arg;
++      irq_entry->cb = irq_cb;
+       ret = dpu_hw_intr_enable_irq_locked(
+                               dpu_kms->hw_intr,
+@@ -552,6 +562,7 @@ int dpu_core_irq_register_callback(struct dpu_kms *dpu_kms, int irq_idx,
+ int dpu_core_irq_unregister_callback(struct dpu_kms *dpu_kms, int irq_idx)
+ {
++      struct dpu_hw_intr_entry *irq_entry;
+       unsigned long irq_flags;
+       int ret;
+@@ -570,8 +581,9 @@ int dpu_core_irq_unregister_callback(struct dpu_kms *dpu_kms, int irq_idx)
+               DPU_ERROR("Fail to disable IRQ for irq_idx:%d: %d\n",
+                                       irq_idx, ret);
+-      dpu_kms->hw_intr->irq_tbl[irq_idx].cb = NULL;
+-      dpu_kms->hw_intr->irq_tbl[irq_idx].arg = NULL;
++      irq_entry = dpu_core_irq_get_entry(dpu_kms->hw_intr, irq_idx);
++      irq_entry->cb = NULL;
++      irq_entry->arg = NULL;
+       spin_unlock_irqrestore(&dpu_kms->hw_intr->irq_lock, irq_flags);
+@@ -584,14 +596,16 @@ int dpu_core_irq_unregister_callback(struct dpu_kms *dpu_kms, int irq_idx)
+ static int dpu_debugfs_core_irq_show(struct seq_file *s, void *v)
+ {
+       struct dpu_kms *dpu_kms = s->private;
++      struct dpu_hw_intr_entry *irq_entry;
+       unsigned long irq_flags;
+       int i, irq_count;
+       void *cb;
+       for (i = 0; i < dpu_kms->hw_intr->total_irqs; i++) {
+               spin_lock_irqsave(&dpu_kms->hw_intr->irq_lock, irq_flags);
+-              irq_count = atomic_read(&dpu_kms->hw_intr->irq_tbl[i].count);
+-              cb = dpu_kms->hw_intr->irq_tbl[i].cb;
++              irq_entry = dpu_core_irq_get_entry(dpu_kms->hw_intr, i);
++              irq_count = atomic_read(&irq_entry->count);
++              cb = irq_entry->cb;
+               spin_unlock_irqrestore(&dpu_kms->hw_intr->irq_lock, irq_flags);
+               if (irq_count || cb)
+@@ -614,6 +628,7 @@ void dpu_debugfs_core_irq_init(struct dpu_kms *dpu_kms,
+ void dpu_core_irq_preinstall(struct msm_kms *kms)
+ {
+       struct dpu_kms *dpu_kms = to_dpu_kms(kms);
++      struct dpu_hw_intr_entry *irq_entry;
+       int i;
+       pm_runtime_get_sync(&dpu_kms->pdev->dev);
+@@ -621,22 +636,27 @@ void dpu_core_irq_preinstall(struct msm_kms *kms)
+       dpu_disable_all_irqs(dpu_kms);
+       pm_runtime_put_sync(&dpu_kms->pdev->dev);
+-      for (i = 0; i < dpu_kms->hw_intr->total_irqs; i++)
+-              atomic_set(&dpu_kms->hw_intr->irq_tbl[i].count, 0);
++      for (i = 0; i < dpu_kms->hw_intr->total_irqs; i++) {
++              irq_entry = dpu_core_irq_get_entry(dpu_kms->hw_intr, i);
++              atomic_set(&irq_entry->count, 0);
++      }
+ }
+ void dpu_core_irq_uninstall(struct msm_kms *kms)
+ {
+       struct dpu_kms *dpu_kms = to_dpu_kms(kms);
++      struct dpu_hw_intr_entry *irq_entry;
+       int i;
+       if (!dpu_kms->hw_intr)
+               return;
+       pm_runtime_get_sync(&dpu_kms->pdev->dev);
+-      for (i = 0; i < dpu_kms->hw_intr->total_irqs; i++)
+-              if (dpu_kms->hw_intr->irq_tbl[i].cb)
++      for (i = 0; i < dpu_kms->hw_intr->total_irqs; i++) {
++              irq_entry = dpu_core_irq_get_entry(dpu_kms->hw_intr, i);
++              if (irq_entry->cb)
+                       DPU_ERROR("irq_idx=%d still enabled/registered\n", i);
++      }
+       dpu_clear_irqs(dpu_kms);
+       dpu_disable_all_irqs(dpu_kms);
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
+index e2b00dd326193..391fb268ad903 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
+@@ -38,6 +38,12 @@ enum dpu_hw_intr_reg {
+ #define DPU_IRQ_IDX(reg_idx, offset)  (reg_idx * 32 + offset)
++struct dpu_hw_intr_entry {
++      void (*cb)(void *arg);
++      void *arg;
++      atomic_t count;
++};
++
+ /**
+  * struct dpu_hw_intr: hw interrupts handling data structure
+  * @hw:               virtual address mapping
+@@ -57,11 +63,7 @@ struct dpu_hw_intr {
+       unsigned long irq_mask;
+       const struct dpu_intr_reg *intr_set;
+-      struct {
+-              void (*cb)(void *arg);
+-              void *arg;
+-              atomic_t count;
+-      } irq_tbl[];
++      struct dpu_hw_intr_entry irq_tbl[];
+ };
+ /**
+-- 
+2.43.0
+
diff --git a/queue-6.6/drm-msm-dpu-always-flush-the-slave-intf-on-the-ctl.patch b/queue-6.6/drm-msm-dpu-always-flush-the-slave-intf-on-the-ctl.patch
new file mode 100644 (file)
index 0000000..b8ac8ed
--- /dev/null
@@ -0,0 +1,49 @@
+From 421551c7c3331a0a1b3ed73e3ed2157d194cb9f8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 17 Apr 2024 01:57:43 +0200
+Subject: drm/msm/dpu: Always flush the slave INTF on the CTL
+
+From: Marijn Suijten <marijn.suijten@somainline.org>
+
+[ Upstream commit 2b938c3ab0a69ec6ea587bbf6fc2aec3db4a8736 ]
+
+As we can clearly see in a downstream kernel [1], flushing the slave INTF
+is skipped /only if/ the PPSPLIT topology is active.
+
+However, when DPU was originally submitted to mainline PPSPLIT was no
+longer part of it (seems to have been ripped out before submission), but
+this clause was incorrectly ported from the original SDE driver.  Given
+that there is no support for PPSPLIT (currently), flushing the slave
+INTF should /never/ be skipped (as the `if (ppsplit && !master) goto
+skip;` clause downstream never becomes true).
+
+[1]: https://git.codelinaro.org/clo/la/platform/vendor/opensource/display-drivers/-/blob/display-kernel.lnx.5.4.r1-rel/msm/sde/sde_encoder_phys_cmd.c?ref_type=heads#L1131-1139
+
+Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
+Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
+Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Patchwork: https://patchwork.freedesktop.org/patch/589901/
+Link: https://lore.kernel.org/r/20240417-drm-msm-initial-dualpipe-dsc-fixes-v1-3-78ae3ee9a697@somainline.org
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c
+index df88358e7037b..0f7c5deb5e52d 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c
+@@ -449,9 +449,6 @@ static void dpu_encoder_phys_cmd_enable_helper(
+       _dpu_encoder_phys_cmd_pingpong_config(phys_enc);
+-      if (!dpu_encoder_phys_cmd_is_master(phys_enc))
+-              return;
+-
+       ctl = phys_enc->hw_ctl;
+       ctl->ops.update_pending_flush_intf(ctl, phys_enc->hw_intf->idx);
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.6/drm-msm-dpu-extract-dpu_core_irq_is_valid-helper.patch b/queue-6.6/drm-msm-dpu-extract-dpu_core_irq_is_valid-helper.patch
new file mode 100644 (file)
index 0000000..67290c9
--- /dev/null
@@ -0,0 +1,93 @@
+From 0f9ef7b32b2008c0d5057d26248e645bafde4c1e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 2 Aug 2023 13:04:21 +0300
+Subject: drm/msm/dpu: extract dpu_core_irq_is_valid() helper
+
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+
+[ Upstream commit a65264833690d1280b901e3fe8e2825a44b3502c ]
+
+In preparation to reworking IRQ indices, move irq_idx validation to
+a separate helper.
+
+Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Patchwork: https://patchwork.freedesktop.org/patch/550929/
+Link: https://lore.kernel.org/r/20230802100426.4184892-4-dmitry.baryshkov@linaro.org
+Stable-dep-of: 530f272053a5 ("drm/msm/dpu: Add callback function pointer check before its call")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 22 +++++++++----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
+index 01a9ccfcd54bf..81d03b6c67d12 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
+@@ -200,6 +200,12 @@ static const struct dpu_intr_reg dpu_intr_set_7xxx[] = {
+ #define DPU_IRQ_REG(irq_idx)  (irq_idx / 32)
+ #define DPU_IRQ_MASK(irq_idx) (BIT(irq_idx % 32))
++static inline bool dpu_core_irq_is_valid(struct dpu_hw_intr *intr,
++                                       int irq_idx)
++{
++      return irq_idx >= 0 && irq_idx < intr->total_irqs;
++}
++
+ /**
+  * dpu_core_irq_callback_handler - dispatch core interrupts
+  * @dpu_kms:          Pointer to DPU's KMS structure
+@@ -291,7 +297,7 @@ static int dpu_hw_intr_enable_irq_locked(struct dpu_hw_intr *intr, int irq_idx)
+       if (!intr)
+               return -EINVAL;
+-      if (irq_idx < 0 || irq_idx >= intr->total_irqs) {
++      if (!dpu_core_irq_is_valid(intr, irq_idx)) {
+               pr_err("invalid IRQ index: [%d]\n", irq_idx);
+               return -EINVAL;
+       }
+@@ -344,7 +350,7 @@ static int dpu_hw_intr_disable_irq_locked(struct dpu_hw_intr *intr, int irq_idx)
+       if (!intr)
+               return -EINVAL;
+-      if (irq_idx < 0 || irq_idx >= intr->total_irqs) {
++      if (!dpu_core_irq_is_valid(intr, irq_idx)) {
+               pr_err("invalid IRQ index: [%d]\n", irq_idx);
+               return -EINVAL;
+       }
+@@ -429,13 +435,7 @@ u32 dpu_core_irq_read(struct dpu_kms *dpu_kms, int irq_idx)
+       if (!intr)
+               return 0;
+-      if (irq_idx < 0) {
+-              DPU_ERROR("[%pS] invalid irq_idx=%d\n",
+-                              __builtin_return_address(0), irq_idx);
+-              return 0;
+-      }
+-
+-      if (irq_idx < 0 || irq_idx >= intr->total_irqs) {
++      if (!dpu_core_irq_is_valid(intr, irq_idx)) {
+               pr_err("invalid IRQ index: [%d]\n", irq_idx);
+               return 0;
+       }
+@@ -518,7 +518,7 @@ int dpu_core_irq_register_callback(struct dpu_kms *dpu_kms, int irq_idx,
+               return -EINVAL;
+       }
+-      if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->total_irqs) {
++      if (!dpu_core_irq_is_valid(dpu_kms->hw_intr, irq_idx)) {
+               DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx);
+               return -EINVAL;
+       }
+@@ -555,7 +555,7 @@ int dpu_core_irq_unregister_callback(struct dpu_kms *dpu_kms, int irq_idx)
+       unsigned long irq_flags;
+       int ret;
+-      if (irq_idx < 0 || irq_idx >= dpu_kms->hw_intr->total_irqs) {
++      if (!dpu_core_irq_is_valid(dpu_kms->hw_intr, irq_idx)) {
+               DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx);
+               return -EINVAL;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.6/drm-msm-dpu-make-the-irq-table-size-static.patch b/queue-6.6/drm-msm-dpu-make-the-irq-table-size-static.patch
new file mode 100644 (file)
index 0000000..807ef61
--- /dev/null
@@ -0,0 +1,174 @@
+From fb262d18043641ec56e1fbed5f5d4c4841882074 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 2 Aug 2023 13:04:23 +0300
+Subject: drm/msm/dpu: make the irq table size static
+
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+
+[ Upstream commit 56acb1b620e263d3fed8f11f71bf2ab7ce1cae5b ]
+
+The size of the irq table is static, it has MDP_INTR_MAX * 32 interrupt
+entries. Provide the fixed length and drop struct_size() statement.
+
+Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Patchwork: https://patchwork.freedesktop.org/patch/550927/
+Link: https://lore.kernel.org/r/20230802100426.4184892-6-dmitry.baryshkov@linaro.org
+Stable-dep-of: 530f272053a5 ("drm/msm/dpu: Add callback function pointer check before its call")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 26 ++++++++-----------
+ .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h |  6 ++---
+ 2 files changed, 14 insertions(+), 18 deletions(-)
+
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
+index 14d374de30c52..3d6d13407dded 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
+@@ -200,10 +200,9 @@ static const struct dpu_intr_reg dpu_intr_set_7xxx[] = {
+ #define DPU_IRQ_REG(irq_idx)  (irq_idx / 32)
+ #define DPU_IRQ_MASK(irq_idx) (BIT(irq_idx % 32))
+-static inline bool dpu_core_irq_is_valid(struct dpu_hw_intr *intr,
+-                                       int irq_idx)
++static inline bool dpu_core_irq_is_valid(int irq_idx)
+ {
+-      return irq_idx >= 0 && irq_idx < intr->total_irqs;
++      return irq_idx >= 0 && irq_idx < DPU_NUM_IRQS;
+ }
+ static inline struct dpu_hw_intr_entry *dpu_core_irq_get_entry(struct dpu_hw_intr *intr,
+@@ -305,7 +304,7 @@ static int dpu_hw_intr_enable_irq_locked(struct dpu_hw_intr *intr, int irq_idx)
+       if (!intr)
+               return -EINVAL;
+-      if (!dpu_core_irq_is_valid(intr, irq_idx)) {
++      if (!dpu_core_irq_is_valid(irq_idx)) {
+               pr_err("invalid IRQ index: [%d]\n", irq_idx);
+               return -EINVAL;
+       }
+@@ -358,7 +357,7 @@ static int dpu_hw_intr_disable_irq_locked(struct dpu_hw_intr *intr, int irq_idx)
+       if (!intr)
+               return -EINVAL;
+-      if (!dpu_core_irq_is_valid(intr, irq_idx)) {
++      if (!dpu_core_irq_is_valid(irq_idx)) {
+               pr_err("invalid IRQ index: [%d]\n", irq_idx);
+               return -EINVAL;
+       }
+@@ -443,7 +442,7 @@ u32 dpu_core_irq_read(struct dpu_kms *dpu_kms, int irq_idx)
+       if (!intr)
+               return 0;
+-      if (!dpu_core_irq_is_valid(intr, irq_idx)) {
++      if (!dpu_core_irq_is_valid(irq_idx)) {
+               pr_err("invalid IRQ index: [%d]\n", irq_idx);
+               return 0;
+       }
+@@ -470,13 +469,12 @@ struct dpu_hw_intr *dpu_hw_intr_init(void __iomem *addr,
+               const struct dpu_mdss_cfg *m)
+ {
+       struct dpu_hw_intr *intr;
+-      int nirq = MDP_INTR_MAX * 32;
+       unsigned int i;
+       if (!addr || !m)
+               return ERR_PTR(-EINVAL);
+-      intr = kzalloc(struct_size(intr, irq_tbl, nirq), GFP_KERNEL);
++      intr = kzalloc(sizeof(*intr), GFP_KERNEL);
+       if (!intr)
+               return ERR_PTR(-ENOMEM);
+@@ -487,8 +485,6 @@ struct dpu_hw_intr *dpu_hw_intr_init(void __iomem *addr,
+       intr->hw.blk_addr = addr + m->mdp[0].base;
+-      intr->total_irqs = nirq;
+-
+       intr->irq_mask = BIT(MDP_SSPP_TOP0_INTR) |
+                        BIT(MDP_SSPP_TOP0_INTR2) |
+                        BIT(MDP_SSPP_TOP0_HIST_INTR);
+@@ -527,7 +523,7 @@ int dpu_core_irq_register_callback(struct dpu_kms *dpu_kms, int irq_idx,
+               return -EINVAL;
+       }
+-      if (!dpu_core_irq_is_valid(dpu_kms->hw_intr, irq_idx)) {
++      if (!dpu_core_irq_is_valid(irq_idx)) {
+               DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx);
+               return -EINVAL;
+       }
+@@ -566,7 +562,7 @@ int dpu_core_irq_unregister_callback(struct dpu_kms *dpu_kms, int irq_idx)
+       unsigned long irq_flags;
+       int ret;
+-      if (!dpu_core_irq_is_valid(dpu_kms->hw_intr, irq_idx)) {
++      if (!dpu_core_irq_is_valid(irq_idx)) {
+               DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx);
+               return -EINVAL;
+       }
+@@ -601,7 +597,7 @@ static int dpu_debugfs_core_irq_show(struct seq_file *s, void *v)
+       int i, irq_count;
+       void *cb;
+-      for (i = 0; i < dpu_kms->hw_intr->total_irqs; i++) {
++      for (i = 0; i < DPU_NUM_IRQS; i++) {
+               spin_lock_irqsave(&dpu_kms->hw_intr->irq_lock, irq_flags);
+               irq_entry = dpu_core_irq_get_entry(dpu_kms->hw_intr, i);
+               irq_count = atomic_read(&irq_entry->count);
+@@ -636,7 +632,7 @@ void dpu_core_irq_preinstall(struct msm_kms *kms)
+       dpu_disable_all_irqs(dpu_kms);
+       pm_runtime_put_sync(&dpu_kms->pdev->dev);
+-      for (i = 0; i < dpu_kms->hw_intr->total_irqs; i++) {
++      for (i = 0; i < DPU_NUM_IRQS; i++) {
+               irq_entry = dpu_core_irq_get_entry(dpu_kms->hw_intr, i);
+               atomic_set(&irq_entry->count, 0);
+       }
+@@ -652,7 +648,7 @@ void dpu_core_irq_uninstall(struct msm_kms *kms)
+               return;
+       pm_runtime_get_sync(&dpu_kms->pdev->dev);
+-      for (i = 0; i < dpu_kms->hw_intr->total_irqs; i++) {
++      for (i = 0; i < DPU_NUM_IRQS; i++) {
+               irq_entry = dpu_core_irq_get_entry(dpu_kms->hw_intr, i);
+               if (irq_entry->cb)
+                       DPU_ERROR("irq_idx=%d still enabled/registered\n", i);
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
+index 391fb268ad903..bb775b6a24327 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
+@@ -38,6 +38,8 @@ enum dpu_hw_intr_reg {
+ #define DPU_IRQ_IDX(reg_idx, offset)  (reg_idx * 32 + offset)
++#define DPU_NUM_IRQS          (MDP_INTR_MAX * 32)
++
+ struct dpu_hw_intr_entry {
+       void (*cb)(void *arg);
+       void *arg;
+@@ -50,7 +52,6 @@ struct dpu_hw_intr_entry {
+  * @ops:              function pointer mapping for IRQ handling
+  * @cache_irq_mask:   array of IRQ enable masks reg storage created during init
+  * @save_irq_status:  array of IRQ status reg storage created during init
+- * @total_irqs: total number of irq_idx mapped in the hw_interrupts
+  * @irq_lock:         spinlock for accessing IRQ resources
+  * @irq_cb_tbl:       array of IRQ callbacks
+  */
+@@ -58,12 +59,11 @@ struct dpu_hw_intr {
+       struct dpu_hw_blk_reg_map hw;
+       u32 cache_irq_mask[MDP_INTR_MAX];
+       u32 *save_irq_status;
+-      u32 total_irqs;
+       spinlock_t irq_lock;
+       unsigned long irq_mask;
+       const struct dpu_intr_reg *intr_set;
+-      struct dpu_hw_intr_entry irq_tbl[];
++      struct dpu_hw_intr_entry irq_tbl[DPU_NUM_IRQS];
+ };
+ /**
+-- 
+2.43.0
+
diff --git a/queue-6.6/drm-msm-dpu-remove-irq_idx-argument-from-irq-callbac.patch b/queue-6.6/drm-msm-dpu-remove-irq_idx-argument-from-irq-callbac.patch
new file mode 100644 (file)
index 0000000..cf0b5b7
--- /dev/null
@@ -0,0 +1,211 @@
+From 4bd09f4a6e7a9dd83f962c5139a24494ecfcad2c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 2 Aug 2023 13:04:20 +0300
+Subject: drm/msm/dpu: remove irq_idx argument from IRQ callbacks
+
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+
+[ Upstream commit e75e45c25b66ae9a78fa2476df0bf99ad80f33f9 ]
+
+There is no point in passing the IRQ index to IRQ callbacks, no function
+uses that. Drop it at last.
+
+Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Patchwork: https://patchwork.freedesktop.org/patch/550925/
+Link: https://lore.kernel.org/r/20230802100426.4184892-3-dmitry.baryshkov@linaro.org
+Stable-dep-of: 530f272053a5 ("drm/msm/dpu: Add callback function pointer check before its call")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h     |  2 +-
+ drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c      |  4 ++--
+ drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h |  2 +-
+ .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c |  8 ++++----
+ .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c |  4 ++--
+ .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c  | 16 +++++-----------
+ .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c    |  4 ++--
+ .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h    |  2 +-
+ 8 files changed, 18 insertions(+), 24 deletions(-)
+
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h
+index b5b6e7031fb9e..ba06312cbb163 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_irq.h
+@@ -53,7 +53,7 @@ u32 dpu_core_irq_read(
+ int dpu_core_irq_register_callback(
+               struct dpu_kms *dpu_kms,
+               int irq_idx,
+-              void (*irq_cb)(void *arg, int irq_idx),
++              void (*irq_cb)(void *arg),
+               void *irq_arg);
+ /**
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+index 20e118546432d..3961b514a9a18 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+@@ -358,7 +358,7 @@ static int dpu_encoder_helper_wait_event_timeout(int32_t drm_id,
+ int dpu_encoder_helper_wait_for_irq(struct dpu_encoder_phys *phys_enc,
+               int irq,
+-              void (*func)(void *arg, int irq_idx),
++              void (*func)(void *arg),
+               struct dpu_encoder_wait_info *wait_info)
+ {
+       u32 irq_status;
+@@ -405,7 +405,7 @@ int dpu_encoder_helper_wait_for_irq(struct dpu_encoder_phys *phys_enc,
+                                     phys_enc->hw_pp->idx - PINGPONG_0,
+                                     atomic_read(wait_info->atomic_cnt));
+                       local_irq_save(flags);
+-                      func(phys_enc, irq);
++                      func(phys_enc);
+                       local_irq_restore(flags);
+                       ret = 0;
+               } else {
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
+index d48558ede488d..f91661a698882 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h
+@@ -365,7 +365,7 @@ void dpu_encoder_helper_report_irq_timeout(struct dpu_encoder_phys *phys_enc,
+  */
+ int dpu_encoder_helper_wait_for_irq(struct dpu_encoder_phys *phys_enc,
+               int irq,
+-              void (*func)(void *arg, int irq_idx),
++              void (*func)(void *arg),
+               struct dpu_encoder_wait_info *wait_info);
+ /**
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c
+index 0f7c5deb5e52d..718421306247f 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_cmd.c
+@@ -76,7 +76,7 @@ static void _dpu_encoder_phys_cmd_update_intf_cfg(
+               phys_enc->hw_intf->ops.program_intf_cmd_cfg(phys_enc->hw_intf, &cmd_mode_cfg);
+ }
+-static void dpu_encoder_phys_cmd_pp_tx_done_irq(void *arg, int irq_idx)
++static void dpu_encoder_phys_cmd_pp_tx_done_irq(void *arg)
+ {
+       struct dpu_encoder_phys *phys_enc = arg;
+       unsigned long lock_flags;
+@@ -103,7 +103,7 @@ static void dpu_encoder_phys_cmd_pp_tx_done_irq(void *arg, int irq_idx)
+       DPU_ATRACE_END("pp_done_irq");
+ }
+-static void dpu_encoder_phys_cmd_te_rd_ptr_irq(void *arg, int irq_idx)
++static void dpu_encoder_phys_cmd_te_rd_ptr_irq(void *arg)
+ {
+       struct dpu_encoder_phys *phys_enc = arg;
+       struct dpu_encoder_phys_cmd *cmd_enc;
+@@ -126,7 +126,7 @@ static void dpu_encoder_phys_cmd_te_rd_ptr_irq(void *arg, int irq_idx)
+       DPU_ATRACE_END("rd_ptr_irq");
+ }
+-static void dpu_encoder_phys_cmd_ctl_start_irq(void *arg, int irq_idx)
++static void dpu_encoder_phys_cmd_ctl_start_irq(void *arg)
+ {
+       struct dpu_encoder_phys *phys_enc = arg;
+@@ -139,7 +139,7 @@ static void dpu_encoder_phys_cmd_ctl_start_irq(void *arg, int irq_idx)
+       DPU_ATRACE_END("ctl_start_irq");
+ }
+-static void dpu_encoder_phys_cmd_underrun_irq(void *arg, int irq_idx)
++static void dpu_encoder_phys_cmd_underrun_irq(void *arg)
+ {
+       struct dpu_encoder_phys *phys_enc = arg;
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c
+index 2141b81397824..aec3ca4aa0fb7 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c
+@@ -300,7 +300,7 @@ static void dpu_encoder_phys_vid_setup_timing_engine(
+       programmable_fetch_config(phys_enc, &timing_params);
+ }
+-static void dpu_encoder_phys_vid_vblank_irq(void *arg, int irq_idx)
++static void dpu_encoder_phys_vid_vblank_irq(void *arg)
+ {
+       struct dpu_encoder_phys *phys_enc = arg;
+       struct dpu_hw_ctl *hw_ctl;
+@@ -337,7 +337,7 @@ static void dpu_encoder_phys_vid_vblank_irq(void *arg, int irq_idx)
+       DPU_ATRACE_END("vblank_irq");
+ }
+-static void dpu_encoder_phys_vid_underrun_irq(void *arg, int irq_idx)
++static void dpu_encoder_phys_vid_underrun_irq(void *arg)
+ {
+       struct dpu_encoder_phys *phys_enc = arg;
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
+index 78037a697633b..870a1f5060e30 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
+@@ -345,7 +345,11 @@ static void dpu_encoder_phys_wb_setup(
+ }
+-static void _dpu_encoder_phys_wb_frame_done_helper(void *arg)
++/**
++ * dpu_encoder_phys_wb_done_irq - writeback interrupt handler
++ * @arg:      Pointer to writeback encoder
++ */
++static void dpu_encoder_phys_wb_done_irq(void *arg)
+ {
+       struct dpu_encoder_phys *phys_enc = arg;
+       struct dpu_encoder_phys_wb *wb_enc = to_dpu_encoder_phys_wb(phys_enc);
+@@ -371,16 +375,6 @@ static void _dpu_encoder_phys_wb_frame_done_helper(void *arg)
+       wake_up_all(&phys_enc->pending_kickoff_wq);
+ }
+-/**
+- * dpu_encoder_phys_wb_done_irq - writeback interrupt handler
+- * @arg:      Pointer to writeback encoder
+- * @irq_idx:  interrupt index
+- */
+-static void dpu_encoder_phys_wb_done_irq(void *arg, int irq_idx)
+-{
+-      _dpu_encoder_phys_wb_frame_done_helper(arg);
+-}
+-
+ /**
+  * dpu_encoder_phys_wb_irq_ctrl - irq control of WB
+  * @phys:     Pointer to physical encoder
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
+index e3c50439f80a1..01a9ccfcd54bf 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
+@@ -217,7 +217,7 @@ static void dpu_core_irq_callback_handler(struct dpu_kms *dpu_kms, int irq_idx)
+       /*
+        * Perform registered function callback
+        */
+-      dpu_kms->hw_intr->irq_tbl[irq_idx].cb(dpu_kms->hw_intr->irq_tbl[irq_idx].arg, irq_idx);
++      dpu_kms->hw_intr->irq_tbl[irq_idx].cb(dpu_kms->hw_intr->irq_tbl[irq_idx].arg);
+ }
+ irqreturn_t dpu_core_irq(struct msm_kms *kms)
+@@ -507,7 +507,7 @@ void dpu_hw_intr_destroy(struct dpu_hw_intr *intr)
+ }
+ int dpu_core_irq_register_callback(struct dpu_kms *dpu_kms, int irq_idx,
+-              void (*irq_cb)(void *arg, int irq_idx),
++              void (*irq_cb)(void *arg),
+               void *irq_arg)
+ {
+       unsigned long irq_flags;
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
+index dab761e548636..e2b00dd326193 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
+@@ -58,7 +58,7 @@ struct dpu_hw_intr {
+       const struct dpu_intr_reg *intr_set;
+       struct {
+-              void (*cb)(void *arg, int irq_idx);
++              void (*cb)(void *arg);
+               void *arg;
+               atomic_t count;
+       } irq_tbl[];
+-- 
+2.43.0
+
diff --git a/queue-6.6/drm-msm-dpu-stop-using-raw-irq-indices-in-the-kernel.patch b/queue-6.6/drm-msm-dpu-stop-using-raw-irq-indices-in-the-kernel.patch
new file mode 100644 (file)
index 0000000..604e449
--- /dev/null
@@ -0,0 +1,277 @@
+From 2850cce3890243befc59ede791be063ee66a4167 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 2 Aug 2023 13:04:24 +0300
+Subject: drm/msm/dpu: stop using raw IRQ indices in the kernel output
+
+From: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+
+[ Upstream commit 6893199183f836e1ff452082f0f9d068364b2f17 ]
+
+In preparation to reworking IRQ indcies, stop using raw IRQ indices in
+kernel output (both printk and debugfs). Instead use a pair of register
+index and bit. This corresponds closer to the values in HW catalog.
+
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Reviewed-by: Marijn Suijten <marijn.suijten@somainline.org>
+Patchwork: https://patchwork.freedesktop.org/patch/550933/
+Link: https://lore.kernel.org/r/20230802100426.4184892-7-dmitry.baryshkov@linaro.org
+Stable-dep-of: 530f272053a5 ("drm/msm/dpu: Add callback function pointer check before its call")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c   | 26 +++++-----
+ .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c | 51 +++++++++++--------
+ .../gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h |  2 +
+ 3 files changed, 46 insertions(+), 33 deletions(-)
+
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+index 3961b514a9a18..5fb7e2e10801d 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c
+@@ -357,7 +357,7 @@ static int dpu_encoder_helper_wait_event_timeout(int32_t drm_id,
+               u32 irq_idx, struct dpu_encoder_wait_info *info);
+ int dpu_encoder_helper_wait_for_irq(struct dpu_encoder_phys *phys_enc,
+-              int irq,
++              int irq_idx,
+               void (*func)(void *arg),
+               struct dpu_encoder_wait_info *wait_info)
+ {
+@@ -372,36 +372,36 @@ int dpu_encoder_helper_wait_for_irq(struct dpu_encoder_phys *phys_enc,
+       /* return EWOULDBLOCK since we know the wait isn't necessary */
+       if (phys_enc->enable_state == DPU_ENC_DISABLED) {
+-              DRM_ERROR("encoder is disabled id=%u, callback=%ps, irq=%d\n",
++              DRM_ERROR("encoder is disabled id=%u, callback=%ps, IRQ=[%d, %d]\n",
+                         DRMID(phys_enc->parent), func,
+-                        irq);
++                        DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
+               return -EWOULDBLOCK;
+       }
+-      if (irq < 0) {
++      if (irq_idx < 0) {
+               DRM_DEBUG_KMS("skip irq wait id=%u, callback=%ps\n",
+                             DRMID(phys_enc->parent), func);
+               return 0;
+       }
+-      DRM_DEBUG_KMS("id=%u, callback=%ps, irq=%d, pp=%d, pending_cnt=%d\n",
++      DRM_DEBUG_KMS("id=%u, callback=%ps, IRQ=[%d, %d], pp=%d, pending_cnt=%d\n",
+                     DRMID(phys_enc->parent), func,
+-                    irq, phys_enc->hw_pp->idx - PINGPONG_0,
++                    DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx), phys_enc->hw_pp->idx - PINGPONG_0,
+                     atomic_read(wait_info->atomic_cnt));
+       ret = dpu_encoder_helper_wait_event_timeout(
+                       DRMID(phys_enc->parent),
+-                      irq,
++                      irq_idx,
+                       wait_info);
+       if (ret <= 0) {
+-              irq_status = dpu_core_irq_read(phys_enc->dpu_kms, irq);
++              irq_status = dpu_core_irq_read(phys_enc->dpu_kms, irq_idx);
+               if (irq_status) {
+                       unsigned long flags;
+-                      DRM_DEBUG_KMS("irq not triggered id=%u, callback=%ps, irq=%d, pp=%d, atomic_cnt=%d\n",
++                      DRM_DEBUG_KMS("IRQ=[%d, %d] not triggered id=%u, callback=%ps, pp=%d, atomic_cnt=%d\n",
++                                    DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx),
+                                     DRMID(phys_enc->parent), func,
+-                                    irq,
+                                     phys_enc->hw_pp->idx - PINGPONG_0,
+                                     atomic_read(wait_info->atomic_cnt));
+                       local_irq_save(flags);
+@@ -410,16 +410,16 @@ int dpu_encoder_helper_wait_for_irq(struct dpu_encoder_phys *phys_enc,
+                       ret = 0;
+               } else {
+                       ret = -ETIMEDOUT;
+-                      DRM_DEBUG_KMS("irq timeout id=%u, callback=%ps, irq=%d, pp=%d, atomic_cnt=%d\n",
++                      DRM_DEBUG_KMS("IRQ=[%d, %d] timeout id=%u, callback=%ps, pp=%d, atomic_cnt=%d\n",
++                                    DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx),
+                                     DRMID(phys_enc->parent), func,
+-                                    irq,
+                                     phys_enc->hw_pp->idx - PINGPONG_0,
+                                     atomic_read(wait_info->atomic_cnt));
+               }
+       } else {
+               ret = 0;
+               trace_dpu_enc_irq_wait_success(DRMID(phys_enc->parent),
+-                      func, irq,
++                      func, irq_idx,
+                       phys_enc->hw_pp->idx - PINGPONG_0,
+                       atomic_read(wait_info->atomic_cnt));
+       }
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
+index 3d6d13407dded..c413e9917d7eb 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.c
+@@ -197,8 +197,7 @@ static const struct dpu_intr_reg dpu_intr_set_7xxx[] = {
+       },
+ };
+-#define DPU_IRQ_REG(irq_idx)  (irq_idx / 32)
+-#define DPU_IRQ_MASK(irq_idx) (BIT(irq_idx % 32))
++#define DPU_IRQ_MASK(irq_idx) (BIT(DPU_IRQ_BIT(irq_idx)))
+ static inline bool dpu_core_irq_is_valid(int irq_idx)
+ {
+@@ -220,10 +219,11 @@ static void dpu_core_irq_callback_handler(struct dpu_kms *dpu_kms, int irq_idx)
+ {
+       struct dpu_hw_intr_entry *irq_entry = dpu_core_irq_get_entry(dpu_kms->hw_intr, irq_idx);
+-      VERB("irq_idx=%d\n", irq_idx);
++      VERB("IRQ=[%d, %d]\n", DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
+       if (!irq_entry->cb)
+-              DRM_ERROR("no registered cb, idx:%d\n", irq_idx);
++              DRM_ERROR("no registered cb, IRQ=[%d, %d]\n",
++                        DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
+       atomic_inc(&irq_entry->count);
+@@ -305,7 +305,8 @@ static int dpu_hw_intr_enable_irq_locked(struct dpu_hw_intr *intr, int irq_idx)
+               return -EINVAL;
+       if (!dpu_core_irq_is_valid(irq_idx)) {
+-              pr_err("invalid IRQ index: [%d]\n", irq_idx);
++              pr_err("invalid IRQ=[%d, %d]\n",
++                     DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
+               return -EINVAL;
+       }
+@@ -341,7 +342,8 @@ static int dpu_hw_intr_enable_irq_locked(struct dpu_hw_intr *intr, int irq_idx)
+               intr->cache_irq_mask[reg_idx] = cache_irq_mask;
+       }
+-      pr_debug("DPU IRQ %d %senabled: MASK:0x%.8lx, CACHE-MASK:0x%.8x\n", irq_idx, dbgstr,
++      pr_debug("DPU IRQ=[%d, %d] %senabled: MASK:0x%.8lx, CACHE-MASK:0x%.8x\n",
++               DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx), dbgstr,
+                       DPU_IRQ_MASK(irq_idx), cache_irq_mask);
+       return 0;
+@@ -358,7 +360,8 @@ static int dpu_hw_intr_disable_irq_locked(struct dpu_hw_intr *intr, int irq_idx)
+               return -EINVAL;
+       if (!dpu_core_irq_is_valid(irq_idx)) {
+-              pr_err("invalid IRQ index: [%d]\n", irq_idx);
++              pr_err("invalid IRQ=[%d, %d]\n",
++                     DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
+               return -EINVAL;
+       }
+@@ -390,7 +393,8 @@ static int dpu_hw_intr_disable_irq_locked(struct dpu_hw_intr *intr, int irq_idx)
+               intr->cache_irq_mask[reg_idx] = cache_irq_mask;
+       }
+-      pr_debug("DPU IRQ %d %sdisabled: MASK:0x%.8lx, CACHE-MASK:0x%.8x\n", irq_idx, dbgstr,
++      pr_debug("DPU IRQ=[%d, %d] %sdisabled: MASK:0x%.8lx, CACHE-MASK:0x%.8x\n",
++               DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx), dbgstr,
+                       DPU_IRQ_MASK(irq_idx), cache_irq_mask);
+       return 0;
+@@ -443,7 +447,7 @@ u32 dpu_core_irq_read(struct dpu_kms *dpu_kms, int irq_idx)
+               return 0;
+       if (!dpu_core_irq_is_valid(irq_idx)) {
+-              pr_err("invalid IRQ index: [%d]\n", irq_idx);
++              pr_err("invalid IRQ=[%d, %d]\n", DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
+               return 0;
+       }
+@@ -519,16 +523,19 @@ int dpu_core_irq_register_callback(struct dpu_kms *dpu_kms, int irq_idx,
+       int ret;
+       if (!irq_cb) {
+-              DPU_ERROR("invalid ird_idx:%d irq_cb:%ps\n", irq_idx, irq_cb);
++              DPU_ERROR("invalid IRQ=[%d, %d] irq_cb:%ps\n",
++                        DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx), irq_cb);
+               return -EINVAL;
+       }
+       if (!dpu_core_irq_is_valid(irq_idx)) {
+-              DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx);
++              DPU_ERROR("invalid IRQ=[%d, %d]\n",
++                        DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
+               return -EINVAL;
+       }
+-      VERB("[%pS] irq_idx=%d\n", __builtin_return_address(0), irq_idx);
++      VERB("[%pS] IRQ=[%d, %d]\n", __builtin_return_address(0),
++           DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
+       spin_lock_irqsave(&dpu_kms->hw_intr->irq_lock, irq_flags);
+@@ -547,8 +554,8 @@ int dpu_core_irq_register_callback(struct dpu_kms *dpu_kms, int irq_idx,
+                               dpu_kms->hw_intr,
+                               irq_idx);
+       if (ret)
+-              DPU_ERROR("Fail to enable IRQ for irq_idx:%d\n",
+-                                      irq_idx);
++              DPU_ERROR("Failed/ to enable IRQ=[%d, %d]\n",
++                        DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
+       spin_unlock_irqrestore(&dpu_kms->hw_intr->irq_lock, irq_flags);
+       trace_dpu_irq_register_success(irq_idx);
+@@ -563,19 +570,21 @@ int dpu_core_irq_unregister_callback(struct dpu_kms *dpu_kms, int irq_idx)
+       int ret;
+       if (!dpu_core_irq_is_valid(irq_idx)) {
+-              DPU_ERROR("invalid IRQ index: [%d]\n", irq_idx);
++              DPU_ERROR("invalid IRQ=[%d, %d]\n",
++                        DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
+               return -EINVAL;
+       }
+-      VERB("[%pS] irq_idx=%d\n", __builtin_return_address(0), irq_idx);
++      VERB("[%pS] IRQ=[%d, %d]\n", __builtin_return_address(0),
++           DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx));
+       spin_lock_irqsave(&dpu_kms->hw_intr->irq_lock, irq_flags);
+       trace_dpu_core_irq_unregister_callback(irq_idx);
+       ret = dpu_hw_intr_disable_irq_locked(dpu_kms->hw_intr, irq_idx);
+       if (ret)
+-              DPU_ERROR("Fail to disable IRQ for irq_idx:%d: %d\n",
+-                                      irq_idx, ret);
++              DPU_ERROR("Failed to disable IRQ=[%d, %d]: %d\n",
++                        DPU_IRQ_REG(irq_idx), DPU_IRQ_BIT(irq_idx), ret);
+       irq_entry = dpu_core_irq_get_entry(dpu_kms->hw_intr, irq_idx);
+       irq_entry->cb = NULL;
+@@ -605,7 +614,8 @@ static int dpu_debugfs_core_irq_show(struct seq_file *s, void *v)
+               spin_unlock_irqrestore(&dpu_kms->hw_intr->irq_lock, irq_flags);
+               if (irq_count || cb)
+-                      seq_printf(s, "idx:%d irq:%d cb:%ps\n", i, irq_count, cb);
++                      seq_printf(s, "IRQ=[%d, %d] count:%d cb:%ps\n",
++                                 DPU_IRQ_REG(i), DPU_IRQ_BIT(i), irq_count, cb);
+       }
+       return 0;
+@@ -651,7 +661,8 @@ void dpu_core_irq_uninstall(struct msm_kms *kms)
+       for (i = 0; i < DPU_NUM_IRQS; i++) {
+               irq_entry = dpu_core_irq_get_entry(dpu_kms->hw_intr, i);
+               if (irq_entry->cb)
+-                      DPU_ERROR("irq_idx=%d still enabled/registered\n", i);
++                      DPU_ERROR("IRQ=[%d, %d] still enabled/registered\n",
++                                DPU_IRQ_REG(i), DPU_IRQ_BIT(i));
+       }
+       dpu_clear_irqs(dpu_kms);
+diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
+index bb775b6a24327..9df5d6e737a11 100644
+--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
++++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_interrupts.h
+@@ -37,6 +37,8 @@ enum dpu_hw_intr_reg {
+ #define MDP_INTFn_INTR(intf)  (MDP_INTF0_INTR + (intf - INTF_0))
+ #define DPU_IRQ_IDX(reg_idx, offset)  (reg_idx * 32 + offset)
++#define DPU_IRQ_REG(irq_idx)  (irq_idx / 32)
++#define DPU_IRQ_BIT(irq_idx)  (irq_idx % 32)
+ #define DPU_NUM_IRQS          (MDP_INTR_MAX * 32)
+-- 
+2.43.0
+
diff --git a/queue-6.6/drm-msm-dsi-print-dual-dsi-adjusted-pclk-instead-of-.patch b/queue-6.6/drm-msm-dsi-print-dual-dsi-adjusted-pclk-instead-of-.patch
new file mode 100644 (file)
index 0000000..4895300
--- /dev/null
@@ -0,0 +1,60 @@
+From 545a649e986c2e37ce1c304a7be1b0badbdcf8d0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 17 Apr 2024 01:57:41 +0200
+Subject: drm/msm/dsi: Print dual-DSI-adjusted pclk instead of original mode
+ pclk
+
+From: Marijn Suijten <marijn.suijten@somainline.org>
+
+[ Upstream commit f12e0e12524a34bf145f7b80122e653ffe3d130a ]
+
+When dual-DSI (bonded DSI) was added in commit ed9976a09b48
+("drm/msm/dsi: adjust dsi timing for dual dsi mode") some DBG() prints
+were not updated, leading to print the original mode->clock rather
+than the adjusted (typically the mode clock divided by two, though more
+recently also adjusted for DSC compression) msm_host->pixel_clk_rate
+which is passed to clk_set_rate() just below.  Fix that by printing the
+actual pixel_clk_rate that is being set.
+
+Fixes: ed9976a09b48 ("drm/msm/dsi: adjust dsi timing for dual dsi mode")
+Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
+Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Patchwork: https://patchwork.freedesktop.org/patch/589896/
+Link: https://lore.kernel.org/r/20240417-drm-msm-initial-dualpipe-dsc-fixes-v1-1-78ae3ee9a697@somainline.org
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/msm/dsi/dsi_host.c | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
+index 470866896b9b8..ab393bdaba6cd 100644
+--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
++++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
+@@ -366,8 +366,8 @@ int dsi_link_clk_set_rate_6g(struct msm_dsi_host *msm_host)
+ {
+       int ret;
+-      DBG("Set clk rates: pclk=%d, byteclk=%lu",
+-              msm_host->mode->clock, msm_host->byte_clk_rate);
++      DBG("Set clk rates: pclk=%lu, byteclk=%lu",
++          msm_host->pixel_clk_rate, msm_host->byte_clk_rate);
+       ret = dev_pm_opp_set_rate(&msm_host->pdev->dev,
+                                 msm_host->byte_clk_rate);
+@@ -440,9 +440,9 @@ int dsi_link_clk_set_rate_v2(struct msm_dsi_host *msm_host)
+ {
+       int ret;
+-      DBG("Set clk rates: pclk=%d, byteclk=%lu, esc_clk=%lu, dsi_src_clk=%lu",
+-              msm_host->mode->clock, msm_host->byte_clk_rate,
+-              msm_host->esc_clk_rate, msm_host->src_clk_rate);
++      DBG("Set clk rates: pclk=%lu, byteclk=%lu, esc_clk=%lu, dsi_src_clk=%lu",
++          msm_host->pixel_clk_rate, msm_host->byte_clk_rate,
++          msm_host->esc_clk_rate, msm_host->src_clk_rate);
+       ret = clk_set_rate(msm_host->byte_clk, msm_host->byte_clk_rate);
+       if (ret) {
+-- 
+2.43.0
+
diff --git a/queue-6.6/drm-nouveau-use-tile_mode-and-pte_kind-for-vm_bind-b.patch b/queue-6.6/drm-nouveau-use-tile_mode-and-pte_kind-for-vm_bind-b.patch
new file mode 100644 (file)
index 0000000..9059bb1
--- /dev/null
@@ -0,0 +1,128 @@
+From 456bf5fbeecac5fad61d5d41c2520a191fb2e01a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 9 May 2024 23:43:52 +0300
+Subject: drm/nouveau: use tile_mode and pte_kind for VM_BIND bo allocations
+
+From: Mohamed Ahmed <mohamedahmedegypt2001@gmail.com>
+
+[ Upstream commit aed9a1a4f7106ff99a882ad06318cebfa71016a2 ]
+
+Allow PTE kind and tile mode on BO create with VM_BIND, and add a
+GETPARAM to indicate this change. This is needed to support modifiers in
+NVK and ensure correctness when dealing with the nouveau GL driver.
+
+The userspace modifiers implementation this is for can be found here:
+https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24795
+
+Fixes: b88baab82871 ("drm/nouveau: implement new VM_BIND uAPI")
+Signed-off-by: Mohamed Ahmed <mohamedahmedegypt2001@gmail.com>
+Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
+Signed-off-by: Danilo Krummrich <dakr@redhat.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240509204352.7597-1-mohamedahmedegypt2001@gmail.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/nouveau/nouveau_abi16.c |  3 ++
+ drivers/gpu/drm/nouveau/nouveau_bo.c    | 44 +++++++++++--------------
+ include/uapi/drm/nouveau_drm.h          |  7 ++++
+ 3 files changed, 29 insertions(+), 25 deletions(-)
+
+diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
+index 0fbc9c841666e..b3f0e10f83fef 100644
+--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
++++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
+@@ -277,6 +277,9 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
+               getparam->value = (u64)ttm_resource_manager_usage(vram_mgr) << PAGE_SHIFT;
+               break;
+       }
++      case NOUVEAU_GETPARAM_HAS_VMA_TILEMODE:
++              getparam->value = 1;
++              break;
+       default:
+               NV_PRINTK(dbg, cli, "unknown parameter %lld\n", getparam->param);
+               return -EINVAL;
+diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
+index 254d6c9ef2023..3a7f4ce34aa31 100644
+--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
++++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
+@@ -234,28 +234,28 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain,
+       }
+       nvbo->contig = !(tile_flags & NOUVEAU_GEM_TILE_NONCONTIG);
+-      if (!nouveau_cli_uvmm(cli) || internal) {
+-              /* for BO noVM allocs, don't assign kinds */
+-              if (cli->device.info.family >= NV_DEVICE_INFO_V0_FERMI) {
+-                      nvbo->kind = (tile_flags & 0x0000ff00) >> 8;
+-                      if (!nvif_mmu_kind_valid(mmu, nvbo->kind)) {
+-                              kfree(nvbo);
+-                              return ERR_PTR(-EINVAL);
+-                      }
+-                      nvbo->comp = mmu->kind[nvbo->kind] != nvbo->kind;
+-              } else if (cli->device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
+-                      nvbo->kind = (tile_flags & 0x00007f00) >> 8;
+-                      nvbo->comp = (tile_flags & 0x00030000) >> 16;
+-                      if (!nvif_mmu_kind_valid(mmu, nvbo->kind)) {
+-                              kfree(nvbo);
+-                              return ERR_PTR(-EINVAL);
+-                      }
+-              } else {
+-                      nvbo->zeta = (tile_flags & 0x00000007);
++      if (cli->device.info.family >= NV_DEVICE_INFO_V0_FERMI) {
++              nvbo->kind = (tile_flags & 0x0000ff00) >> 8;
++              if (!nvif_mmu_kind_valid(mmu, nvbo->kind)) {
++                      kfree(nvbo);
++                      return ERR_PTR(-EINVAL);
++              }
++
++              nvbo->comp = mmu->kind[nvbo->kind] != nvbo->kind;
++      } else if (cli->device.info.family >= NV_DEVICE_INFO_V0_TESLA) {
++              nvbo->kind = (tile_flags & 0x00007f00) >> 8;
++              nvbo->comp = (tile_flags & 0x00030000) >> 16;
++              if (!nvif_mmu_kind_valid(mmu, nvbo->kind)) {
++                      kfree(nvbo);
++                      return ERR_PTR(-EINVAL);
+               }
+-              nvbo->mode = tile_mode;
++      } else {
++              nvbo->zeta = (tile_flags & 0x00000007);
++      }
++      nvbo->mode = tile_mode;
++      if (!nouveau_cli_uvmm(cli) || internal) {
+               /* Determine the desirable target GPU page size for the buffer. */
+               for (i = 0; i < vmm->page_nr; i++) {
+                       /* Because we cannot currently allow VMM maps to fail
+@@ -297,12 +297,6 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain,
+               }
+               nvbo->page = vmm->page[pi].shift;
+       } else {
+-              /* reject other tile flags when in VM mode. */
+-              if (tile_mode)
+-                      return ERR_PTR(-EINVAL);
+-              if (tile_flags & ~NOUVEAU_GEM_TILE_NONCONTIG)
+-                      return ERR_PTR(-EINVAL);
+-
+               /* Determine the desirable target GPU page size for the buffer. */
+               for (i = 0; i < vmm->page_nr; i++) {
+                       /* Because we cannot currently allow VMM maps to fail
+diff --git a/include/uapi/drm/nouveau_drm.h b/include/uapi/drm/nouveau_drm.h
+index 77d7ff0d5b110..c3d8dc7512971 100644
+--- a/include/uapi/drm/nouveau_drm.h
++++ b/include/uapi/drm/nouveau_drm.h
+@@ -68,6 +68,13 @@ extern "C" {
+  */
+ #define NOUVEAU_GETPARAM_VRAM_USED 19
++/*
++ * NOUVEAU_GETPARAM_HAS_VMA_TILEMODE
++ *
++ * Query whether tile mode and PTE kind are accepted with VM allocs or not.
++ */
++#define NOUVEAU_GETPARAM_HAS_VMA_TILEMODE 20
++
+ struct drm_nouveau_getparam {
+       __u64 param;
+       __u64 value;
+-- 
+2.43.0
+
diff --git a/queue-6.6/drm-zynqmp_dpsub-always-register-bridge.patch b/queue-6.6/drm-zynqmp_dpsub-always-register-bridge.patch
new file mode 100644 (file)
index 0000000..035b9c7
--- /dev/null
@@ -0,0 +1,97 @@
+From efcee4a465ac8d86f387e8a968c4a9107b3553c8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 8 Mar 2024 15:47:41 -0500
+Subject: drm: zynqmp_dpsub: Always register bridge
+
+From: Sean Anderson <sean.anderson@linux.dev>
+
+[ Upstream commit be3f3042391d061cfca2bd22630e0d101acea5fc ]
+
+We must always register the DRM bridge, since zynqmp_dp_hpd_work_func
+calls drm_bridge_hpd_notify, which in turn expects hpd_mutex to be
+initialized. We do this before zynqmp_dpsub_drm_init since that calls
+drm_bridge_attach. This fixes the following lockdep warning:
+
+[   19.217084] ------------[ cut here ]------------
+[   19.227530] DEBUG_LOCKS_WARN_ON(lock->magic != lock)
+[   19.227768] WARNING: CPU: 0 PID: 140 at kernel/locking/mutex.c:582 __mutex_lock+0x4bc/0x550
+[   19.241696] Modules linked in:
+[   19.244937] CPU: 0 PID: 140 Comm: kworker/0:4 Not tainted 6.6.20+ #96
+[   19.252046] Hardware name: xlnx,zynqmp (DT)
+[   19.256421] Workqueue: events zynqmp_dp_hpd_work_func
+[   19.261795] pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
+[   19.269104] pc : __mutex_lock+0x4bc/0x550
+[   19.273364] lr : __mutex_lock+0x4bc/0x550
+[   19.277592] sp : ffffffc085c5bbe0
+[   19.281066] x29: ffffffc085c5bbe0 x28: 0000000000000000 x27: ffffff88009417f8
+[   19.288624] x26: ffffff8800941788 x25: ffffff8800020008 x24: ffffffc082aa3000
+[   19.296227] x23: ffffffc080d90e3c x22: 0000000000000002 x21: 0000000000000000
+[   19.303744] x20: 0000000000000000 x19: ffffff88002f5210 x18: 0000000000000000
+[   19.311295] x17: 6c707369642e3030 x16: 3030613464662072 x15: 0720072007200720
+[   19.318922] x14: 0000000000000000 x13: 284e4f5f4e524157 x12: 0000000000000001
+[   19.326442] x11: 0001ffc085c5b940 x10: 0001ff88003f388b x9 : 0001ff88003f3888
+[   19.334003] x8 : 0001ff88003f3888 x7 : 0000000000000000 x6 : 0000000000000000
+[   19.341537] x5 : 0000000000000000 x4 : 0000000000001668 x3 : 0000000000000000
+[   19.349054] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffffff88003f3880
+[   19.356581] Call trace:
+[   19.359160]  __mutex_lock+0x4bc/0x550
+[   19.363032]  mutex_lock_nested+0x24/0x30
+[   19.367187]  drm_bridge_hpd_notify+0x2c/0x6c
+[   19.371698]  zynqmp_dp_hpd_work_func+0x44/0x54
+[   19.376364]  process_one_work+0x3ac/0x988
+[   19.380660]  worker_thread+0x398/0x694
+[   19.384736]  kthread+0x1bc/0x1c0
+[   19.388241]  ret_from_fork+0x10/0x20
+[   19.392031] irq event stamp: 183
+[   19.395450] hardirqs last  enabled at (183): [<ffffffc0800b9278>] finish_task_switch.isra.0+0xa8/0x2d4
+[   19.405140] hardirqs last disabled at (182): [<ffffffc081ad3754>] __schedule+0x714/0xd04
+[   19.413612] softirqs last  enabled at (114): [<ffffffc080133de8>] srcu_invoke_callbacks+0x158/0x23c
+[   19.423128] softirqs last disabled at (110): [<ffffffc080133de8>] srcu_invoke_callbacks+0x158/0x23c
+[   19.432614] ---[ end trace 0000000000000000 ]---
+
+Fixes: eb2d64bfcc17 ("drm: xlnx: zynqmp_dpsub: Report HPD through the bridge")
+Signed-off-by: Sean Anderson <sean.anderson@linux.dev>
+Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
+Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240308204741.3631919-1-sean.anderson@linux.dev
+(cherry picked from commit 61ba791c4a7a09a370c45b70a81b8c7d4cf6b2ae)
+Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/xlnx/zynqmp_dpsub.c | 7 +++----
+ 1 file changed, 3 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
+index 88eb33acd5f0d..face8d6b2a6fb 100644
+--- a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
++++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
+@@ -256,12 +256,12 @@ static int zynqmp_dpsub_probe(struct platform_device *pdev)
+       if (ret)
+               goto err_dp;
++      drm_bridge_add(dpsub->bridge);
++
+       if (dpsub->dma_enabled) {
+               ret = zynqmp_dpsub_drm_init(dpsub);
+               if (ret)
+                       goto err_disp;
+-      } else {
+-              drm_bridge_add(dpsub->bridge);
+       }
+       dev_info(&pdev->dev, "ZynqMP DisplayPort Subsystem driver probed");
+@@ -288,9 +288,8 @@ static void zynqmp_dpsub_remove(struct platform_device *pdev)
+       if (dpsub->drm)
+               zynqmp_dpsub_drm_cleanup(dpsub);
+-      else
+-              drm_bridge_remove(dpsub->bridge);
++      drm_bridge_remove(dpsub->bridge);
+       zynqmp_disp_remove(dpsub);
+       zynqmp_dp_remove(dpsub);
+-- 
+2.43.0
+
diff --git a/queue-6.6/fs-ntfs3-check-folio-pointer-for-null.patch b/queue-6.6/fs-ntfs3-check-folio-pointer-for-null.patch
new file mode 100644 (file)
index 0000000..7ebf251
--- /dev/null
@@ -0,0 +1,50 @@
+From 527353d1d0a972cd787bdfa0699d44a0653ffce5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 16 Apr 2024 09:54:34 +0300
+Subject: fs/ntfs3: Check 'folio' pointer for NULL
+
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+
+[ Upstream commit 1cd6c96219c429ebcfa8e79a865277376c563803 ]
+
+It can be NULL if bmap is called.
+
+Fixes: 82cae269cfa95 ("fs/ntfs3: Add initialization of super block")
+Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/ntfs3/inode.c | 17 +++++++++++------
+ 1 file changed, 11 insertions(+), 6 deletions(-)
+
+diff --git a/fs/ntfs3/inode.c b/fs/ntfs3/inode.c
+index be8c8e47d7e27..6af705ccba65a 100644
+--- a/fs/ntfs3/inode.c
++++ b/fs/ntfs3/inode.c
+@@ -571,13 +571,18 @@ static noinline int ntfs_get_block_vbo(struct inode *inode, u64 vbo,
+       clear_buffer_uptodate(bh);
+       if (is_resident(ni)) {
+-              ni_lock(ni);
+-              err = attr_data_read_resident(ni, &folio->page);
+-              ni_unlock(ni);
+-
+-              if (!err)
+-                      set_buffer_uptodate(bh);
++              bh->b_blocknr = RESIDENT_LCN;
+               bh->b_size = block_size;
++              if (!folio) {
++                      err = 0;
++              } else {
++                      ni_lock(ni);
++                      err = attr_data_read_resident(ni, &folio->page);
++                      ni_unlock(ni);
++
++                      if (!err)
++                              set_buffer_uptodate(bh);
++              }
+               return err;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.6/fs-ntfs3-use-64-bit-variable-to-avoid-32-bit-overflo.patch b/queue-6.6/fs-ntfs3-use-64-bit-variable-to-avoid-32-bit-overflo.patch
new file mode 100644 (file)
index 0000000..632d8d7
--- /dev/null
@@ -0,0 +1,36 @@
+From 7c90504f76339b078f4b29427e080949313d0f23 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 16 Apr 2024 09:45:09 +0300
+Subject: fs/ntfs3: Use 64 bit variable to avoid 32 bit overflow
+
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+
+[ Upstream commit e931f6b630ffb22d66caab202a52aa8cbb10c649 ]
+
+For example, in the expression:
+       vbo = 2 * vbo + skip
+
+Fixes: b46acd6a6a627 ("fs/ntfs3: Add NTFS journal")
+Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/ntfs3/fslog.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
+index 855519713bf79..4085fe30bf481 100644
+--- a/fs/ntfs3/fslog.c
++++ b/fs/ntfs3/fslog.c
+@@ -1184,7 +1184,8 @@ static int read_log_page(struct ntfs_log *log, u32 vbo,
+ static int log_read_rst(struct ntfs_log *log, bool first,
+                       struct restart_info *info)
+ {
+-      u32 skip, vbo;
++      u32 skip;
++      u64 vbo;
+       struct RESTART_HDR *r_page = NULL;
+       /* Determine which restart area we are looking for. */
+-- 
+2.43.0
+
diff --git a/queue-6.6/fs-ntfs3-use-variable-length-array-instead-of-fixed-.patch b/queue-6.6/fs-ntfs3-use-variable-length-array-instead-of-fixed-.patch
new file mode 100644 (file)
index 0000000..814f5b2
--- /dev/null
@@ -0,0 +1,38 @@
+From 2f36a91596262ace51e5a831cfeb3810b72ca6de Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 16 Apr 2024 09:43:58 +0300
+Subject: fs/ntfs3: Use variable length array instead of fixed size
+
+From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+
+[ Upstream commit 1997cdc3e727526aa5d84b32f7cbb3f56459b7ef ]
+
+Should fix smatch warning:
+       ntfs_set_label() error: __builtin_memcpy() 'uni->name' too small (20 vs 256)
+
+Fixes: 4534a70b7056f ("fs/ntfs3: Add headers and misc files")
+Reported-by: kernel test robot <lkp@intel.com>
+Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
+Closes: https://lore.kernel.org/r/202401091421.3RJ24Mn3-lkp@intel.com/
+Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/ntfs3/ntfs.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/fs/ntfs3/ntfs.h b/fs/ntfs3/ntfs.h
+index f61f5b3adb03a..b70288cc5f6fa 100644
+--- a/fs/ntfs3/ntfs.h
++++ b/fs/ntfs3/ntfs.h
+@@ -59,7 +59,7 @@ struct GUID {
+ struct cpu_str {
+       u8 len;
+       u8 unused;
+-      u16 name[10];
++      u16 name[];
+ };
+ struct le_str {
+-- 
+2.43.0
+
diff --git a/queue-6.6/i3c-add-actual_len-in-i3c_priv_xfer.patch b/queue-6.6/i3c-add-actual_len-in-i3c_priv_xfer.patch
new file mode 100644 (file)
index 0000000..2aa311e
--- /dev/null
@@ -0,0 +1,56 @@
+From fae5a14fea33cfbcbb1fe4c79cf420f6113293d4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 1 Dec 2023 17:25:29 -0500
+Subject: i3c: add actual_len in i3c_priv_xfer
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Frank Li <Frank.Li@nxp.com>
+
+[ Upstream commit e5e3df06ac98d15cfb10bb5c12356709365e91b2 ]
+
+In MIPI I3C Specification:
+
+"Ninth Bit of SDR Target Returned (Read) Data as End-of-Data: In I2C, the
+ninth Data bit from Target to Controller is an ACK by the Controller. By
+contrast, in I3C this bit allows the Target to end a Read, and allows the
+Controller to Abort a Read. In SDR terms, the ninth bit of Read data is
+referred to as the T-Bit (for â€˜Transition’)"
+
+I3C allow devices early terminate data transfer. So need "actual_len" field
+to indicate how much get by i3c_priv_xfer.
+
+Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Signed-off-by: Frank Li <Frank.Li@nxp.com>
+Link: https://lore.kernel.org/r/20231201222532.2431484-4-Frank.Li@nxp.com
+Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
+Stable-dep-of: 7f3d633b460b ("i3c: master: svc: change ENXIO to EAGAIN when IBI occurs during start frame")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/i3c/device.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/include/linux/i3c/device.h b/include/linux/i3c/device.h
+index 90fa83464f003..ef6217da8253b 100644
+--- a/include/linux/i3c/device.h
++++ b/include/linux/i3c/device.h
+@@ -54,6 +54,7 @@ enum i3c_hdr_mode {
+  * struct i3c_priv_xfer - I3C SDR private transfer
+  * @rnw: encodes the transfer direction. true for a read, false for a write
+  * @len: transfer length in bytes of the transfer
++ * @actual_len: actual length in bytes are transferred by the controller
+  * @data: input/output buffer
+  * @data.in: input buffer. Must point to a DMA-able buffer
+  * @data.out: output buffer. Must point to a DMA-able buffer
+@@ -62,6 +63,7 @@ enum i3c_hdr_mode {
+ struct i3c_priv_xfer {
+       u8 rnw;
+       u16 len;
++      u16 actual_len;
+       union {
+               void *in;
+               const void *out;
+-- 
+2.43.0
+
diff --git a/queue-6.6/i3c-master-svc-change-enxio-to-eagain-when-ibi-occur.patch b/queue-6.6/i3c-master-svc-change-enxio-to-eagain-when-ibi-occur.patch
new file mode 100644 (file)
index 0000000..c03ef2a
--- /dev/null
@@ -0,0 +1,42 @@
+From c9e6ed10528b75f953096f930f2e43ca94e766ec Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 6 May 2024 12:40:08 -0400
+Subject: i3c: master: svc: change ENXIO to EAGAIN when IBI occurs during start
+ frame
+
+From: Frank Li <Frank.Li@nxp.com>
+
+[ Upstream commit 7f3d633b460be5553a65a247def5426d16805e72 ]
+
+svc_i3c_master_xfer() returns error ENXIO if an In-Band Interrupt (IBI)
+occurs when the host starts the frame.
+
+Change error code to EAGAIN to inform the client driver that this
+situation has occurred and to try again sometime later.
+
+Fixes: 5e5e3c92e748 ("i3c: master: svc: fix wrong data return when IBI happen during start frame")
+Signed-off-by: Frank Li <Frank.Li@nxp.com>
+Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Link: https://lore.kernel.org/r/20240506164009.21375-2-Frank.Li@nxp.com
+Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i3c/master/svc-i3c-master.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
+index 3966924d10668..e18bf9ca85197 100644
+--- a/drivers/i3c/master/svc-i3c-master.c
++++ b/drivers/i3c/master/svc-i3c-master.c
+@@ -1065,7 +1065,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
+        * and yield the above events handler.
+        */
+       if (SVC_I3C_MSTATUS_IBIWON(reg)) {
+-              ret = -ENXIO;
++              ret = -EAGAIN;
+               *actual_len = 0;
+               goto emit_stop;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.6/i3c-master-svc-rename-read_len-as-actual_len.patch b/queue-6.6/i3c-master-svc-rename-read_len-as-actual_len.patch
new file mode 100644 (file)
index 0000000..26922f0
--- /dev/null
@@ -0,0 +1,142 @@
+From 5f84ca014917ce31490e77e2032220d7588dff34 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 1 Dec 2023 17:25:30 -0500
+Subject: i3c: master: svc: rename read_len as actual_len
+
+From: Frank Li <Frank.Li@nxp.com>
+
+[ Upstream commit 6fb61734a74eaa307a5b6a0bee770e736d8acf89 ]
+
+I3C transfer (SDR), target can early terminate read transfer.
+I3C transfer (HDR), target can end write transfer.
+I2C transfer, target can NACK write transfer.
+
+'actual_len' is better name than 'read_len'.
+
+Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Signed-off-by: Frank Li <Frank.Li@nxp.com>
+Link: https://lore.kernel.org/r/20231201222532.2431484-5-Frank.Li@nxp.com
+Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
+Stable-dep-of: 7f3d633b460b ("i3c: master: svc: change ENXIO to EAGAIN when IBI occurs during start frame")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i3c/master/svc-i3c-master.c | 26 +++++++++++++-------------
+ 1 file changed, 13 insertions(+), 13 deletions(-)
+
+diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
+index c395e52294140..d8d817858e000 100644
+--- a/drivers/i3c/master/svc-i3c-master.c
++++ b/drivers/i3c/master/svc-i3c-master.c
+@@ -134,7 +134,7 @@ struct svc_i3c_cmd {
+       u8 *in;
+       const void *out;
+       unsigned int len;
+-      unsigned int read_len;
++      unsigned int actual_len;
+       bool continued;
+ };
+@@ -1024,7 +1024,7 @@ static int svc_i3c_master_write(struct svc_i3c_master *master,
+ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
+                              bool rnw, unsigned int xfer_type, u8 addr,
+                              u8 *in, const u8 *out, unsigned int xfer_len,
+-                             unsigned int *read_len, bool continued)
++                             unsigned int *actual_len, bool continued)
+ {
+       u32 reg;
+       int ret;
+@@ -1037,7 +1037,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
+              SVC_I3C_MCTRL_IBIRESP_NACK |
+              SVC_I3C_MCTRL_DIR(rnw) |
+              SVC_I3C_MCTRL_ADDR(addr) |
+-             SVC_I3C_MCTRL_RDTERM(*read_len),
++             SVC_I3C_MCTRL_RDTERM(*actual_len),
+              master->regs + SVC_I3C_MCTRL);
+       ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg,
+@@ -1075,7 +1075,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
+               goto emit_stop;
+       if (rnw)
+-              *read_len = ret;
++              *actual_len = ret;
+       ret = readl_poll_timeout(master->regs + SVC_I3C_MSTATUS, reg,
+                                SVC_I3C_MSTATUS_COMPLETE(reg), 0, 1000);
+@@ -1157,7 +1157,7 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master)
+               ret = svc_i3c_master_xfer(master, cmd->rnw, xfer->type,
+                                         cmd->addr, cmd->in, cmd->out,
+-                                        cmd->len, &cmd->read_len,
++                                        cmd->len, &cmd->actual_len,
+                                         cmd->continued);
+               if (ret)
+                       break;
+@@ -1243,7 +1243,7 @@ static int svc_i3c_master_send_bdcast_ccc_cmd(struct svc_i3c_master *master,
+       cmd->in = NULL;
+       cmd->out = buf;
+       cmd->len = xfer_len;
+-      cmd->read_len = 0;
++      cmd->actual_len = 0;
+       cmd->continued = false;
+       mutex_lock(&master->lock);
+@@ -1263,7 +1263,7 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master,
+                                             struct i3c_ccc_cmd *ccc)
+ {
+       unsigned int xfer_len = ccc->dests[0].payload.len;
+-      unsigned int read_len = ccc->rnw ? xfer_len : 0;
++      unsigned int actual_len = ccc->rnw ? xfer_len : 0;
+       struct svc_i3c_xfer *xfer;
+       struct svc_i3c_cmd *cmd;
+       int ret;
+@@ -1281,7 +1281,7 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master,
+       cmd->in = NULL;
+       cmd->out = &ccc->id;
+       cmd->len = 1;
+-      cmd->read_len = 0;
++      cmd->actual_len = 0;
+       cmd->continued = true;
+       /* Directed message */
+@@ -1291,7 +1291,7 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master,
+       cmd->in = ccc->rnw ? ccc->dests[0].payload.data : NULL;
+       cmd->out = ccc->rnw ? NULL : ccc->dests[0].payload.data,
+       cmd->len = xfer_len;
+-      cmd->read_len = read_len;
++      cmd->actual_len = actual_len;
+       cmd->continued = false;
+       mutex_lock(&master->lock);
+@@ -1300,8 +1300,8 @@ static int svc_i3c_master_send_direct_ccc_cmd(struct svc_i3c_master *master,
+               svc_i3c_master_dequeue_xfer(master, xfer);
+       mutex_unlock(&master->lock);
+-      if (cmd->read_len != xfer_len)
+-              ccc->dests[0].payload.len = cmd->read_len;
++      if (cmd->actual_len != xfer_len)
++              ccc->dests[0].payload.len = cmd->actual_len;
+       ret = xfer->ret;
+       svc_i3c_master_free_xfer(xfer);
+@@ -1351,7 +1351,7 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev,
+               cmd->in = xfers[i].rnw ? xfers[i].data.in : NULL;
+               cmd->out = xfers[i].rnw ? NULL : xfers[i].data.out;
+               cmd->len = xfers[i].len;
+-              cmd->read_len = xfers[i].rnw ? xfers[i].len : 0;
++              cmd->actual_len = xfers[i].rnw ? xfers[i].len : 0;
+               cmd->continued = (i + 1) < nxfers;
+       }
+@@ -1391,7 +1391,7 @@ static int svc_i3c_master_i2c_xfers(struct i2c_dev_desc *dev,
+               cmd->in = cmd->rnw ? xfers[i].buf : NULL;
+               cmd->out = cmd->rnw ? NULL : xfers[i].buf;
+               cmd->len = xfers[i].len;
+-              cmd->read_len = cmd->rnw ? xfers[i].len : 0;
++              cmd->actual_len = cmd->rnw ? xfers[i].len : 0;
+               cmd->continued = (i + 1 < nxfers);
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.6/i3c-master-svc-return-actual-transfer-data-len.patch b/queue-6.6/i3c-master-svc-return-actual-transfer-data-len.patch
new file mode 100644 (file)
index 0000000..ea93d3c
--- /dev/null
@@ -0,0 +1,72 @@
+From 0e33047eb4c2db850065be4845ac7d19507a248d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 1 Dec 2023 17:25:31 -0500
+Subject: i3c: master: svc: return actual transfer data len
+
+From: Frank Li <Frank.Li@nxp.com>
+
+[ Upstream commit 6d1a19d34e2cc07ca9cdad8892da94e716e9d15f ]
+
+I3C allow devices early terminate data transfer. So set "actual_len" to
+indicate how much data get by i3c_priv_xfer.
+
+Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Signed-off-by: Frank Li <Frank.Li@nxp.com>
+Link: https://lore.kernel.org/r/20231201222532.2431484-6-Frank.Li@nxp.com
+Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
+Stable-dep-of: 7f3d633b460b ("i3c: master: svc: change ENXIO to EAGAIN when IBI occurs during start frame")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/i3c/master/svc-i3c-master.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/drivers/i3c/master/svc-i3c-master.c b/drivers/i3c/master/svc-i3c-master.c
+index d8d817858e000..3966924d10668 100644
+--- a/drivers/i3c/master/svc-i3c-master.c
++++ b/drivers/i3c/master/svc-i3c-master.c
+@@ -135,6 +135,7 @@ struct svc_i3c_cmd {
+       const void *out;
+       unsigned int len;
+       unsigned int actual_len;
++      struct i3c_priv_xfer *xfer;
+       bool continued;
+ };
+@@ -1047,6 +1048,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
+       if (readl(master->regs + SVC_I3C_MERRWARN) & SVC_I3C_MERRWARN_NACK) {
+               ret = -ENXIO;
++              *actual_len = 0;
+               goto emit_stop;
+       }
+@@ -1064,6 +1066,7 @@ static int svc_i3c_master_xfer(struct svc_i3c_master *master,
+        */
+       if (SVC_I3C_MSTATUS_IBIWON(reg)) {
+               ret = -ENXIO;
++              *actual_len = 0;
+               goto emit_stop;
+       }
+@@ -1159,6 +1162,10 @@ static void svc_i3c_master_start_xfer_locked(struct svc_i3c_master *master)
+                                         cmd->addr, cmd->in, cmd->out,
+                                         cmd->len, &cmd->actual_len,
+                                         cmd->continued);
++              /* cmd->xfer is NULL if I2C or CCC transfer */
++              if (cmd->xfer)
++                      cmd->xfer->actual_len = cmd->actual_len;
++
+               if (ret)
+                       break;
+       }
+@@ -1346,6 +1353,7 @@ static int svc_i3c_master_priv_xfers(struct i3c_dev_desc *dev,
+       for (i = 0; i < nxfers; i++) {
+               struct svc_i3c_cmd *cmd = &xfer->cmds[i];
++              cmd->xfer = &xfers[i];
+               cmd->addr = master->addrs[data->index];
+               cmd->rnw = xfers[i].rnw;
+               cmd->in = xfers[i].rnw ? xfers[i].data.in : NULL;
+-- 
+2.43.0
+
diff --git a/queue-6.6/ice-interpret-.set_channels-input-differently.patch b/queue-6.6/ice-interpret-.set_channels-input-differently.patch
new file mode 100644 (file)
index 0000000..24aafd3
--- /dev/null
@@ -0,0 +1,90 @@
+From a6f67e03a9caae4c7aa10fb6052912f58f410244 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 May 2024 12:39:53 -0700
+Subject: ice: Interpret .set_channels() input differently
+
+From: Larysa Zaremba <larysa.zaremba@intel.com>
+
+[ Upstream commit 05d6f442f31f901d27dbc64fd504a8ec7d5013de ]
+
+A bug occurs because a safety check guarding AF_XDP-related queues in
+ethnl_set_channels(), does not trigger. This happens, because kernel and
+ice driver interpret the ethtool command differently.
+
+How the bug occurs:
+1. ethtool -l <IFNAME> -> combined: 40
+2. Attach AF_XDP to queue 30
+3. ethtool -L <IFNAME> rx 15 tx 15
+   combined number is not specified, so command becomes {rx_count = 15,
+   tx_count = 15, combined_count = 40}.
+4. ethnl_set_channels checks, if there are any AF_XDP of queues from the
+   new (combined_count + rx_count) to the old one, so from 55 to 40, check
+   does not trigger.
+5. ice interprets `rx 15 tx 15` as 15 combined channels and deletes the
+   queue that AF_XDP is attached to.
+
+Interpret the command in a way that is more consistent with ethtool
+manual [0] (--show-channels and --set-channels).
+
+Considering that in the ice driver only the difference between RX and TX
+queues forms dedicated channels, change the correct way to set number of
+channels to:
+
+ethtool -L <IFNAME> combined 10 /* For symmetric queues */
+ethtool -L <IFNAME> combined 8 tx 2 rx 0 /* For asymmetric queues */
+
+[0] https://man7.org/linux/man-pages/man8/ethtool.8.html
+
+Fixes: 87324e747fde ("ice: Implement ethtool ops for channels")
+Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
+Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
+Tested-by: Chandan Kumar Rout <chandanx.rout@intel.com>
+Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com>
+Acked-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
+Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/intel/ice/ice_ethtool.c | 19 ++-----------------
+ 1 file changed, 2 insertions(+), 17 deletions(-)
+
+diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
+index 9be13e9840917..39b5f24be7e4f 100644
+--- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
++++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
+@@ -3429,7 +3429,6 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)
+       struct ice_pf *pf = vsi->back;
+       int new_rx = 0, new_tx = 0;
+       bool locked = false;
+-      u32 curr_combined;
+       int ret = 0;
+       /* do not support changing channels in Safe Mode */
+@@ -3451,22 +3450,8 @@ static int ice_set_channels(struct net_device *dev, struct ethtool_channels *ch)
+               return -EOPNOTSUPP;
+       }
+-      curr_combined = ice_get_combined_cnt(vsi);
+-
+-      /* these checks are for cases where user didn't specify a particular
+-       * value on cmd line but we get non-zero value anyway via
+-       * get_channels(); look at ethtool.c in ethtool repository (the user
+-       * space part), particularly, do_schannels() routine
+-       */
+-      if (ch->rx_count == vsi->num_rxq - curr_combined)
+-              ch->rx_count = 0;
+-      if (ch->tx_count == vsi->num_txq - curr_combined)
+-              ch->tx_count = 0;
+-      if (ch->combined_count == curr_combined)
+-              ch->combined_count = 0;
+-
+-      if (!(ch->combined_count || (ch->rx_count && ch->tx_count))) {
+-              netdev_err(dev, "Please specify at least 1 Rx and 1 Tx channel\n");
++      if (ch->rx_count && ch->tx_count) {
++              netdev_err(dev, "Dedicated RX or TX channels cannot be used simultaneously\n");
+               return -EINVAL;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.6/input-cyapa-add-missing-input-core-locking-to-suspen.patch b/queue-6.6/input-cyapa-add-missing-input-core-locking-to-suspen.patch
new file mode 100644 (file)
index 0000000..b3831b8
--- /dev/null
@@ -0,0 +1,126 @@
+From a16ee771bb75eb849094049d1518691922bdb77a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 9 Oct 2023 14:10:18 +0200
+Subject: Input: cyapa - add missing input core locking to suspend/resume
+ functions
+
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+
+[ Upstream commit 7b4e0b39182cf5e677c1fc092a3ec40e621c25b6 ]
+
+Grab input->mutex during suspend/resume functions like it is done in
+other input drivers. This fixes the following warning during system
+suspend/resume cycle on Samsung Exynos5250-based Snow Chromebook:
+
+------------[ cut here ]------------
+WARNING: CPU: 1 PID: 1680 at drivers/input/input.c:2291 input_device_enabled+0x68/0x6c
+Modules linked in: ...
+CPU: 1 PID: 1680 Comm: kworker/u4:12 Tainted: G        W          6.6.0-rc5-next-20231009 #14109
+Hardware name: Samsung Exynos (Flattened Device Tree)
+Workqueue: events_unbound async_run_entry_fn
+ unwind_backtrace from show_stack+0x10/0x14
+ show_stack from dump_stack_lvl+0x58/0x70
+ dump_stack_lvl from __warn+0x1a8/0x1cc
+ __warn from warn_slowpath_fmt+0x18c/0x1b4
+ warn_slowpath_fmt from input_device_enabled+0x68/0x6c
+ input_device_enabled from cyapa_gen3_set_power_mode+0x13c/0x1dc
+ cyapa_gen3_set_power_mode from cyapa_reinitialize+0x10c/0x15c
+ cyapa_reinitialize from cyapa_resume+0x48/0x98
+ cyapa_resume from dpm_run_callback+0x90/0x298
+ dpm_run_callback from device_resume+0xb4/0x258
+ device_resume from async_resume+0x20/0x64
+ async_resume from async_run_entry_fn+0x40/0x15c
+ async_run_entry_fn from process_scheduled_works+0xbc/0x6a8
+ process_scheduled_works from worker_thread+0x188/0x454
+ worker_thread from kthread+0x108/0x140
+ kthread from ret_from_fork+0x14/0x28
+Exception stack(0xf1625fb0 to 0xf1625ff8)
+...
+---[ end trace 0000000000000000 ]---
+...
+------------[ cut here ]------------
+WARNING: CPU: 1 PID: 1680 at drivers/input/input.c:2291 input_device_enabled+0x68/0x6c
+Modules linked in: ...
+CPU: 1 PID: 1680 Comm: kworker/u4:12 Tainted: G        W          6.6.0-rc5-next-20231009 #14109
+Hardware name: Samsung Exynos (Flattened Device Tree)
+Workqueue: events_unbound async_run_entry_fn
+ unwind_backtrace from show_stack+0x10/0x14
+ show_stack from dump_stack_lvl+0x58/0x70
+ dump_stack_lvl from __warn+0x1a8/0x1cc
+ __warn from warn_slowpath_fmt+0x18c/0x1b4
+ warn_slowpath_fmt from input_device_enabled+0x68/0x6c
+ input_device_enabled from cyapa_gen3_set_power_mode+0x13c/0x1dc
+ cyapa_gen3_set_power_mode from cyapa_reinitialize+0x10c/0x15c
+ cyapa_reinitialize from cyapa_resume+0x48/0x98
+ cyapa_resume from dpm_run_callback+0x90/0x298
+ dpm_run_callback from device_resume+0xb4/0x258
+ device_resume from async_resume+0x20/0x64
+ async_resume from async_run_entry_fn+0x40/0x15c
+ async_run_entry_fn from process_scheduled_works+0xbc/0x6a8
+ process_scheduled_works from worker_thread+0x188/0x454
+ worker_thread from kthread+0x108/0x140
+ kthread from ret_from_fork+0x14/0x28
+Exception stack(0xf1625fb0 to 0xf1625ff8)
+...
+---[ end trace 0000000000000000 ]---
+
+Fixes: d69f0a43c677 ("Input: use input_device_enabled()")
+Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Reviewed-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
+Link: https://lore.kernel.org/r/20231009121018.1075318-1-m.szyprowski@samsung.com
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/input/mouse/cyapa.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/input/mouse/cyapa.c b/drivers/input/mouse/cyapa.c
+index 05851bc32541f..40b01cabaa337 100644
+--- a/drivers/input/mouse/cyapa.c
++++ b/drivers/input/mouse/cyapa.c
+@@ -1356,10 +1356,16 @@ static int cyapa_suspend(struct device *dev)
+       u8 power_mode;
+       int error;
+-      error = mutex_lock_interruptible(&cyapa->state_sync_lock);
++      error = mutex_lock_interruptible(&cyapa->input->mutex);
+       if (error)
+               return error;
++      error = mutex_lock_interruptible(&cyapa->state_sync_lock);
++      if (error) {
++              mutex_unlock(&cyapa->input->mutex);
++              return error;
++      }
++
+       /*
+        * Runtime PM is enable only when device is in operational mode and
+        * users in use, so need check it before disable it to
+@@ -1394,6 +1400,8 @@ static int cyapa_suspend(struct device *dev)
+               cyapa->irq_wake = (enable_irq_wake(client->irq) == 0);
+       mutex_unlock(&cyapa->state_sync_lock);
++      mutex_unlock(&cyapa->input->mutex);
++
+       return 0;
+ }
+@@ -1403,6 +1411,7 @@ static int cyapa_resume(struct device *dev)
+       struct cyapa *cyapa = i2c_get_clientdata(client);
+       int error;
++      mutex_lock(&cyapa->input->mutex);
+       mutex_lock(&cyapa->state_sync_lock);
+       if (device_may_wakeup(dev) && cyapa->irq_wake) {
+@@ -1421,6 +1430,7 @@ static int cyapa_resume(struct device *dev)
+       enable_irq(client->irq);
+       mutex_unlock(&cyapa->state_sync_lock);
++      mutex_unlock(&cyapa->input->mutex);
+       return 0;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.6/input-ims-pcu-fix-printf-string-overflow.patch b/queue-6.6/input-ims-pcu-fix-printf-string-overflow.patch
new file mode 100644 (file)
index 0000000..71b4b51
--- /dev/null
@@ -0,0 +1,43 @@
+From edaa6e8af68479d5ebbc794d852c01bb7829e985 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Mar 2024 13:28:56 -0700
+Subject: Input: ims-pcu - fix printf string overflow
+
+From: Arnd Bergmann <arnd@arndb.de>
+
+[ Upstream commit bf32bceedd0453c70d9d022e2e29f98e446d7161 ]
+
+clang warns about a string overflow in this driver
+
+drivers/input/misc/ims-pcu.c:1802:2: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 12 [-Werror,-Wformat-truncation]
+drivers/input/misc/ims-pcu.c:1814:2: error: 'snprintf' will always be truncated; specified size is 10, but format string expands to at least 12 [-Werror,-Wformat-truncation]
+
+Make the buffer a little longer to ensure it always fits.
+
+Fixes: 628329d52474 ("Input: add IMS Passenger Control Unit driver")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Link: https://lore.kernel.org/r/20240326223825.4084412-7-arnd@kernel.org
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/input/misc/ims-pcu.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/input/misc/ims-pcu.c b/drivers/input/misc/ims-pcu.c
+index b2f1292e27ef7..180d90e46061e 100644
+--- a/drivers/input/misc/ims-pcu.c
++++ b/drivers/input/misc/ims-pcu.c
+@@ -42,8 +42,8 @@ struct ims_pcu_backlight {
+ #define IMS_PCU_PART_NUMBER_LEN               15
+ #define IMS_PCU_SERIAL_NUMBER_LEN     8
+ #define IMS_PCU_DOM_LEN                       8
+-#define IMS_PCU_FW_VERSION_LEN                (9 + 1)
+-#define IMS_PCU_BL_VERSION_LEN                (9 + 1)
++#define IMS_PCU_FW_VERSION_LEN                16
++#define IMS_PCU_BL_VERSION_LEN                16
+ #define IMS_PCU_BL_RESET_REASON_LEN   (2 + 1)
+ #define IMS_PCU_PCU_B_DEVICE_ID               5
+-- 
+2.43.0
+
diff --git a/queue-6.6/input-pm8xxx-vibrator-correct-vib_max_levels-calcula.patch b/queue-6.6/input-pm8xxx-vibrator-correct-vib_max_levels-calcula.patch
new file mode 100644 (file)
index 0000000..0235be0
--- /dev/null
@@ -0,0 +1,55 @@
+From 900d7d5cf77c3f13390b79120a3174ca6a4bd91d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 15 Apr 2024 16:03:40 -0700
+Subject: Input: pm8xxx-vibrator - correct VIB_MAX_LEVELS calculation
+
+From: Fenglin Wu <quic_fenglinw@quicinc.com>
+
+[ Upstream commit 48c0687a322d54ac7e7a685c0b6db78d78f593af ]
+
+The output voltage is inclusive hence the max level calculation is
+off-by-one-step. Correct it.
+
+iWhile we are at it also add a define for the step size instead of
+using the magic value.
+
+Fixes: 11205bb63e5c ("Input: add support for pm8xxx based vibrator driver")
+Signed-off-by: Fenglin Wu <quic_fenglinw@quicinc.com>
+Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
+Link: https://lore.kernel.org/r/20240412-pm8xxx-vibrator-new-design-v10-1-0ec0ad133866@quicinc.com
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/input/misc/pm8xxx-vibrator.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/input/misc/pm8xxx-vibrator.c b/drivers/input/misc/pm8xxx-vibrator.c
+index 5c288fe7accf1..79f478d3a9b37 100644
+--- a/drivers/input/misc/pm8xxx-vibrator.c
++++ b/drivers/input/misc/pm8xxx-vibrator.c
+@@ -13,7 +13,8 @@
+ #define VIB_MAX_LEVEL_mV      (3100)
+ #define VIB_MIN_LEVEL_mV      (1200)
+-#define VIB_MAX_LEVELS                (VIB_MAX_LEVEL_mV - VIB_MIN_LEVEL_mV)
++#define VIB_PER_STEP_mV               (100)
++#define VIB_MAX_LEVELS                (VIB_MAX_LEVEL_mV - VIB_MIN_LEVEL_mV + VIB_PER_STEP_mV)
+ #define MAX_FF_SPEED          0xff
+@@ -117,10 +118,10 @@ static void pm8xxx_work_handler(struct work_struct *work)
+               vib->active = true;
+               vib->level = ((VIB_MAX_LEVELS * vib->speed) / MAX_FF_SPEED) +
+                                               VIB_MIN_LEVEL_mV;
+-              vib->level /= 100;
++              vib->level /= VIB_PER_STEP_mV;
+       } else {
+               vib->active = false;
+-              vib->level = VIB_MIN_LEVEL_mV / 100;
++              vib->level = VIB_MIN_LEVEL_mV / VIB_PER_STEP_mV;
+       }
+       pm8xxx_vib_set(vib, vib->active);
+-- 
+2.43.0
+
diff --git a/queue-6.6/ipv6-sr-fix-memleak-in-seg6_hmac_init_algo.patch b/queue-6.6/ipv6-sr-fix-memleak-in-seg6_hmac_init_algo.patch
new file mode 100644 (file)
index 0000000..e400fb5
--- /dev/null
@@ -0,0 +1,125 @@
+From 79fe45d24eee60c54e7900c61457e6b85ae408af Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 17 May 2024 08:54:35 +0800
+Subject: ipv6: sr: fix memleak in seg6_hmac_init_algo
+
+From: Hangbin Liu <liuhangbin@gmail.com>
+
+[ Upstream commit efb9f4f19f8e37fde43dfecebc80292d179f56c6 ]
+
+seg6_hmac_init_algo returns without cleaning up the previous allocations
+if one fails, so it's going to leak all that memory and the crypto tfms.
+
+Update seg6_hmac_exit to only free the memory when allocated, so we can
+reuse the code directly.
+
+Fixes: bf355b8d2c30 ("ipv6: sr: add core files for SR HMAC support")
+Reported-by: Sabrina Dubroca <sd@queasysnail.net>
+Closes: https://lore.kernel.org/netdev/Zj3bh-gE7eT6V6aH@hog/
+Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
+Reviewed-by: Simon Horman <horms@kernel.org>
+Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
+Link: https://lore.kernel.org/r/20240517005435.2600277-1-liuhangbin@gmail.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv6/seg6_hmac.c | 42 ++++++++++++++++++++++++++++--------------
+ 1 file changed, 28 insertions(+), 14 deletions(-)
+
+diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c
+index d43c50a7310d6..3c3800223e0e0 100644
+--- a/net/ipv6/seg6_hmac.c
++++ b/net/ipv6/seg6_hmac.c
+@@ -354,6 +354,7 @@ static int seg6_hmac_init_algo(void)
+       struct crypto_shash *tfm;
+       struct shash_desc *shash;
+       int i, alg_count, cpu;
++      int ret = -ENOMEM;
+       alg_count = ARRAY_SIZE(hmac_algos);
+@@ -364,12 +365,14 @@ static int seg6_hmac_init_algo(void)
+               algo = &hmac_algos[i];
+               algo->tfms = alloc_percpu(struct crypto_shash *);
+               if (!algo->tfms)
+-                      return -ENOMEM;
++                      goto error_out;
+               for_each_possible_cpu(cpu) {
+                       tfm = crypto_alloc_shash(algo->name, 0, 0);
+-                      if (IS_ERR(tfm))
+-                              return PTR_ERR(tfm);
++                      if (IS_ERR(tfm)) {
++                              ret = PTR_ERR(tfm);
++                              goto error_out;
++                      }
+                       p_tfm = per_cpu_ptr(algo->tfms, cpu);
+                       *p_tfm = tfm;
+               }
+@@ -381,18 +384,22 @@ static int seg6_hmac_init_algo(void)
+               algo->shashs = alloc_percpu(struct shash_desc *);
+               if (!algo->shashs)
+-                      return -ENOMEM;
++                      goto error_out;
+               for_each_possible_cpu(cpu) {
+                       shash = kzalloc_node(shsize, GFP_KERNEL,
+                                            cpu_to_node(cpu));
+                       if (!shash)
+-                              return -ENOMEM;
++                              goto error_out;
+                       *per_cpu_ptr(algo->shashs, cpu) = shash;
+               }
+       }
+       return 0;
++
++error_out:
++      seg6_hmac_exit();
++      return ret;
+ }
+ int __init seg6_hmac_init(void)
+@@ -410,22 +417,29 @@ int __net_init seg6_hmac_net_init(struct net *net)
+ void seg6_hmac_exit(void)
+ {
+       struct seg6_hmac_algo *algo = NULL;
++      struct crypto_shash *tfm;
++      struct shash_desc *shash;
+       int i, alg_count, cpu;
+       alg_count = ARRAY_SIZE(hmac_algos);
+       for (i = 0; i < alg_count; i++) {
+               algo = &hmac_algos[i];
+-              for_each_possible_cpu(cpu) {
+-                      struct crypto_shash *tfm;
+-                      struct shash_desc *shash;
+-                      shash = *per_cpu_ptr(algo->shashs, cpu);
+-                      kfree(shash);
+-                      tfm = *per_cpu_ptr(algo->tfms, cpu);
+-                      crypto_free_shash(tfm);
++              if (algo->shashs) {
++                      for_each_possible_cpu(cpu) {
++                              shash = *per_cpu_ptr(algo->shashs, cpu);
++                              kfree(shash);
++                      }
++                      free_percpu(algo->shashs);
++              }
++
++              if (algo->tfms) {
++                      for_each_possible_cpu(cpu) {
++                              tfm = *per_cpu_ptr(algo->tfms, cpu);
++                              crypto_free_shash(tfm);
++                      }
++                      free_percpu(algo->tfms);
+               }
+-              free_percpu(algo->tfms);
+-              free_percpu(algo->shashs);
+       }
+ }
+ EXPORT_SYMBOL(seg6_hmac_exit);
+-- 
+2.43.0
+
diff --git a/queue-6.6/ipv6-sr-fix-missing-sk_buff-release-in-seg6_input_co.patch b/queue-6.6/ipv6-sr-fix-missing-sk_buff-release-in-seg6_input_co.patch
new file mode 100644 (file)
index 0000000..96406c7
--- /dev/null
@@ -0,0 +1,76 @@
+From d4177dcfeb6948c8753d67be562cdf02aa01cb6c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 17 May 2024 18:45:41 +0200
+Subject: ipv6: sr: fix missing sk_buff release in seg6_input_core
+
+From: Andrea Mayer <andrea.mayer@uniroma2.it>
+
+[ Upstream commit 5447f9708d9e4c17a647b16a9cb29e9e02820bd9 ]
+
+The seg6_input() function is responsible for adding the SRH into a
+packet, delegating the operation to the seg6_input_core(). This function
+uses the skb_cow_head() to ensure that there is sufficient headroom in
+the sk_buff for accommodating the link-layer header.
+In the event that the skb_cow_header() function fails, the
+seg6_input_core() catches the error but it does not release the sk_buff,
+which will result in a memory leak.
+
+This issue was introduced in commit af3b5158b89d ("ipv6: sr: fix BUG due
+to headroom too small after SRH push") and persists even after commit
+7a3f5b0de364 ("netfilter: add netfilter hooks to SRv6 data plane"),
+where the entire seg6_input() code was refactored to deal with netfilter
+hooks.
+
+The proposed patch addresses the identified memory leak by requiring the
+seg6_input_core() function to release the sk_buff in the event that
+skb_cow_head() fails.
+
+Fixes: af3b5158b89d ("ipv6: sr: fix BUG due to headroom too small after SRH push")
+Signed-off-by: Andrea Mayer <andrea.mayer@uniroma2.it>
+Reviewed-by: Simon Horman <horms@kernel.org>
+Reviewed-by: David Ahern <dsahern@kernel.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv6/seg6_iptunnel.c | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/net/ipv6/seg6_iptunnel.c b/net/ipv6/seg6_iptunnel.c
+index 03b877ff45588..a75df2ec8db0d 100644
+--- a/net/ipv6/seg6_iptunnel.c
++++ b/net/ipv6/seg6_iptunnel.c
+@@ -459,10 +459,8 @@ static int seg6_input_core(struct net *net, struct sock *sk,
+       int err;
+       err = seg6_do_srh(skb);
+-      if (unlikely(err)) {
+-              kfree_skb(skb);
+-              return err;
+-      }
++      if (unlikely(err))
++              goto drop;
+       slwt = seg6_lwt_lwtunnel(orig_dst->lwtstate);
+@@ -486,7 +484,7 @@ static int seg6_input_core(struct net *net, struct sock *sk,
+       err = skb_cow_head(skb, LL_RESERVED_SPACE(dst->dev));
+       if (unlikely(err))
+-              return err;
++              goto drop;
+       if (static_branch_unlikely(&nf_hooks_lwtunnel_enabled))
+               return NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT,
+@@ -494,6 +492,9 @@ static int seg6_input_core(struct net *net, struct sock *sk,
+                              skb_dst(skb)->dev, seg6_input_finish);
+       return seg6_input_finish(dev_net(skb->dev), NULL, skb);
++drop:
++      kfree_skb(skb);
++      return err;
+ }
+ static int seg6_input_nf(struct sk_buff *skb)
+-- 
+2.43.0
+
diff --git a/queue-6.6/kasan-fortify-properly-rename-memintrinsics.patch b/queue-6.6/kasan-fortify-properly-rename-memintrinsics.patch
new file mode 100644 (file)
index 0000000..94a1c4e
--- /dev/null
@@ -0,0 +1,93 @@
+From d6e02b2d0b33316fc7884555e6bd888c291085c3 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 17 May 2024 15:01:18 +0200
+Subject: kasan, fortify: properly rename memintrinsics
+
+From: Andrey Konovalov <andreyknvl@gmail.com>
+
+[ Upstream commit 2e577732e8d28b9183df701fb90cb7943aa4ed16 ]
+
+After commit 69d4c0d32186 ("entry, kasan, x86: Disallow overriding mem*()
+functions") and the follow-up fixes, with CONFIG_FORTIFY_SOURCE enabled,
+even though the compiler instruments meminstrinsics by generating calls to
+__asan/__hwasan_ prefixed functions, FORTIFY_SOURCE still uses
+uninstrumented memset/memmove/memcpy as the underlying functions.
+
+As a result, KASAN cannot detect bad accesses in memset/memmove/memcpy.
+This also makes KASAN tests corrupt kernel memory and cause crashes.
+
+To fix this, use __asan_/__hwasan_memset/memmove/memcpy as the underlying
+functions whenever appropriate.  Do this only for the instrumented code
+(as indicated by __SANITIZE_ADDRESS__).
+
+Link: https://lkml.kernel.org/r/20240517130118.759301-1-andrey.konovalov@linux.dev
+Fixes: 69d4c0d32186 ("entry, kasan, x86: Disallow overriding mem*() functions")
+Fixes: 51287dcb00cc ("kasan: emit different calls for instrumentable memintrinsics")
+Fixes: 36be5cba99f6 ("kasan: treat meminstrinsic as builtins in uninstrumented files")
+Signed-off-by: Andrey Konovalov <andreyknvl@gmail.com>
+Reported-by: Erhard Furtner <erhard_f@mailbox.org>
+Reported-by: Nico Pache <npache@redhat.com>
+Closes: https://lore.kernel.org/all/20240501144156.17e65021@outsider.home/
+Reviewed-by: Marco Elver <elver@google.com>
+Tested-by: Nico Pache <npache@redhat.com>
+Acked-by: Nico Pache <npache@redhat.com>
+Cc: Alexander Potapenko <glider@google.com>
+Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
+Cc: Daniel Axtens <dja@axtens.net>
+Cc: Dmitry Vyukov <dvyukov@google.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ include/linux/fortify-string.h | 22 ++++++++++++++++++----
+ 1 file changed, 18 insertions(+), 4 deletions(-)
+
+diff --git a/include/linux/fortify-string.h b/include/linux/fortify-string.h
+index da51a83b28293..f7e1895367fa1 100644
+--- a/include/linux/fortify-string.h
++++ b/include/linux/fortify-string.h
+@@ -31,17 +31,30 @@ void __write_overflow_field(size_t avail, size_t wanted) __compiletime_warning("
+       __ret;                                                  \
+ })
+-#if defined(CONFIG_KASAN_GENERIC) || defined(CONFIG_KASAN_SW_TAGS)
++#if defined(__SANITIZE_ADDRESS__)
++
++#if !defined(CONFIG_CC_HAS_KASAN_MEMINTRINSIC_PREFIX) && !defined(CONFIG_GENERIC_ENTRY)
++extern void *__underlying_memset(void *p, int c, __kernel_size_t size) __RENAME(memset);
++extern void *__underlying_memmove(void *p, const void *q, __kernel_size_t size) __RENAME(memmove);
++extern void *__underlying_memcpy(void *p, const void *q, __kernel_size_t size) __RENAME(memcpy);
++#elif defined(CONFIG_KASAN_GENERIC)
++extern void *__underlying_memset(void *p, int c, __kernel_size_t size) __RENAME(__asan_memset);
++extern void *__underlying_memmove(void *p, const void *q, __kernel_size_t size) __RENAME(__asan_memmove);
++extern void *__underlying_memcpy(void *p, const void *q, __kernel_size_t size) __RENAME(__asan_memcpy);
++#else /* CONFIG_KASAN_SW_TAGS */
++extern void *__underlying_memset(void *p, int c, __kernel_size_t size) __RENAME(__hwasan_memset);
++extern void *__underlying_memmove(void *p, const void *q, __kernel_size_t size) __RENAME(__hwasan_memmove);
++extern void *__underlying_memcpy(void *p, const void *q, __kernel_size_t size) __RENAME(__hwasan_memcpy);
++#endif
++
+ extern void *__underlying_memchr(const void *p, int c, __kernel_size_t size) __RENAME(memchr);
+ extern int __underlying_memcmp(const void *p, const void *q, __kernel_size_t size) __RENAME(memcmp);
+-extern void *__underlying_memcpy(void *p, const void *q, __kernel_size_t size) __RENAME(memcpy);
+-extern void *__underlying_memmove(void *p, const void *q, __kernel_size_t size) __RENAME(memmove);
+-extern void *__underlying_memset(void *p, int c, __kernel_size_t size) __RENAME(memset);
+ extern char *__underlying_strcat(char *p, const char *q) __RENAME(strcat);
+ extern char *__underlying_strcpy(char *p, const char *q) __RENAME(strcpy);
+ extern __kernel_size_t __underlying_strlen(const char *p) __RENAME(strlen);
+ extern char *__underlying_strncat(char *p, const char *q, __kernel_size_t count) __RENAME(strncat);
+ extern char *__underlying_strncpy(char *p, const char *q, __kernel_size_t size) __RENAME(strncpy);
++
+ #else
+ #if defined(__SANITIZE_MEMORY__)
+@@ -66,6 +79,7 @@ extern char *__underlying_strncpy(char *p, const char *q, __kernel_size_t size)
+ #define __underlying_strlen   __builtin_strlen
+ #define __underlying_strncat  __builtin_strncat
+ #define __underlying_strncpy  __builtin_strncpy
++
+ #endif
+ /**
+-- 
+2.43.0
+
diff --git a/queue-6.6/media-cec-cec-adap-always-cancel-work-in-cec_transmi.patch b/queue-6.6/media-cec-cec-adap-always-cancel-work-in-cec_transmi.patch
new file mode 100644 (file)
index 0000000..d3c07e2
--- /dev/null
@@ -0,0 +1,39 @@
+From 9f543287463478d3d078ab4d88dc3225a3a7a46d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 23 Feb 2024 12:24:38 +0000
+Subject: media: cec: cec-adap: always cancel work in cec_transmit_msg_fh
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit 9fe2816816a3c765dff3b88af5b5c3d9bbb911ce ]
+
+Do not check for !data->completed, just always call
+cancel_delayed_work_sync(). This fixes a small race condition.
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Reported-by: Yang, Chenyuan <cy54@illinois.edu>
+Closes: https://lore.kernel.org/linux-media/PH7PR11MB57688E64ADE4FE82E658D86DA09EA@PH7PR11MB5768.namprd11.prod.outlook.com/
+Fixes: 490d84f6d73c ("media: cec: forgot to cancel delayed work")
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/cec/core/cec-adap.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c
+index ed1fa07e70b57..99c14942f2813 100644
+--- a/drivers/media/cec/core/cec-adap.c
++++ b/drivers/media/cec/core/cec-adap.c
+@@ -909,8 +909,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
+        */
+       mutex_unlock(&adap->lock);
+       wait_for_completion_killable(&data->c);
+-      if (!data->completed)
+-              cancel_delayed_work_sync(&data->work);
++      cancel_delayed_work_sync(&data->work);
+       mutex_lock(&adap->lock);
+       /* Cancel the transmit if it was interrupted */
+-- 
+2.43.0
+
diff --git a/queue-6.6/media-cec-cec-api-add-locking-in-cec_release.patch b/queue-6.6/media-cec-cec-api-add-locking-in-cec_release.patch
new file mode 100644 (file)
index 0000000..ae42e57
--- /dev/null
@@ -0,0 +1,46 @@
+From 652a6007274b7accc1f61fe347f82e7ae9fd94d8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 23 Feb 2024 12:25:55 +0000
+Subject: media: cec: cec-api: add locking in cec_release()
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit 42bcaacae924bf18ae387c3f78c202df0b739292 ]
+
+When cec_release() uses fh->msgs it has to take fh->lock,
+otherwise the list can get corrupted.
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Reported-by: Yang, Chenyuan <cy54@illinois.edu>
+Closes: https://lore.kernel.org/linux-media/PH7PR11MB57688E64ADE4FE82E658D86DA09EA@PH7PR11MB5768.namprd11.prod.outlook.com/
+Fixes: ca684386e6e2 ("[media] cec: add HDMI CEC framework (api)")
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/cec/core/cec-api.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/drivers/media/cec/core/cec-api.c b/drivers/media/cec/core/cec-api.c
+index 67dc79ef17050..d64bb716f9c68 100644
+--- a/drivers/media/cec/core/cec-api.c
++++ b/drivers/media/cec/core/cec-api.c
+@@ -664,6 +664,8 @@ static int cec_release(struct inode *inode, struct file *filp)
+               list_del_init(&data->xfer_list);
+       }
+       mutex_unlock(&adap->lock);
++
++      mutex_lock(&fh->lock);
+       while (!list_empty(&fh->msgs)) {
+               struct cec_msg_entry *entry =
+                       list_first_entry(&fh->msgs, struct cec_msg_entry, list);
+@@ -681,6 +683,7 @@ static int cec_release(struct inode *inode, struct file *filp)
+                       kfree(entry);
+               }
+       }
++      mutex_unlock(&fh->lock);
+       kfree(fh);
+       cec_put_device(devnode);
+-- 
+2.43.0
+
diff --git a/queue-6.6/media-cec-core-avoid-confusing-transmit-timed-out-me.patch b/queue-6.6/media-cec-core-avoid-confusing-transmit-timed-out-me.patch
new file mode 100644 (file)
index 0000000..e765529
--- /dev/null
@@ -0,0 +1,73 @@
+From b3210cdc5c4b4d7e081b670c8b0e659e06522c49 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 30 Apr 2024 11:13:47 +0100
+Subject: media: cec: core: avoid confusing "transmit timed out" message
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit cbe499977bc36fedae89f0a0d7deb4ccde9798fe ]
+
+If, when waiting for a transmit to finish, the wait is interrupted,
+then you might get a "transmit timed out" message, even though the
+transmit was interrupted and did not actually time out.
+
+Set transmit_in_progress_aborted to true if the
+wait_for_completion_killable() call was interrupted and ensure
+that the transmit is properly marked as ABORTED.
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Reported-by: Yang, Chenyuan <cy54@illinois.edu>
+Closes: https://lore.kernel.org/linux-media/PH7PR11MB57688E64ADE4FE82E658D86DA09EA@PH7PR11MB5768.namprd11.prod.outlook.com/
+Fixes: 590a8e564c6e ("media: cec: abort if the current transmit was canceled")
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/cec/core/cec-adap.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c
+index c15abee3e9bc4..3b67e922f9815 100644
+--- a/drivers/media/cec/core/cec-adap.c
++++ b/drivers/media/cec/core/cec-adap.c
+@@ -490,6 +490,15 @@ int cec_thread_func(void *_adap)
+                       goto unlock;
+               }
++              if (adap->transmit_in_progress &&
++                  adap->transmit_in_progress_aborted) {
++                      if (adap->transmitting)
++                              cec_data_cancel(adap->transmitting,
++                                              CEC_TX_STATUS_ABORTED, 0);
++                      adap->transmit_in_progress = false;
++                      adap->transmit_in_progress_aborted = false;
++                      goto unlock;
++              }
+               if (adap->transmit_in_progress && timeout) {
+                       /*
+                        * If we timeout, then log that. Normally this does
+@@ -744,6 +753,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
+ {
+       struct cec_data *data;
+       bool is_raw = msg_is_raw(msg);
++      int err;
+       if (adap->devnode.unregistered)
+               return -ENODEV;
+@@ -908,10 +918,13 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg,
+        * Release the lock and wait, retake the lock afterwards.
+        */
+       mutex_unlock(&adap->lock);
+-      wait_for_completion_killable(&data->c);
++      err = wait_for_completion_killable(&data->c);
+       cancel_delayed_work_sync(&data->work);
+       mutex_lock(&adap->lock);
++      if (err)
++              adap->transmit_in_progress_aborted = true;
++
+       /* Cancel the transmit if it was interrupted */
+       if (!data->completed) {
+               if (data->msg.tx_status & CEC_TX_STATUS_OK)
+-- 
+2.43.0
+
diff --git a/queue-6.6/media-cec-core-avoid-recursive-cec_claim_log_addrs.patch b/queue-6.6/media-cec-core-avoid-recursive-cec_claim_log_addrs.patch
new file mode 100644 (file)
index 0000000..b21953b
--- /dev/null
@@ -0,0 +1,81 @@
+From 3040141a5aa4ec469eadeef717f1604c757cda2e Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 22 Feb 2024 16:17:33 +0000
+Subject: media: cec: core: avoid recursive cec_claim_log_addrs
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+[ Upstream commit 47c82aac10a6954d68f29f10d9758d016e8e5af1 ]
+
+Keep track if cec_claim_log_addrs() is running, and return -EBUSY
+if it is when calling CEC_ADAP_S_LOG_ADDRS.
+
+This prevents a case where cec_claim_log_addrs() could be called
+while it was still in progress.
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Reported-by: Yang, Chenyuan <cy54@illinois.edu>
+Closes: https://lore.kernel.org/linux-media/PH7PR11MB57688E64ADE4FE82E658D86DA09EA@PH7PR11MB5768.namprd11.prod.outlook.com/
+Fixes: ca684386e6e2 ("[media] cec: add HDMI CEC framework (api)")
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/cec/core/cec-adap.c | 6 +++++-
+ drivers/media/cec/core/cec-api.c  | 2 +-
+ include/media/cec.h               | 1 +
+ 3 files changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c
+index 99c14942f2813..c15abee3e9bc4 100644
+--- a/drivers/media/cec/core/cec-adap.c
++++ b/drivers/media/cec/core/cec-adap.c
+@@ -1547,9 +1547,12 @@ static int cec_config_thread_func(void *arg)
+  */
+ static void cec_claim_log_addrs(struct cec_adapter *adap, bool block)
+ {
+-      if (WARN_ON(adap->is_configuring || adap->is_configured))
++      if (WARN_ON(adap->is_claiming_log_addrs ||
++                  adap->is_configuring || adap->is_configured))
+               return;
++      adap->is_claiming_log_addrs = true;
++
+       init_completion(&adap->config_completion);
+       /* Ready to kick off the thread */
+@@ -1564,6 +1567,7 @@ static void cec_claim_log_addrs(struct cec_adapter *adap, bool block)
+               wait_for_completion(&adap->config_completion);
+               mutex_lock(&adap->lock);
+       }
++      adap->is_claiming_log_addrs = false;
+ }
+ /*
+diff --git a/drivers/media/cec/core/cec-api.c b/drivers/media/cec/core/cec-api.c
+index d64bb716f9c68..3ef9153443044 100644
+--- a/drivers/media/cec/core/cec-api.c
++++ b/drivers/media/cec/core/cec-api.c
+@@ -178,7 +178,7 @@ static long cec_adap_s_log_addrs(struct cec_adapter *adap, struct cec_fh *fh,
+                          CEC_LOG_ADDRS_FL_ALLOW_RC_PASSTHRU |
+                          CEC_LOG_ADDRS_FL_CDC_ONLY;
+       mutex_lock(&adap->lock);
+-      if (!adap->is_configuring &&
++      if (!adap->is_claiming_log_addrs && !adap->is_configuring &&
+           (!log_addrs.num_log_addrs || !adap->is_configured) &&
+           !cec_is_busy(adap, fh)) {
+               err = __cec_s_log_addrs(adap, &log_addrs, block);
+diff --git a/include/media/cec.h b/include/media/cec.h
+index 9c007f83569aa..ffd17371302ca 100644
+--- a/include/media/cec.h
++++ b/include/media/cec.h
+@@ -247,6 +247,7 @@ struct cec_adapter {
+       u16 phys_addr;
+       bool needs_hpd;
+       bool is_enabled;
++      bool is_claiming_log_addrs;
+       bool is_configuring;
+       bool must_reconfigure;
+       bool is_configured;
+-- 
+2.43.0
+
diff --git a/queue-6.6/media-flexcop-usb-fix-sanity-check-of-bnumendpoints.patch b/queue-6.6/media-flexcop-usb-fix-sanity-check-of-bnumendpoints.patch
new file mode 100644 (file)
index 0000000..dc82642
--- /dev/null
@@ -0,0 +1,40 @@
+From 1f821a8e83ee1d389ded77c33d244a5739d4cc26 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 2 Jun 2022 06:50:24 +0100
+Subject: media: flexcop-usb: fix sanity check of bNumEndpoints
+
+From: Dongliang Mu <mudongliangabcd@gmail.com>
+
+[ Upstream commit f62dc8f6bf82d1b307fc37d8d22cc79f67856c2f ]
+
+Commit d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type
+") adds a sanity check for endpoint[1], but fails to modify the sanity
+check of bNumEndpoints.
+
+Fix this by modifying the sanity check of bNumEndpoints to 2.
+
+Link: https://lore.kernel.org/linux-media/20220602055027.849014-1-dzm91@hust.edu.cn
+Fixes: d725d20e81c2 ("media: flexcop-usb: sanity checking of endpoint type")
+Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/b2c2/flexcop-usb.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/drivers/media/usb/b2c2/flexcop-usb.c b/drivers/media/usb/b2c2/flexcop-usb.c
+index 790787f0eba84..bcb24d8964981 100644
+--- a/drivers/media/usb/b2c2/flexcop-usb.c
++++ b/drivers/media/usb/b2c2/flexcop-usb.c
+@@ -515,7 +515,7 @@ static int flexcop_usb_init(struct flexcop_usb *fc_usb)
+       alt = fc_usb->uintf->cur_altsetting;
+-      if (alt->desc.bNumEndpoints < 1)
++      if (alt->desc.bNumEndpoints < 2)
+               return -ENODEV;
+       if (!usb_endpoint_is_isoc_in(&alt->endpoint[0].desc))
+               return -ENODEV;
+-- 
+2.43.0
+
diff --git a/queue-6.6/media-mediatek-vcodec-add-encoder-power-management-h.patch b/queue-6.6/media-mediatek-vcodec-add-encoder-power-management-h.patch
new file mode 100644 (file)
index 0000000..a6e9ecc
--- /dev/null
@@ -0,0 +1,182 @@
+From 5e4ce15647987fa953c6045b86260710fecc9ace Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 25 Sep 2023 12:02:00 +0800
+Subject: media: mediatek: vcodec: add encoder power management helper
+ functions
+
+From: Irui Wang <irui.wang@mediatek.com>
+
+[ Upstream commit 3568cb6556695af163e930a75b1ed8f6dfa848ba ]
+
+Remove PM functions at start/stop streaming, add PM helper functions
+to get PM before encoding frame start and put PM after encoding frame
+done. Meanwhile, remove unnecessary clock operations.
+
+Signed-off-by: Irui Wang <irui.wang@mediatek.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Stable-dep-of: c28d4921a1e3 ("media: mediatek: vcodec: fix possible unbalanced PM counter")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../mediatek/vcodec/encoder/mtk_vcodec_enc.c  | 21 +++----------------
+ .../vcodec/encoder/mtk_vcodec_enc_pm.c        | 18 ++++++++++++++++
+ .../vcodec/encoder/mtk_vcodec_enc_pm.h        |  3 ++-
+ .../mediatek/vcodec/encoder/venc_drv_if.c     |  8 ++-----
+ 4 files changed, 25 insertions(+), 25 deletions(-)
+
+diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c
+index 04948d3eb011a..eb381fa6e7d14 100644
+--- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c
++++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc.c
+@@ -866,7 +866,7 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count)
+ {
+       struct mtk_vcodec_enc_ctx *ctx = vb2_get_drv_priv(q);
+       struct venc_enc_param param;
+-      int ret, pm_ret;
++      int ret;
+       int i;
+       /* Once state turn into MTK_STATE_ABORT, we need stop_streaming
+@@ -886,18 +886,12 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count)
+                       return 0;
+       }
+-      ret = pm_runtime_resume_and_get(&ctx->dev->plat_dev->dev);
+-      if (ret < 0) {
+-              mtk_v4l2_venc_err(ctx, "pm_runtime_resume_and_get fail %d", ret);
+-              goto err_start_stream;
+-      }
+-
+       mtk_venc_set_param(ctx, &param);
+       ret = venc_if_set_param(ctx, VENC_SET_PARAM_ENC, &param);
+       if (ret) {
+               mtk_v4l2_venc_err(ctx, "venc_if_set_param failed=%d", ret);
+               ctx->state = MTK_STATE_ABORT;
+-              goto err_set_param;
++              goto err_start_stream;
+       }
+       ctx->param_change = MTK_ENCODE_PARAM_NONE;
+@@ -910,18 +904,13 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count)
+               if (ret) {
+                       mtk_v4l2_venc_err(ctx, "venc_if_set_param failed=%d", ret);
+                       ctx->state = MTK_STATE_ABORT;
+-                      goto err_set_param;
++                      goto err_start_stream;
+               }
+               ctx->state = MTK_STATE_HEADER;
+       }
+       return 0;
+-err_set_param:
+-      pm_ret = pm_runtime_put(&ctx->dev->plat_dev->dev);
+-      if (pm_ret < 0)
+-              mtk_v4l2_venc_err(ctx, "pm_runtime_put fail %d", pm_ret);
+-
+ err_start_stream:
+       for (i = 0; i < q->num_buffers; ++i) {
+               struct vb2_buffer *buf = vb2_get_buffer(q, i);
+@@ -1004,10 +993,6 @@ static void vb2ops_venc_stop_streaming(struct vb2_queue *q)
+       if (ret)
+               mtk_v4l2_venc_err(ctx, "venc_if_deinit failed=%d", ret);
+-      ret = pm_runtime_put(&ctx->dev->plat_dev->dev);
+-      if (ret < 0)
+-              mtk_v4l2_venc_err(ctx, "pm_runtime_put fail %d", ret);
+-
+       ctx->state = MTK_STATE_FREE;
+ }
+diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c
+index 3fce936e61b9f..a22b7dfc656e1 100644
+--- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c
++++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c
+@@ -58,6 +58,24 @@ int mtk_vcodec_init_enc_clk(struct mtk_vcodec_enc_dev *mtkdev)
+       return 0;
+ }
++void mtk_vcodec_enc_pw_on(struct mtk_vcodec_pm *pm)
++{
++      int ret;
++
++      ret = pm_runtime_resume_and_get(pm->dev);
++      if (ret)
++              dev_err(pm->dev, "pm_runtime_resume_and_get fail: %d", ret);
++}
++
++void mtk_vcodec_enc_pw_off(struct mtk_vcodec_pm *pm)
++{
++      int ret;
++
++      ret = pm_runtime_put(pm->dev);
++      if (ret && ret != -EAGAIN)
++              dev_err(pm->dev, "pm_runtime_put fail %d", ret);
++}
++
+ void mtk_vcodec_enc_clock_on(struct mtk_vcodec_pm *pm)
+ {
+       struct mtk_vcodec_clk *enc_clk = &pm->venc_clk;
+diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.h b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.h
+index e50be0575190a..157ea08ba9e36 100644
+--- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.h
++++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.h
+@@ -10,7 +10,8 @@
+ #include "mtk_vcodec_enc_drv.h"
+ int mtk_vcodec_init_enc_clk(struct mtk_vcodec_enc_dev *dev);
+-
++void mtk_vcodec_enc_pw_on(struct mtk_vcodec_pm *pm);
++void mtk_vcodec_enc_pw_off(struct mtk_vcodec_pm *pm);
+ void mtk_vcodec_enc_clock_on(struct mtk_vcodec_pm *pm);
+ void mtk_vcodec_enc_clock_off(struct mtk_vcodec_pm *pm);
+diff --git a/drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c b/drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c
+index 1bdaecdd64a79..c402a686f3cb2 100644
+--- a/drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c
++++ b/drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c
+@@ -32,9 +32,7 @@ int venc_if_init(struct mtk_vcodec_enc_ctx *ctx, unsigned int fourcc)
+       }
+       mtk_venc_lock(ctx);
+-      mtk_vcodec_enc_clock_on(&ctx->dev->pm);
+       ret = ctx->enc_if->init(ctx);
+-      mtk_vcodec_enc_clock_off(&ctx->dev->pm);
+       mtk_venc_unlock(ctx);
+       return ret;
+@@ -46,9 +44,7 @@ int venc_if_set_param(struct mtk_vcodec_enc_ctx *ctx,
+       int ret = 0;
+       mtk_venc_lock(ctx);
+-      mtk_vcodec_enc_clock_on(&ctx->dev->pm);
+       ret = ctx->enc_if->set_param(ctx->drv_handle, type, in);
+-      mtk_vcodec_enc_clock_off(&ctx->dev->pm);
+       mtk_venc_unlock(ctx);
+       return ret;
+@@ -68,10 +64,12 @@ int venc_if_encode(struct mtk_vcodec_enc_ctx *ctx,
+       ctx->dev->curr_ctx = ctx;
+       spin_unlock_irqrestore(&ctx->dev->irqlock, flags);
++      mtk_vcodec_enc_pw_on(&ctx->dev->pm);
+       mtk_vcodec_enc_clock_on(&ctx->dev->pm);
+       ret = ctx->enc_if->encode(ctx->drv_handle, opt, frm_buf,
+                                 bs_buf, result);
+       mtk_vcodec_enc_clock_off(&ctx->dev->pm);
++      mtk_vcodec_enc_pw_off(&ctx->dev->pm);
+       spin_lock_irqsave(&ctx->dev->irqlock, flags);
+       ctx->dev->curr_ctx = NULL;
+@@ -89,9 +87,7 @@ int venc_if_deinit(struct mtk_vcodec_enc_ctx *ctx)
+               return 0;
+       mtk_venc_lock(ctx);
+-      mtk_vcodec_enc_clock_on(&ctx->dev->pm);
+       ret = ctx->enc_if->deinit(ctx->drv_handle);
+-      mtk_vcodec_enc_clock_off(&ctx->dev->pm);
+       mtk_venc_unlock(ctx);
+       ctx->drv_handle = NULL;
+-- 
+2.43.0
+
diff --git a/queue-6.6/media-mediatek-vcodec-fix-possible-unbalanced-pm-cou.patch b/queue-6.6/media-mediatek-vcodec-fix-possible-unbalanced-pm-cou.patch
new file mode 100644 (file)
index 0000000..717f46d
--- /dev/null
@@ -0,0 +1,88 @@
+From 6c4ac0a46d978749910aa756dbff2270705a39ad Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Dec 2023 13:32:40 +0200
+Subject: media: mediatek: vcodec: fix possible unbalanced PM counter
+
+From: Eugen Hristev <eugen.hristev@collabora.com>
+
+[ Upstream commit c28d4921a1e3ce0a0374b7e9d68593be8802c42a ]
+
+It is possible that mtk_vcodec_enc_pw_on fails, and in that scenario
+the PM counter is not incremented, and subsequent call to
+mtk_vcodec_enc_pw_off decrements the counter, leading to a PM imbalance.
+Fix by bailing out of venc_if_encode in the case when mtk_vcodec_enc_pw_on
+fails.
+
+Fixes: 4e855a6efa54 ("[media] vcodec: mediatek: Add Mediatek V4L2 Video Encoder Driver")
+Signed-off-by: Eugen Hristev <eugen.hristev@collabora.com>
+Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com>
+Signed-off-by: Sebastian Fricke <sebastian.fricke@collabora.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ .../platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c     | 4 +++-
+ .../platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.h     | 2 +-
+ drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c | 5 ++++-
+ 3 files changed, 8 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c
+index a22b7dfc656e1..1a2b14a3e219c 100644
+--- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c
++++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.c
+@@ -58,13 +58,15 @@ int mtk_vcodec_init_enc_clk(struct mtk_vcodec_enc_dev *mtkdev)
+       return 0;
+ }
+-void mtk_vcodec_enc_pw_on(struct mtk_vcodec_pm *pm)
++int mtk_vcodec_enc_pw_on(struct mtk_vcodec_pm *pm)
+ {
+       int ret;
+       ret = pm_runtime_resume_and_get(pm->dev);
+       if (ret)
+               dev_err(pm->dev, "pm_runtime_resume_and_get fail: %d", ret);
++
++      return ret;
+ }
+ void mtk_vcodec_enc_pw_off(struct mtk_vcodec_pm *pm)
+diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.h b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.h
+index 157ea08ba9e36..2e28f25e36cc4 100644
+--- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.h
++++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_pm.h
+@@ -10,7 +10,7 @@
+ #include "mtk_vcodec_enc_drv.h"
+ int mtk_vcodec_init_enc_clk(struct mtk_vcodec_enc_dev *dev);
+-void mtk_vcodec_enc_pw_on(struct mtk_vcodec_pm *pm);
++int mtk_vcodec_enc_pw_on(struct mtk_vcodec_pm *pm);
+ void mtk_vcodec_enc_pw_off(struct mtk_vcodec_pm *pm);
+ void mtk_vcodec_enc_clock_on(struct mtk_vcodec_pm *pm);
+ void mtk_vcodec_enc_clock_off(struct mtk_vcodec_pm *pm);
+diff --git a/drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c b/drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c
+index c402a686f3cb2..e83747b8d69ab 100644
+--- a/drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c
++++ b/drivers/media/platform/mediatek/vcodec/encoder/venc_drv_if.c
+@@ -64,7 +64,9 @@ int venc_if_encode(struct mtk_vcodec_enc_ctx *ctx,
+       ctx->dev->curr_ctx = ctx;
+       spin_unlock_irqrestore(&ctx->dev->irqlock, flags);
+-      mtk_vcodec_enc_pw_on(&ctx->dev->pm);
++      ret = mtk_vcodec_enc_pw_on(&ctx->dev->pm);
++      if (ret)
++              goto venc_if_encode_pw_on_err;
+       mtk_vcodec_enc_clock_on(&ctx->dev->pm);
+       ret = ctx->enc_if->encode(ctx->drv_handle, opt, frm_buf,
+                                 bs_buf, result);
+@@ -75,6 +77,7 @@ int venc_if_encode(struct mtk_vcodec_enc_ctx *ctx,
+       ctx->dev->curr_ctx = NULL;
+       spin_unlock_irqrestore(&ctx->dev->irqlock, flags);
++venc_if_encode_pw_on_err:
+       mtk_venc_unlock(ctx);
+       return ret;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.6/media-ov2680-allow-probing-if-link-frequencies-is-ab.patch b/queue-6.6/media-ov2680-allow-probing-if-link-frequencies-is-ab.patch
new file mode 100644 (file)
index 0000000..9425387
--- /dev/null
@@ -0,0 +1,64 @@
+From 1300b029a1ee14259f25a81433f3437348bcd208 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Mar 2024 19:44:13 -0300
+Subject: media: ov2680: Allow probing if link-frequencies is absent
+
+From: Fabio Estevam <festevam@denx.de>
+
+[ Upstream commit fd2e66abd729dae5809dbb41c6c52a6931cfa6bb ]
+
+Since commit 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint
+property verification") the ov2680 no longer probes on a imx7s-warp7:
+
+ov2680 1-0036: error -EINVAL: supported link freq 330000000 not found
+ov2680 1-0036: probe with driver ov2680 failed with error -22
+
+As the 'link-frequencies' property is not mandatory, allow the probe
+to succeed by skipping the link-frequency verification when the
+property is absent.
+
+Cc: stable@vger.kernel.org
+Fixes: 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint property verification")
+Signed-off-by: Fabio Estevam <festevam@denx.de>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Stable-dep-of: 24034af644fc ("media: ov2680: Do not fail if data-lanes property is absent")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/i2c/ov2680.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c
+index 7b1d9bd0b60f3..1163062c41c59 100644
+--- a/drivers/media/i2c/ov2680.c
++++ b/drivers/media/i2c/ov2680.c
+@@ -1111,18 +1111,23 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor)
+               goto out_free_bus_cfg;
+       }
++      if (!bus_cfg.nr_of_link_frequencies) {
++              dev_warn(dev, "Consider passing 'link-frequencies' in DT\n");
++              goto skip_link_freq_validation;
++      }
++
+       for (i = 0; i < bus_cfg.nr_of_link_frequencies; i++)
+               if (bus_cfg.link_frequencies[i] == sensor->link_freq[0])
+                       break;
+-      if (bus_cfg.nr_of_link_frequencies == 0 ||
+-          bus_cfg.nr_of_link_frequencies == i) {
++      if (bus_cfg.nr_of_link_frequencies == i) {
+               ret = dev_err_probe(dev, -EINVAL,
+                                   "supported link freq %lld not found\n",
+                                   sensor->link_freq[0]);
+               goto out_free_bus_cfg;
+       }
++skip_link_freq_validation:
+       ret = 0;
+ out_free_bus_cfg:
+       v4l2_fwnode_endpoint_free(&bus_cfg);
+-- 
+2.43.0
+
diff --git a/queue-6.6/media-ov2680-clear-the-ret-variable-on-success.patch b/queue-6.6/media-ov2680-clear-the-ret-variable-on-success.patch
new file mode 100644 (file)
index 0000000..09bcfb6
--- /dev/null
@@ -0,0 +1,62 @@
+From 2e0915abf3ab0092ef13d04ebaf3e8c3f06cc2a2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Mar 2024 19:44:12 -0300
+Subject: media: ov2680: Clear the 'ret' variable on success
+
+From: Fabio Estevam <festevam@denx.de>
+
+[ Upstream commit 49a9bad83b4ab5dac1d7aba2615c77978bcf3984 ]
+
+Since commit 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint
+property verification") even when the correct 'link-frequencies'
+property is passed in the devicetree, the driver fails to probe:
+
+ov2680 1-0036: probe with driver ov2680 failed with error -22
+
+The reason is that the variable 'ret' may contain the -EINVAL value
+from a previous assignment:
+
+ret = fwnode_property_read_u32(dev_fwnode(dev), "clock-frequency",
+                              &rate);
+
+Fix the problem by clearing 'ret' on the successful path.
+
+Tested on imx7s-warp board with the following devicetree:
+
+port {
+       ov2680_to_mipi: endpoint {
+               remote-endpoint = <&mipi_from_sensor>;
+               clock-lanes = <0>;
+               data-lanes = <1>;
+               link-frequencies = /bits/ 64 <330000000>;
+       };
+};
+
+Cc: stable@vger.kernel.org
+Fixes: 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint property verification")
+Suggested-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Fabio Estevam <festevam@denx.de>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Stable-dep-of: 24034af644fc ("media: ov2680: Do not fail if data-lanes property is absent")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/i2c/ov2680.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c
+index 72bab0ff8a36a..7b1d9bd0b60f3 100644
+--- a/drivers/media/i2c/ov2680.c
++++ b/drivers/media/i2c/ov2680.c
+@@ -1123,6 +1123,7 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor)
+               goto out_free_bus_cfg;
+       }
++      ret = 0;
+ out_free_bus_cfg:
+       v4l2_fwnode_endpoint_free(&bus_cfg);
+       return ret;
+-- 
+2.43.0
+
diff --git a/queue-6.6/media-ov2680-do-not-fail-if-data-lanes-property-is-a.patch b/queue-6.6/media-ov2680-do-not-fail-if-data-lanes-property-is-a.patch
new file mode 100644 (file)
index 0000000..f717032
--- /dev/null
@@ -0,0 +1,50 @@
+From 998cb10217ab83b053baa823a77e7b57a2b40a74 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 14 Apr 2024 18:09:06 -0300
+Subject: media: ov2680: Do not fail if data-lanes property is absent
+
+From: Fabio Estevam <festevam@denx.de>
+
+[ Upstream commit 24034af644fc01126bec9850346a06ef1450181f ]
+
+Since commit 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint
+property verification") the ov2680 driver no longer probes when the
+'data-lanes' property is absent.
+
+The OV2680 sensor has only one data lane, so there is no need for
+describing it the devicetree.
+
+Remove the unnecessary data-lanes property check.
+
+Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Fixes: 63b0cd30b78e ("media: ov2680: Add bus-cfg / endpoint property verification")
+Signed-off-by: Fabio Estevam <festevam@denx.de>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/i2c/ov2680.c | 7 -------
+ 1 file changed, 7 deletions(-)
+
+diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c
+index 1163062c41c59..6436879f95c01 100644
+--- a/drivers/media/i2c/ov2680.c
++++ b/drivers/media/i2c/ov2680.c
+@@ -1104,13 +1104,6 @@ static int ov2680_parse_dt(struct ov2680_dev *sensor)
+       sensor->pixel_rate = sensor->link_freq[0] * 2;
+       do_div(sensor->pixel_rate, 10);
+-      /* Verify bus cfg */
+-      if (bus_cfg.bus.mipi_csi2.num_data_lanes != 1) {
+-              ret = dev_err_probe(dev, -EINVAL,
+-                                  "only a 1-lane CSI2 config is supported");
+-              goto out_free_bus_cfg;
+-      }
+-
+       if (!bus_cfg.nr_of_link_frequencies) {
+               dev_warn(dev, "Consider passing 'link-frequencies' in DT\n");
+               goto skip_link_freq_validation;
+-- 
+2.43.0
+
diff --git a/queue-6.6/media-stk1160-fix-bounds-checking-in-stk1160_copy_vi.patch b/queue-6.6/media-stk1160-fix-bounds-checking-in-stk1160_copy_vi.patch
new file mode 100644 (file)
index 0000000..e0d77e2
--- /dev/null
@@ -0,0 +1,84 @@
+From e7960d9e33e119c622a98c41f54a49ef86fdaab6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 22 Apr 2024 12:32:44 +0300
+Subject: media: stk1160: fix bounds checking in stk1160_copy_video()
+
+From: Dan Carpenter <dan.carpenter@linaro.org>
+
+[ Upstream commit faa4364bef2ec0060de381ff028d1d836600a381 ]
+
+The subtract in this condition is reversed.  The ->length is the length
+of the buffer.  The ->bytesused is how many bytes we have copied thus
+far.  When the condition is reversed that means the result of the
+subtraction is always negative but since it's unsigned then the result
+is a very high positive value.  That means the overflow check is never
+true.
+
+Additionally, the ->bytesused doesn't actually work for this purpose
+because we're not writing to "buf->mem + buf->bytesused".  Instead, the
+math to calculate the destination where we are writing is a bit
+involved.  You calculate the number of full lines already written,
+multiply by two, skip a line if necessary so that we start on an odd
+numbered line, and add the offset into the line.
+
+To fix this buffer overflow, just take the actual destination where we
+are writing, if the offset is already out of bounds print an error and
+return.  Otherwise, write up to buf->length bytes.
+
+Fixes: 9cb2173e6ea8 ("[media] media: Add stk1160 new driver (easycap replacement)")
+Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
+Reviewed-by: Ricardo Ribalda <ribalda@chromium.org>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/usb/stk1160/stk1160-video.c | 20 +++++++++++++++-----
+ 1 file changed, 15 insertions(+), 5 deletions(-)
+
+diff --git a/drivers/media/usb/stk1160/stk1160-video.c b/drivers/media/usb/stk1160/stk1160-video.c
+index 366f0e4a5dc0d..e79c45db60ab5 100644
+--- a/drivers/media/usb/stk1160/stk1160-video.c
++++ b/drivers/media/usb/stk1160/stk1160-video.c
+@@ -99,7 +99,7 @@ void stk1160_buffer_done(struct stk1160 *dev)
+ static inline
+ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)
+ {
+-      int linesdone, lineoff, lencopy;
++      int linesdone, lineoff, lencopy, offset;
+       int bytesperline = dev->width * 2;
+       struct stk1160_buffer *buf = dev->isoc_ctl.buf;
+       u8 *dst = buf->mem;
+@@ -139,8 +139,13 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)
+        * Check if we have enough space left in the buffer.
+        * In that case, we force loop exit after copy.
+        */
+-      if (lencopy > buf->bytesused - buf->length) {
+-              lencopy = buf->bytesused - buf->length;
++      offset = dst - (u8 *)buf->mem;
++      if (offset > buf->length) {
++              dev_warn_ratelimited(dev->dev, "out of bounds offset\n");
++              return;
++      }
++      if (lencopy > buf->length - offset) {
++              lencopy = buf->length - offset;
+               remain = lencopy;
+       }
+@@ -182,8 +187,13 @@ void stk1160_copy_video(struct stk1160 *dev, u8 *src, int len)
+                * Check if we have enough space left in the buffer.
+                * In that case, we force loop exit after copy.
+                */
+-              if (lencopy > buf->bytesused - buf->length) {
+-                      lencopy = buf->bytesused - buf->length;
++              offset = dst - (u8 *)buf->mem;
++              if (offset > buf->length) {
++                      dev_warn_ratelimited(dev->dev, "offset out of bounds\n");
++                      return;
++              }
++              if (lencopy > buf->length - offset) {
++                      lencopy = buf->length - offset;
+                       remain = lencopy;
+               }
+-- 
+2.43.0
+
diff --git a/queue-6.6/media-sunxi-a83-mips-csi2-also-select-generic_phy.patch b/queue-6.6/media-sunxi-a83-mips-csi2-also-select-generic_phy.patch
new file mode 100644 (file)
index 0000000..d2757eb
--- /dev/null
@@ -0,0 +1,44 @@
+From 94d56e2af4eea3f83d52fff47b3109e5364d21ff Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 27 Sep 2023 05:04:38 +0100
+Subject: media: sunxi: a83-mips-csi2: also select GENERIC_PHY
+
+From: Randy Dunlap <rdunlap@infradead.org>
+
+[ Upstream commit 8237026159cb6760ad22e28d57b9a1c53b612d3a ]
+
+When selecting GENERIC_PHY_MIPI_DPHY, also select GENERIC_PHY to
+prevent kconfig warnings:
+
+WARNING: unmet direct dependencies detected for GENERIC_PHY_MIPI_DPHY
+  Depends on [n]: GENERIC_PHY [=n]
+  Selected by [y]:
+  - VIDEO_SUN8I_A83T_MIPI_CSI2 [=y] && MEDIA_SUPPORT [=y] && MEDIA_PLATFORM_SUPPORT [=y] && MEDIA_PLATFORM_DRIVERS [=y] && V4L_PLATFORM_DRIVERS [=y] && VIDEO_DEV [=y] && (ARCH_SUNXI || COMPILE_TEST [=y]) && PM [=y] && COMMON_CLK [=y] && RESET_CONTROLLER [=y]
+
+Fixes: 94d7fd9692b5 ("media: sunxi: Depend on GENERIC_PHY_MIPI_DPHY")
+Reported-by: kernel test robot <lkp@intel.com>
+Closes: https://lore.kernel.org/r/ZQ/WS8HC1A3F0Qn8@rli9-mobl
+Link: https://lore.kernel.org/linux-media/20230927040438.5589-1-rdunlap@infradead.org
+
+Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig
+index 47a8c0fb7eb9f..99c401e653bc4 100644
+--- a/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig
++++ b/drivers/media/platform/sunxi/sun8i-a83t-mipi-csi2/Kconfig
+@@ -8,6 +8,7 @@ config VIDEO_SUN8I_A83T_MIPI_CSI2
+       select VIDEO_V4L2_SUBDEV_API
+       select V4L2_FWNODE
+       select REGMAP_MMIO
++      select GENERIC_PHY
+       select GENERIC_PHY_MIPI_DPHY
+       help
+          Support for the Allwinner A83T MIPI CSI-2 controller and D-PHY.
+-- 
+2.43.0
+
diff --git a/queue-6.6/media-v4l-don-t-turn-on-privacy-led-if-streamon-fail.patch b/queue-6.6/media-v4l-don-t-turn-on-privacy-led-if-streamon-fail.patch
new file mode 100644 (file)
index 0000000..badc56d
--- /dev/null
@@ -0,0 +1,68 @@
+From 1d3657fe71ebd16bd18701d867271e0dd7241408 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 10 Apr 2024 12:58:44 +0300
+Subject: media: v4l: Don't turn on privacy LED if streamon fails
+
+From: Sakari Ailus <sakari.ailus@linux.intel.com>
+
+[ Upstream commit f2bf6cd8f44781349620e30a0af8987fe9af008f ]
+
+Turn on the privacy LED only if streamon succeeds. This can be done after
+enabling streaming on the sensor.
+
+Fixes: b6e10ff6c23d ("media: v4l2-core: Make the v4l2-core code enable/disable the privacy LED if present")
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Reviewed-by: Hans de Goede <hdegoede@redhat.com>
+Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
+Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/v4l2-core/v4l2-subdev.c | 22 ++++++++++++----------
+ 1 file changed, 12 insertions(+), 10 deletions(-)
+
+diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
+index f481d1ca32abb..a32ef739eb449 100644
+--- a/drivers/media/v4l2-core/v4l2-subdev.c
++++ b/drivers/media/v4l2-core/v4l2-subdev.c
+@@ -371,15 +371,6 @@ static int call_s_stream(struct v4l2_subdev *sd, int enable)
+       if (WARN_ON(!!sd->enabled_streams == !!enable))
+               return 0;
+-#if IS_REACHABLE(CONFIG_LEDS_CLASS)
+-      if (!IS_ERR_OR_NULL(sd->privacy_led)) {
+-              if (enable)
+-                      led_set_brightness(sd->privacy_led,
+-                                         sd->privacy_led->max_brightness);
+-              else
+-                      led_set_brightness(sd->privacy_led, 0);
+-      }
+-#endif
+       ret = sd->ops->video->s_stream(sd, enable);
+       if (!enable && ret < 0) {
+@@ -387,9 +378,20 @@ static int call_s_stream(struct v4l2_subdev *sd, int enable)
+               ret = 0;
+       }
+-      if (!ret)
++      if (!ret) {
+               sd->enabled_streams = enable ? BIT(0) : 0;
++#if IS_REACHABLE(CONFIG_LEDS_CLASS)
++              if (!IS_ERR_OR_NULL(sd->privacy_led)) {
++                      if (enable)
++                              led_set_brightness(sd->privacy_led,
++                                                 sd->privacy_led->max_brightness);
++                      else
++                              led_set_brightness(sd->privacy_led, 0);
++              }
++#endif
++      }
++
+       return ret;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.6/media-v4l2-subdev-document-and-enforce-.s_stream-req.patch b/queue-6.6/media-v4l2-subdev-document-and-enforce-.s_stream-req.patch
new file mode 100644 (file)
index 0000000..31bc82a
--- /dev/null
@@ -0,0 +1,79 @@
+From 2248585d80e8e8fe3c08b096777058086de77209 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 18 Sep 2023 15:48:38 +0300
+Subject: media: v4l2-subdev: Document and enforce .s_stream() requirements
+
+From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+
+[ Upstream commit 009905ec50433259c05f474251000b040098564e ]
+
+The subdev .s_stream() operation must not be called to start an already
+started subdev, or stop an already stopped one. This requirement has
+never been formally documented. Fix it, and catch possible offenders
+with a WARN_ON() in the call_s_stream() wrapper.
+
+Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Stable-dep-of: f2bf6cd8f447 ("media: v4l: Don't turn on privacy LED if streamon fails")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/media/v4l2-core/v4l2-subdev.c | 17 ++++++++++++++++-
+ include/media/v4l2-subdev.h           |  4 +++-
+ 2 files changed, 19 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
+index ee159b4341abc..f481d1ca32abb 100644
+--- a/drivers/media/v4l2-core/v4l2-subdev.c
++++ b/drivers/media/v4l2-core/v4l2-subdev.c
+@@ -359,6 +359,18 @@ static int call_s_stream(struct v4l2_subdev *sd, int enable)
+ {
+       int ret;
++      /*
++       * The .s_stream() operation must never be called to start or stop an
++       * already started or stopped subdev. Catch offenders but don't return
++       * an error yet to avoid regressions.
++       *
++       * As .s_stream() is mutually exclusive with the .enable_streams() and
++       * .disable_streams() operation, we can use the enabled_streams field
++       * to store the subdev streaming state.
++       */
++      if (WARN_ON(!!sd->enabled_streams == !!enable))
++              return 0;
++
+ #if IS_REACHABLE(CONFIG_LEDS_CLASS)
+       if (!IS_ERR_OR_NULL(sd->privacy_led)) {
+               if (enable)
+@@ -372,9 +384,12 @@ static int call_s_stream(struct v4l2_subdev *sd, int enable)
+       if (!enable && ret < 0) {
+               dev_warn(sd->dev, "disabling streaming failed (%d)\n", ret);
+-              return 0;
++              ret = 0;
+       }
++      if (!ret)
++              sd->enabled_streams = enable ? BIT(0) : 0;
++
+       return ret;
+ }
+diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
+index d9fca929c10b5..ab2a7ef61d420 100644
+--- a/include/media/v4l2-subdev.h
++++ b/include/media/v4l2-subdev.h
+@@ -446,7 +446,9 @@ enum v4l2_subdev_pre_streamon_flags {
+  * @s_stream: start (enabled == 1) or stop (enabled == 0) streaming on the
+  *    sub-device. Failure on stop will remove any resources acquired in
+  *    streaming start, while the error code is still returned by the driver.
+- *    Also see call_s_stream wrapper in v4l2-subdev.c.
++ *    The caller shall track the subdev state, and shall not start or stop an
++ *    already started or stopped subdev. Also see call_s_stream wrapper in
++ *    v4l2-subdev.c.
+  *
+  * @g_pixelaspect: callback to return the pixelaspect ratio.
+  *
+-- 
+2.43.0
+
diff --git a/queue-6.6/mmc-sdhci_am654-add-itapdlysel-in-sdhci_j721e_4bit_s.patch b/queue-6.6/mmc-sdhci_am654-add-itapdlysel-in-sdhci_j721e_4bit_s.patch
new file mode 100644 (file)
index 0000000..5bae6b1
--- /dev/null
@@ -0,0 +1,60 @@
+From a6e43151928a615a7eb7587e61e82dcaf91e24bf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Mar 2024 17:38:36 -0500
+Subject: mmc: sdhci_am654: Add ITAPDLYSEL in sdhci_j721e_4bit_set_clock
+
+From: Judith Mendez <jm@ti.com>
+
+[ Upstream commit 9dff65bb5e09903c27d9cff947dff4d22b6ea6a1 ]
+
+Add ITAPDLYSEL to sdhci_j721e_4bit_set_clock function.
+This allows to set the correct ITAPDLY for timings that
+do not carry out tuning.
+
+Fixes: 1accbced1c32 ("mmc: sdhci_am654: Add Support for 4 bit IP on J721E")
+Signed-off-by: Judith Mendez <jm@ti.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Link: https://lore.kernel.org/r/20240320223837.959900-7-jm@ti.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/mmc/host/sdhci_am654.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
+index 888bfda0ebc0e..884d1b53180d7 100644
+--- a/drivers/mmc/host/sdhci_am654.c
++++ b/drivers/mmc/host/sdhci_am654.c
+@@ -320,6 +320,7 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host,
+       unsigned char timing = host->mmc->ios.timing;
+       u32 otap_del_sel;
+       u32 itap_del_ena;
++      u32 itap_del_sel;
+       u32 mask, val;
+       /* Setup DLL Output TAP delay */
+@@ -329,13 +330,18 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host,
+       val = (0x1 << OTAPDLYENA_SHIFT) |
+             (otap_del_sel << OTAPDLYSEL_SHIFT);
++      /* Setup Input TAP delay */
+       itap_del_ena = sdhci_am654->itap_del_ena[timing];
++      itap_del_sel = sdhci_am654->itap_del_sel[timing];
+-      mask |= ITAPDLYENA_MASK;
+-      val |= (itap_del_ena << ITAPDLYENA_SHIFT);
++      mask |= ITAPDLYENA_MASK | ITAPDLYSEL_MASK;
++      val |= (itap_del_ena << ITAPDLYENA_SHIFT) |
++             (itap_del_sel << ITAPDLYSEL_SHIFT);
++      regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPCHGWIN_MASK,
++                         1 << ITAPCHGWIN_SHIFT);
+       regmap_update_bits(sdhci_am654->base, PHY_CTRL4, mask, val);
+-
++      regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPCHGWIN_MASK, 0);
+       regmap_update_bits(sdhci_am654->base, PHY_CTRL5, CLKBUFSEL_MASK,
+                          sdhci_am654->clkbuf_sel);
+-- 
+2.43.0
+
diff --git a/queue-6.6/mmc-sdhci_am654-add-otap-itap-delay-enable.patch b/queue-6.6/mmc-sdhci_am654-add-otap-itap-delay-enable.patch
new file mode 100644 (file)
index 0000000..389d626
--- /dev/null
@@ -0,0 +1,168 @@
+From 543caca572fd15ceee4b15e3ee63a54696eb0b48 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Mar 2024 17:38:33 -0500
+Subject: mmc: sdhci_am654: Add OTAP/ITAP delay enable
+
+From: Judith Mendez <jm@ti.com>
+
+[ Upstream commit 387c1bf7dce0dfea02080c8bdb066b5209e92155 ]
+
+Currently the OTAP/ITAP delay enable functionality is incorrect in
+the am654_set_clock function. The OTAP delay is not enabled when
+timing < SDR25 bus speed mode. The ITAP delay is not enabled for
+timings that do not carry out tuning.
+
+Add this OTAP/ITAP delay functionality according to the datasheet
+[1] OTAPDLYENA and ITAPDLYENA for MMC0.
+
+[1] https://www.ti.com/lit/ds/symlink/am62p.pdf
+
+Fixes: 8ee5fc0e0b3b ("mmc: sdhci_am654: Update OTAPDLY writes")
+Signed-off-by: Judith Mendez <jm@ti.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Link: https://lore.kernel.org/r/20240320223837.959900-4-jm@ti.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/mmc/host/sdhci_am654.c | 40 ++++++++++++++++++++++------------
+ 1 file changed, 26 insertions(+), 14 deletions(-)
+
+diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
+index cfb614d0b42b4..888bfda0ebc0e 100644
+--- a/drivers/mmc/host/sdhci_am654.c
++++ b/drivers/mmc/host/sdhci_am654.c
+@@ -143,6 +143,7 @@ struct sdhci_am654_data {
+       struct regmap *base;
+       int otap_del_sel[ARRAY_SIZE(td)];
+       int itap_del_sel[ARRAY_SIZE(td)];
++      u32 itap_del_ena[ARRAY_SIZE(td)];
+       int clkbuf_sel;
+       int trm_icp;
+       int drv_strength;
+@@ -239,11 +240,13 @@ static void sdhci_am654_setup_dll(struct sdhci_host *host, unsigned int clock)
+ }
+ static void sdhci_am654_write_itapdly(struct sdhci_am654_data *sdhci_am654,
+-                                    u32 itapdly)
++                                    u32 itapdly, u32 enable)
+ {
+       /* Set ITAPCHGWIN before writing to ITAPDLY */
+       regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPCHGWIN_MASK,
+                          1 << ITAPCHGWIN_SHIFT);
++      regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPDLYENA_MASK,
++                         enable << ITAPDLYENA_SHIFT);
+       regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPDLYSEL_MASK,
+                          itapdly << ITAPDLYSEL_SHIFT);
+       regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPCHGWIN_MASK, 0);
+@@ -260,8 +263,8 @@ static void sdhci_am654_setup_delay_chain(struct sdhci_am654_data *sdhci_am654,
+       mask = SELDLYTXCLK_MASK | SELDLYRXCLK_MASK;
+       regmap_update_bits(sdhci_am654->base, PHY_CTRL5, mask, val);
+-      sdhci_am654_write_itapdly(sdhci_am654,
+-                                sdhci_am654->itap_del_sel[timing]);
++      sdhci_am654_write_itapdly(sdhci_am654, sdhci_am654->itap_del_sel[timing],
++                                sdhci_am654->itap_del_ena[timing]);
+ }
+ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)
+@@ -270,7 +273,6 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)
+       struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
+       unsigned char timing = host->mmc->ios.timing;
+       u32 otap_del_sel;
+-      u32 otap_del_ena;
+       u32 mask, val;
+       regmap_update_bits(sdhci_am654->base, PHY_CTRL1, ENDLL_MASK, 0);
+@@ -279,10 +281,9 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)
+       /* Setup DLL Output TAP delay */
+       otap_del_sel = sdhci_am654->otap_del_sel[timing];
+-      otap_del_ena = (timing > MMC_TIMING_UHS_SDR25) ? 1 : 0;
+       mask = OTAPDLYENA_MASK | OTAPDLYSEL_MASK;
+-      val = (otap_del_ena << OTAPDLYENA_SHIFT) |
++      val = (0x1 << OTAPDLYENA_SHIFT) |
+             (otap_del_sel << OTAPDLYSEL_SHIFT);
+       /* Write to STRBSEL for HS400 speed mode */
+@@ -300,7 +301,8 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)
+       if (timing > MMC_TIMING_UHS_SDR25 && clock >= CLOCK_TOO_SLOW_HZ) {
+               sdhci_am654_setup_dll(host, clock);
+               sdhci_am654->dll_enable = true;
+-              sdhci_am654_write_itapdly(sdhci_am654, sdhci_am654->itap_del_sel[timing]);
++              sdhci_am654_write_itapdly(sdhci_am654, sdhci_am654->itap_del_sel[timing],
++                                        sdhci_am654->itap_del_ena[timing]);
+       } else {
+               sdhci_am654_setup_delay_chain(sdhci_am654, timing);
+               sdhci_am654->dll_enable = false;
+@@ -317,6 +319,7 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host,
+       struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
+       unsigned char timing = host->mmc->ios.timing;
+       u32 otap_del_sel;
++      u32 itap_del_ena;
+       u32 mask, val;
+       /* Setup DLL Output TAP delay */
+@@ -325,6 +328,12 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host,
+       mask = OTAPDLYENA_MASK | OTAPDLYSEL_MASK;
+       val = (0x1 << OTAPDLYENA_SHIFT) |
+             (otap_del_sel << OTAPDLYSEL_SHIFT);
++
++      itap_del_ena = sdhci_am654->itap_del_ena[timing];
++
++      mask |= ITAPDLYENA_MASK;
++      val |= (itap_del_ena << ITAPDLYENA_SHIFT);
++
+       regmap_update_bits(sdhci_am654->base, PHY_CTRL4, mask, val);
+       regmap_update_bits(sdhci_am654->base, PHY_CTRL5, CLKBUFSEL_MASK,
+@@ -478,6 +487,7 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
+ {
+       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+       struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
++      unsigned char timing = host->mmc->ios.timing;
+       struct window fail_window[ITAPDLY_LENGTH];
+       u8 curr_pass, itap;
+       u8 fail_index = 0;
+@@ -486,11 +496,10 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
+       memset(fail_window, 0, sizeof(fail_window));
+       /* Enable ITAPDLY */
+-      regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPDLYENA_MASK,
+-                         1 << ITAPDLYENA_SHIFT);
++      sdhci_am654->itap_del_ena[timing] = 0x1;
+       for (itap = 0; itap < ITAPDLY_LENGTH; itap++) {
+-              sdhci_am654_write_itapdly(sdhci_am654, itap);
++              sdhci_am654_write_itapdly(sdhci_am654, itap, sdhci_am654->itap_del_ena[timing]);
+               curr_pass = !mmc_send_tuning(host->mmc, opcode, NULL);
+@@ -514,7 +523,7 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
+       itap = sdhci_am654_calculate_itap(host, fail_window, fail_index,
+                                         sdhci_am654->dll_enable);
+-      sdhci_am654_write_itapdly(sdhci_am654, itap);
++      sdhci_am654_write_itapdly(sdhci_am654, itap, sdhci_am654->itap_del_ena[timing]);
+       return 0;
+ }
+@@ -663,9 +672,12 @@ static int sdhci_am654_get_otap_delay(struct sdhci_host *host,
+                               host->mmc->caps2 &= ~td[i].capability;
+               }
+-              if (td[i].itap_binding)
+-                      device_property_read_u32(dev, td[i].itap_binding,
+-                                               &sdhci_am654->itap_del_sel[i]);
++              if (td[i].itap_binding) {
++                      ret = device_property_read_u32(dev, td[i].itap_binding,
++                                                     &sdhci_am654->itap_del_sel[i]);
++                      if (!ret)
++                              sdhci_am654->itap_del_ena[i] = 0x1;
++              }
+       }
+       return 0;
+-- 
+2.43.0
+
diff --git a/queue-6.6/mmc-sdhci_am654-add-tuning-algorithm-for-delay-chain.patch b/queue-6.6/mmc-sdhci_am654-add-tuning-algorithm-for-delay-chain.patch
new file mode 100644 (file)
index 0000000..79a14d1
--- /dev/null
@@ -0,0 +1,195 @@
+From 37e24974086b7ace8d9df41626e30823883a9e86 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Mar 2024 17:38:31 -0500
+Subject: mmc: sdhci_am654: Add tuning algorithm for delay chain
+
+From: Judith Mendez <jm@ti.com>
+
+[ Upstream commit 6231d99dd4119312ad41abf9383e18fec66cbe4b ]
+
+Currently the sdhci_am654 driver only supports one tuning
+algorithm which should be used only when DLL is enabled. The
+ITAPDLY is selected from the largest passing window and the
+buffer is viewed as a circular buffer.
+
+The new algorithm should be used when the delay chain
+is enabled. The ITAPDLY is selected from the largest passing
+window and the buffer is not viewed as a circular buffer.
+
+This implementation is based off of the following paper: [1].
+
+Also add support for multiple failing windows.
+
+[1] https://www.ti.com/lit/an/spract9/spract9.pdf
+
+Fixes: 13ebeae68ac9 ("mmc: sdhci_am654: Add support for software tuning")
+Signed-off-by: Judith Mendez <jm@ti.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Link: https://lore.kernel.org/r/20240320223837.959900-2-jm@ti.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/mmc/host/sdhci_am654.c | 112 +++++++++++++++++++++++++++------
+ 1 file changed, 92 insertions(+), 20 deletions(-)
+
+diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
+index 967bd2dfcda1b..c3b07957736e9 100644
+--- a/drivers/mmc/host/sdhci_am654.c
++++ b/drivers/mmc/host/sdhci_am654.c
+@@ -150,10 +150,17 @@ struct sdhci_am654_data {
+       int strb_sel;
+       u32 flags;
+       u32 quirks;
++      bool dll_enable;
+ #define SDHCI_AM654_QUIRK_FORCE_CDTEST BIT(0)
+ };
++struct window {
++      u8 start;
++      u8 end;
++      u8 length;
++};
++
+ struct sdhci_am654_driver_data {
+       const struct sdhci_pltfm_data *pdata;
+       u32 flags;
+@@ -295,10 +302,13 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)
+       regmap_update_bits(sdhci_am654->base, PHY_CTRL4, mask, val);
+-      if (timing > MMC_TIMING_UHS_SDR25 && clock >= CLOCK_TOO_SLOW_HZ)
++      if (timing > MMC_TIMING_UHS_SDR25 && clock >= CLOCK_TOO_SLOW_HZ) {
+               sdhci_am654_setup_dll(host, clock);
+-      else
++              sdhci_am654->dll_enable = true;
++      } else {
+               sdhci_am654_setup_delay_chain(sdhci_am654, timing);
++              sdhci_am654->dll_enable = false;
++      }
+       regmap_update_bits(sdhci_am654->base, PHY_CTRL5, CLKBUFSEL_MASK,
+                          sdhci_am654->clkbuf_sel);
+@@ -416,39 +426,101 @@ static u32 sdhci_am654_cqhci_irq(struct sdhci_host *host, u32 intmask)
+       return 0;
+ }
+-#define ITAP_MAX      32
++#define ITAPDLY_LENGTH 32
++#define ITAPDLY_LAST_INDEX (ITAPDLY_LENGTH - 1)
++
++static u32 sdhci_am654_calculate_itap(struct sdhci_host *host, struct window
++                        *fail_window, u8 num_fails, bool circular_buffer)
++{
++      u8 itap = 0, start_fail = 0, end_fail = 0, pass_length = 0;
++      u8 first_fail_start = 0, last_fail_end = 0;
++      struct device *dev = mmc_dev(host->mmc);
++      struct window pass_window = {0, 0, 0};
++      int prev_fail_end = -1;
++      u8 i;
++
++      if (!num_fails)
++              return ITAPDLY_LAST_INDEX >> 1;
++
++      if (fail_window->length == ITAPDLY_LENGTH) {
++              dev_err(dev, "No passing ITAPDLY, return 0\n");
++              return 0;
++      }
++
++      first_fail_start = fail_window->start;
++      last_fail_end = fail_window[num_fails - 1].end;
++
++      for (i = 0; i < num_fails; i++) {
++              start_fail = fail_window[i].start;
++              end_fail = fail_window[i].end;
++              pass_length = start_fail - (prev_fail_end + 1);
++
++              if (pass_length > pass_window.length) {
++                      pass_window.start = prev_fail_end + 1;
++                      pass_window.length = pass_length;
++              }
++              prev_fail_end = end_fail;
++      }
++
++      if (!circular_buffer)
++              pass_length = ITAPDLY_LAST_INDEX - last_fail_end;
++      else
++              pass_length = ITAPDLY_LAST_INDEX - last_fail_end + first_fail_start;
++
++      if (pass_length > pass_window.length) {
++              pass_window.start = last_fail_end + 1;
++              pass_window.length = pass_length;
++      }
++
++      if (!circular_buffer)
++              itap = pass_window.start + (pass_window.length >> 1);
++      else
++              itap = (pass_window.start + (pass_window.length >> 1)) % ITAPDLY_LENGTH;
++
++      return (itap > ITAPDLY_LAST_INDEX) ? ITAPDLY_LAST_INDEX >> 1 : itap;
++}
++
+ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
+                                              u32 opcode)
+ {
+       struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
+       struct sdhci_am654_data *sdhci_am654 = sdhci_pltfm_priv(pltfm_host);
+-      int cur_val, prev_val = 1, fail_len = 0, pass_window = 0, pass_len;
+-      u32 itap;
++      struct window fail_window[ITAPDLY_LENGTH];
++      u8 curr_pass, itap;
++      u8 fail_index = 0;
++      u8 prev_pass = 1;
++
++      memset(fail_window, 0, sizeof(fail_window));
+       /* Enable ITAPDLY */
+       regmap_update_bits(sdhci_am654->base, PHY_CTRL4, ITAPDLYENA_MASK,
+                          1 << ITAPDLYENA_SHIFT);
+-      for (itap = 0; itap < ITAP_MAX; itap++) {
++      for (itap = 0; itap < ITAPDLY_LENGTH; itap++) {
+               sdhci_am654_write_itapdly(sdhci_am654, itap);
+-              cur_val = !mmc_send_tuning(host->mmc, opcode, NULL);
+-              if (cur_val && !prev_val)
+-                      pass_window = itap;
++              curr_pass = !mmc_send_tuning(host->mmc, opcode, NULL);
+-              if (!cur_val)
+-                      fail_len++;
++              if (!curr_pass && prev_pass)
++                      fail_window[fail_index].start = itap;
+-              prev_val = cur_val;
++              if (!curr_pass) {
++                      fail_window[fail_index].end = itap;
++                      fail_window[fail_index].length++;
++              }
++
++              if (curr_pass && !prev_pass)
++                      fail_index++;
++
++              prev_pass = curr_pass;
+       }
+-      /*
+-       * Having determined the length of the failing window and start of
+-       * the passing window calculate the length of the passing window and
+-       * set the final value halfway through it considering the range as a
+-       * circular buffer
+-       */
+-      pass_len = ITAP_MAX - fail_len;
+-      itap = (pass_window + (pass_len >> 1)) % ITAP_MAX;
++
++      if (fail_window[fail_index].length != 0)
++              fail_index++;
++
++      itap = sdhci_am654_calculate_itap(host, fail_window, fail_index,
++                                        sdhci_am654->dll_enable);
++
+       sdhci_am654_write_itapdly(sdhci_am654, itap);
+       return 0;
+-- 
+2.43.0
+
diff --git a/queue-6.6/mmc-sdhci_am654-drop-lookup-for-deprecated-ti-otap-d.patch b/queue-6.6/mmc-sdhci_am654-drop-lookup-for-deprecated-ti-otap-d.patch
new file mode 100644 (file)
index 0000000..0d2ead5
--- /dev/null
@@ -0,0 +1,102 @@
+From 6ca2adbc8be5f86b6e12acea0c919278e8ac21b1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 22 Nov 2023 11:32:14 +0530
+Subject: mmc: sdhci_am654: Drop lookup for deprecated ti,otap-del-sel
+
+From: Vignesh Raghavendra <vigneshr@ti.com>
+
+[ Upstream commit 5cb2f9286a31f33dc732c57540838ad9339393ab ]
+
+ti,otap-del-sel has been deprecated since v5.7 and there are no users of
+this property and no documentation in the DT bindings either.
+Drop the fallback code looking for this property, this makes
+sdhci_am654_get_otap_delay() much easier to read as all the TAP values
+can be handled via a single iterator loop.
+
+Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Link: https://lore.kernel.org/r/20231122060215.2074799-1-vigneshr@ti.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Stable-dep-of: 387c1bf7dce0 ("mmc: sdhci_am654: Add OTAP/ITAP delay enable")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/mmc/host/sdhci_am654.c | 37 ++++++----------------------------
+ 1 file changed, 6 insertions(+), 31 deletions(-)
+
+diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
+index f38fa28b99141..cfb614d0b42b4 100644
+--- a/drivers/mmc/host/sdhci_am654.c
++++ b/drivers/mmc/host/sdhci_am654.c
+@@ -141,7 +141,6 @@ static const struct timing_data td[] = {
+ struct sdhci_am654_data {
+       struct regmap *base;
+-      bool legacy_otapdly;
+       int otap_del_sel[ARRAY_SIZE(td)];
+       int itap_del_sel[ARRAY_SIZE(td)];
+       int clkbuf_sel;
+@@ -279,11 +278,7 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)
+       sdhci_set_clock(host, clock);
+       /* Setup DLL Output TAP delay */
+-      if (sdhci_am654->legacy_otapdly)
+-              otap_del_sel = sdhci_am654->otap_del_sel[0];
+-      else
+-              otap_del_sel = sdhci_am654->otap_del_sel[timing];
+-
++      otap_del_sel = sdhci_am654->otap_del_sel[timing];
+       otap_del_ena = (timing > MMC_TIMING_UHS_SDR25) ? 1 : 0;
+       mask = OTAPDLYENA_MASK | OTAPDLYSEL_MASK;
+@@ -325,10 +320,7 @@ static void sdhci_j721e_4bit_set_clock(struct sdhci_host *host,
+       u32 mask, val;
+       /* Setup DLL Output TAP delay */
+-      if (sdhci_am654->legacy_otapdly)
+-              otap_del_sel = sdhci_am654->otap_del_sel[0];
+-      else
+-              otap_del_sel = sdhci_am654->otap_del_sel[timing];
++      otap_del_sel = sdhci_am654->otap_del_sel[timing];
+       mask = OTAPDLYENA_MASK | OTAPDLYSEL_MASK;
+       val = (0x1 << OTAPDLYENA_SHIFT) |
+@@ -650,32 +642,15 @@ static int sdhci_am654_get_otap_delay(struct sdhci_host *host,
+       int i;
+       int ret;
+-      ret = device_property_read_u32(dev, td[MMC_TIMING_LEGACY].otap_binding,
+-                               &sdhci_am654->otap_del_sel[MMC_TIMING_LEGACY]);
+-      if (ret) {
+-              /*
+-               * ti,otap-del-sel-legacy is mandatory, look for old binding
+-               * if not found.
+-               */
+-              ret = device_property_read_u32(dev, "ti,otap-del-sel",
+-                                             &sdhci_am654->otap_del_sel[0]);
+-              if (ret) {
+-                      dev_err(dev, "Couldn't find otap-del-sel\n");
+-
+-                      return ret;
+-              }
+-
+-              dev_info(dev, "Using legacy binding ti,otap-del-sel\n");
+-              sdhci_am654->legacy_otapdly = true;
+-
+-              return 0;
+-      }
+-
+       for (i = MMC_TIMING_LEGACY; i <= MMC_TIMING_MMC_HS400; i++) {
+               ret = device_property_read_u32(dev, td[i].otap_binding,
+                                              &sdhci_am654->otap_del_sel[i]);
+               if (ret) {
++                      if (i == MMC_TIMING_LEGACY) {
++                              dev_err(dev, "Couldn't find mandatory ti,otap-del-sel-legacy\n");
++                              return ret;
++                      }
+                       dev_dbg(dev, "Couldn't find %s\n",
+                               td[i].otap_binding);
+                       /*
+-- 
+2.43.0
+
diff --git a/queue-6.6/mmc-sdhci_am654-fix-itapdly-for-hs400-timing.patch b/queue-6.6/mmc-sdhci_am654-fix-itapdly-for-hs400-timing.patch
new file mode 100644 (file)
index 0000000..5fcdbe5
--- /dev/null
@@ -0,0 +1,59 @@
+From 929634239a224cced81d1c3fcb9cec7e3d74bdc7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Mar 2024 17:38:37 -0500
+Subject: mmc: sdhci_am654: Fix ITAPDLY for HS400 timing
+
+From: Judith Mendez <jm@ti.com>
+
+[ Upstream commit d3182932bb070e7518411fd165e023f82afd7d25 ]
+
+While STRB is currently used for DATA and CRC responses, the CMD
+responses from the device to the host still require ITAPDLY for
+HS400 timing.
+
+Currently what is stored for HS400 is the ITAPDLY from High Speed
+mode which is incorrect. The ITAPDLY for HS400 speed mode should
+be the same as ITAPDLY as HS200 timing after tuning is executed.
+Add the functionality to save ITAPDLY from HS200 tuning and save
+as HS400 ITAPDLY.
+
+Fixes: a161c45f2979 ("mmc: sdhci_am654: Enable DLL only for some speed modes")
+Signed-off-by: Judith Mendez <jm@ti.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Link: https://lore.kernel.org/r/20240320223837.959900-8-jm@ti.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/mmc/host/sdhci_am654.c | 9 +++++++++
+ 1 file changed, 9 insertions(+)
+
+diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
+index 884d1b53180d7..562034af653eb 100644
+--- a/drivers/mmc/host/sdhci_am654.c
++++ b/drivers/mmc/host/sdhci_am654.c
+@@ -301,6 +301,12 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)
+       if (timing > MMC_TIMING_UHS_SDR25 && clock >= CLOCK_TOO_SLOW_HZ) {
+               sdhci_am654_setup_dll(host, clock);
+               sdhci_am654->dll_enable = true;
++
++              if (timing == MMC_TIMING_MMC_HS400) {
++                      sdhci_am654->itap_del_ena[timing] = 0x1;
++                      sdhci_am654->itap_del_sel[timing] = sdhci_am654->itap_del_sel[timing - 1];
++              }
++
+               sdhci_am654_write_itapdly(sdhci_am654, sdhci_am654->itap_del_sel[timing],
+                                         sdhci_am654->itap_del_ena[timing]);
+       } else {
+@@ -531,6 +537,9 @@ static int sdhci_am654_platform_execute_tuning(struct sdhci_host *host,
+       sdhci_am654_write_itapdly(sdhci_am654, itap, sdhci_am654->itap_del_ena[timing]);
++      /* Save ITAPDLY */
++      sdhci_am654->itap_del_sel[timing] = itap;
++
+       return 0;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.6/mmc-sdhci_am654-write-itapdly-for-ddr52-timing.patch b/queue-6.6/mmc-sdhci_am654-write-itapdly-for-ddr52-timing.patch
new file mode 100644 (file)
index 0000000..bac5b4c
--- /dev/null
@@ -0,0 +1,39 @@
+From 4cffcac8d1cb59978510da971c1774df55bd6a17 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 20 Mar 2024 17:38:32 -0500
+Subject: mmc: sdhci_am654: Write ITAPDLY for DDR52 timing
+
+From: Judith Mendez <jm@ti.com>
+
+[ Upstream commit d465234493bb6ad1b9c10a0c9ef9881b8d85081a ]
+
+For DDR52 timing, DLL is enabled but tuning is not carried
+out, therefore the ITAPDLY value in PHY CTRL 4 register is
+not correct. Fix this by writing ITAPDLY after enabling DLL.
+
+Fixes: a161c45f2979 ("mmc: sdhci_am654: Enable DLL only for some speed modes")
+Signed-off-by: Judith Mendez <jm@ti.com>
+Reviewed-by: Andrew Davis <afd@ti.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Link: https://lore.kernel.org/r/20240320223837.959900-3-jm@ti.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/mmc/host/sdhci_am654.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/mmc/host/sdhci_am654.c b/drivers/mmc/host/sdhci_am654.c
+index c3b07957736e9..f38fa28b99141 100644
+--- a/drivers/mmc/host/sdhci_am654.c
++++ b/drivers/mmc/host/sdhci_am654.c
+@@ -305,6 +305,7 @@ static void sdhci_am654_set_clock(struct sdhci_host *host, unsigned int clock)
+       if (timing > MMC_TIMING_UHS_SDR25 && clock >= CLOCK_TOO_SLOW_HZ) {
+               sdhci_am654_setup_dll(host, clock);
+               sdhci_am654->dll_enable = true;
++              sdhci_am654_write_itapdly(sdhci_am654, sdhci_am654->itap_del_sel[timing]);
+       } else {
+               sdhci_am654_setup_delay_chain(sdhci_am654, timing);
+               sdhci_am654->dll_enable = false;
+-- 
+2.43.0
+
diff --git a/queue-6.6/net-always-descend-into-dsa-folder-with-config_net_d.patch b/queue-6.6/net-always-descend-into-dsa-folder-with-config_net_d.patch
new file mode 100644 (file)
index 0000000..d4c3a0c
--- /dev/null
@@ -0,0 +1,58 @@
+From ff17621f1ca14e43d845c6e146fbb0974375151c Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 16 May 2024 09:56:30 -0700
+Subject: net: Always descend into dsa/ folder with CONFIG_NET_DSA enabled
+
+From: Florian Fainelli <florian.fainelli@broadcom.com>
+
+[ Upstream commit b1fa60ec252fba39130107074becd12d0b3f83ec ]
+
+Stephen reported that he was unable to get the dsa_loop driver to get
+probed, and the reason ended up being because he had CONFIG_FIXED_PHY=y
+in his kernel configuration. As Masahiro explained it:
+
+  "obj-m += dsa/" means everything under dsa/ must be modular.
+
+  If there is a built-in object under dsa/ with CONFIG_NET_DSA=m,
+  you cannot do  "obj-$(CONFIG_NET_DSA) += dsa/".
+
+  You need to change it back to "obj-y += dsa/".
+
+This was the case here whereby CONFIG_NET_DSA=m, and so the
+obj-$(CONFIG_FIXED_PHY) += dsa_loop_bdinfo.o rule is not executed and
+the DSA loop mdio_board info structure is not registered with the
+kernel, and eventually the device is simply not found.
+
+To preserve the intention of the original commit of limiting the amount
+of folder descending, conditionally descend into drivers/net/dsa when
+CONFIG_NET_DSA is enabled.
+
+Fixes: 227d72063fcc ("dsa: simplify Kconfig symbols and dependencies")
+Reported-by: Stephen Langstaff <stephenlangstaff1@gmail.com>
+Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
+Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
+Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/Makefile | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/net/Makefile b/drivers/net/Makefile
+index e26f98f897c55..e15939e77122b 100644
+--- a/drivers/net/Makefile
++++ b/drivers/net/Makefile
+@@ -48,7 +48,9 @@ obj-$(CONFIG_ARCNET) += arcnet/
+ obj-$(CONFIG_DEV_APPLETALK) += appletalk/
+ obj-$(CONFIG_CAIF) += caif/
+ obj-$(CONFIG_CAN) += can/
+-obj-$(CONFIG_NET_DSA) += dsa/
++ifdef CONFIG_NET_DSA
++obj-y += dsa/
++endif
+ obj-$(CONFIG_ETHERNET) += ethernet/
+ obj-$(CONFIG_FDDI) += fddi/
+ obj-$(CONFIG_HIPPI) += hippi/
+-- 
+2.43.0
+
diff --git a/queue-6.6/net-fec-avoid-lock-evasion-when-reading-pps_enable.patch b/queue-6.6/net-fec-avoid-lock-evasion-when-reading-pps_enable.patch
new file mode 100644 (file)
index 0000000..206032d
--- /dev/null
@@ -0,0 +1,62 @@
+From 727ba58127d75725911ceff73b7edbb50ee4cea1 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 May 2024 10:38:00 +0800
+Subject: net: fec: avoid lock evasion when reading pps_enable
+
+From: Wei Fang <wei.fang@nxp.com>
+
+[ Upstream commit 3b1c92f8e5371700fada307cc8fd2c51fa7bc8c1 ]
+
+The assignment of pps_enable is protected by tmreg_lock, but the read
+operation of pps_enable is not. So the Coverity tool reports a lock
+evasion warning which may cause data race to occur when running in a
+multithread environment. Although this issue is almost impossible to
+occur, we'd better fix it, at least it seems more logically reasonable,
+and it also prevents Coverity from continuing to issue warnings.
+
+Fixes: 278d24047891 ("net: fec: ptp: Enable PPS output based on ptp clock")
+Signed-off-by: Wei Fang <wei.fang@nxp.com>
+Link: https://lore.kernel.org/r/20240521023800.17102-1-wei.fang@nxp.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/freescale/fec_ptp.c | 14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
+index 181d9bfbee220..e32f6724f5681 100644
+--- a/drivers/net/ethernet/freescale/fec_ptp.c
++++ b/drivers/net/ethernet/freescale/fec_ptp.c
+@@ -104,14 +104,13 @@ static int fec_ptp_enable_pps(struct fec_enet_private *fep, uint enable)
+       struct timespec64 ts;
+       u64 ns;
+-      if (fep->pps_enable == enable)
+-              return 0;
+-
+-      fep->pps_channel = DEFAULT_PPS_CHANNEL;
+-      fep->reload_period = PPS_OUPUT_RELOAD_PERIOD;
+-
+       spin_lock_irqsave(&fep->tmreg_lock, flags);
++      if (fep->pps_enable == enable) {
++              spin_unlock_irqrestore(&fep->tmreg_lock, flags);
++              return 0;
++      }
++
+       if (enable) {
+               /* clear capture or output compare interrupt status if have.
+                */
+@@ -532,6 +531,9 @@ static int fec_ptp_enable(struct ptp_clock_info *ptp,
+       int ret = 0;
+       if (rq->type == PTP_CLK_REQ_PPS) {
++              fep->pps_channel = DEFAULT_PPS_CHANNEL;
++              fep->reload_period = PPS_OUPUT_RELOAD_PERIOD;
++
+               ret = fec_ptp_enable_pps(fep, on);
+               return ret;
+-- 
+2.43.0
+
diff --git a/queue-6.6/net-lan966x-remove-ptp-traps-in-case-the-ptp-is-not-.patch b/queue-6.6/net-lan966x-remove-ptp-traps-in-case-the-ptp-is-not-.patch
new file mode 100644 (file)
index 0000000..8ac3e01
--- /dev/null
@@ -0,0 +1,52 @@
+From 1111d1b3d69c9c789c9b04147404c9e15d93a1a4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 17 May 2024 15:58:08 +0200
+Subject: net: lan966x: Remove ptp traps in case the ptp is not enabled.
+
+From: Horatiu Vultur <horatiu.vultur@microchip.com>
+
+[ Upstream commit eda40be3a5ff3fdce513d2bcfeaca8cc16cf962a ]
+
+Lan966x is adding ptp traps to redirect the ptp frames to the CPU such
+that the HW will not forward these frames anywhere. The issue is that in
+case ptp is not enabled and the timestamping source is et to
+HWTSTAMP_SOURCE_NETDEV then these traps would not be removed on the
+error path.
+Fix this by removing the traps in this case as they are not needed.
+
+Fixes: 54e1ed69c40a ("net: lan966x: convert to ndo_hwtstamp_get() and ndo_hwtstamp_set()")
+Suggested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
+Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
+Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
+Link: https://lore.kernel.org/r/20240517135808.3025435-1-horatiu.vultur@microchip.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
+index 3f1033abd462d..c3f6c10bc2393 100644
+--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
++++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
+@@ -474,14 +474,14 @@ static int lan966x_port_hwtstamp_set(struct net_device *dev,
+           cfg->source != HWTSTAMP_SOURCE_PHYLIB)
+               return -EOPNOTSUPP;
++      if (cfg->source == HWTSTAMP_SOURCE_NETDEV && !port->lan966x->ptp)
++              return -EOPNOTSUPP;
++
+       err = lan966x_ptp_setup_traps(port, cfg);
+       if (err)
+               return err;
+       if (cfg->source == HWTSTAMP_SOURCE_NETDEV) {
+-              if (!port->lan966x->ptp)
+-                      return -EOPNOTSUPP;
+-
+               err = lan966x_ptp_hwtstamp_set(port, cfg, extack);
+               if (err) {
+                       lan966x_ptp_del_traps(port);
+-- 
+2.43.0
+
diff --git a/queue-6.6/net-relax-socket-state-check-at-accept-time.patch b/queue-6.6/net-relax-socket-state-check-at-accept-time.patch
new file mode 100644 (file)
index 0000000..34ce8df
--- /dev/null
@@ -0,0 +1,88 @@
+From 94c600aec5e59f3c6ebb7b8f9e74acdab01bf20d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 May 2024 16:01:00 +0200
+Subject: net: relax socket state check at accept time.
+
+From: Paolo Abeni <pabeni@redhat.com>
+
+[ Upstream commit 26afda78cda3da974fd4c287962c169e9462c495 ]
+
+Christoph reported the following splat:
+
+WARNING: CPU: 1 PID: 772 at net/ipv4/af_inet.c:761 __inet_accept+0x1f4/0x4a0
+Modules linked in:
+CPU: 1 PID: 772 Comm: syz-executor510 Not tainted 6.9.0-rc7-g7da7119fe22b #56
+Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.11.0-2.el7 04/01/2014
+RIP: 0010:__inet_accept+0x1f4/0x4a0 net/ipv4/af_inet.c:759
+Code: 04 38 84 c0 0f 85 87 00 00 00 41 c7 04 24 03 00 00 00 48 83 c4 10 5b 41 5c 41 5d 41 5e 41 5f 5d c3 cc cc cc cc e8 ec b7 da fd <0f> 0b e9 7f fe ff ff e8 e0 b7 da fd 0f 0b e9 fe fe ff ff 89 d9 80
+RSP: 0018:ffffc90000c2fc58 EFLAGS: 00010293
+RAX: ffffffff836bdd14 RBX: 0000000000000000 RCX: ffff888104668000
+RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
+RBP: dffffc0000000000 R08: ffffffff836bdb89 R09: fffff52000185f64
+R10: dffffc0000000000 R11: fffff52000185f64 R12: dffffc0000000000
+R13: 1ffff92000185f98 R14: ffff88810754d880 R15: ffff8881007b7800
+FS:  000000001c772880(0000) GS:ffff88811b280000(0000) knlGS:0000000000000000
+CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+CR2: 00007fb9fcf2e178 CR3: 00000001045d2002 CR4: 0000000000770ef0
+DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
+PKRU: 55555554
+Call Trace:
+ <TASK>
+ inet_accept+0x138/0x1d0 net/ipv4/af_inet.c:786
+ do_accept+0x435/0x620 net/socket.c:1929
+ __sys_accept4_file net/socket.c:1969 [inline]
+ __sys_accept4+0x9b/0x110 net/socket.c:1999
+ __do_sys_accept net/socket.c:2016 [inline]
+ __se_sys_accept net/socket.c:2013 [inline]
+ __x64_sys_accept+0x7d/0x90 net/socket.c:2013
+ do_syscall_x64 arch/x86/entry/common.c:52 [inline]
+ do_syscall_64+0x58/0x100 arch/x86/entry/common.c:83
+ entry_SYSCALL_64_after_hwframe+0x76/0x7e
+RIP: 0033:0x4315f9
+Code: fd ff 48 81 c4 80 00 00 00 e9 f1 fe ff ff 0f 1f 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 ab b4 fd ff c3 66 2e 0f 1f 84 00 00 00 00
+RSP: 002b:00007ffdb26d9c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002b
+RAX: ffffffffffffffda RBX: 0000000000400300 RCX: 00000000004315f9
+RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
+RBP: 00000000006e1018 R08: 0000000000400300 R09: 0000000000400300
+R10: 0000000000400300 R11: 0000000000000246 R12: 0000000000000000
+R13: 000000000040cdf0 R14: 000000000040ce80 R15: 0000000000000055
+ </TASK>
+
+The reproducer invokes shutdown() before entering the listener status.
+After commit 94062790aedb ("tcp: defer shutdown(SEND_SHUTDOWN) for
+TCP_SYN_RECV sockets"), the above causes the child to reach the accept
+syscall in FIN_WAIT1 status.
+
+Eric noted we can relax the existing assertion in __inet_accept()
+
+Reported-by: Christoph Paasch <cpaasch@apple.com>
+Closes: https://github.com/multipath-tcp/mptcp_net-next/issues/490
+Suggested-by: Eric Dumazet <edumazet@google.com>
+Fixes: 94062790aedb ("tcp: defer shutdown(SEND_SHUTDOWN) for TCP_SYN_RECV sockets")
+Reviewed-by: Eric Dumazet <edumazet@google.com>
+Link: https://lore.kernel.org/r/23ab880a44d8cfd967e84de8b93dbf48848e3d8c.1716299669.git.pabeni@redhat.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv4/af_inet.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
+index b50308105551f..3feff7f738a48 100644
+--- a/net/ipv4/af_inet.c
++++ b/net/ipv4/af_inet.c
+@@ -757,7 +757,9 @@ void __inet_accept(struct socket *sock, struct socket *newsock, struct sock *new
+       sock_rps_record_flow(newsk);
+       WARN_ON(!((1 << newsk->sk_state) &
+                 (TCPF_ESTABLISHED | TCPF_SYN_RECV |
+-                TCPF_CLOSE_WAIT | TCPF_CLOSE)));
++                 TCPF_FIN_WAIT1 | TCPF_FIN_WAIT2 |
++                 TCPF_CLOSING | TCPF_CLOSE_WAIT |
++                 TCPF_CLOSE)));
+       if (test_bit(SOCK_SUPPORT_ZC, &sock->flags))
+               set_bit(SOCK_SUPPORT_ZC, &newsock->flags);
+-- 
+2.43.0
+
diff --git a/queue-6.6/nfc-nci-fix-handling-of-zero-length-payload-packets-.patch b/queue-6.6/nfc-nci-fix-handling-of-zero-length-payload-packets-.patch
new file mode 100644 (file)
index 0000000..26b6d05
--- /dev/null
@@ -0,0 +1,42 @@
+From fb4fedbc8392f7e8ce5c8fc0265d12fa8fb2d644 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 22 May 2024 00:34:42 +0900
+Subject: nfc: nci: Fix handling of zero-length payload packets in
+ nci_rx_work()
+
+From: Ryosuke Yasuoka <ryasuoka@redhat.com>
+
+[ Upstream commit 6671e352497ca4bb07a96c48e03907065ff77d8a ]
+
+When nci_rx_work() receives a zero-length payload packet, it should not
+discard the packet and exit the loop. Instead, it should continue
+processing subsequent packets.
+
+Fixes: d24b03535e5e ("nfc: nci: Fix uninit-value in nci_dev_up and nci_ntf_packet")
+Signed-off-by: Ryosuke Yasuoka <ryasuoka@redhat.com>
+Reviewed-by: Simon Horman <horms@kernel.org>
+Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Link: https://lore.kernel.org/r/20240521153444.535399-1-ryasuoka@redhat.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/nfc/nci/core.c | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
+index f350c5fb992ec..c4d2932c59032 100644
+--- a/net/nfc/nci/core.c
++++ b/net/nfc/nci/core.c
+@@ -1531,8 +1531,7 @@ static void nci_rx_work(struct work_struct *work)
+               if (!nci_valid_size(skb)) {
+                       kfree_skb(skb);
+-                      kcov_remote_stop();
+-                      break;
++                      continue;
+               }
+               /* Process frame */
+-- 
+2.43.0
+
diff --git a/queue-6.6/nfc-nci-fix-uninit-value-in-nci_rx_work.patch b/queue-6.6/nfc-nci-fix-uninit-value-in-nci_rx_work.patch
new file mode 100644 (file)
index 0000000..3da18fb
--- /dev/null
@@ -0,0 +1,63 @@
+From cf0089f11d20a369b947a176c3a53e273c35b58b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 19 May 2024 18:43:03 +0900
+Subject: nfc: nci: Fix uninit-value in nci_rx_work
+
+From: Ryosuke Yasuoka <ryasuoka@redhat.com>
+
+[ Upstream commit e4a87abf588536d1cdfb128595e6e680af5cf3ed ]
+
+syzbot reported the following uninit-value access issue [1]
+
+nci_rx_work() parses received packet from ndev->rx_q. It should be
+validated header size, payload size and total packet size before
+processing the packet. If an invalid packet is detected, it should be
+silently discarded.
+
+Fixes: d24b03535e5e ("nfc: nci: Fix uninit-value in nci_dev_up and nci_ntf_packet")
+Reported-and-tested-by: syzbot+d7b4dc6cd50410152534@syzkaller.appspotmail.com
+Closes: https://syzkaller.appspot.com/bug?extid=d7b4dc6cd50410152534 [1]
+Signed-off-by: Ryosuke Yasuoka <ryasuoka@redhat.com>
+Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/nfc/nci/core.c | 15 ++++++++++++++-
+ 1 file changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/net/nfc/nci/core.c b/net/nfc/nci/core.c
+index 5d708af0fcfd3..f350c5fb992ec 100644
+--- a/net/nfc/nci/core.c
++++ b/net/nfc/nci/core.c
+@@ -1463,6 +1463,19 @@ int nci_core_ntf_packet(struct nci_dev *ndev, __u16 opcode,
+                                ndev->ops->n_core_ops);
+ }
++static bool nci_valid_size(struct sk_buff *skb)
++{
++      BUILD_BUG_ON(NCI_CTRL_HDR_SIZE != NCI_DATA_HDR_SIZE);
++      unsigned int hdr_size = NCI_CTRL_HDR_SIZE;
++
++      if (skb->len < hdr_size ||
++          !nci_plen(skb->data) ||
++          skb->len < hdr_size + nci_plen(skb->data)) {
++              return false;
++      }
++      return true;
++}
++
+ /* ---- NCI TX Data worker thread ---- */
+ static void nci_tx_work(struct work_struct *work)
+@@ -1516,7 +1529,7 @@ static void nci_rx_work(struct work_struct *work)
+               nfc_send_to_raw_sock(ndev->nfc_dev, skb,
+                                    RAW_PAYLOAD_NCI, NFC_DIRECTION_RX);
+-              if (!nci_plen(skb->data)) {
++              if (!nci_valid_size(skb)) {
+                       kfree_skb(skb);
+                       kcov_remote_stop();
+                       break;
+-- 
+2.43.0
+
diff --git a/queue-6.6/nfs-keep-server-info-for-remounts.patch b/queue-6.6/nfs-keep-server-info-for-remounts.patch
new file mode 100644 (file)
index 0000000..415a73f
--- /dev/null
@@ -0,0 +1,55 @@
+From 2bed312387b07faef54d83613cb62e5f2be1b672 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 14 Apr 2024 19:01:09 +0200
+Subject: nfs: keep server info for remounts
+
+From: Martin Kaiser <martin@kaiser.cx>
+
+[ Upstream commit b322bf9e983addedff0894c55e92d58f4d16d92a ]
+
+With newer kernels that use fs_context for nfs mounts, remounts fail with
+-EINVAL.
+
+$ mount -t nfs -o nolock 10.0.0.1:/tmp/test /mnt/test/
+$ mount -t nfs -o remount /mnt/test/
+mount: mounting 10.0.0.1:/tmp/test on /mnt/test failed: Invalid argument
+
+For remounts, the nfs server address and port are populated by
+nfs_init_fs_context and later overwritten with 0x00 bytes by
+nfs23_parse_monolithic. The remount then fails as the server address is
+invalid.
+
+Fix this by not overwriting nfs server info in nfs23_parse_monolithic if
+we're doing a remount.
+
+Fixes: f2aedb713c28 ("NFS: Add fs_context support.")
+Signed-off-by: Martin Kaiser <martin@kaiser.cx>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/fs_context.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/fs/nfs/fs_context.c b/fs/nfs/fs_context.c
+index 853e8d609bb3b..41126d6dcd760 100644
+--- a/fs/nfs/fs_context.c
++++ b/fs/nfs/fs_context.c
+@@ -1111,9 +1111,12 @@ static int nfs23_parse_monolithic(struct fs_context *fc,
+               ctx->acdirmax   = data->acdirmax;
+               ctx->need_mount = false;
+-              memcpy(sap, &data->addr, sizeof(data->addr));
+-              ctx->nfs_server.addrlen = sizeof(data->addr);
+-              ctx->nfs_server.port = ntohs(data->addr.sin_port);
++              if (!is_remount_fc(fc)) {
++                      memcpy(sap, &data->addr, sizeof(data->addr));
++                      ctx->nfs_server.addrlen = sizeof(data->addr);
++                      ctx->nfs_server.port = ntohs(data->addr.sin_port);
++              }
++
+               if (sap->ss_family != AF_INET ||
+                   !nfs_verify_server_address(sap))
+                       goto out_no_address;
+-- 
+2.43.0
+
diff --git a/queue-6.6/nfsv4-fixup-smatch-warning-for-ambiguous-return.patch b/queue-6.6/nfsv4-fixup-smatch-warning-for-ambiguous-return.patch
new file mode 100644 (file)
index 0000000..b3d140a
--- /dev/null
@@ -0,0 +1,67 @@
+From b06dd49b202f4443a4391fae30a232c68f37f266 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 17 Apr 2024 14:49:29 -0400
+Subject: NFSv4: Fixup smatch warning for ambiguous return
+
+From: Benjamin Coddington <bcodding@redhat.com>
+
+[ Upstream commit 37ffe06537af3e3ec212e7cbe941046fce0a822f ]
+
+Dan Carpenter reports smatch warning for nfs4_try_migration() when a memory
+allocation failure results in a zero return value.  In this case, a
+transient allocation failure error will likely be retried the next time the
+server responds with NFS4ERR_MOVED.
+
+We can fixup the smatch warning with a small refactor: attempt all three
+allocations before testing and returning on a failure.
+
+Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
+Fixes: c3ed222745d9 ("NFSv4: Fix free of uninitialized nfs4_label on referral lookup.")
+Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
+Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
+Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/nfs4state.c | 12 +++++-------
+ 1 file changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
+index 9a5d911a7edc7..c95c50328ced8 100644
+--- a/fs/nfs/nfs4state.c
++++ b/fs/nfs/nfs4state.c
+@@ -2117,6 +2117,7 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred
+ {
+       struct nfs_client *clp = server->nfs_client;
+       struct nfs4_fs_locations *locations = NULL;
++      struct nfs_fattr *fattr;
+       struct inode *inode;
+       struct page *page;
+       int status, result;
+@@ -2126,19 +2127,16 @@ static int nfs4_try_migration(struct nfs_server *server, const struct cred *cred
+                       (unsigned long long)server->fsid.minor,
+                       clp->cl_hostname);
+-      result = 0;
+       page = alloc_page(GFP_KERNEL);
+       locations = kmalloc(sizeof(struct nfs4_fs_locations), GFP_KERNEL);
+-      if (page == NULL || locations == NULL) {
+-              dprintk("<-- %s: no memory\n", __func__);
+-              goto out;
+-      }
+-      locations->fattr = nfs_alloc_fattr();
+-      if (locations->fattr == NULL) {
++      fattr = nfs_alloc_fattr();
++      if (page == NULL || locations == NULL || fattr == NULL) {
+               dprintk("<-- %s: no memory\n", __func__);
++              result = 0;
+               goto out;
+       }
++      locations->fattr = fattr;
+       inode = d_inode(server->super->s_root);
+       result = nfs4_proc_get_locations(server, NFS_FH(inode), locations,
+                                        page, cred);
+-- 
+2.43.0
+
diff --git a/queue-6.6/nilfs2-make-superblock-data-array-index-computation-.patch b/queue-6.6/nilfs2-make-superblock-data-array-index-computation-.patch
new file mode 100644 (file)
index 0000000..5b01e81
--- /dev/null
@@ -0,0 +1,73 @@
+From 0edb31fac1e33108384e229455da942809f152c2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 30 Apr 2024 17:00:19 +0900
+Subject: nilfs2: make superblock data array index computation sparse friendly
+
+From: Ryusuke Konishi <konishi.ryusuke@gmail.com>
+
+[ Upstream commit 91d743a9c8299de1fc1b47428d8bb4c85face00f ]
+
+Upon running sparse, "warning: dubious: x & !y" is output at an array
+index calculation within nilfs_load_super_block().
+
+The calculation is not wrong, but to eliminate the sparse warning, replace
+it with an equivalent calculation.
+
+Also, add a comment to make it easier to understand what the unintuitive
+array index calculation is doing and whether it's correct.
+
+Link: https://lkml.kernel.org/r/20240430080019.4242-3-konishi.ryusuke@gmail.com
+Fixes: e339ad31f599 ("nilfs2: introduce secondary super block")
+Signed-off-by: Ryusuke Konishi <konishi.ryusuke@gmail.com>
+Cc: Bart Van Assche <bvanassche@acm.org>
+Cc: Jens Axboe <axboe@kernel.dk>
+Cc: kernel test robot <lkp@intel.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nilfs2/the_nilfs.c | 20 ++++++++++++++++++--
+ 1 file changed, 18 insertions(+), 2 deletions(-)
+
+diff --git a/fs/nilfs2/the_nilfs.c b/fs/nilfs2/the_nilfs.c
+index 71400496ed365..3e3c1d32da180 100644
+--- a/fs/nilfs2/the_nilfs.c
++++ b/fs/nilfs2/the_nilfs.c
+@@ -592,7 +592,7 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs,
+       struct nilfs_super_block **sbp = nilfs->ns_sbp;
+       struct buffer_head **sbh = nilfs->ns_sbh;
+       u64 sb2off, devsize = bdev_nr_bytes(nilfs->ns_bdev);
+-      int valid[2], swp = 0;
++      int valid[2], swp = 0, older;
+       if (devsize < NILFS_SEG_MIN_BLOCKS * NILFS_MIN_BLOCK_SIZE + 4096) {
+               nilfs_err(sb, "device size too small");
+@@ -648,9 +648,25 @@ static int nilfs_load_super_block(struct the_nilfs *nilfs,
+       if (swp)
+               nilfs_swap_super_block(nilfs);
++      /*
++       * Calculate the array index of the older superblock data.
++       * If one has been dropped, set index 0 pointing to the remaining one,
++       * otherwise set index 1 pointing to the old one (including if both
++       * are the same).
++       *
++       *  Divided case             valid[0]  valid[1]  swp  ->  older
++       *  -------------------------------------------------------------
++       *  Both SBs are invalid        0         0       N/A (Error)
++       *  SB1 is invalid              0         1       1         0
++       *  SB2 is invalid              1         0       0         0
++       *  SB2 is newer                1         1       1         0
++       *  SB2 is older or the same    1         1       0         1
++       */
++      older = valid[1] ^ swp;
++
+       nilfs->ns_sbwcount = 0;
+       nilfs->ns_sbwtime = le64_to_cpu(sbp[0]->s_wtime);
+-      nilfs->ns_prot_seq = le64_to_cpu(sbp[valid[1] & !swp]->s_last_seq);
++      nilfs->ns_prot_seq = le64_to_cpu(sbp[older]->s_last_seq);
+       *sbpp = sbp[0];
+       return 0;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.6/nouveau-add-an-ioctl-to-report-vram-usage.patch b/queue-6.6/nouveau-add-an-ioctl-to-report-vram-usage.patch
new file mode 100644 (file)
index 0000000..9042fc2
--- /dev/null
@@ -0,0 +1,60 @@
+From 70a58b7103b45590fc16fb49564b105d92ea2a4d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 24 Jan 2024 14:24:25 +1000
+Subject: nouveau: add an ioctl to report vram usage
+
+From: Dave Airlie <airlied@redhat.com>
+
+[ Upstream commit 72fa02fdf83306c52bc1eede28359e3fa32a151a ]
+
+This reports the currently used vram allocations.
+
+userspace using this has been proposed for nvk, but
+it's a rather trivial uapi addition.
+
+Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Stable-dep-of: aed9a1a4f710 ("drm/nouveau: use tile_mode and pte_kind for VM_BIND bo allocations")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/nouveau/nouveau_abi16.c | 5 +++++
+ include/uapi/drm/nouveau_drm.h          | 7 +++++++
+ 2 files changed, 12 insertions(+)
+
+diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
+index d05bd0ecea2b5..0fbc9c841666e 100644
+--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
++++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
+@@ -272,6 +272,11 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
+       case NOUVEAU_GETPARAM_VRAM_BAR_SIZE:
+               getparam->value = nvkm_device->func->resource_size(nvkm_device, 1);
+               break;
++      case NOUVEAU_GETPARAM_VRAM_USED: {
++              struct ttm_resource_manager *vram_mgr = ttm_manager_type(&drm->ttm.bdev, TTM_PL_VRAM);
++              getparam->value = (u64)ttm_resource_manager_usage(vram_mgr) << PAGE_SHIFT;
++              break;
++      }
+       default:
+               NV_PRINTK(dbg, cli, "unknown parameter %lld\n", getparam->param);
+               return -EINVAL;
+diff --git a/include/uapi/drm/nouveau_drm.h b/include/uapi/drm/nouveau_drm.h
+index 10a917639d8d3..77d7ff0d5b110 100644
+--- a/include/uapi/drm/nouveau_drm.h
++++ b/include/uapi/drm/nouveau_drm.h
+@@ -61,6 +61,13 @@ extern "C" {
+  */
+ #define NOUVEAU_GETPARAM_VRAM_BAR_SIZE 18
++/*
++ * NOUVEAU_GETPARAM_VRAM_USED
++ *
++ * Get remaining VRAM size.
++ */
++#define NOUVEAU_GETPARAM_VRAM_USED 19
++
+ struct drm_nouveau_getparam {
+       __u64 param;
+       __u64 value;
+-- 
+2.43.0
+
diff --git a/queue-6.6/nouveau-add-an-ioctl-to-return-vram-bar-size.patch b/queue-6.6/nouveau-add-an-ioctl-to-return-vram-bar-size.patch
new file mode 100644 (file)
index 0000000..7299ef7
--- /dev/null
@@ -0,0 +1,67 @@
+From 1bbf3a0808765f6a8b1b1d4b13f3a502c73653e5 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 24 Jan 2024 13:50:58 +1000
+Subject: nouveau: add an ioctl to return vram bar size.
+
+From: Dave Airlie <airlied@redhat.com>
+
+[ Upstream commit 3f4d8aac6e768c2215ce68275256971c2f54f0c8 ]
+
+This returns the BAR resources size so userspace can make
+decisions based on rebar support.
+
+userspace using this has been proposed for nvk, but
+it's a rather trivial uapi addition.
+
+Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Stable-dep-of: aed9a1a4f710 ("drm/nouveau: use tile_mode and pte_kind for VM_BIND bo allocations")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/nouveau/nouveau_abi16.c | 4 ++++
+ include/uapi/drm/nouveau_drm.h          | 7 +++++++
+ 2 files changed, 11 insertions(+)
+
+diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c
+index 2edd7bb13faea..d05bd0ecea2b5 100644
+--- a/drivers/gpu/drm/nouveau/nouveau_abi16.c
++++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c
+@@ -204,6 +204,7 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
+       struct nouveau_cli *cli = nouveau_cli(file_priv);
+       struct nouveau_drm *drm = nouveau_drm(dev);
+       struct nvif_device *device = &drm->client.device;
++      struct nvkm_device *nvkm_device = nvxx_device(&drm->client.device);
+       struct nvkm_gr *gr = nvxx_gr(device);
+       struct drm_nouveau_getparam *getparam = data;
+       struct pci_dev *pdev = to_pci_dev(dev->dev);
+@@ -268,6 +269,9 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)
+               getparam->value = nouveau_exec_push_max_from_ib_max(ib_max);
+               break;
+       }
++      case NOUVEAU_GETPARAM_VRAM_BAR_SIZE:
++              getparam->value = nvkm_device->func->resource_size(nvkm_device, 1);
++              break;
+       default:
+               NV_PRINTK(dbg, cli, "unknown parameter %lld\n", getparam->param);
+               return -EINVAL;
+diff --git a/include/uapi/drm/nouveau_drm.h b/include/uapi/drm/nouveau_drm.h
+index 0bade1592f34f..10a917639d8d3 100644
+--- a/include/uapi/drm/nouveau_drm.h
++++ b/include/uapi/drm/nouveau_drm.h
+@@ -54,6 +54,13 @@ extern "C" {
+  */
+ #define NOUVEAU_GETPARAM_EXEC_PUSH_MAX   17
++/*
++ * NOUVEAU_GETPARAM_VRAM_BAR_SIZE - query bar size
++ *
++ * Query the VRAM BAR size.
++ */
++#define NOUVEAU_GETPARAM_VRAM_BAR_SIZE 18
++
+ struct drm_nouveau_getparam {
+       __u64 param;
+       __u64 value;
+-- 
+2.43.0
+
diff --git a/queue-6.6/null_blk-fix-the-warning-modpost-missing-module_desc.patch b/queue-6.6/null_blk-fix-the-warning-modpost-missing-module_desc.patch
new file mode 100644 (file)
index 0000000..d68b79f
--- /dev/null
@@ -0,0 +1,34 @@
+From 6ec201a6d3999a07c75f5c8ade2d7fdb06d01bc8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 6 May 2024 09:55:38 +0200
+Subject: null_blk: Fix the WARNING: modpost: missing MODULE_DESCRIPTION()
+
+From: Zhu Yanjun <yanjun.zhu@linux.dev>
+
+[ Upstream commit 9e6727f824edcdb8fdd3e6e8a0862eb49546e1cd ]
+
+No functional changes intended.
+
+Fixes: f2298c0403b0 ("null_blk: multi queue aware block test driver")
+Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
+Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
+Link: https://lore.kernel.org/r/20240506075538.6064-1-yanjun.zhu@linux.dev
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/block/null_blk/main.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c
+index cc4dcb951fd24..561706fc2cd8e 100644
+--- a/drivers/block/null_blk/main.c
++++ b/drivers/block/null_blk/main.c
+@@ -2360,4 +2360,5 @@ module_init(null_init);
+ module_exit(null_exit);
+ MODULE_AUTHOR("Jens Axboe <axboe@kernel.dk>");
++MODULE_DESCRIPTION("multi queue aware block test driver");
+ MODULE_LICENSE("GPL");
+-- 
+2.43.0
+
diff --git a/queue-6.6/openvswitch-set-the-skbuff-pkt_type-for-proper-pmtud.patch b/queue-6.6/openvswitch-set-the-skbuff-pkt_type-for-proper-pmtud.patch
new file mode 100644 (file)
index 0000000..e1351f9
--- /dev/null
@@ -0,0 +1,101 @@
+From 82d0ec83d283cd08d5f8d7868f2b7e23343c6e1d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 16 May 2024 16:09:41 -0400
+Subject: openvswitch: Set the skbuff pkt_type for proper pmtud support.
+
+From: Aaron Conole <aconole@redhat.com>
+
+[ Upstream commit 30a92c9e3d6b073932762bef2ac66f4ee784c657 ]
+
+Open vSwitch is originally intended to switch at layer 2, only dealing with
+Ethernet frames.  With the introduction of l3 tunnels support, it crossed
+into the realm of needing to care a bit about some routing details when
+making forwarding decisions.  If an oversized packet would need to be
+fragmented during this forwarding decision, there is a chance for pmtu
+to get involved and generate a routing exception.  This is gated by the
+skbuff->pkt_type field.
+
+When a flow is already loaded into the openvswitch module this field is
+set up and transitioned properly as a packet moves from one port to
+another.  In the case that a packet execute is invoked after a flow is
+newly installed this field is not properly initialized.  This causes the
+pmtud mechanism to omit sending the required exception messages across
+the tunnel boundary and a second attempt needs to be made to make sure
+that the routing exception is properly setup.  To fix this, we set the
+outgoing packet's pkt_type to PACKET_OUTGOING, since it can only get
+to the openvswitch module via a port device or packet command.
+
+Even for bridge ports as users, the pkt_type needs to be reset when
+doing the transmit as the packet is truly outgoing and routing needs
+to get involved post packet transformations, in the case of
+VXLAN/GENEVE/udp-tunnel packets.  In general, the pkt_type on output
+gets ignored, since we go straight to the driver, but in the case of
+tunnel ports they go through IP routing layer.
+
+This issue is periodically encountered in complex setups, such as large
+openshift deployments, where multiple sets of tunnel traversal occurs.
+A way to recreate this is with the ovn-heater project that can setup
+a networking environment which mimics such large deployments.  We need
+larger environments for this because we need to ensure that flow
+misses occur.  In these environment, without this patch, we can see:
+
+  ./ovn_cluster.sh start
+  podman exec ovn-chassis-1 ip r a 170.168.0.5/32 dev eth1 mtu 1200
+  podman exec ovn-chassis-1 ip netns exec sw01p1 ip r flush cache
+  podman exec ovn-chassis-1 ip netns exec sw01p1 \
+         ping 21.0.0.3 -M do -s 1300 -c2
+  PING 21.0.0.3 (21.0.0.3) 1300(1328) bytes of data.
+  From 21.0.0.3 icmp_seq=2 Frag needed and DF set (mtu = 1142)
+
+  --- 21.0.0.3 ping statistics ---
+  ...
+
+Using tcpdump, we can also see the expected ICMP FRAG_NEEDED message is not
+sent into the server.
+
+With this patch, setting the pkt_type, we see the following:
+
+  podman exec ovn-chassis-1 ip netns exec sw01p1 \
+         ping 21.0.0.3 -M do -s 1300 -c2
+  PING 21.0.0.3 (21.0.0.3) 1300(1328) bytes of data.
+  From 21.0.0.3 icmp_seq=1 Frag needed and DF set (mtu = 1222)
+  ping: local error: message too long, mtu=1222
+
+  --- 21.0.0.3 ping statistics ---
+  ...
+
+In this case, the first ping request receives the FRAG_NEEDED message and
+a local routing exception is created.
+
+Tested-by: Jaime Caamano <jcaamano@redhat.com>
+Reported-at: https://issues.redhat.com/browse/FDP-164
+Fixes: 58264848a5a7 ("openvswitch: Add vxlan tunneling support.")
+Signed-off-by: Aaron Conole <aconole@redhat.com>
+Acked-by: Eelco Chaudron <echaudro@redhat.com>
+Link: https://lore.kernel.org/r/20240516200941.16152-1-aconole@redhat.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/openvswitch/actions.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
+index fd66014d8a76a..4f5cbcaa38386 100644
+--- a/net/openvswitch/actions.c
++++ b/net/openvswitch/actions.c
+@@ -929,6 +929,12 @@ static void do_output(struct datapath *dp, struct sk_buff *skb, int out_port,
+                               pskb_trim(skb, ovs_mac_header_len(key));
+               }
++              /* Need to set the pkt_type to involve the routing layer.  The
++               * packet movement through the OVS datapath doesn't generally
++               * use routing, but this is needed for tunnel cases.
++               */
++              skb->pkt_type = PACKET_OUTGOING;
++
+               if (likely(!mru ||
+                          (skb->len <= mru + vport->dev->hard_header_len))) {
+                       ovs_vport_send(vport, skb, ovs_key_mac_proto(key));
+-- 
+2.43.0
+
diff --git a/queue-6.6/perf-arm-dmc620-fix-lockdep-assert-in-event_init.patch b/queue-6.6/perf-arm-dmc620-fix-lockdep-assert-in-event_init.patch
new file mode 100644 (file)
index 0000000..9f1d08e
--- /dev/null
@@ -0,0 +1,61 @@
+From 84d1d3b78dc4a2426d4ea2f7ffaaf56b034ca4fc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 14 May 2024 11:00:50 -0700
+Subject: perf/arm-dmc620: Fix lockdep assert in ->event_init()
+
+From: Namhyung Kim <namhyung@kernel.org>
+
+[ Upstream commit a4c5a457c6107dfe9dc65a104af1634811396bac ]
+
+for_each_sibling_event() checks leader's ctx but it doesn't have the ctx
+yet if it's the leader.  Like in perf_event_validate_size(), we should
+skip checking siblings in that case.
+
+Acked-by: Mark Rutland <mark.rutland@arm.com>
+Fixes: f3c0eba28704 ("perf: Add a few assertions")
+Reported-by: Greg Thelen <gthelen@google.com>
+Cc: Robin Murphy <robin.murphy@arm.com>
+Cc: Tuan Phan <tuanphan@os.amperecomputing.com>
+Signed-off-by: Namhyung Kim <namhyung@kernel.org>
+Reviewed-by: Robin Murphy <robin.murphy@arm.com>
+Link: https://lore.kernel.org/r/20240514180050.182454-1-namhyung@kernel.org
+Signed-off-by: Will Deacon <will@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/perf/arm_dmc620_pmu.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/perf/arm_dmc620_pmu.c b/drivers/perf/arm_dmc620_pmu.c
+index 30cea68595747..b6a677224d682 100644
+--- a/drivers/perf/arm_dmc620_pmu.c
++++ b/drivers/perf/arm_dmc620_pmu.c
+@@ -542,12 +542,16 @@ static int dmc620_pmu_event_init(struct perf_event *event)
+       if (event->cpu < 0)
+               return -EINVAL;
++      hwc->idx = -1;
++
++      if (event->group_leader == event)
++              return 0;
++
+       /*
+        * We can't atomically disable all HW counters so only one event allowed,
+        * although software events are acceptable.
+        */
+-      if (event->group_leader != event &&
+-                      !is_software_event(event->group_leader))
++      if (!is_software_event(event->group_leader))
+               return -EINVAL;
+       for_each_sibling_event(sibling, event->group_leader) {
+@@ -556,7 +560,6 @@ static int dmc620_pmu_event_init(struct perf_event *event)
+                       return -EINVAL;
+       }
+-      hwc->idx = -1;
+       return 0;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.6/platform-x86-thinkpad_acpi-take-hotkey_mutex-during-.patch b/queue-6.6/platform-x86-thinkpad_acpi-take-hotkey_mutex-during-.patch
new file mode 100644 (file)
index 0000000..79f9527
--- /dev/null
@@ -0,0 +1,61 @@
+From 83d435af914b7cfbd440b92a4ab4dcbf01ed7d01 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 24 Apr 2024 14:28:11 +0200
+Subject: platform/x86: thinkpad_acpi: Take hotkey_mutex during hotkey_exit()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+[ Upstream commit e397c564298c2e91aea3887990da8e8eddb65277 ]
+
+hotkey_exit() already takes the mutex around the hotkey_poll_stop_sync()
+call, but not around the other calls.
+
+commit 38831eaf7d4c ("platform/x86: thinkpad_acpi: use lockdep
+annotations") has added lockdep_assert_held() checks to various hotkey
+functions.
+
+These lockdep_assert_held() checks fail causing WARN() backtraces in
+dmesg due to missing locking in hotkey_exit(), fix this.
+
+Fixes: 38831eaf7d4c ("platform/x86: thinkpad_acpi: use lockdep annotations")
+Tested-by: Mark Pearson <mpearson-lenovo@squebb.ca>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
+Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Link: https://lore.kernel.org/r/20240424122834.19801-2-hdegoede@redhat.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/platform/x86/thinkpad_acpi.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
+index 89c37a83d7fcd..5b1f08eabd923 100644
+--- a/drivers/platform/x86/thinkpad_acpi.c
++++ b/drivers/platform/x86/thinkpad_acpi.c
+@@ -3042,10 +3042,9 @@ static void tpacpi_send_radiosw_update(void)
+ static void hotkey_exit(void)
+ {
+-#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
+       mutex_lock(&hotkey_mutex);
++#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
+       hotkey_poll_stop_sync();
+-      mutex_unlock(&hotkey_mutex);
+ #endif
+       dbg_printk(TPACPI_DBG_EXIT | TPACPI_DBG_HKEY,
+                  "restoring original HKEY status and mask\n");
+@@ -3055,6 +3054,8 @@ static void hotkey_exit(void)
+             hotkey_mask_set(hotkey_orig_mask)) |
+            hotkey_status_set(false)) != 0)
+               pr_err("failed to restore hot key mask to BIOS defaults\n");
++
++      mutex_unlock(&hotkey_mutex);
+ }
+ static void __init hotkey_unmap(const unsigned int scancode)
+-- 
+2.43.0
+
diff --git a/queue-6.6/pnfs-filelayout-fixup-pnfs-allocation-modes.patch b/queue-6.6/pnfs-filelayout-fixup-pnfs-allocation-modes.patch
new file mode 100644 (file)
index 0000000..6a07bce
--- /dev/null
@@ -0,0 +1,45 @@
+From 29db5fc9608795542d1dd9643b985cf0c3d39687 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 7 May 2024 11:15:45 -0400
+Subject: pNFS/filelayout: fixup pNfs allocation modes
+
+From: Olga Kornievskaia <kolga@netapp.com>
+
+[ Upstream commit 3ebcb24646f8c5bfad2866892d3f3cff05514452 ]
+
+Change left over allocation flags.
+
+Fixes: a245832aaa99 ("pNFS/files: Ensure pNFS allocation modes are consistent with nfsiod")
+Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
+Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ fs/nfs/filelayout/filelayout.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/fs/nfs/filelayout/filelayout.c b/fs/nfs/filelayout/filelayout.c
+index ce8f8934bca51..569ae4ec60845 100644
+--- a/fs/nfs/filelayout/filelayout.c
++++ b/fs/nfs/filelayout/filelayout.c
+@@ -883,7 +883,7 @@ filelayout_pg_init_read(struct nfs_pageio_descriptor *pgio,
+                                                     NFS4_MAX_UINT64,
+                                                     IOMODE_READ,
+                                                     false,
+-                                                    GFP_KERNEL);
++                                                    nfs_io_gfp_mask());
+               if (IS_ERR(pgio->pg_lseg)) {
+                       pgio->pg_error = PTR_ERR(pgio->pg_lseg);
+                       pgio->pg_lseg = NULL;
+@@ -907,7 +907,7 @@ filelayout_pg_init_write(struct nfs_pageio_descriptor *pgio,
+                                                     NFS4_MAX_UINT64,
+                                                     IOMODE_RW,
+                                                     false,
+-                                                    GFP_NOFS);
++                                                    nfs_io_gfp_mask());
+               if (IS_ERR(pgio->pg_lseg)) {
+                       pgio->pg_error = PTR_ERR(pgio->pg_lseg);
+                       pgio->pg_lseg = NULL;
+-- 
+2.43.0
+
diff --git a/queue-6.6/powerpc-pseries-add-failure-related-checks-for-h_get.patch b/queue-6.6/powerpc-pseries-add-failure-related-checks-for-h_get.patch
new file mode 100644 (file)
index 0000000..052c6a3
--- /dev/null
@@ -0,0 +1,86 @@
+From 9340d8944ea2b36794e1586251400b2f4948fc72 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 12 Apr 2024 14:50:47 +0530
+Subject: powerpc/pseries: Add failure related checks for h_get_mpp and
+ h_get_ppp
+
+From: Shrikanth Hegde <sshegde@linux.ibm.com>
+
+[ Upstream commit 6d4341638516bf97b9a34947e0bd95035a8230a5 ]
+
+Couple of Minor fixes:
+
+- hcall return values are long. Fix that for h_get_mpp, h_get_ppp and
+parse_ppp_data
+
+- If hcall fails, values set should be at-least zero. It shouldn't be
+uninitialized values. Fix that for h_get_mpp and h_get_ppp
+
+Signed-off-by: Shrikanth Hegde <sshegde@linux.ibm.com>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://msgid.link/20240412092047.455483-3-sshegde@linux.ibm.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/powerpc/include/asm/hvcall.h        | 2 +-
+ arch/powerpc/platforms/pseries/lpar.c    | 6 +++---
+ arch/powerpc/platforms/pseries/lparcfg.c | 6 +++---
+ 3 files changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
+index c099780385dd3..92ea0fa17ff41 100644
+--- a/arch/powerpc/include/asm/hvcall.h
++++ b/arch/powerpc/include/asm/hvcall.h
+@@ -540,7 +540,7 @@ struct hvcall_mpp_data {
+       unsigned long backing_mem;
+ };
+-int h_get_mpp(struct hvcall_mpp_data *);
++long h_get_mpp(struct hvcall_mpp_data *mpp_data);
+ struct hvcall_mpp_x_data {
+       unsigned long coalesced_bytes;
+diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
+index 47d9a65324472..c3585e90c6db6 100644
+--- a/arch/powerpc/platforms/pseries/lpar.c
++++ b/arch/powerpc/platforms/pseries/lpar.c
+@@ -1886,10 +1886,10 @@ notrace void __trace_hcall_exit(long opcode, long retval, unsigned long *retbuf)
+  * h_get_mpp
+  * H_GET_MPP hcall returns info in 7 parms
+  */
+-int h_get_mpp(struct hvcall_mpp_data *mpp_data)
++long h_get_mpp(struct hvcall_mpp_data *mpp_data)
+ {
+-      int rc;
+-      unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
++      unsigned long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
++      long rc;
+       rc = plpar_hcall9(H_GET_MPP, retbuf);
+diff --git a/arch/powerpc/platforms/pseries/lparcfg.c b/arch/powerpc/platforms/pseries/lparcfg.c
+index 1c151d77e74b3..f04bfea1a97bd 100644
+--- a/arch/powerpc/platforms/pseries/lparcfg.c
++++ b/arch/powerpc/platforms/pseries/lparcfg.c
+@@ -113,8 +113,8 @@ struct hvcall_ppp_data {
+  */
+ static unsigned int h_get_ppp(struct hvcall_ppp_data *ppp_data)
+ {
+-      unsigned long rc;
+-      unsigned long retbuf[PLPAR_HCALL9_BUFSIZE];
++      unsigned long retbuf[PLPAR_HCALL9_BUFSIZE] = {0};
++      long rc;
+       rc = plpar_hcall9(H_GET_PPP, retbuf);
+@@ -193,7 +193,7 @@ static void parse_ppp_data(struct seq_file *m)
+       struct hvcall_ppp_data ppp_data;
+       struct device_node *root;
+       const __be32 *perf_level;
+-      int rc;
++      long rc;
+       rc = h_get_ppp(&ppp_data);
+       if (rc)
+-- 
+2.43.0
+
diff --git a/queue-6.6/regulator-bd71828-don-t-overwrite-runtime-voltages.patch b/queue-6.6/regulator-bd71828-don-t-overwrite-runtime-voltages.patch
new file mode 100644 (file)
index 0000000..fd26bff
--- /dev/null
@@ -0,0 +1,186 @@
+From 1c15129a2aab454f548850910e44702b8b5cf0fe Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 16 May 2024 11:54:41 +0300
+Subject: regulator: bd71828: Don't overwrite runtime voltages
+
+From: Matti Vaittinen <mazziesaccount@gmail.com>
+
+[ Upstream commit 0f9f7c63c415e287cd57b5c98be61eb320dedcfc ]
+
+Some of the regulators on the BD71828 have common voltage setting for
+RUN/SUSPEND/IDLE/LPSR states. The enable control can be set for each
+state though.
+
+The driver allows setting the voltage values for these states via
+device-tree. As a side effect, setting the voltages for
+SUSPEND/IDLE/LPSR will also change the RUN level voltage which is not
+desired and can break the system.
+
+The comment in code reflects this behaviour, but it is likely to not
+make people any happier. The right thing to do is to allow setting the
+enable/disable state at SUSPEND/IDLE/LPSR via device-tree, but to
+disallow setting state specific voltages for those regulators.
+
+BUCK1 is a bit different. It only shares the SUSPEND and LPSR state
+voltages. The former behaviour of allowing to silently overwrite the
+SUSPEND state voltage by LPSR state voltage is also changed here so that
+the SUSPEND voltage is prioritized over LPSR voltage.
+
+Prevent setting PMIC state specific voltages for regulators which do not
+support it.
+
+Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
+Fixes: 522498f8cb8c ("regulator: bd71828: Basic support for ROHM bd71828 PMIC regulators")
+Link: https://msgid.link/r/e1883ae1e3ae5668f1030455d4750923561f3d68.1715848512.git.mazziesaccount@gmail.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/regulator/bd71828-regulator.c | 58 +--------------------------
+ 1 file changed, 2 insertions(+), 56 deletions(-)
+
+diff --git a/drivers/regulator/bd71828-regulator.c b/drivers/regulator/bd71828-regulator.c
+index 08d4ee369287e..dd871ffe979c3 100644
+--- a/drivers/regulator/bd71828-regulator.c
++++ b/drivers/regulator/bd71828-regulator.c
+@@ -206,14 +206,11 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
+                       .suspend_reg = BD71828_REG_BUCK1_SUSP_VOLT,
+                       .suspend_mask = BD71828_MASK_BUCK1267_VOLT,
+                       .suspend_on_mask = BD71828_MASK_SUSP_EN,
+-                      .lpsr_on_mask = BD71828_MASK_LPSR_EN,
+                       /*
+                        * LPSR voltage is same as SUSPEND voltage. Allow
+-                       * setting it so that regulator can be set enabled at
+-                       * LPSR state
++                       * only enabling/disabling regulator for LPSR state
+                        */
+-                      .lpsr_reg = BD71828_REG_BUCK1_SUSP_VOLT,
+-                      .lpsr_mask = BD71828_MASK_BUCK1267_VOLT,
++                      .lpsr_on_mask = BD71828_MASK_LPSR_EN,
+               },
+               .reg_inits = buck1_inits,
+               .reg_init_amnt = ARRAY_SIZE(buck1_inits),
+@@ -288,13 +285,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
+                                    ROHM_DVS_LEVEL_SUSPEND |
+                                    ROHM_DVS_LEVEL_LPSR,
+                       .run_reg = BD71828_REG_BUCK3_VOLT,
+-                      .idle_reg = BD71828_REG_BUCK3_VOLT,
+-                      .suspend_reg = BD71828_REG_BUCK3_VOLT,
+-                      .lpsr_reg = BD71828_REG_BUCK3_VOLT,
+                       .run_mask = BD71828_MASK_BUCK3_VOLT,
+-                      .idle_mask = BD71828_MASK_BUCK3_VOLT,
+-                      .suspend_mask = BD71828_MASK_BUCK3_VOLT,
+-                      .lpsr_mask = BD71828_MASK_BUCK3_VOLT,
+                       .idle_on_mask = BD71828_MASK_IDLE_EN,
+                       .suspend_on_mask = BD71828_MASK_SUSP_EN,
+                       .lpsr_on_mask = BD71828_MASK_LPSR_EN,
+@@ -329,13 +320,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
+                                    ROHM_DVS_LEVEL_SUSPEND |
+                                    ROHM_DVS_LEVEL_LPSR,
+                       .run_reg = BD71828_REG_BUCK4_VOLT,
+-                      .idle_reg = BD71828_REG_BUCK4_VOLT,
+-                      .suspend_reg = BD71828_REG_BUCK4_VOLT,
+-                      .lpsr_reg = BD71828_REG_BUCK4_VOLT,
+                       .run_mask = BD71828_MASK_BUCK4_VOLT,
+-                      .idle_mask = BD71828_MASK_BUCK4_VOLT,
+-                      .suspend_mask = BD71828_MASK_BUCK4_VOLT,
+-                      .lpsr_mask = BD71828_MASK_BUCK4_VOLT,
+                       .idle_on_mask = BD71828_MASK_IDLE_EN,
+                       .suspend_on_mask = BD71828_MASK_SUSP_EN,
+                       .lpsr_on_mask = BD71828_MASK_LPSR_EN,
+@@ -370,13 +355,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
+                                    ROHM_DVS_LEVEL_SUSPEND |
+                                    ROHM_DVS_LEVEL_LPSR,
+                       .run_reg = BD71828_REG_BUCK5_VOLT,
+-                      .idle_reg = BD71828_REG_BUCK5_VOLT,
+-                      .suspend_reg = BD71828_REG_BUCK5_VOLT,
+-                      .lpsr_reg = BD71828_REG_BUCK5_VOLT,
+                       .run_mask = BD71828_MASK_BUCK5_VOLT,
+-                      .idle_mask = BD71828_MASK_BUCK5_VOLT,
+-                      .suspend_mask = BD71828_MASK_BUCK5_VOLT,
+-                      .lpsr_mask = BD71828_MASK_BUCK5_VOLT,
+                       .idle_on_mask = BD71828_MASK_IDLE_EN,
+                       .suspend_on_mask = BD71828_MASK_SUSP_EN,
+                       .lpsr_on_mask = BD71828_MASK_LPSR_EN,
+@@ -493,13 +472,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
+                                    ROHM_DVS_LEVEL_SUSPEND |
+                                    ROHM_DVS_LEVEL_LPSR,
+                       .run_reg = BD71828_REG_LDO1_VOLT,
+-                      .idle_reg = BD71828_REG_LDO1_VOLT,
+-                      .suspend_reg = BD71828_REG_LDO1_VOLT,
+-                      .lpsr_reg = BD71828_REG_LDO1_VOLT,
+                       .run_mask = BD71828_MASK_LDO_VOLT,
+-                      .idle_mask = BD71828_MASK_LDO_VOLT,
+-                      .suspend_mask = BD71828_MASK_LDO_VOLT,
+-                      .lpsr_mask = BD71828_MASK_LDO_VOLT,
+                       .idle_on_mask = BD71828_MASK_IDLE_EN,
+                       .suspend_on_mask = BD71828_MASK_SUSP_EN,
+                       .lpsr_on_mask = BD71828_MASK_LPSR_EN,
+@@ -533,13 +506,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
+                                    ROHM_DVS_LEVEL_SUSPEND |
+                                    ROHM_DVS_LEVEL_LPSR,
+                       .run_reg = BD71828_REG_LDO2_VOLT,
+-                      .idle_reg = BD71828_REG_LDO2_VOLT,
+-                      .suspend_reg = BD71828_REG_LDO2_VOLT,
+-                      .lpsr_reg = BD71828_REG_LDO2_VOLT,
+                       .run_mask = BD71828_MASK_LDO_VOLT,
+-                      .idle_mask = BD71828_MASK_LDO_VOLT,
+-                      .suspend_mask = BD71828_MASK_LDO_VOLT,
+-                      .lpsr_mask = BD71828_MASK_LDO_VOLT,
+                       .idle_on_mask = BD71828_MASK_IDLE_EN,
+                       .suspend_on_mask = BD71828_MASK_SUSP_EN,
+                       .lpsr_on_mask = BD71828_MASK_LPSR_EN,
+@@ -573,13 +540,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
+                                    ROHM_DVS_LEVEL_SUSPEND |
+                                    ROHM_DVS_LEVEL_LPSR,
+                       .run_reg = BD71828_REG_LDO3_VOLT,
+-                      .idle_reg = BD71828_REG_LDO3_VOLT,
+-                      .suspend_reg = BD71828_REG_LDO3_VOLT,
+-                      .lpsr_reg = BD71828_REG_LDO3_VOLT,
+                       .run_mask = BD71828_MASK_LDO_VOLT,
+-                      .idle_mask = BD71828_MASK_LDO_VOLT,
+-                      .suspend_mask = BD71828_MASK_LDO_VOLT,
+-                      .lpsr_mask = BD71828_MASK_LDO_VOLT,
+                       .idle_on_mask = BD71828_MASK_IDLE_EN,
+                       .suspend_on_mask = BD71828_MASK_SUSP_EN,
+                       .lpsr_on_mask = BD71828_MASK_LPSR_EN,
+@@ -614,13 +575,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
+                                    ROHM_DVS_LEVEL_SUSPEND |
+                                    ROHM_DVS_LEVEL_LPSR,
+                       .run_reg = BD71828_REG_LDO4_VOLT,
+-                      .idle_reg = BD71828_REG_LDO4_VOLT,
+-                      .suspend_reg = BD71828_REG_LDO4_VOLT,
+-                      .lpsr_reg = BD71828_REG_LDO4_VOLT,
+                       .run_mask = BD71828_MASK_LDO_VOLT,
+-                      .idle_mask = BD71828_MASK_LDO_VOLT,
+-                      .suspend_mask = BD71828_MASK_LDO_VOLT,
+-                      .lpsr_mask = BD71828_MASK_LDO_VOLT,
+                       .idle_on_mask = BD71828_MASK_IDLE_EN,
+                       .suspend_on_mask = BD71828_MASK_SUSP_EN,
+                       .lpsr_on_mask = BD71828_MASK_LPSR_EN,
+@@ -655,13 +610,7 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
+                                    ROHM_DVS_LEVEL_SUSPEND |
+                                    ROHM_DVS_LEVEL_LPSR,
+                       .run_reg = BD71828_REG_LDO5_VOLT,
+-                      .idle_reg = BD71828_REG_LDO5_VOLT,
+-                      .suspend_reg = BD71828_REG_LDO5_VOLT,
+-                      .lpsr_reg = BD71828_REG_LDO5_VOLT,
+                       .run_mask = BD71828_MASK_LDO_VOLT,
+-                      .idle_mask = BD71828_MASK_LDO_VOLT,
+-                      .suspend_mask = BD71828_MASK_LDO_VOLT,
+-                      .lpsr_mask = BD71828_MASK_LDO_VOLT,
+                       .idle_on_mask = BD71828_MASK_IDLE_EN,
+                       .suspend_on_mask = BD71828_MASK_SUSP_EN,
+                       .lpsr_on_mask = BD71828_MASK_LPSR_EN,
+@@ -720,9 +669,6 @@ static const struct bd71828_regulator_data bd71828_rdata[] = {
+                       .suspend_reg = BD71828_REG_LDO7_VOLT,
+                       .lpsr_reg = BD71828_REG_LDO7_VOLT,
+                       .run_mask = BD71828_MASK_LDO_VOLT,
+-                      .idle_mask = BD71828_MASK_LDO_VOLT,
+-                      .suspend_mask = BD71828_MASK_LDO_VOLT,
+-                      .lpsr_mask = BD71828_MASK_LDO_VOLT,
+                       .idle_on_mask = BD71828_MASK_IDLE_EN,
+                       .suspend_on_mask = BD71828_MASK_SUSP_EN,
+                       .lpsr_on_mask = BD71828_MASK_LPSR_EN,
+-- 
+2.43.0
+
diff --git a/queue-6.6/regulator-pickable-ranges-don-t-always-cache-vsel.patch b/queue-6.6/regulator-pickable-ranges-don-t-always-cache-vsel.patch
new file mode 100644 (file)
index 0000000..9269267
--- /dev/null
@@ -0,0 +1,114 @@
+From d2d57f5cf9909708170b556c82c4eea8c6fedfbf Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 20 May 2024 15:31:33 +0300
+Subject: regulator: pickable ranges: don't always cache vsel
+
+From: Matti Vaittinen <mazziesaccount@gmail.com>
+
+[ Upstream commit f4f4276f985a5aac7b310a4ed040b47e275e7591 ]
+
+Some PMICs treat the vsel_reg same as apply-bit. Eg, when voltage range
+is changed, the new voltage setting is not taking effect until the vsel
+register is written.
+
+Add a flag 'range_applied_by_vsel' to the regulator desc to indicate this
+behaviour and to force the vsel value to be written to hardware if range
+was changed, even if the old selector was same as the new one.
+
+Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
+Link: https://msgid.link/r/ZktCpcGZdgHWuN_L@fedora
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Stable-dep-of: 1ace99d7c7c4 ("regulator: tps6287x: Force writing VSEL bit")
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/regulator/helpers.c      | 43 ++++++++++++++++++++++----------
+ include/linux/regulator/driver.h |  3 +++
+ 2 files changed, 33 insertions(+), 13 deletions(-)
+
+diff --git a/drivers/regulator/helpers.c b/drivers/regulator/helpers.c
+index d492683365532..6e1ace660b8cf 100644
+--- a/drivers/regulator/helpers.c
++++ b/drivers/regulator/helpers.c
+@@ -161,6 +161,32 @@ int regulator_get_voltage_sel_pickable_regmap(struct regulator_dev *rdev)
+ }
+ EXPORT_SYMBOL_GPL(regulator_get_voltage_sel_pickable_regmap);
++static int write_separate_vsel_and_range(struct regulator_dev *rdev,
++                                       unsigned int sel, unsigned int range)
++{
++      bool range_updated;
++      int ret;
++
++      ret = regmap_update_bits_base(rdev->regmap, rdev->desc->vsel_range_reg,
++                                    rdev->desc->vsel_range_mask,
++                                    range, &range_updated, false, false);
++      if (ret)
++              return ret;
++
++      /*
++       * Some PMICs treat the vsel_reg same as apply-bit. Force it to be
++       * written if the range changed, even if the old selector was same as
++       * the new one
++       */
++      if (rdev->desc->range_applied_by_vsel && range_updated)
++              return regmap_write_bits(rdev->regmap,
++                                      rdev->desc->vsel_reg,
++                                      rdev->desc->vsel_mask, sel);
++
++      return regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg,
++                                rdev->desc->vsel_mask, sel);
++}
++
+ /**
+  * regulator_set_voltage_sel_pickable_regmap - pickable range set_voltage_sel
+  *
+@@ -199,21 +225,12 @@ int regulator_set_voltage_sel_pickable_regmap(struct regulator_dev *rdev,
+       range = rdev->desc->linear_range_selectors_bitfield[i];
+       range <<= ffs(rdev->desc->vsel_range_mask) - 1;
+-      if (rdev->desc->vsel_reg == rdev->desc->vsel_range_reg) {
+-              ret = regmap_update_bits(rdev->regmap,
+-                                       rdev->desc->vsel_reg,
++      if (rdev->desc->vsel_reg == rdev->desc->vsel_range_reg)
++              ret = regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg,
+                                        rdev->desc->vsel_range_mask |
+                                        rdev->desc->vsel_mask, sel | range);
+-      } else {
+-              ret = regmap_update_bits(rdev->regmap,
+-                                       rdev->desc->vsel_range_reg,
+-                                       rdev->desc->vsel_range_mask, range);
+-              if (ret)
+-                      return ret;
+-
+-              ret = regmap_update_bits(rdev->regmap, rdev->desc->vsel_reg,
+-                                rdev->desc->vsel_mask, sel);
+-      }
++      else
++              ret = write_separate_vsel_and_range(rdev, sel, range);
+       if (ret)
+               return ret;
+diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
+index 4b7eceb3828b0..2dbf87233f85a 100644
+--- a/include/linux/regulator/driver.h
++++ b/include/linux/regulator/driver.h
+@@ -304,6 +304,8 @@ enum regulator_type {
+  * @vsel_range_reg: Register for range selector when using pickable ranges
+  *                and ``regulator_map_*_voltage_*_pickable`` functions.
+  * @vsel_range_mask: Mask for register bitfield used for range selector
++ * @range_applied_by_vsel: A flag to indicate that changes to vsel_range_reg
++ *                       are only effective after vsel_reg is written
+  * @vsel_reg: Register for selector when using ``regulator_map_*_voltage_*``
+  * @vsel_mask: Mask for register bitfield used for selector
+  * @vsel_step: Specify the resolution of selector stepping when setting
+@@ -394,6 +396,7 @@ struct regulator_desc {
+       unsigned int vsel_range_reg;
+       unsigned int vsel_range_mask;
++      bool range_applied_by_vsel;
+       unsigned int vsel_reg;
+       unsigned int vsel_mask;
+       unsigned int vsel_step;
+-- 
+2.43.0
+
diff --git a/queue-6.6/regulator-tps6287x-force-writing-vsel-bit.patch b/queue-6.6/regulator-tps6287x-force-writing-vsel-bit.patch
new file mode 100644 (file)
index 0000000..9c765cb
--- /dev/null
@@ -0,0 +1,64 @@
+From 6167feee813e0e5f6447ae458c7b98ce86f082bc Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 20 May 2024 15:36:55 +0300
+Subject: regulator: tps6287x: Force writing VSEL bit
+
+From: Matti Vaittinen <mazziesaccount@gmail.com>
+
+[ Upstream commit 1ace99d7c7c4c801c0660246f741ff846a9b8e3c ]
+
+The data-sheet for TPS6287x-Q1
+https://www.ti.com/lit/ds/symlink/tps62873-q1.pdf
+states at chapter 9.3.6.1 Output Voltage Range:
+
+"Note that every change to the VRANGE[1:0] bits must be followed by a
+write to the VSET register, even if the value of the VSET[7:0] bits does
+not change."
+
+The current implementation of the driver uses the
+regulator_set_voltage_sel_pickable_regmap() helper which further uses
+regmap_update_bits() to write the VSET-register. The
+regmap_update_bits() will not access the hardware if the new register
+value is same as old. It is worth noting that this is true also when the
+register is marked volatile, which I can't say is wrong because
+'read-mnodify-write'-cycle with a volatile register is in any case
+something user should carefully consider.
+
+The 'range_applied_by_vsel'-flag in regulator desc was added to force
+the vsel register upodates by using regmap_write_bits(). This variant
+will always unconditionally write the bits to the hardware.
+
+It is worth noting that the vsel is now forced to be written to the
+hardware, whether the range was changed or not. This may cause a
+performance drop if users are wrtiting same voltage value repeteadly.
+
+It would be possible to read the range register to determine if it was
+changed, but this would be a performance issue for users who don't use
+reg cache for vsel.
+
+Always write the VSET register to the hardware regardless the cache.
+
+Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
+Fixes: 7b0518fbf2be ("regulator: Add support for TI TPS6287x regulators")
+Link: https://msgid.link/r/ZktD50C5twF1EuKu@fedora
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/regulator/tps6287x-regulator.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/drivers/regulator/tps6287x-regulator.c b/drivers/regulator/tps6287x-regulator.c
+index 9b7c3d77789e3..3c9d79e003e4b 100644
+--- a/drivers/regulator/tps6287x-regulator.c
++++ b/drivers/regulator/tps6287x-regulator.c
+@@ -115,6 +115,7 @@ static struct regulator_desc tps6287x_reg = {
+       .vsel_mask = 0xFF,
+       .vsel_range_reg = TPS6287X_CTRL2,
+       .vsel_range_mask = TPS6287X_CTRL2_VRANGE,
++      .range_applied_by_vsel = true,
+       .ramp_reg = TPS6287X_CTRL1,
+       .ramp_mask = TPS6287X_CTRL1_VRAMP,
+       .ramp_delay_table = tps6287x_ramp_table,
+-- 
+2.43.0
+
diff --git a/queue-6.6/regulator-tps6594-regulator-correct-multi-phase-conf.patch b/queue-6.6/regulator-tps6594-regulator-correct-multi-phase-conf.patch
new file mode 100644 (file)
index 0000000..9ce0b68
--- /dev/null
@@ -0,0 +1,72 @@
+From 6c8efab23e089bb505c1358a1d80cb680ecc9b9b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 May 2024 15:17:58 +0530
+Subject: regulator: tps6594-regulator: Correct multi-phase configuration
+
+From: Neha Malcom Francis <n-francis@ti.com>
+
+[ Upstream commit 74b38cd77d3eb63c6d0ad9cf2ae59812ae54d3ee ]
+
+According to the TPS6594 PMIC Manual (linked) 8.3.2.1.4 Multi-Phase BUCK
+Regulator Configurations section, the PMIC ignores all the other bucks'
+except the primary buck's regulator registers. This is BUCK1 for
+configurations BUCK12, BUCK123 and BUCK1234 while it is BUCK3 for
+BUCK34. Correct the registers mapped for these configurations
+accordingly.
+
+Fixes: f17ccc5deb4d ("regulator: tps6594-regulator: Add driver for TI TPS6594 regulators")
+Link: https://www.ti.com/lit/gpn/tps6594-q1
+Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
+Link: https://msgid.link/r/20240521094758.2190331-1-n-francis@ti.com
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/regulator/tps6594-regulator.c | 16 ++++++++--------
+ 1 file changed, 8 insertions(+), 8 deletions(-)
+
+diff --git a/drivers/regulator/tps6594-regulator.c b/drivers/regulator/tps6594-regulator.c
+index b7f0c87797577..5fad61785e72f 100644
+--- a/drivers/regulator/tps6594-regulator.c
++++ b/drivers/regulator/tps6594-regulator.c
+@@ -287,30 +287,30 @@ static struct tps6594_regulator_irq_type *tps6594_ldos_irq_types[] = {
+ static const struct regulator_desc multi_regs[] = {
+       TPS6594_REGULATOR("BUCK12", "buck12", TPS6594_BUCK_1,
+                         REGULATOR_VOLTAGE, tps6594_bucks_ops, TPS6594_MASK_BUCKS_VSET,
+-                        TPS6594_REG_BUCKX_VOUT_1(1),
++                        TPS6594_REG_BUCKX_VOUT_1(0),
+                         TPS6594_MASK_BUCKS_VSET,
+-                        TPS6594_REG_BUCKX_CTRL(1),
++                        TPS6594_REG_BUCKX_CTRL(0),
+                         TPS6594_BIT_BUCK_EN, 0, 0, bucks_ranges,
+                         4, 4000, 0, NULL, 0, 0),
+       TPS6594_REGULATOR("BUCK34", "buck34", TPS6594_BUCK_3,
+                         REGULATOR_VOLTAGE, tps6594_bucks_ops, TPS6594_MASK_BUCKS_VSET,
+-                        TPS6594_REG_BUCKX_VOUT_1(3),
++                        TPS6594_REG_BUCKX_VOUT_1(2),
+                         TPS6594_MASK_BUCKS_VSET,
+-                        TPS6594_REG_BUCKX_CTRL(3),
++                        TPS6594_REG_BUCKX_CTRL(2),
+                         TPS6594_BIT_BUCK_EN, 0, 0, bucks_ranges,
+                         4, 0, 0, NULL, 0, 0),
+       TPS6594_REGULATOR("BUCK123", "buck123", TPS6594_BUCK_1,
+                         REGULATOR_VOLTAGE, tps6594_bucks_ops, TPS6594_MASK_BUCKS_VSET,
+-                        TPS6594_REG_BUCKX_VOUT_1(1),
++                        TPS6594_REG_BUCKX_VOUT_1(0),
+                         TPS6594_MASK_BUCKS_VSET,
+-                        TPS6594_REG_BUCKX_CTRL(1),
++                        TPS6594_REG_BUCKX_CTRL(0),
+                         TPS6594_BIT_BUCK_EN, 0, 0, bucks_ranges,
+                         4, 4000, 0, NULL, 0, 0),
+       TPS6594_REGULATOR("BUCK1234", "buck1234", TPS6594_BUCK_1,
+                         REGULATOR_VOLTAGE, tps6594_bucks_ops, TPS6594_MASK_BUCKS_VSET,
+-                        TPS6594_REG_BUCKX_VOUT_1(1),
++                        TPS6594_REG_BUCKX_VOUT_1(0),
+                         TPS6594_MASK_BUCKS_VSET,
+-                        TPS6594_REG_BUCKX_CTRL(1),
++                        TPS6594_REG_BUCKX_CTRL(0),
+                         TPS6594_BIT_BUCK_EN, 0, 0, bucks_ranges,
+                         4, 4000, 0, NULL, 0, 0),
+ };
+-- 
+2.43.0
+
diff --git a/queue-6.6/revert-drm-bridge-ti-sn65dsi83-fix-enable-error-path.patch b/queue-6.6/revert-drm-bridge-ti-sn65dsi83-fix-enable-error-path.patch
new file mode 100644 (file)
index 0000000..81bbd9e
--- /dev/null
@@ -0,0 +1,82 @@
+From 7cd32d037001fddca7aff638feeb97a928c1b768 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 26 Apr 2024 14:22:59 +0200
+Subject: Revert "drm/bridge: ti-sn65dsi83: Fix enable error path"
+
+From: Luca Ceresoli <luca.ceresoli@bootlin.com>
+
+[ Upstream commit ad81feb5b6f1f5461641706376dcf7a9914ed2e7 ]
+
+This reverts commit 8a91b29f1f50ce7742cdbe5cf11d17f128511f3f.
+
+The regulator_disable() added by the original commit solves one kind of
+regulator imbalance but adds another one as it allows the regulator to be
+disabled one more time than it is enabled in the following scenario:
+
+ 1. Start video pipeline -> sn65dsi83_atomic_pre_enable -> regulator_enable
+ 2. PLL lock fails -> regulator_disable
+ 3. Stop video pipeline -> sn65dsi83_atomic_disable -> regulator_disable
+
+The reason is clear from the code flow, which looks like this (after
+removing unrelated code):
+
+  static void sn65dsi83_atomic_pre_enable()
+  {
+      regulator_enable(ctx->vcc);
+
+      if (PLL failed locking) {
+          regulator_disable(ctx->vcc);  <---- added by patch being reverted
+          return;
+      }
+  }
+
+  static void sn65dsi83_atomic_disable()
+  {
+      regulator_disable(ctx->vcc);
+  }
+
+The use case for introducing the additional regulator_disable() was
+removing the module for debugging (see link below for the discussion). If
+the module is removed after a .atomic_pre_enable, i.e. with an active
+pipeline from the DRM point of view, .atomic_disable is not called and thus
+the regulator would not be disabled.
+
+According to the discussion however there is no actual use case for
+removing the module with an active pipeline, except for
+debugging/development.
+
+On the other hand, the occurrence of a PLL lock failure is possible due to
+any physical reason (e.g. a temporary hardware failure for electrical
+reasons) so handling it gracefully should be supported. As there is no way
+for .atomic[_pre]_enable to report an error to the core, the only clean way
+to support it is calling regulator_disabled() only in .atomic_disable,
+unconditionally, as it was before.
+
+Link: https://lore.kernel.org/all/15244220.uLZWGnKmhe@steina-w/
+Fixes: 8a91b29f1f50 ("drm/bridge: ti-sn65dsi83: Fix enable error path")
+Reviewed-by: Alexander Stein <alexander.stein@ew.tq-group.com>
+Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
+Signed-off-by: Robert Foss <rfoss@kernel.org>
+Link: https://patchwork.freedesktop.org/patch/msgid/20240426122259.46808-1-luca.ceresoli@bootlin.com
+(cherry picked from commit 2940ee03b23281071620dda1d790cd644dabd394)
+Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/gpu/drm/bridge/ti-sn65dsi83.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi83.c b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
+index 061e8bd5915de..8a23116346a8a 100644
+--- a/drivers/gpu/drm/bridge/ti-sn65dsi83.c
++++ b/drivers/gpu/drm/bridge/ti-sn65dsi83.c
+@@ -478,7 +478,6 @@ static void sn65dsi83_atomic_pre_enable(struct drm_bridge *bridge,
+               dev_err(ctx->dev, "failed to lock PLL, ret=%i\n", ret);
+               /* On failure, disable PLL again and exit. */
+               regmap_write(ctx->regmap, REG_RC_PLL_EN, 0x00);
+-              regulator_disable(ctx->vcc);
+               return;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.6/revert-ixgbe-manual-an-37-for-troublesome-link-partn.patch b/queue-6.6/revert-ixgbe-manual-an-37-for-troublesome-link-partn.patch
new file mode 100644 (file)
index 0000000..53741ae
--- /dev/null
@@ -0,0 +1,148 @@
+From 7f998b015a701fbd87ab25eb9ce601acc00ad9e0 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 20 May 2024 17:21:27 -0700
+Subject: Revert "ixgbe: Manual AN-37 for troublesome link partners for X550
+ SFI"
+
+From: Jacob Keller <jacob.e.keller@intel.com>
+
+[ Upstream commit b35b1c0b4e166a427395deaf61e3140495dfcb89 ]
+
+This reverts commit 565736048bd5f9888990569993c6b6bfdf6dcb6d.
+
+According to the commit, it implements a manual AN-37 for some
+"troublesome" Juniper MX5 switches. This appears to be a workaround for a
+particular switch.
+
+It has been reported that this causes a severe breakage for other switches,
+including a Cisco 3560CX-12PD-S.
+
+The code appears to be a workaround for a specific switch which fails to
+link in SFI mode. It expects to see AN-37 auto negotiation in order to
+link. The Cisco switch is not expecting AN-37 auto negotiation. When the
+device starts the manual AN-37, the Cisco switch decides that the port is
+confused and stops attempting to link with it. This persists until a power
+cycle. A simple driver unload and reload does not resolve the issue, even
+if loading with a version of the driver which lacks this workaround.
+
+The authors of the workaround commit have not responded with
+clarifications, and the result of the workaround is complete failure to
+connect with other switches.
+
+This appears to be a case where the driver can either "correctly" link with
+the Juniper MX5 switch, at the cost of bricking the link with the Cisco
+switch, or it can behave properly for the Cisco switch, but fail to link
+with the Junipir MX5 switch. I do not know enough about the standards
+involved to clearly determine whether either switch is at fault or behaving
+incorrectly. Nor do I know whether there exists some alternative fix which
+corrects behavior with both switches.
+
+Revert the workaround for the Juniper switch.
+
+Fixes: 565736048bd5 ("ixgbe: Manual AN-37 for troublesome link partners for X550 SFI")
+Link: https://lore.kernel.org/netdev/cbe874db-9ac9-42b8-afa0-88ea910e1e99@intel.com/T/
+Link: https://forum.proxmox.com/threads/intel-x553-sfp-ixgbe-no-go-on-pve8.135129/#post-612291
+Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
+Cc: Jeff Daly <jeffd@silicom-usa.com>
+Cc: kernel.org-fo5k2w@ycharbi.fr
+Reviewed-by: Simon Horman <horms@kernel.org>
+Link: https://lore.kernel.org/r/20240520-net-2024-05-20-revert-silicom-switch-workaround-v1-1-50f80f261c94@intel.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/net/ethernet/intel/ixgbe/ixgbe_type.h |  3 -
+ drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 56 +------------------
+ 2 files changed, 3 insertions(+), 56 deletions(-)
+
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
+index 61b9774b3d31e..c24a72d1e2737 100644
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_type.h
+@@ -3673,9 +3673,7 @@ struct ixgbe_info {
+ #define IXGBE_KRM_LINK_S1(P)          ((P) ? 0x8200 : 0x4200)
+ #define IXGBE_KRM_LINK_CTRL_1(P)      ((P) ? 0x820C : 0x420C)
+ #define IXGBE_KRM_AN_CNTL_1(P)                ((P) ? 0x822C : 0x422C)
+-#define IXGBE_KRM_AN_CNTL_4(P)                ((P) ? 0x8238 : 0x4238)
+ #define IXGBE_KRM_AN_CNTL_8(P)                ((P) ? 0x8248 : 0x4248)
+-#define IXGBE_KRM_PCS_KX_AN(P)                ((P) ? 0x9918 : 0x5918)
+ #define IXGBE_KRM_SGMII_CTRL(P)               ((P) ? 0x82A0 : 0x42A0)
+ #define IXGBE_KRM_LP_BASE_PAGE_HIGH(P)        ((P) ? 0x836C : 0x436C)
+ #define IXGBE_KRM_DSP_TXFFE_STATE_4(P)        ((P) ? 0x8634 : 0x4634)
+@@ -3685,7 +3683,6 @@ struct ixgbe_info {
+ #define IXGBE_KRM_PMD_FLX_MASK_ST20(P)        ((P) ? 0x9054 : 0x5054)
+ #define IXGBE_KRM_TX_COEFF_CTRL_1(P)  ((P) ? 0x9520 : 0x5520)
+ #define IXGBE_KRM_RX_ANA_CTL(P)               ((P) ? 0x9A00 : 0x5A00)
+-#define IXGBE_KRM_FLX_TMRS_CTRL_ST31(P)       ((P) ? 0x9180 : 0x5180)
+ #define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_DA                ~(0x3 << 20)
+ #define IXGBE_KRM_PMD_FLX_MASK_ST20_SFI_10G_SR                BIT(20)
+diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
+index c1adc94a5a657..f806fbf25ec7c 100644
+--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
++++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
+@@ -1722,59 +1722,9 @@ static s32 ixgbe_setup_sfi_x550a(struct ixgbe_hw *hw, ixgbe_link_speed *speed)
+               return -EINVAL;
+       }
+-      (void)mac->ops.write_iosf_sb_reg(hw,
+-                      IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
+-                      IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+-
+-      /* change mode enforcement rules to hybrid */
+-      (void)mac->ops.read_iosf_sb_reg(hw,
+-                      IXGBE_KRM_FLX_TMRS_CTRL_ST31(hw->bus.lan_id),
+-                      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+-      reg_val |= 0x0400;
+-
+-      (void)mac->ops.write_iosf_sb_reg(hw,
+-                      IXGBE_KRM_FLX_TMRS_CTRL_ST31(hw->bus.lan_id),
+-                      IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+-
+-      /* manually control the config */
+-      (void)mac->ops.read_iosf_sb_reg(hw,
+-                      IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+-                      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+-      reg_val |= 0x20002240;
+-
+-      (void)mac->ops.write_iosf_sb_reg(hw,
+-                      IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+-                      IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+-
+-      /* move the AN base page values */
+-      (void)mac->ops.read_iosf_sb_reg(hw,
+-                      IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id),
+-                      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+-      reg_val |= 0x1;
+-
+-      (void)mac->ops.write_iosf_sb_reg(hw,
+-                      IXGBE_KRM_PCS_KX_AN(hw->bus.lan_id),
+-                      IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+-
+-      /* set the AN37 over CB mode */
+-      (void)mac->ops.read_iosf_sb_reg(hw,
+-                      IXGBE_KRM_AN_CNTL_4(hw->bus.lan_id),
+-                      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+-      reg_val |= 0x20000000;
+-
+-      (void)mac->ops.write_iosf_sb_reg(hw,
+-                      IXGBE_KRM_AN_CNTL_4(hw->bus.lan_id),
+-                      IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+-
+-      /* restart AN manually */
+-      (void)mac->ops.read_iosf_sb_reg(hw,
+-                      IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+-                      IXGBE_SB_IOSF_TARGET_KR_PHY, &reg_val);
+-      reg_val |= IXGBE_KRM_LINK_CTRL_1_TETH_AN_RESTART;
+-
+-      (void)mac->ops.write_iosf_sb_reg(hw,
+-                      IXGBE_KRM_LINK_CTRL_1(hw->bus.lan_id),
+-                      IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
++      status = mac->ops.write_iosf_sb_reg(hw,
++                              IXGBE_KRM_PMD_FLX_MASK_ST20(hw->bus.lan_id),
++                              IXGBE_SB_IOSF_TARGET_KR_PHY, reg_val);
+       /* Toggle port SW reset by AN reset. */
+       status = ixgbe_restart_an_internal_phy_x550em(hw);
+-- 
+2.43.0
+
diff --git a/queue-6.6/riscv-cpufeature-fix-thead-vector-hwcap-removal.patch b/queue-6.6/riscv-cpufeature-fix-thead-vector-hwcap-removal.patch
new file mode 100644 (file)
index 0000000..7d3c555
--- /dev/null
@@ -0,0 +1,136 @@
+From 4d6441c0930663b95c8144abe824598e42076ab9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 2 May 2024 21:50:50 -0700
+Subject: riscv: cpufeature: Fix thead vector hwcap removal
+
+From: Charlie Jenkins <charlie@rivosinc.com>
+
+[ Upstream commit e482eab4d1eb31031eff2b6afb71776483101979 ]
+
+The riscv_cpuinfo struct that contains mvendorid and marchid is not
+populated until all harts are booted which happens after the DT parsing.
+Use the mvendorid/marchid from the boot hart to determine if the DT
+contains an invalid V.
+
+Fixes: d82f32202e0d ("RISC-V: Ignore V from the riscv,isa DT property on older T-Head CPUs")
+Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
+Reviewed-by: Conor Dooley <conor.dooley@microchip.com>
+Reviewed-by: Guo Ren <guoren@kernel.org>
+Link: https://lore.kernel.org/r/20240502-cpufeature_fixes-v4-1-b3d1a088722d@rivosinc.com
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/riscv/include/asm/sbi.h   |  2 ++
+ arch/riscv/kernel/cpu.c        | 40 ++++++++++++++++++++++++++++++----
+ arch/riscv/kernel/cpufeature.c |  8 +++++--
+ 3 files changed, 44 insertions(+), 6 deletions(-)
+
+diff --git a/arch/riscv/include/asm/sbi.h b/arch/riscv/include/asm/sbi.h
+index b79d0228144f4..3ed853b8a8c85 100644
+--- a/arch/riscv/include/asm/sbi.h
++++ b/arch/riscv/include/asm/sbi.h
+@@ -327,6 +327,8 @@ static inline int sbi_remote_fence_i(const struct cpumask *cpu_mask) { return -1
+ static inline void sbi_init(void) {}
+ #endif /* CONFIG_RISCV_SBI */
++unsigned long riscv_get_mvendorid(void);
++unsigned long riscv_get_marchid(void);
+ unsigned long riscv_cached_mvendorid(unsigned int cpu_id);
+ unsigned long riscv_cached_marchid(unsigned int cpu_id);
+ unsigned long riscv_cached_mimpid(unsigned int cpu_id);
+diff --git a/arch/riscv/kernel/cpu.c b/arch/riscv/kernel/cpu.c
+index 157ace8b262c2..88732abecd023 100644
+--- a/arch/riscv/kernel/cpu.c
++++ b/arch/riscv/kernel/cpu.c
+@@ -139,6 +139,34 @@ int riscv_of_parent_hartid(struct device_node *node, unsigned long *hartid)
+       return -1;
+ }
++unsigned long __init riscv_get_marchid(void)
++{
++      struct riscv_cpuinfo *ci = this_cpu_ptr(&riscv_cpuinfo);
++
++#if IS_ENABLED(CONFIG_RISCV_SBI)
++      ci->marchid = sbi_spec_is_0_1() ? 0 : sbi_get_marchid();
++#elif IS_ENABLED(CONFIG_RISCV_M_MODE)
++      ci->marchid = csr_read(CSR_MARCHID);
++#else
++      ci->marchid = 0;
++#endif
++      return ci->marchid;
++}
++
++unsigned long __init riscv_get_mvendorid(void)
++{
++      struct riscv_cpuinfo *ci = this_cpu_ptr(&riscv_cpuinfo);
++
++#if IS_ENABLED(CONFIG_RISCV_SBI)
++      ci->mvendorid = sbi_spec_is_0_1() ? 0 : sbi_get_mvendorid();
++#elif IS_ENABLED(CONFIG_RISCV_M_MODE)
++      ci->mvendorid = csr_read(CSR_MVENDORID);
++#else
++      ci->mvendorid = 0;
++#endif
++      return ci->mvendorid;
++}
++
+ DEFINE_PER_CPU(struct riscv_cpuinfo, riscv_cpuinfo);
+ unsigned long riscv_cached_mvendorid(unsigned int cpu_id)
+@@ -170,12 +198,16 @@ static int riscv_cpuinfo_starting(unsigned int cpu)
+       struct riscv_cpuinfo *ci = this_cpu_ptr(&riscv_cpuinfo);
+ #if IS_ENABLED(CONFIG_RISCV_SBI)
+-      ci->mvendorid = sbi_spec_is_0_1() ? 0 : sbi_get_mvendorid();
+-      ci->marchid = sbi_spec_is_0_1() ? 0 : sbi_get_marchid();
++      if (!ci->mvendorid)
++              ci->mvendorid = sbi_spec_is_0_1() ? 0 : sbi_get_mvendorid();
++      if (!ci->marchid)
++              ci->marchid = sbi_spec_is_0_1() ? 0 : sbi_get_marchid();
+       ci->mimpid = sbi_spec_is_0_1() ? 0 : sbi_get_mimpid();
+ #elif IS_ENABLED(CONFIG_RISCV_M_MODE)
+-      ci->mvendorid = csr_read(CSR_MVENDORID);
+-      ci->marchid = csr_read(CSR_MARCHID);
++      if (!ci->mvendorid)
++              ci->mvendorid = csr_read(CSR_MVENDORID);
++      if (!ci->marchid)
++              ci->marchid = csr_read(CSR_MARCHID);
+       ci->mimpid = csr_read(CSR_MIMPID);
+ #else
+       ci->mvendorid = 0;
+diff --git a/arch/riscv/kernel/cpufeature.c b/arch/riscv/kernel/cpufeature.c
+index 6754a922a844f..a6b6bbf3f8598 100644
+--- a/arch/riscv/kernel/cpufeature.c
++++ b/arch/riscv/kernel/cpufeature.c
+@@ -351,6 +351,8 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap)
+       struct acpi_table_header *rhct;
+       acpi_status status;
+       unsigned int cpu;
++      u64 boot_vendorid;
++      u64 boot_archid;
+       if (!acpi_disabled) {
+               status = acpi_get_table(ACPI_SIG_RHCT, 0, &rhct);
+@@ -358,6 +360,9 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap)
+                       return;
+       }
++      boot_vendorid = riscv_get_mvendorid();
++      boot_archid = riscv_get_marchid();
++
+       for_each_possible_cpu(cpu) {
+               struct riscv_isainfo *isainfo = &hart_isa[cpu];
+               unsigned long this_hwcap = 0;
+@@ -405,8 +410,7 @@ static void __init riscv_fill_hwcap_from_isa_string(unsigned long *isa2hwcap)
+                * CPU cores with the ratified spec will contain non-zero
+                * marchid.
+                */
+-              if (acpi_disabled && riscv_cached_mvendorid(cpu) == THEAD_VENDOR_ID &&
+-                  riscv_cached_marchid(cpu) == 0x0) {
++              if (acpi_disabled && boot_vendorid == THEAD_VENDOR_ID && boot_archid == 0x0) {
+                       this_hwcap &= ~isa2hwcap[RISCV_ISA_EXT_v];
+                       clear_bit(RISCV_ISA_EXT_v, isainfo->isa);
+               }
+-- 
+2.43.0
+
diff --git a/queue-6.6/riscv-stacktrace-fixed-walk_stackframe.patch b/queue-6.6/riscv-stacktrace-fixed-walk_stackframe.patch
new file mode 100644 (file)
index 0000000..d20a87f
--- /dev/null
@@ -0,0 +1,132 @@
+From 29b101990fa55d9877d515b90c5f10fedca4bf7d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 May 2024 22:13:13 +0300
+Subject: riscv: stacktrace: fixed walk_stackframe()
+
+From: Matthew Bystrin <dev.mbstr@gmail.com>
+
+[ Upstream commit a2a4d4a6a0bf5eba66f8b0b32502cc20d82715a0 ]
+
+If the load access fault occures in a leaf function (with
+CONFIG_FRAME_POINTER=y), when wrong stack trace will be displayed:
+
+[<ffffffff804853c2>] regmap_mmio_read32le+0xe/0x1c
+---[ end trace 0000000000000000 ]---
+
+Registers dump:
+    ra     0xffffffff80485758 <regmap_mmio_read+36>
+    sp     0xffffffc80200b9a0
+    fp     0xffffffc80200b9b0
+    pc     0xffffffff804853ba <regmap_mmio_read32le+6>
+
+Stack dump:
+    0xffffffc80200b9a0:  0xffffffc80200b9e0  0xffffffc80200b9e0
+    0xffffffc80200b9b0:  0xffffffff8116d7e8  0x0000000000000100
+    0xffffffc80200b9c0:  0xffffffd8055b9400  0xffffffd8055b9400
+    0xffffffc80200b9d0:  0xffffffc80200b9f0  0xffffffff8047c526
+    0xffffffc80200b9e0:  0xffffffc80200ba30  0xffffffff8047fe9a
+
+The assembler dump of the function preambula:
+    add     sp,sp,-16
+    sd      s0,8(sp)
+    add     s0,sp,16
+
+In the fist stack frame, where ra is not stored on the stack we can
+observe:
+
+        0(sp)                  8(sp)
+        .---------------------------------------------.
+    sp->|       frame->fp      | frame->ra (saved fp) |
+        |---------------------------------------------|
+    fp->|         ....         |         ....         |
+        |---------------------------------------------|
+        |                      |                      |
+
+and in the code check is performed:
+       if (regs && (regs->epc == pc) && (frame->fp & 0x7))
+
+I see no reason to check frame->fp value at all, because it is can be
+uninitialized value on the stack. A better way is to check frame->ra to
+be an address on the stack. After the stacktrace shows as expect:
+
+[<ffffffff804853c2>] regmap_mmio_read32le+0xe/0x1c
+[<ffffffff80485758>] regmap_mmio_read+0x24/0x52
+[<ffffffff8047c526>] _regmap_bus_reg_read+0x1a/0x22
+[<ffffffff8047fe9a>] _regmap_read+0x5c/0xea
+[<ffffffff80480376>] _regmap_update_bits+0x76/0xc0
+...
+---[ end trace 0000000000000000 ]---
+As pointed by Samuel Holland it is incorrect to remove check of the stackframe
+entirely.
+
+Changes since v2 [2]:
+ - Add accidentally forgotten curly brace
+
+Changes since v1 [1]:
+ - Instead of just dropping frame->fp check, replace it with validation of
+   frame->ra, which should be a stack address.
+ - Move frame pointer validation into the separate function.
+
+[1] https://lore.kernel.org/linux-riscv/20240426072701.6463-1-dev.mbstr@gmail.com/
+[2] https://lore.kernel.org/linux-riscv/20240521131314.48895-1-dev.mbstr@gmail.com/
+
+Fixes: f766f77a74f5 ("riscv/stacktrace: Fix stack output without ra on the stack top")
+Signed-off-by: Matthew Bystrin <dev.mbstr@gmail.com>
+Reviewed-by: Samuel Holland <samuel.holland@sifive.com>
+Link: https://lore.kernel.org/r/20240521191727.62012-1-dev.mbstr@gmail.com
+Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/riscv/kernel/stacktrace.c | 20 ++++++++++++++------
+ 1 file changed, 14 insertions(+), 6 deletions(-)
+
+diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
+index 64a9c093aef93..528ec7cc9a622 100644
+--- a/arch/riscv/kernel/stacktrace.c
++++ b/arch/riscv/kernel/stacktrace.c
+@@ -18,6 +18,16 @@
+ extern asmlinkage void ret_from_exception(void);
++static inline int fp_is_valid(unsigned long fp, unsigned long sp)
++{
++      unsigned long low, high;
++
++      low = sp + sizeof(struct stackframe);
++      high = ALIGN(sp, THREAD_SIZE);
++
++      return !(fp < low || fp > high || fp & 0x07);
++}
++
+ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
+                            bool (*fn)(void *, unsigned long), void *arg)
+ {
+@@ -41,21 +51,19 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs,
+       }
+       for (;;) {
+-              unsigned long low, high;
+               struct stackframe *frame;
+               if (unlikely(!__kernel_text_address(pc) || (level++ >= 0 && !fn(arg, pc))))
+                       break;
+-              /* Validate frame pointer */
+-              low = sp + sizeof(struct stackframe);
+-              high = ALIGN(sp, THREAD_SIZE);
+-              if (unlikely(fp < low || fp > high || fp & 0x7))
++              if (unlikely(!fp_is_valid(fp, sp)))
+                       break;
++
+               /* Unwind stack frame */
+               frame = (struct stackframe *)fp - 1;
+               sp = fp;
+-              if (regs && (regs->epc == pc) && (frame->fp & 0x7)) {
++              if (regs && (regs->epc == pc) && fp_is_valid(frame->ra, sp)) {
++                      /* We hit function where ra is not saved on the stack */
+                       fp = frame->ra;
+                       pc = regs->ra;
+               } else {
+-- 
+2.43.0
+
diff --git a/queue-6.6/rpcrdma-fix-handling-for-rdma_cm_event_device_remova.patch b/queue-6.6/rpcrdma-fix-handling-for-rdma_cm_event_device_remova.patch
new file mode 100644 (file)
index 0000000..c620f41
--- /dev/null
@@ -0,0 +1,51 @@
+From 822ad73ae67224fb60464df4520c98b52cf6c0fa Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 6 May 2024 12:37:59 +0300
+Subject: rpcrdma: fix handling for RDMA_CM_EVENT_DEVICE_REMOVAL
+
+From: Dan Aloni <dan.aloni@vastdata.com>
+
+[ Upstream commit 4836da219781ec510c4c0303df901aa643507a7a ]
+
+Under the scenario of IB device bonding, when bringing down one of the
+ports, or all ports, we saw xprtrdma entering a non-recoverable state
+where it is not even possible to complete the disconnect and shut it
+down the mount, requiring a reboot. Following debug, we saw that
+transport connect never ended after receiving the
+RDMA_CM_EVENT_DEVICE_REMOVAL callback.
+
+The DEVICE_REMOVAL callback is irrespective of whether the CM_ID is
+connected, and ESTABLISHED may not have happened. So need to work with
+each of these states accordingly.
+
+Fixes: 2acc5cae2923 ('xprtrdma: Prevent dereferencing r_xprt->rx_ep after it is freed')
+Cc: Sagi Grimberg <sagi.grimberg@vastdata.com>
+Signed-off-by: Dan Aloni <dan.aloni@vastdata.com>
+Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
+Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/sunrpc/xprtrdma/verbs.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
+index 28c0771c4e8c3..4f71627ba39ce 100644
+--- a/net/sunrpc/xprtrdma/verbs.c
++++ b/net/sunrpc/xprtrdma/verbs.c
+@@ -244,7 +244,11 @@ rpcrdma_cm_event_handler(struct rdma_cm_id *id, struct rdma_cm_event *event)
+       case RDMA_CM_EVENT_DEVICE_REMOVAL:
+               pr_info("rpcrdma: removing device %s for %pISpc\n",
+                       ep->re_id->device->name, sap);
+-              fallthrough;
++              switch (xchg(&ep->re_connect_status, -ENODEV)) {
++              case 0: goto wake_connect_worker;
++              case 1: goto disconnected;
++              }
++              return 0;
+       case RDMA_CM_EVENT_ADDR_CHANGE:
+               ep->re_connect_status = -ENODEV;
+               goto disconnected;
+-- 
+2.43.0
+
diff --git a/queue-6.6/rv-update-rv_en-dis-able_monitor-doc-to-match-kernel.patch b/queue-6.6/rv-update-rv_en-dis-able_monitor-doc-to-match-kernel.patch
new file mode 100644 (file)
index 0000000..8229fff
--- /dev/null
@@ -0,0 +1,45 @@
+From bddb448042239534012eea6f6ff064784d71f6b9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 20 May 2024 13:42:39 +0800
+Subject: rv: Update rv_en(dis)able_monitor doc to match kernel-doc
+
+From: Yang Li <yang.lee@linux.alibaba.com>
+
+[ Upstream commit 1e8b7b3dbb3103d577a586ca72bc329f7b67120b ]
+
+The patch updates the function documentation comment for
+rv_en(dis)able_monitor to adhere to the kernel-doc specification.
+
+Link: https://lore.kernel.org/linux-trace-kernel/20240520054239.61784-1-yang.lee@linux.alibaba.com
+
+Fixes: 102227b970a15 ("rv: Add Runtime Verification (RV) interface")
+Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
+Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/trace/rv/rv.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/kernel/trace/rv/rv.c b/kernel/trace/rv/rv.c
+index 2f68e93fff0bc..df0745a42a3f3 100644
+--- a/kernel/trace/rv/rv.c
++++ b/kernel/trace/rv/rv.c
+@@ -245,6 +245,7 @@ static int __rv_disable_monitor(struct rv_monitor_def *mdef, bool sync)
+ /**
+  * rv_disable_monitor - disable a given runtime monitor
++ * @mdef: Pointer to the monitor definition structure.
+  *
+  * Returns 0 on success.
+  */
+@@ -256,6 +257,7 @@ int rv_disable_monitor(struct rv_monitor_def *mdef)
+ /**
+  * rv_enable_monitor - enable a given runtime monitor
++ * @mdef: Pointer to the monitor definition structure.
+  *
+  * Returns 0 on success, error otherwise.
+  */
+-- 
+2.43.0
+
diff --git a/queue-6.6/selftests-net-kill-smcrouted-in-the-cleanup-logic-in.patch b/queue-6.6/selftests-net-kill-smcrouted-in-the-cleanup-logic-in.patch
new file mode 100644 (file)
index 0000000..3d7ee9b
--- /dev/null
@@ -0,0 +1,60 @@
+From f1d9f99c4bb466f38ad094c2d71eb10fecd99094 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sat, 18 May 2024 13:20:52 +0000
+Subject: selftests: net: kill smcrouted in the cleanup logic in amt.sh
+
+From: Taehee Yoo <ap420073@gmail.com>
+
+[ Upstream commit cc563e749810f5636451d4b833fbd689899ecdb9 ]
+
+The amt.sh requires smcrouted for multicasting routing.
+So, it starts smcrouted before forwarding tests.
+It must be stopped after all tests, but it isn't.
+
+To fix this issue, it kills smcrouted in the cleanup logic.
+
+Fixes: c08e8baea78e ("selftests: add amt interface selftest script")
+Signed-off-by: Taehee Yoo <ap420073@gmail.com>
+Reviewed-by: Simon Horman <horms@kernel.org>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/net/amt.sh | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/tools/testing/selftests/net/amt.sh b/tools/testing/selftests/net/amt.sh
+index 5175a42cbe8a2..7e7ed6c558da9 100755
+--- a/tools/testing/selftests/net/amt.sh
++++ b/tools/testing/selftests/net/amt.sh
+@@ -77,6 +77,7 @@ readonly LISTENER=$(mktemp -u listener-XXXXXXXX)
+ readonly GATEWAY=$(mktemp -u gateway-XXXXXXXX)
+ readonly RELAY=$(mktemp -u relay-XXXXXXXX)
+ readonly SOURCE=$(mktemp -u source-XXXXXXXX)
++readonly SMCROUTEDIR="$(mktemp -d)"
+ ERR=4
+ err=0
+@@ -85,6 +86,11 @@ exit_cleanup()
+       for ns in "$@"; do
+               ip netns delete "${ns}" 2>/dev/null || true
+       done
++      if [ -f "$SMCROUTEDIR/amt.pid" ]; then
++              smcpid=$(< $SMCROUTEDIR/amt.pid)
++              kill $smcpid
++      fi
++      rm -rf $SMCROUTEDIR
+       exit $ERR
+ }
+@@ -167,7 +173,7 @@ setup_iptables()
+ setup_mcast_routing()
+ {
+-      ip netns exec "${RELAY}" smcrouted
++      ip netns exec "${RELAY}" smcrouted -P $SMCROUTEDIR/amt.pid
+       ip netns exec "${RELAY}" smcroutectl a relay_src \
+               172.17.0.2 239.0.0.1 amtr
+       ip netns exec "${RELAY}" smcroutectl a relay_src \
+-- 
+2.43.0
+
diff --git a/queue-6.6/selftests-powerpc-dexcr-add-no-pie-to-hashchk-tests.patch b/queue-6.6/selftests-powerpc-dexcr-add-no-pie-to-hashchk-tests.patch
new file mode 100644 (file)
index 0000000..ad4c5a7
--- /dev/null
@@ -0,0 +1,41 @@
+From be1439091957c02a3406df8d18ff2aae59d6d298 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 17 Apr 2024 21:23:17 +1000
+Subject: selftests/powerpc/dexcr: Add -no-pie to hashchk tests
+
+From: Benjamin Gray <bgray@linux.ibm.com>
+
+[ Upstream commit d7228a58d9438d6f219dc7f33eab0d1980b3bd2f ]
+
+The hashchk tests want to verify that the hash key is changed over exec.
+It does so by calculating hashes at the same address across an exec.
+This is made simpler by disabling PIE functionality, so we can
+re-execute ourselves and be using the same addresses in the child.
+
+While -fno-pie is already added, -no-pie is also required.
+
+Fixes: bdb07f35a52f ("selftests/powerpc/dexcr: Add hashst/hashchk test")
+Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>
+Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
+Link: https://msgid.link/20240417112325.728010-2-bgray@linux.ibm.com
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/testing/selftests/powerpc/dexcr/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/testing/selftests/powerpc/dexcr/Makefile b/tools/testing/selftests/powerpc/dexcr/Makefile
+index 76210f2bcec3c..829ad075b4a44 100644
+--- a/tools/testing/selftests/powerpc/dexcr/Makefile
++++ b/tools/testing/selftests/powerpc/dexcr/Makefile
+@@ -3,7 +3,7 @@ TEST_GEN_FILES := lsdexcr
+ include ../../lib.mk
+-$(OUTPUT)/hashchk_test: CFLAGS += -fno-pie $(call cc-option,-mno-rop-protect)
++$(OUTPUT)/hashchk_test: CFLAGS += -fno-pie -no-pie $(call cc-option,-mno-rop-protect)
+ $(TEST_GEN_PROGS): ../harness.c ../utils.c ./dexcr.c
+ $(TEST_GEN_FILES): ../utils.c ./dexcr.c
+-- 
+2.43.0
+
index 649a367f83770645aa12e421a17626195b996eed..3bbef88ba4663da718fe03c9ea2b2950aa0a04f2 100644 (file)
@@ -563,3 +563,116 @@ eventfs-free-all-of-the-eventfs_inode-after-rcu.patch
 eventfs-have-events-directory-get-permissions-from-i.patch
 dt-bindings-adc-axi-adc-update-bindings-for-backend-.patch
 dt-bindings-adc-axi-adc-add-clocks-property.patch
+input-ims-pcu-fix-printf-string-overflow.patch
+mmc-sdhci_am654-add-tuning-algorithm-for-delay-chain.patch
+mmc-sdhci_am654-write-itapdly-for-ddr52-timing.patch
+mmc-sdhci_am654-drop-lookup-for-deprecated-ti-otap-d.patch
+mmc-sdhci_am654-add-otap-itap-delay-enable.patch
+mmc-sdhci_am654-add-itapdlysel-in-sdhci_j721e_4bit_s.patch
+mmc-sdhci_am654-fix-itapdly-for-hs400-timing.patch
+input-pm8xxx-vibrator-correct-vib_max_levels-calcula.patch
+media-v4l2-subdev-document-and-enforce-.s_stream-req.patch
+media-v4l-don-t-turn-on-privacy-led-if-streamon-fail.patch
+media-ov2680-clear-the-ret-variable-on-success.patch
+media-ov2680-allow-probing-if-link-frequencies-is-ab.patch
+media-ov2680-do-not-fail-if-data-lanes-property-is-a.patch
+drm-msm-dsi-print-dual-dsi-adjusted-pclk-instead-of-.patch
+drm-msm-dpu-always-flush-the-slave-intf-on-the-ctl.patch
+drm-mediatek-dp-fix-mtk_dp_aux_transfer-return-value.patch
+drm-meson-gate-px_clk-when-setting-rate.patch
+um-fix-return-value-in-ubd_init.patch
+um-add-winch-to-winch_handlers-before-registering-wi.patch
+um-vector-fix-bpfflash-parameter-evaluation.patch
+fs-ntfs3-check-folio-pointer-for-null.patch
+fs-ntfs3-use-64-bit-variable-to-avoid-32-bit-overflo.patch
+fs-ntfs3-use-variable-length-array-instead-of-fixed-.patch
+drm-msm-dpu-remove-irq_idx-argument-from-irq-callbac.patch
+drm-msm-dpu-extract-dpu_core_irq_is_valid-helper.patch
+drm-msm-dpu-add-helper-to-get-irq-related-data.patch
+drm-msm-dpu-make-the-irq-table-size-static.patch
+drm-msm-dpu-stop-using-raw-irq-indices-in-the-kernel.patch
+drm-msm-dpu-add-callback-function-pointer-check-befo.patch
+drm-bridge-tc358775-fix-support-for-jeida-18-and-jei.patch
+media-stk1160-fix-bounds-checking-in-stk1160_copy_vi.patch
+input-cyapa-add-missing-input-core-locking-to-suspen.patch
+drm-amdgpu-init-microcode-chip-name-from-ip-versions.patch
+drm-amdgpu-fix-buffer-size-in-gfx_v9_4_3_init_-cp_co.patch
+media-mediatek-vcodec-add-encoder-power-management-h.patch
+media-mediatek-vcodec-fix-possible-unbalanced-pm-cou.patch
+tools-arch-x86-intel_sdsi-fix-maximum-meter-bundle-l.patch
+tools-arch-x86-intel_sdsi-fix-meter_show-display.patch
+tools-arch-x86-intel_sdsi-fix-meter_certificate-deco.patch
+platform-x86-thinkpad_acpi-take-hotkey_mutex-during-.patch
+media-flexcop-usb-fix-sanity-check-of-bnumendpoints.patch
+powerpc-pseries-add-failure-related-checks-for-h_get.patch
+um-fix-the-wmissing-prototypes-warning-for-__switch_.patch
+um-fix-the-wmissing-prototypes-warning-for-get_threa.patch
+um-fix-the-declaration-of-kasan_map_memory.patch
+cxl-trace-correct-dpa-field-masks-for-general_media-.patch
+cxl-region-fix-cxlr_pmem-leaks.patch
+media-sunxi-a83-mips-csi2-also-select-generic_phy.patch
+media-cec-cec-adap-always-cancel-work-in-cec_transmi.patch
+media-cec-cec-api-add-locking-in-cec_release.patch
+media-cec-core-avoid-recursive-cec_claim_log_addrs.patch
+media-cec-core-avoid-confusing-transmit-timed-out-me.patch
+revert-drm-bridge-ti-sn65dsi83-fix-enable-error-path.patch
+drm-zynqmp_dpsub-always-register-bridge.patch
+selftests-powerpc-dexcr-add-no-pie-to-hashchk-tests.patch
+drm-msm-a6xx-avoid-a-nullptr-dereference-when-speedb.patch
+asoc-tas2781-fix-a-warning-reported-by-robot-kernel-.patch
+null_blk-fix-the-warning-modpost-missing-module_desc.patch
+nilfs2-make-superblock-data-array-index-computation-.patch
+alsa-hda-cs_dsp_ctl-use-private_free-for-control-cle.patch
+asoc-cs35l56-fix-to-ensure-asp1-registers-match-cach.patch
+alsa-hda-cs35l56-initialize-all-asp1-registers.patch
+alsa-hda-cs35l56-fix-lifetime-of-cs_dsp-instance.patch
+asoc-mediatek-mt8192-fix-register-configuration-for-.patch
+nouveau-add-an-ioctl-to-return-vram-bar-size.patch
+nouveau-add-an-ioctl-to-report-vram-usage.patch
+drm-nouveau-use-tile_mode-and-pte_kind-for-vm_bind-b.patch
+blk-cgroup-fix-list-corruption-from-resetting-io-sta.patch
+blk-cgroup-fix-list-corruption-from-reorder-of-write.patch
+blk-cgroup-properly-propagate-the-iostat-update-up-t.patch
+regulator-bd71828-don-t-overwrite-runtime-voltages.patch
+xen-x86-add-extra-pages-to-unpopulated-alloc-if-avai.patch
+perf-arm-dmc620-fix-lockdep-assert-in-event_init.patch
+x86-kconfig-select-arch_want_frame_pointers-again-wh.patch
+net-always-descend-into-dsa-folder-with-config_net_d.patch
+ipv6-sr-fix-missing-sk_buff-release-in-seg6_input_co.patch
+selftests-net-kill-smcrouted-in-the-cleanup-logic-in.patch
+nfc-nci-fix-uninit-value-in-nci_rx_work.patch
+asoc-tas2552-add-tx-path-for-capturing-audio-out-dat.patch
+asoc-tas2781-fix-wrong-loading-calibrated-data-seque.patch
+nfsv4-fixup-smatch-warning-for-ambiguous-return.patch
+nfs-keep-server-info-for-remounts.patch
+sunrpc-fix-nfsacl-rpc-retry-on-soft-mount.patch
+rpcrdma-fix-handling-for-rdma_cm_event_device_remova.patch
+regulator-pickable-ranges-don-t-always-cache-vsel.patch
+regulator-tps6287x-force-writing-vsel-bit.patch
+af_unix-update-unix_sk-sk-oob_skb-under-sk_receive_q.patch
+ipv6-sr-fix-memleak-in-seg6_hmac_init_algo.patch
+regulator-tps6594-regulator-correct-multi-phase-conf.patch
+tcp-fix-shift-out-of-bounds-in-dctcp_update_alpha.patch
+pnfs-filelayout-fixup-pnfs-allocation-modes.patch
+openvswitch-set-the-skbuff-pkt_type-for-proper-pmtud.patch
+arm64-asm-bug-add-.align-2-to-the-end-of-__bug_entry.patch
+rv-update-rv_en-dis-able_monitor-doc-to-match-kernel.patch
+net-lan966x-remove-ptp-traps-in-case-the-ptp-is-not-.patch
+virtio-delete-vq-in-vp_find_vqs_msix-when-request_ir.patch
+riscv-cpufeature-fix-thead-vector-hwcap-removal.patch
+i3c-add-actual_len-in-i3c_priv_xfer.patch
+i3c-master-svc-rename-read_len-as-actual_len.patch
+i3c-master-svc-return-actual-transfer-data-len.patch
+i3c-master-svc-change-enxio-to-eagain-when-ibi-occur.patch
+riscv-stacktrace-fixed-walk_stackframe.patch
+revert-ixgbe-manual-an-37-for-troublesome-link-partn.patch
+net-fec-avoid-lock-evasion-when-reading-pps_enable.patch
+tls-fix-missing-memory-barrier-in-tls_init.patch
+tcp-remove-64-kbyte-limit-for-initial-tp-rcv_wnd-val.patch
+net-relax-socket-state-check-at-accept-time.patch
+nfc-nci-fix-handling-of-zero-length-payload-packets-.patch
+drivers-xen-improve-the-late-xenstore-init-protocol.patch
+ice-interpret-.set_channels-input-differently.patch
+kasan-fortify-properly-rename-memintrinsics.patch
+tracing-probes-fix-error-check-in-parse_btf_field.patch
+tpm_tis_spi-account-for-spi-header-when-allocating-t.patch
diff --git a/queue-6.6/sunrpc-fix-nfsacl-rpc-retry-on-soft-mount.patch b/queue-6.6/sunrpc-fix-nfsacl-rpc-retry-on-soft-mount.patch
new file mode 100644 (file)
index 0000000..57fa7d4
--- /dev/null
@@ -0,0 +1,55 @@
+From 71b7eea0e77c42b723955add4a8c5dca18832491 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 25 Apr 2024 13:49:38 +0300
+Subject: sunrpc: fix NFSACL RPC retry on soft mount
+
+From: Dan Aloni <dan.aloni@vastdata.com>
+
+[ Upstream commit 0dc9f430027b8bd9073fdafdfcdeb1a073ab5594 ]
+
+It used to be quite awhile ago since 1b63a75180c6 ('SUNRPC: Refactor
+rpc_clone_client()'), in 2012, that `cl_timeout` was copied in so that
+all mount parameters propagate to NFSACL clients. However since that
+change, if mount options as follows are given:
+
+    soft,timeo=50,retrans=16,vers=3
+
+The resultant NFSACL client receives:
+
+    cl_softrtry: 1
+    cl_timeout: to_initval=60000, to_maxval=60000, to_increment=0, to_retries=2, to_exponential=0
+
+These values lead to NFSACL operations not being retried under the
+condition of transient network outages with soft mount. Instead, getacl
+call fails after 60 seconds with EIO.
+
+The simple fix is to pass the existing client's `cl_timeout` as the new
+client timeout.
+
+Cc: Chuck Lever <chuck.lever@oracle.com>
+Cc: Benjamin Coddington <bcodding@redhat.com>
+Link: https://lore.kernel.org/all/20231105154857.ryakhmgaptq3hb6b@gmail.com/T/
+Fixes: 1b63a75180c6 ('SUNRPC: Refactor rpc_clone_client()')
+Signed-off-by: Dan Aloni <dan.aloni@vastdata.com>
+Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
+Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/sunrpc/clnt.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
+index f4d32cf2cd16a..d3c917c0c8d59 100644
+--- a/net/sunrpc/clnt.c
++++ b/net/sunrpc/clnt.c
+@@ -1056,6 +1056,7 @@ struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *old,
+               .authflavor     = old->cl_auth->au_flavor,
+               .cred           = old->cl_cred,
+               .stats          = old->cl_stats,
++              .timeout        = old->cl_timeout,
+       };
+       struct rpc_clnt *clnt;
+       int err;
+-- 
+2.43.0
+
diff --git a/queue-6.6/tcp-fix-shift-out-of-bounds-in-dctcp_update_alpha.patch b/queue-6.6/tcp-fix-shift-out-of-bounds-in-dctcp_update_alpha.patch
new file mode 100644 (file)
index 0000000..fbfb3ee
--- /dev/null
@@ -0,0 +1,125 @@
+From 0b4bad29b8533406e46bb12ad4ec266957e29290 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 17 May 2024 18:16:26 +0900
+Subject: tcp: Fix shift-out-of-bounds in dctcp_update_alpha().
+
+From: Kuniyuki Iwashima <kuniyu@amazon.com>
+
+[ Upstream commit 3ebc46ca8675de6378e3f8f40768e180bb8afa66 ]
+
+In dctcp_update_alpha(), we use a module parameter dctcp_shift_g
+as follows:
+
+  alpha -= min_not_zero(alpha, alpha >> dctcp_shift_g);
+  ...
+  delivered_ce <<= (10 - dctcp_shift_g);
+
+It seems syzkaller started fuzzing module parameters and triggered
+shift-out-of-bounds [0] by setting 100 to dctcp_shift_g:
+
+  memcpy((void*)0x20000080,
+         "/sys/module/tcp_dctcp/parameters/dctcp_shift_g\000", 47);
+  res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000080ul,
+                /*flags=*/2ul, /*mode=*/0ul);
+  memcpy((void*)0x20000000, "100\000", 4);
+  syscall(__NR_write, /*fd=*/r[0], /*val=*/0x20000000ul, /*len=*/4ul);
+
+Let's limit the max value of dctcp_shift_g by param_set_uint_minmax().
+
+With this patch:
+
+  # echo 10 > /sys/module/tcp_dctcp/parameters/dctcp_shift_g
+  # cat /sys/module/tcp_dctcp/parameters/dctcp_shift_g
+  10
+  # echo 11 > /sys/module/tcp_dctcp/parameters/dctcp_shift_g
+  -bash: echo: write error: Invalid argument
+
+[0]:
+UBSAN: shift-out-of-bounds in net/ipv4/tcp_dctcp.c:143:12
+shift exponent 100 is too large for 32-bit type 'u32' (aka 'unsigned int')
+CPU: 0 PID: 8083 Comm: syz-executor345 Not tainted 6.9.0-05151-g1b294a1f3561 #2
+Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
+1.13.0-1ubuntu1.1 04/01/2014
+Call Trace:
+ <TASK>
+ __dump_stack lib/dump_stack.c:88 [inline]
+ dump_stack_lvl+0x201/0x300 lib/dump_stack.c:114
+ ubsan_epilogue lib/ubsan.c:231 [inline]
+ __ubsan_handle_shift_out_of_bounds+0x346/0x3a0 lib/ubsan.c:468
+ dctcp_update_alpha+0x540/0x570 net/ipv4/tcp_dctcp.c:143
+ tcp_in_ack_event net/ipv4/tcp_input.c:3802 [inline]
+ tcp_ack+0x17b1/0x3bc0 net/ipv4/tcp_input.c:3948
+ tcp_rcv_state_process+0x57a/0x2290 net/ipv4/tcp_input.c:6711
+ tcp_v4_do_rcv+0x764/0xc40 net/ipv4/tcp_ipv4.c:1937
+ sk_backlog_rcv include/net/sock.h:1106 [inline]
+ __release_sock+0x20f/0x350 net/core/sock.c:2983
+ release_sock+0x61/0x1f0 net/core/sock.c:3549
+ mptcp_subflow_shutdown+0x3d0/0x620 net/mptcp/protocol.c:2907
+ mptcp_check_send_data_fin+0x225/0x410 net/mptcp/protocol.c:2976
+ __mptcp_close+0x238/0xad0 net/mptcp/protocol.c:3072
+ mptcp_close+0x2a/0x1a0 net/mptcp/protocol.c:3127
+ inet_release+0x190/0x1f0 net/ipv4/af_inet.c:437
+ __sock_release net/socket.c:659 [inline]
+ sock_close+0xc0/0x240 net/socket.c:1421
+ __fput+0x41b/0x890 fs/file_table.c:422
+ task_work_run+0x23b/0x300 kernel/task_work.c:180
+ exit_task_work include/linux/task_work.h:38 [inline]
+ do_exit+0x9c8/0x2540 kernel/exit.c:878
+ do_group_exit+0x201/0x2b0 kernel/exit.c:1027
+ __do_sys_exit_group kernel/exit.c:1038 [inline]
+ __se_sys_exit_group kernel/exit.c:1036 [inline]
+ __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1036
+ do_syscall_x64 arch/x86/entry/common.c:52 [inline]
+ do_syscall_64+0xe4/0x240 arch/x86/entry/common.c:83
+ entry_SYSCALL_64_after_hwframe+0x67/0x6f
+RIP: 0033:0x7f6c2b5005b6
+Code: Unable to access opcode bytes at 0x7f6c2b50058c.
+RSP: 002b:00007ffe883eb948 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
+RAX: ffffffffffffffda RBX: 00007f6c2b5862f0 RCX: 00007f6c2b5005b6
+RDX: 0000000000000001 RSI: 000000000000003c RDI: 0000000000000001
+RBP: 0000000000000001 R08: 00000000000000e7 R09: ffffffffffffffc0
+R10: 0000000000000006 R11: 0000000000000246 R12: 00007f6c2b5862f0
+R13: 0000000000000001 R14: 0000000000000000 R15: 0000000000000001
+ </TASK>
+
+Reported-by: syzkaller <syzkaller@googlegroups.com>
+Reported-by: Yue Sun <samsun1006219@gmail.com>
+Reported-by: xingwei lee <xrivendell7@gmail.com>
+Closes: https://lore.kernel.org/netdev/CAEkJfYNJM=cw-8x7_Vmj1J6uYVCWMbbvD=EFmDPVBGpTsqOxEA@mail.gmail.com/
+Fixes: e3118e8359bb ("net: tcp: add DCTCP congestion control algorithm")
+Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
+Reviewed-by: Simon Horman <horms@kernel.org>
+Link: https://lore.kernel.org/r/20240517091626.32772-1-kuniyu@amazon.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv4/tcp_dctcp.c | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/net/ipv4/tcp_dctcp.c b/net/ipv4/tcp_dctcp.c
+index bb23bb5b387a0..8ad62713b0ba2 100644
+--- a/net/ipv4/tcp_dctcp.c
++++ b/net/ipv4/tcp_dctcp.c
+@@ -58,7 +58,18 @@ struct dctcp {
+ };
+ static unsigned int dctcp_shift_g __read_mostly = 4; /* g = 1/2^4 */
+-module_param(dctcp_shift_g, uint, 0644);
++
++static int dctcp_shift_g_set(const char *val, const struct kernel_param *kp)
++{
++      return param_set_uint_minmax(val, kp, 0, 10);
++}
++
++static const struct kernel_param_ops dctcp_shift_g_ops = {
++      .set = dctcp_shift_g_set,
++      .get = param_get_uint,
++};
++
++module_param_cb(dctcp_shift_g, &dctcp_shift_g_ops, &dctcp_shift_g, 0644);
+ MODULE_PARM_DESC(dctcp_shift_g, "parameter g for updating dctcp_alpha");
+ static unsigned int dctcp_alpha_on_init __read_mostly = DCTCP_MAX_ALPHA;
+-- 
+2.43.0
+
diff --git a/queue-6.6/tcp-remove-64-kbyte-limit-for-initial-tp-rcv_wnd-val.patch b/queue-6.6/tcp-remove-64-kbyte-limit-for-initial-tp-rcv_wnd-val.patch
new file mode 100644 (file)
index 0000000..00d2140
--- /dev/null
@@ -0,0 +1,76 @@
+From 4db9c1f3979145b9d99ad87f0d1a0bc801c88925 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 May 2024 21:42:20 +0800
+Subject: tcp: remove 64 KByte limit for initial tp->rcv_wnd value
+
+From: Jason Xing <kernelxing@tencent.com>
+
+[ Upstream commit 378979e94e953c2070acb4f0e0c98d29260bd09d ]
+
+Recently, we had some servers upgraded to the latest kernel and noticed
+the indicator from the user side showed worse results than before. It is
+caused by the limitation of tp->rcv_wnd.
+
+In 2018 commit a337531b942b ("tcp: up initial rmem to 128KB and SYN rwin
+to around 64KB") limited the initial value of tp->rcv_wnd to 65535, most
+CDN teams would not benefit from this change because they cannot have a
+large window to receive a big packet, which will be slowed down especially
+in long RTT. Small rcv_wnd means slow transfer speed, to some extent. It's
+the side effect for the latency/time-sensitive users.
+
+To avoid future confusion, current change doesn't affect the initial
+receive window on the wire in a SYN or SYN+ACK packet which are set within
+65535 bytes according to RFC 7323 also due to the limit in
+__tcp_transmit_skb():
+
+    th->window      = htons(min(tp->rcv_wnd, 65535U));
+
+In one word, __tcp_transmit_skb() already ensures that constraint is
+respected, no matter how large tp->rcv_wnd is. The change doesn't violate
+RFC.
+
+Let me provide one example if with or without the patch:
+Before:
+client   --- SYN: rwindow=65535 ---> server
+client   <--- SYN+ACK: rwindow=65535 ----  server
+client   --- ACK: rwindow=65536 ---> server
+Note: for the last ACK, the calculation is 512 << 7.
+
+After:
+client   --- SYN: rwindow=65535 ---> server
+client   <--- SYN+ACK: rwindow=65535 ----  server
+client   --- ACK: rwindow=175232 ---> server
+Note: I use the following command to make it work:
+ip route change default via [ip] dev eth0 metric 100 initrwnd 120
+For the last ACK, the calculation is 1369 << 7.
+
+When we apply such a patch, having a large rcv_wnd if the user tweak this
+knob can help transfer data more rapidly and save some rtts.
+
+Fixes: a337531b942b ("tcp: up initial rmem to 128KB and SYN rwin to around 64KB")
+Signed-off-by: Jason Xing <kernelxing@tencent.com>
+Reviewed-by: Eric Dumazet <edumazet@google.com>
+Acked-by: Neal Cardwell <ncardwell@google.com>
+Link: https://lore.kernel.org/r/20240521134220.12510-1-kerneljasonxing@gmail.com
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/ipv4/tcp_output.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
+index 5631041ae12cb..a0ed8ae6762d8 100644
+--- a/net/ipv4/tcp_output.c
++++ b/net/ipv4/tcp_output.c
+@@ -229,7 +229,7 @@ void tcp_select_initial_window(const struct sock *sk, int __space, __u32 mss,
+       if (READ_ONCE(sock_net(sk)->ipv4.sysctl_tcp_workaround_signed_windows))
+               (*rcv_wnd) = min(space, MAX_TCP_WINDOW);
+       else
+-              (*rcv_wnd) = min_t(u32, space, U16_MAX);
++              (*rcv_wnd) = space;
+       if (init_rcv_wnd)
+               *rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss);
+-- 
+2.43.0
+
diff --git a/queue-6.6/tls-fix-missing-memory-barrier-in-tls_init.patch b/queue-6.6/tls-fix-missing-memory-barrier-in-tls_init.patch
new file mode 100644 (file)
index 0000000..46c1ce7
--- /dev/null
@@ -0,0 +1,73 @@
+From f2d17a851ccd7d983a3e0bd5919d45bff1316636 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 21 May 2024 19:34:38 +0900
+Subject: tls: fix missing memory barrier in tls_init
+
+From: Dae R. Jeong <threeearcat@gmail.com>
+
+[ Upstream commit 91e61dd7a0af660408e87372d8330ceb218be302 ]
+
+In tls_init(), a write memory barrier is missing, and store-store
+reordering may cause NULL dereference in tls_{setsockopt,getsockopt}.
+
+CPU0                               CPU1
+-----                              -----
+// In tls_init()
+// In tls_ctx_create()
+ctx = kzalloc()
+ctx->sk_proto = READ_ONCE(sk->sk_prot) -(1)
+
+// In update_sk_prot()
+WRITE_ONCE(sk->sk_prot, tls_prots)     -(2)
+
+                                   // In sock_common_setsockopt()
+                                   READ_ONCE(sk->sk_prot)->setsockopt()
+
+                                   // In tls_{setsockopt,getsockopt}()
+                                   ctx->sk_proto->setsockopt()    -(3)
+
+In the above scenario, when (1) and (2) are reordered, (3) can observe
+the NULL value of ctx->sk_proto, causing NULL dereference.
+
+To fix it, we rely on rcu_assign_pointer() which implies the release
+barrier semantic. By moving rcu_assign_pointer() after ctx->sk_proto is
+initialized, we can ensure that ctx->sk_proto are visible when
+changing sk->sk_prot.
+
+Fixes: d5bee7374b68 ("net/tls: Annotate access to sk_prot with READ_ONCE/WRITE_ONCE")
+Signed-off-by: Yewon Choi <woni9911@gmail.com>
+Signed-off-by: Dae R. Jeong <threeearcat@gmail.com>
+Link: https://lore.kernel.org/netdev/ZU4OJG56g2V9z_H7@dragonet/T/
+Link: https://lore.kernel.org/r/Zkx4vjSFp0mfpjQ2@libra05
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ net/tls/tls_main.c | 10 +++++++++-
+ 1 file changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/net/tls/tls_main.c b/net/tls/tls_main.c
+index e97fcb502115e..0a67b93a52ec2 100644
+--- a/net/tls/tls_main.c
++++ b/net/tls/tls_main.c
+@@ -814,9 +814,17 @@ struct tls_context *tls_ctx_create(struct sock *sk)
+               return NULL;
+       mutex_init(&ctx->tx_lock);
+-      rcu_assign_pointer(icsk->icsk_ulp_data, ctx);
+       ctx->sk_proto = READ_ONCE(sk->sk_prot);
+       ctx->sk = sk;
++      /* Release semantic of rcu_assign_pointer() ensures that
++       * ctx->sk_proto is visible before changing sk->sk_prot in
++       * update_sk_prot(), and prevents reading uninitialized value in
++       * tls_{getsockopt, setsockopt}. Note that we do not need a
++       * read barrier in tls_{getsockopt,setsockopt} as there is an
++       * address dependency between sk->sk_proto->{getsockopt,setsockopt}
++       * and ctx->sk_proto.
++       */
++      rcu_assign_pointer(icsk->icsk_ulp_data, ctx);
+       return ctx;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.6/tools-arch-x86-intel_sdsi-fix-maximum-meter-bundle-l.patch b/queue-6.6/tools-arch-x86-intel_sdsi-fix-maximum-meter-bundle-l.patch
new file mode 100644 (file)
index 0000000..be843bc
--- /dev/null
@@ -0,0 +1,67 @@
+From 534be67b1eb531ca06c683a0190b7cb9991f0e1a Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 10 Apr 2024 19:58:52 -0700
+Subject: tools/arch/x86/intel_sdsi: Fix maximum meter bundle length
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: David E. Box <david.e.box@linux.intel.com>
+
+[ Upstream commit a66f962f67ebbbdf7c82c6652180930c0169cf13 ]
+
+The maximum number of bundles in the meter certificate was set to 8 which
+is much less than the maximum. Instead, since the bundles appear at the end
+of the file, set it based on the remaining file size from the bundle start
+position.
+
+Fixes: 7fdc03a7370f ("tools/arch/x86: intel_sdsi: Add support for reading meter certificates")
+Signed-off-by: David E. Box <david.e.box@linux.intel.com>
+Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Link: https://lore.kernel.org/r/20240411025856.2782476-6-david.e.box@linux.intel.com
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/arch/x86/intel_sdsi/intel_sdsi.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/tools/arch/x86/intel_sdsi/intel_sdsi.c b/tools/arch/x86/intel_sdsi/intel_sdsi.c
+index 2cd92761f1714..7eaffcbff788c 100644
+--- a/tools/arch/x86/intel_sdsi/intel_sdsi.c
++++ b/tools/arch/x86/intel_sdsi/intel_sdsi.c
+@@ -43,7 +43,6 @@
+ #define METER_CERT_MAX_SIZE   4096
+ #define STATE_MAX_NUM_LICENSES        16
+ #define STATE_MAX_NUM_IN_BUNDLE       (uint32_t)8
+-#define METER_MAX_NUM_BUNDLES 8
+ #define __round_mask(x, y) ((__typeof__(x))((y) - 1))
+ #define round_up(x, y) ((((x) - 1) | __round_mask(x, y)) + 1)
+@@ -167,6 +166,11 @@ struct bundle_encoding_counter {
+       uint32_t encoding;
+       uint32_t counter;
+ };
++#define METER_BUNDLE_SIZE sizeof(struct bundle_encoding_counter)
++#define BUNDLE_COUNT(length) ((length) / METER_BUNDLE_SIZE)
++#define METER_MAX_NUM_BUNDLES                                                 \
++              ((METER_CERT_MAX_SIZE - sizeof(struct meter_certificate)) /     \
++               sizeof(struct bundle_encoding_counter))
+ struct sdsi_dev {
+       struct sdsi_regs regs;
+@@ -386,9 +390,9 @@ static int sdsi_meter_cert_show(struct sdsi_dev *s)
+               return -1;
+       }
+-      if (mc->bundle_length > METER_MAX_NUM_BUNDLES * 8)  {
+-              fprintf(stderr, "More than %d bundles: %d\n",
+-                      METER_MAX_NUM_BUNDLES, mc->bundle_length / 8);
++      if (mc->bundle_length > METER_MAX_NUM_BUNDLES * METER_BUNDLE_SIZE)  {
++              fprintf(stderr, "More than %ld bundles: actual %ld\n",
++                      METER_MAX_NUM_BUNDLES, BUNDLE_COUNT(mc->bundle_length));
+               return -1;
+       }
+-- 
+2.43.0
+
diff --git a/queue-6.6/tools-arch-x86-intel_sdsi-fix-meter_certificate-deco.patch b/queue-6.6/tools-arch-x86-intel_sdsi-fix-meter_certificate-deco.patch
new file mode 100644 (file)
index 0000000..1bd3f94
--- /dev/null
@@ -0,0 +1,61 @@
+From 68c930e976733aaaf2e292111a1ac44ad7e21543 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 10 Apr 2024 19:58:54 -0700
+Subject: tools/arch/x86/intel_sdsi: Fix meter_certificate decoding
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: David E. Box <david.e.box@linux.intel.com>
+
+[ Upstream commit 09d70ded6c566fd00886be32c26d0b2004ef239c ]
+
+Fix errors in the calculation of the start position of the counters and in
+the display loop. While here, use a #define for the bundle count and size.
+
+Fixes: 7fdc03a7370f ("tools/arch/x86: intel_sdsi: Add support for reading meter certificates")
+Signed-off-by: David E. Box <david.e.box@linux.intel.com>
+Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
+Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Link: https://lore.kernel.org/r/20240411025856.2782476-8-david.e.box@linux.intel.com
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/arch/x86/intel_sdsi/intel_sdsi.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/tools/arch/x86/intel_sdsi/intel_sdsi.c b/tools/arch/x86/intel_sdsi/intel_sdsi.c
+index ae29214da1029..ba2a6b6645ae8 100644
+--- a/tools/arch/x86/intel_sdsi/intel_sdsi.c
++++ b/tools/arch/x86/intel_sdsi/intel_sdsi.c
+@@ -394,7 +394,7 @@ static int sdsi_meter_cert_show(struct sdsi_dev *s)
+       printf("MMRC encoding:                %.4s\n", name);
+       printf("MMRC counter:                 %d\n", mc->mmrc_counter);
+-      if (mc->bundle_length % 8) {
++      if (mc->bundle_length % METER_BUNDLE_SIZE) {
+               fprintf(stderr, "Invalid bundle length\n");
+               return -1;
+       }
+@@ -405,15 +405,16 @@ static int sdsi_meter_cert_show(struct sdsi_dev *s)
+               return -1;
+       }
+-      bec = (void *)(mc) + sizeof(mc);
++      bec = (struct bundle_encoding_counter *)(mc + 1);
+       printf("Number of Feature Counters:   %ld\n", BUNDLE_COUNT(mc->bundle_length));
+-      while (count++ < mc->bundle_length / 8) {
++      while (count < BUNDLE_COUNT(mc->bundle_length)) {
+               char feature[5];
+               feature[4] = '\0';
+               get_feature(bec[count].encoding, feature);
+               printf("    %s:          %d\n", feature, bec[count].counter);
++              ++count;
+       }
+       return 0;
+-- 
+2.43.0
+
diff --git a/queue-6.6/tools-arch-x86-intel_sdsi-fix-meter_show-display.patch b/queue-6.6/tools-arch-x86-intel_sdsi-fix-meter_show-display.patch
new file mode 100644 (file)
index 0000000..40a6f12
--- /dev/null
@@ -0,0 +1,93 @@
+From f1212428ffc58cbd496f0343e836fcb3f1696fd6 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 10 Apr 2024 19:58:53 -0700
+Subject: tools/arch/x86/intel_sdsi: Fix meter_show display
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: David E. Box <david.e.box@linux.intel.com>
+
+[ Upstream commit 76f2bc17428c890754d11aa6aea14b332ba130c5 ]
+
+Fixes sdsi_meter_cert_show() to correctly decode and display the meter
+certificate output. Adds and displays a missing version field, displays the
+ASCII name of the signature, and fixes the print alignment.
+
+Fixes: 7fdc03a7370f ("tools/arch/x86: intel_sdsi: Add support for reading meter certificates")
+Signed-off-by: David E. Box <david.e.box@linux.intel.com>
+Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
+Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
+Link: https://lore.kernel.org/r/20240411025856.2782476-7-david.e.box@linux.intel.com
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ tools/arch/x86/intel_sdsi/intel_sdsi.c | 29 +++++++++++++++++---------
+ 1 file changed, 19 insertions(+), 10 deletions(-)
+
+diff --git a/tools/arch/x86/intel_sdsi/intel_sdsi.c b/tools/arch/x86/intel_sdsi/intel_sdsi.c
+index 7eaffcbff788c..ae29214da1029 100644
+--- a/tools/arch/x86/intel_sdsi/intel_sdsi.c
++++ b/tools/arch/x86/intel_sdsi/intel_sdsi.c
+@@ -153,11 +153,12 @@ struct bundle_encoding {
+ };
+ struct meter_certificate {
+-      uint32_t block_signature;
+-      uint32_t counter_unit;
++      uint32_t signature;
++      uint32_t version;
+       uint64_t ppin;
++      uint32_t counter_unit;
+       uint32_t bundle_length;
+-      uint32_t reserved;
++      uint64_t reserved;
+       uint32_t mmrc_encoding;
+       uint32_t mmrc_counter;
+ };
+@@ -338,6 +339,7 @@ static int sdsi_meter_cert_show(struct sdsi_dev *s)
+       uint32_t count = 0;
+       FILE *cert_ptr;
+       int ret, size;
++      char name[4];
+       ret = sdsi_update_registers(s);
+       if (ret)
+@@ -379,12 +381,19 @@ static int sdsi_meter_cert_show(struct sdsi_dev *s)
+       printf("\n");
+       printf("Meter certificate for device %s\n", s->dev_name);
+       printf("\n");
+-      printf("Block Signature:       0x%x\n", mc->block_signature);
+-      printf("Count Unit:            %dms\n", mc->counter_unit);
+-      printf("PPIN:                  0x%lx\n", mc->ppin);
+-      printf("Feature Bundle Length: %d\n", mc->bundle_length);
+-      printf("MMRC encoding:         %d\n", mc->mmrc_encoding);
+-      printf("MMRC counter:          %d\n", mc->mmrc_counter);
++
++      get_feature(mc->signature, name);
++      printf("Signature:                    %.4s\n", name);
++
++      printf("Version:                      %d\n", mc->version);
++      printf("Count Unit:                   %dms\n", mc->counter_unit);
++      printf("PPIN:                         0x%lx\n", mc->ppin);
++      printf("Feature Bundle Length:        %d\n", mc->bundle_length);
++
++      get_feature(mc->mmrc_encoding, name);
++      printf("MMRC encoding:                %.4s\n", name);
++
++      printf("MMRC counter:                 %d\n", mc->mmrc_counter);
+       if (mc->bundle_length % 8) {
+               fprintf(stderr, "Invalid bundle length\n");
+               return -1;
+@@ -398,7 +407,7 @@ static int sdsi_meter_cert_show(struct sdsi_dev *s)
+       bec = (void *)(mc) + sizeof(mc);
+-      printf("Number of Feature Counters:          %d\n", mc->bundle_length / 8);
++      printf("Number of Feature Counters:   %ld\n", BUNDLE_COUNT(mc->bundle_length));
+       while (count++ < mc->bundle_length / 8) {
+               char feature[5];
+-- 
+2.43.0
+
diff --git a/queue-6.6/tpm_tis_spi-account-for-spi-header-when-allocating-t.patch b/queue-6.6/tpm_tis_spi-account-for-spi-header-when-allocating-t.patch
new file mode 100644 (file)
index 0000000..28b4729
--- /dev/null
@@ -0,0 +1,53 @@
+From 86b37342cd40a9b5eb68fa7804e9e36f4ee7308b Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 22 May 2024 15:06:40 +0300
+Subject: tpm_tis_spi: Account for SPI header when allocating TPM SPI xfer
+ buffer
+
+From: Matthew R. Ochs <mochs@nvidia.com>
+
+[ Upstream commit 195aba96b854dd664768f382cd1db375d8181f88 ]
+
+The TPM SPI transfer mechanism uses MAX_SPI_FRAMESIZE for computing the
+maximum transfer length and the size of the transfer buffer. As such, it
+does not account for the 4 bytes of header that prepends the SPI data
+frame. This can result in out-of-bounds accesses and was confirmed with
+KASAN.
+
+Introduce SPI_HDRSIZE to account for the header and use to allocate the
+transfer buffer.
+
+Fixes: a86a42ac2bd6 ("tpm_tis_spi: Add hardware wait polling")
+Signed-off-by: Matthew R. Ochs <mochs@nvidia.com>
+Tested-by: Carol Soto <csoto@nvidia.com>
+Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
+Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/char/tpm/tpm_tis_spi_main.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/char/tpm/tpm_tis_spi_main.c b/drivers/char/tpm/tpm_tis_spi_main.c
+index c5c3197ee29f0..4bdad9e3667fa 100644
+--- a/drivers/char/tpm/tpm_tis_spi_main.c
++++ b/drivers/char/tpm/tpm_tis_spi_main.c
+@@ -37,6 +37,7 @@
+ #include "tpm_tis_spi.h"
+ #define MAX_SPI_FRAMESIZE 64
++#define SPI_HDRSIZE 4
+ /*
+  * TCG SPI flow control is documented in section 6.4 of the spec[1]. In short,
+@@ -247,7 +248,7 @@ static int tpm_tis_spi_write_bytes(struct tpm_tis_data *data, u32 addr,
+ int tpm_tis_spi_init(struct spi_device *spi, struct tpm_tis_spi_phy *phy,
+                    int irq, const struct tpm_tis_phy_ops *phy_ops)
+ {
+-      phy->iobuf = devm_kmalloc(&spi->dev, MAX_SPI_FRAMESIZE, GFP_KERNEL);
++      phy->iobuf = devm_kmalloc(&spi->dev, SPI_HDRSIZE + MAX_SPI_FRAMESIZE, GFP_KERNEL);
+       if (!phy->iobuf)
+               return -ENOMEM;
+-- 
+2.43.0
+
diff --git a/queue-6.6/tracing-probes-fix-error-check-in-parse_btf_field.patch b/queue-6.6/tracing-probes-fix-error-check-in-parse_btf_field.patch
new file mode 100644 (file)
index 0000000..fbe8626
--- /dev/null
@@ -0,0 +1,45 @@
+From 23004b949c76fb87fd64ed9b2fcdbba54ce1cb1d Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 27 May 2024 11:43:52 +0200
+Subject: tracing/probes: fix error check in parse_btf_field()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Carlos LĂ³pez <clopez@suse.de>
+
+[ Upstream commit e569eb34970281438e2b48a3ef11c87459fcfbcb ]
+
+btf_find_struct_member() might return NULL or an error via the
+ERR_PTR() macro. However, its caller in parse_btf_field() only checks
+for the NULL condition. Fix this by using IS_ERR() and returning the
+error up the stack.
+
+Link: https://lore.kernel.org/all/20240527094351.15687-1-clopez@suse.de/
+
+Fixes: c440adfbe3025 ("tracing/probes: Support BTF based data structure field access")
+Signed-off-by: Carlos LĂ³pez <clopez@suse.de>
+Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ kernel/trace/trace_probe.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
+index 34289f9c67076..ae162ba36a480 100644
+--- a/kernel/trace/trace_probe.c
++++ b/kernel/trace/trace_probe.c
+@@ -553,6 +553,10 @@ static int parse_btf_field(char *fieldname, const struct btf_type *type,
+                       anon_offs = 0;
+                       field = btf_find_struct_member(ctx->btf, type, fieldname,
+                                                      &anon_offs);
++                      if (IS_ERR(field)) {
++                              trace_probe_log_err(ctx->offset, BAD_BTF_TID);
++                              return PTR_ERR(field);
++                      }
+                       if (!field) {
+                               trace_probe_log_err(ctx->offset, NO_BTF_FIELD);
+                               return -ENOENT;
+-- 
+2.43.0
+
diff --git a/queue-6.6/um-add-winch-to-winch_handlers-before-registering-wi.patch b/queue-6.6/um-add-winch-to-winch_handlers-before-registering-wi.patch
new file mode 100644 (file)
index 0000000..ca08857
--- /dev/null
@@ -0,0 +1,68 @@
+From 922efc101126cf7e182517a01c8bfa9eabb837c8 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 7 Mar 2024 11:49:26 +0100
+Subject: um: Add winch to winch_handlers before registering winch IRQ
+
+From: Roberto Sassu <roberto.sassu@huawei.com>
+
+[ Upstream commit a0fbbd36c156b9f7b2276871d499c9943dfe5101 ]
+
+Registering a winch IRQ is racy, an interrupt may occur before the winch is
+added to the winch_handlers list.
+
+If that happens, register_winch_irq() adds to that list a winch that is
+scheduled to be (or has already been) freed, causing a panic later in
+winch_cleanup().
+
+Avoid the race by adding the winch to the winch_handlers list before
+registering the IRQ, and rolling back if um_request_irq() fails.
+
+Fixes: 42a359e31a0e ("uml: SIGIO support cleanup")
+Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
+Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
+Signed-off-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/um/drivers/line.c | 14 ++++++++------
+ 1 file changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
+index b98545f3edb50..375200e9aba9a 100644
+--- a/arch/um/drivers/line.c
++++ b/arch/um/drivers/line.c
+@@ -673,24 +673,26 @@ void register_winch_irq(int fd, int tty_fd, int pid, struct tty_port *port,
+               goto cleanup;
+       }
+-      *winch = ((struct winch) { .list        = LIST_HEAD_INIT(winch->list),
+-                                 .fd          = fd,
++      *winch = ((struct winch) { .fd          = fd,
+                                  .tty_fd      = tty_fd,
+                                  .pid         = pid,
+                                  .port        = port,
+                                  .stack       = stack });
++      spin_lock(&winch_handler_lock);
++      list_add(&winch->list, &winch_handlers);
++      spin_unlock(&winch_handler_lock);
++
+       if (um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt,
+                          IRQF_SHARED, "winch", winch) < 0) {
+               printk(KERN_ERR "register_winch_irq - failed to register "
+                      "IRQ\n");
++              spin_lock(&winch_handler_lock);
++              list_del(&winch->list);
++              spin_unlock(&winch_handler_lock);
+               goto out_free;
+       }
+-      spin_lock(&winch_handler_lock);
+-      list_add(&winch->list, &winch_handlers);
+-      spin_unlock(&winch_handler_lock);
+-
+       return;
+  out_free:
+-- 
+2.43.0
+
diff --git a/queue-6.6/um-fix-return-value-in-ubd_init.patch b/queue-6.6/um-fix-return-value-in-ubd_init.patch
new file mode 100644 (file)
index 0000000..8ffe9cb
--- /dev/null
@@ -0,0 +1,46 @@
+From 6071038451f5966a4d8990f97586169027c55c99 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Wed, 6 Mar 2024 17:12:59 +0800
+Subject: um: Fix return value in ubd_init()
+
+From: Duoming Zhou <duoming@zju.edu.cn>
+
+[ Upstream commit 31a5990ed253a66712d7ddc29c92d297a991fdf2 ]
+
+When kmalloc_array() fails to allocate memory, the ubd_init()
+should return -ENOMEM instead of -1. So, fix it.
+
+Fixes: f88f0bdfc32f ("um: UBD Improvements")
+Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
+Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
+Signed-off-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/um/drivers/ubd_kern.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
+index 50206feac577d..81405aeab8bf1 100644
+--- a/arch/um/drivers/ubd_kern.c
++++ b/arch/um/drivers/ubd_kern.c
+@@ -1099,7 +1099,7 @@ static int __init ubd_init(void)
+       if (irq_req_buffer == NULL) {
+               printk(KERN_ERR "Failed to initialize ubd buffering\n");
+-              return -1;
++              return -ENOMEM;
+       }
+       io_req_buffer = kmalloc_array(UBD_REQ_BUFFER_SIZE,
+                                     sizeof(struct io_thread_req *),
+@@ -1110,7 +1110,7 @@ static int __init ubd_init(void)
+       if (io_req_buffer == NULL) {
+               printk(KERN_ERR "Failed to initialize ubd buffering\n");
+-              return -1;
++              return -ENOMEM;
+       }
+       platform_driver_register(&ubd_driver);
+       mutex_lock(&ubd_lock);
+-- 
+2.43.0
+
diff --git a/queue-6.6/um-fix-the-declaration-of-kasan_map_memory.patch b/queue-6.6/um-fix-the-declaration-of-kasan_map_memory.patch
new file mode 100644 (file)
index 0000000..8f55975
--- /dev/null
@@ -0,0 +1,61 @@
+From f973565240b4b6ff0bb314b4842a150b99c2d117 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Apr 2024 20:58:55 +0800
+Subject: um: Fix the declaration of kasan_map_memory
+
+From: Tiwei Bie <tiwei.btw@antgroup.com>
+
+[ Upstream commit 6a85e34c4d07d2ec0c153067baff338ac0db55ca ]
+
+Make it match its definition (size_t vs unsigned long). And declare
+it in a shared header to fix the -Wmissing-prototypes warning, as it
+is defined in the user code and called in the kernel code.
+
+Fixes: 5b301409e8bc ("UML: add support for KASAN under x86_64")
+Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
+Signed-off-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/um/include/asm/kasan.h        | 1 -
+ arch/um/include/shared/kern_util.h | 2 ++
+ arch/um/os-Linux/mem.c             | 1 +
+ 3 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/arch/um/include/asm/kasan.h b/arch/um/include/asm/kasan.h
+index 0d6547f4ec85c..f97bb1f7b8514 100644
+--- a/arch/um/include/asm/kasan.h
++++ b/arch/um/include/asm/kasan.h
+@@ -24,7 +24,6 @@
+ #ifdef CONFIG_KASAN
+ void kasan_init(void);
+-void kasan_map_memory(void *start, unsigned long len);
+ extern int kasan_um_is_ready;
+ #ifdef CONFIG_STATIC_LINK
+diff --git a/arch/um/include/shared/kern_util.h b/arch/um/include/shared/kern_util.h
+index 444bae755b16a..7372746c16875 100644
+--- a/arch/um/include/shared/kern_util.h
++++ b/arch/um/include/shared/kern_util.h
+@@ -67,4 +67,6 @@ extern void fatal_sigsegv(void) __attribute__ ((noreturn));
+ void um_idle_sleep(void);
++void kasan_map_memory(void *start, size_t len);
++
+ #endif
+diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
+index 8530b2e086049..c6c9495b14321 100644
+--- a/arch/um/os-Linux/mem.c
++++ b/arch/um/os-Linux/mem.c
+@@ -15,6 +15,7 @@
+ #include <sys/vfs.h>
+ #include <linux/magic.h>
+ #include <init.h>
++#include <kern_util.h>
+ #include <os.h>
+ /*
+-- 
+2.43.0
+
diff --git a/queue-6.6/um-fix-the-wmissing-prototypes-warning-for-__switch_.patch b/queue-6.6/um-fix-the-wmissing-prototypes-warning-for-__switch_.patch
new file mode 100644 (file)
index 0000000..d8770d1
--- /dev/null
@@ -0,0 +1,48 @@
+From 49191d000a7de19f20ed7aa0fee39553d0a1d0e4 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Apr 2024 20:58:53 +0800
+Subject: um: Fix the -Wmissing-prototypes warning for __switch_mm
+
+From: Tiwei Bie <tiwei.btw@antgroup.com>
+
+[ Upstream commit 2cbade17b18c0f0fd9963f26c9fc9b057eb1cb3a ]
+
+The __switch_mm function is defined in the user code, and is called
+by the kernel code. It should be declared in a shared header.
+
+Fixes: 4dc706c2f292 ("um: take um_mmu.h to asm/mmu.h, clean asm/mmu_context.h a bit")
+Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
+Signed-off-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/um/include/asm/mmu.h           | 2 --
+ arch/um/include/shared/skas/mm_id.h | 2 ++
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/arch/um/include/asm/mmu.h b/arch/um/include/asm/mmu.h
+index 5b072aba5b658..a7cb380c0b5c0 100644
+--- a/arch/um/include/asm/mmu.h
++++ b/arch/um/include/asm/mmu.h
+@@ -15,8 +15,6 @@ typedef struct mm_context {
+       struct page *stub_pages[2];
+ } mm_context_t;
+-extern void __switch_mm(struct mm_id * mm_idp);
+-
+ /* Avoid tangled inclusion with asm/ldt.h */
+ extern long init_new_ldt(struct mm_context *to_mm, struct mm_context *from_mm);
+ extern void free_ldt(struct mm_context *mm);
+diff --git a/arch/um/include/shared/skas/mm_id.h b/arch/um/include/shared/skas/mm_id.h
+index e82e203f5f419..92dbf727e3842 100644
+--- a/arch/um/include/shared/skas/mm_id.h
++++ b/arch/um/include/shared/skas/mm_id.h
+@@ -15,4 +15,6 @@ struct mm_id {
+       int kill;
+ };
++void __switch_mm(struct mm_id *mm_idp);
++
+ #endif
+-- 
+2.43.0
+
diff --git a/queue-6.6/um-fix-the-wmissing-prototypes-warning-for-get_threa.patch b/queue-6.6/um-fix-the-wmissing-prototypes-warning-for-get_threa.patch
new file mode 100644 (file)
index 0000000..0a2b166
--- /dev/null
@@ -0,0 +1,54 @@
+From e6a63f128d2c645065c63d7d44a869ebcd6f0d15 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Tue, 23 Apr 2024 20:58:54 +0800
+Subject: um: Fix the -Wmissing-prototypes warning for get_thread_reg
+
+From: Tiwei Bie <tiwei.btw@antgroup.com>
+
+[ Upstream commit 3144013e48f4f6e5127223c4ebc488016815dedb ]
+
+The get_thread_reg function is defined in the user code, and is
+called by the kernel code. It should be declared in a shared header.
+
+Fixes: dbba7f704aa0 ("um: stop polluting the namespace with registers.h contents")
+Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
+Signed-off-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/um/include/asm/processor-generic.h | 1 -
+ arch/x86/um/shared/sysdep/archsetjmp.h  | 7 +++++++
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/arch/um/include/asm/processor-generic.h b/arch/um/include/asm/processor-generic.h
+index 7414154b8e9ae..d34169883dbf0 100644
+--- a/arch/um/include/asm/processor-generic.h
++++ b/arch/um/include/asm/processor-generic.h
+@@ -95,7 +95,6 @@ extern struct cpuinfo_um boot_cpu_data;
+ #define current_cpu_data boot_cpu_data
+ #define cache_line_size()     (boot_cpu_data.cache_alignment)
+-extern unsigned long get_thread_reg(int reg, jmp_buf *buf);
+ #define KSTK_REG(tsk, reg) get_thread_reg(reg, &tsk->thread.switch_buf)
+ extern unsigned long __get_wchan(struct task_struct *p);
+diff --git a/arch/x86/um/shared/sysdep/archsetjmp.h b/arch/x86/um/shared/sysdep/archsetjmp.h
+index 166cedbab9266..8c81d1a604a94 100644
+--- a/arch/x86/um/shared/sysdep/archsetjmp.h
++++ b/arch/x86/um/shared/sysdep/archsetjmp.h
+@@ -1,6 +1,13 @@
+ /* SPDX-License-Identifier: GPL-2.0 */
++#ifndef __X86_UM_SYSDEP_ARCHSETJMP_H
++#define __X86_UM_SYSDEP_ARCHSETJMP_H
++
+ #ifdef __i386__
+ #include "archsetjmp_32.h"
+ #else
+ #include "archsetjmp_64.h"
+ #endif
++
++unsigned long get_thread_reg(int reg, jmp_buf *buf);
++
++#endif /* __X86_UM_SYSDEP_ARCHSETJMP_H */
+-- 
+2.43.0
+
diff --git a/queue-6.6/um-vector-fix-bpfflash-parameter-evaluation.patch b/queue-6.6/um-vector-fix-bpfflash-parameter-evaluation.patch
new file mode 100644 (file)
index 0000000..4e6b7da
--- /dev/null
@@ -0,0 +1,37 @@
+From dcbc31add65259f7a553f834e2c91121572a0bf2 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 28 Mar 2024 10:06:36 +0100
+Subject: um: vector: fix bpfflash parameter evaluation
+
+From: Johannes Berg <johannes.berg@intel.com>
+
+[ Upstream commit 584ed2f76ff5fe360d87a04d17b6520c7999e06b ]
+
+With W=1 the build complains about a pointer compared to
+zero, clearly the result should've been compared.
+
+Fixes: 9807019a62dc ("um: Loadable BPF "Firmware" for vector drivers")
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Reviewed-by: Tiwei Bie <tiwei.btw@antgroup.com>
+Signed-off-by: Richard Weinberger <richard@nod.at>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/um/drivers/vector_kern.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/arch/um/drivers/vector_kern.c b/arch/um/drivers/vector_kern.c
+index 131b7cb295767..94a4dfac6c236 100644
+--- a/arch/um/drivers/vector_kern.c
++++ b/arch/um/drivers/vector_kern.c
+@@ -141,7 +141,7 @@ static bool get_bpf_flash(struct arglist *def)
+       if (allow != NULL) {
+               if (kstrtoul(allow, 10, &result) == 0)
+-                      return (allow > 0);
++                      return result > 0;
+       }
+       return false;
+ }
+-- 
+2.43.0
+
diff --git a/queue-6.6/virtio-delete-vq-in-vp_find_vqs_msix-when-request_ir.patch b/queue-6.6/virtio-delete-vq-in-vp_find_vqs_msix-when-request_ir.patch
new file mode 100644 (file)
index 0000000..8bccff5
--- /dev/null
@@ -0,0 +1,94 @@
+From 7aaa063aad1b53be9b82e18cfd35c790bce1e2a7 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Fri, 26 Apr 2024 17:08:45 +0200
+Subject: virtio: delete vq in vp_find_vqs_msix() when request_irq() fails
+
+From: Jiri Pirko <jiri@nvidia.com>
+
+[ Upstream commit 89875151fccdd024d571aa884ea97a0128b968b6 ]
+
+When request_irq() fails, error path calls vp_del_vqs(). There, as vq is
+present in the list, free_irq() is called for the same vector. That
+causes following splat:
+
+[    0.414355] Trying to free already-free IRQ 27
+[    0.414403] WARNING: CPU: 1 PID: 1 at kernel/irq/manage.c:1899 free_irq+0x1a1/0x2d0
+[    0.414510] Modules linked in:
+[    0.414540] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.9.0-rc4+ #27
+[    0.414540] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-1.fc39 04/01/2014
+[    0.414540] RIP: 0010:free_irq+0x1a1/0x2d0
+[    0.414540] Code: 1e 00 48 83 c4 08 48 89 e8 5b 5d 41 5c 41 5d 41 5e 41 5f c3 cc cc cc cc 90 8b 74 24 04 48 c7 c7 98 80 6c b1 e8 00 c9 f7 ff 90 <0f> 0b 90 90 48 89 ee 4c 89 ef e8 e0 20 b8 00 49 8b 47 40 48 8b 40
+[    0.414540] RSP: 0000:ffffb71480013ae0 EFLAGS: 00010086
+[    0.414540] RAX: 0000000000000000 RBX: ffffa099c2722000 RCX: 0000000000000000
+[    0.414540] RDX: 0000000000000000 RSI: ffffb71480013998 RDI: 0000000000000001
+[    0.414540] RBP: 0000000000000246 R08: 00000000ffffdfff R09: 0000000000000001
+[    0.414540] R10: 00000000ffffdfff R11: ffffffffb18729c0 R12: ffffa099c1c91760
+[    0.414540] R13: ffffa099c1c916a4 R14: ffffa099c1d2f200 R15: ffffa099c1c91600
+[    0.414540] FS:  0000000000000000(0000) GS:ffffa099fec40000(0000) knlGS:0000000000000000
+[    0.414540] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
+[    0.414540] CR2: 0000000000000000 CR3: 0000000008e3e001 CR4: 0000000000370ef0
+[    0.414540] Call Trace:
+[    0.414540]  <TASK>
+[    0.414540]  ? __warn+0x80/0x120
+[    0.414540]  ? free_irq+0x1a1/0x2d0
+[    0.414540]  ? report_bug+0x164/0x190
+[    0.414540]  ? handle_bug+0x3b/0x70
+[    0.414540]  ? exc_invalid_op+0x17/0x70
+[    0.414540]  ? asm_exc_invalid_op+0x1a/0x20
+[    0.414540]  ? free_irq+0x1a1/0x2d0
+[    0.414540]  vp_del_vqs+0xc1/0x220
+[    0.414540]  vp_find_vqs_msix+0x305/0x470
+[    0.414540]  vp_find_vqs+0x3e/0x1a0
+[    0.414540]  vp_modern_find_vqs+0x1b/0x70
+[    0.414540]  init_vqs+0x387/0x600
+[    0.414540]  virtnet_probe+0x50a/0xc80
+[    0.414540]  virtio_dev_probe+0x1e0/0x2b0
+[    0.414540]  really_probe+0xc0/0x2c0
+[    0.414540]  ? __pfx___driver_attach+0x10/0x10
+[    0.414540]  __driver_probe_device+0x73/0x120
+[    0.414540]  driver_probe_device+0x1f/0xe0
+[    0.414540]  __driver_attach+0x88/0x180
+[    0.414540]  bus_for_each_dev+0x85/0xd0
+[    0.414540]  bus_add_driver+0xec/0x1f0
+[    0.414540]  driver_register+0x59/0x100
+[    0.414540]  ? __pfx_virtio_net_driver_init+0x10/0x10
+[    0.414540]  virtio_net_driver_init+0x90/0xb0
+[    0.414540]  do_one_initcall+0x58/0x230
+[    0.414540]  kernel_init_freeable+0x1a3/0x2d0
+[    0.414540]  ? __pfx_kernel_init+0x10/0x10
+[    0.414540]  kernel_init+0x1a/0x1c0
+[    0.414540]  ret_from_fork+0x31/0x50
+[    0.414540]  ? __pfx_kernel_init+0x10/0x10
+[    0.414540]  ret_from_fork_asm+0x1a/0x30
+[    0.414540]  </TASK>
+
+Fix this by calling deleting the current vq when request_irq() fails.
+
+Fixes: 0b0f9dc52ed0 ("Revert "virtio_pci: use shared interrupts for virtqueues"")
+Signed-off-by: Jiri Pirko <jiri@nvidia.com>
+Message-Id: <20240426150845.3999481-1-jiri@resnulli.us>
+Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ drivers/virtio/virtio_pci_common.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/virtio/virtio_pci_common.c b/drivers/virtio/virtio_pci_common.c
+index c2524a7207cfa..64dfa54d702f1 100644
+--- a/drivers/virtio/virtio_pci_common.c
++++ b/drivers/virtio/virtio_pci_common.c
+@@ -345,8 +345,10 @@ static int vp_find_vqs_msix(struct virtio_device *vdev, unsigned int nvqs,
+                                 vring_interrupt, 0,
+                                 vp_dev->msix_names[msix_vec],
+                                 vqs[i]);
+-              if (err)
++              if (err) {
++                      vp_del_vq(vqs[i]);
+                       goto error_find;
++              }
+       }
+       return 0;
+-- 
+2.43.0
+
diff --git a/queue-6.6/x86-kconfig-select-arch_want_frame_pointers-again-wh.patch b/queue-6.6/x86-kconfig-select-arch_want_frame_pointers-again-wh.patch
new file mode 100644 (file)
index 0000000..9d31822
--- /dev/null
@@ -0,0 +1,63 @@
+From e1e32fa14c66b743396cbeea1b5d0a76377b3199 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Sun, 4 Feb 2024 21:20:03 +0900
+Subject: x86/kconfig: Select ARCH_WANT_FRAME_POINTERS again when
+ UNWINDER_FRAME_POINTER=y
+
+From: Masahiro Yamada <masahiroy@kernel.org>
+
+[ Upstream commit 66ee3636eddcc82ab82b539d08b85fb5ac1dff9b ]
+
+It took me some time to understand the purpose of the tricky code at
+the end of arch/x86/Kconfig.debug.
+
+Without it, the following would be shown:
+
+  WARNING: unmet direct dependencies detected for FRAME_POINTER
+
+because
+
+  81d387190039 ("x86/kconfig: Consolidate unwinders into multiple choice selection")
+
+removed 'select ARCH_WANT_FRAME_POINTERS'.
+
+The correct and more straightforward approach should have been to move
+it where 'select FRAME_POINTER' is located.
+
+Several architectures properly handle the conditional selection of
+ARCH_WANT_FRAME_POINTERS. For example, 'config UNWINDER_FRAME_POINTER'
+in arch/arm/Kconfig.debug.
+
+Fixes: 81d387190039 ("x86/kconfig: Consolidate unwinders into multiple choice selection")
+Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
+Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
+Acked-by: Josh Poimboeuf <jpoimboe@kernel.org>
+Link: https://lore.kernel.org/r/20240204122003.53795-1-masahiroy@kernel.org
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/Kconfig.debug | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
+index c5d614d28a759..74777a97e394a 100644
+--- a/arch/x86/Kconfig.debug
++++ b/arch/x86/Kconfig.debug
+@@ -248,6 +248,7 @@ config UNWINDER_ORC
+ config UNWINDER_FRAME_POINTER
+       bool "Frame pointer unwinder"
++      select ARCH_WANT_FRAME_POINTERS
+       select FRAME_POINTER
+       help
+         This option enables the frame pointer unwinder for unwinding kernel
+@@ -271,7 +272,3 @@ config UNWINDER_GUESS
+         overhead.
+ endchoice
+-
+-config FRAME_POINTER
+-      depends on !UNWINDER_ORC && !UNWINDER_GUESS
+-      bool
+-- 
+2.43.0
+
diff --git a/queue-6.6/xen-x86-add-extra-pages-to-unpopulated-alloc-if-avai.patch b/queue-6.6/xen-x86-add-extra-pages-to-unpopulated-alloc-if-avai.patch
new file mode 100644 (file)
index 0000000..01ee27e
--- /dev/null
@@ -0,0 +1,87 @@
+From 2c24c5102e90607457c51fc6a5a5f98f1f143b14 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Mon, 29 Apr 2024 17:50:53 +0200
+Subject: xen/x86: add extra pages to unpopulated-alloc if available
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Roger Pau Monne <roger.pau@citrix.com>
+
+[ Upstream commit a6aa4eb994ee9ced905743817c5de8451d26b911 ]
+
+Commit 262fc47ac174 ('xen/balloon: don't use PV mode extra memory for zone
+device allocations') removed the addition of the extra memory ranges to the
+unpopulated range allocator, using those only for the balloon driver.
+
+This forces the unpopulated allocator to attach hotplug ranges even when spare
+memory (as part of the extra memory ranges) is available.  Furthermore, on PVH
+domains it defeats the purpose of commit 38620fc4e893 ('x86/xen: attempt to
+inflate the memory balloon on PVH'), as extra memory ranges would only be
+used to map foreign memory if the kernel is built without XEN_UNPOPULATED_ALLOC
+support.
+
+Fix this by adding a helpers that adds the extra memory ranges to the list of
+unpopulated pages, and zeroes the ranges so they are not also consumed by the
+balloon driver.
+
+This should have been part of 38620fc4e893, hence the fixes tag.
+
+Note the current logic relies on unpopulated_init() (and hence
+arch_xen_unpopulated_init()) always being called ahead of balloon_init(), so
+that the extra memory regions are consumed by arch_xen_unpopulated_init().
+
+Fixes: 38620fc4e893 ('x86/xen: attempt to inflate the memory balloon on PVH')
+Signed-off-by: Roger Pau MonnĂ© <roger.pau@citrix.com>
+Reviewed-by: Juergen Gross <jgross@suse.com>
+Link: https://lore.kernel.org/r/20240429155053.72509-1-roger.pau@citrix.com
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ arch/x86/xen/enlighten.c | 33 +++++++++++++++++++++++++++++++++
+ 1 file changed, 33 insertions(+)
+
+diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
+index a01ca255b0c64..b88722dfc4f86 100644
+--- a/arch/x86/xen/enlighten.c
++++ b/arch/x86/xen/enlighten.c
+@@ -382,3 +382,36 @@ void __init xen_add_extra_mem(unsigned long start_pfn, unsigned long n_pfns)
+       memblock_reserve(PFN_PHYS(start_pfn), PFN_PHYS(n_pfns));
+ }
++
++#ifdef CONFIG_XEN_UNPOPULATED_ALLOC
++int __init arch_xen_unpopulated_init(struct resource **res)
++{
++      unsigned int i;
++
++      if (!xen_domain())
++              return -ENODEV;
++
++      /* Must be set strictly before calling xen_free_unpopulated_pages(). */
++      *res = &iomem_resource;
++
++      /*
++       * Initialize with pages from the extra memory regions (see
++       * arch/x86/xen/setup.c).
++       */
++      for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) {
++              unsigned int j;
++
++              for (j = 0; j < xen_extra_mem[i].n_pfns; j++) {
++                      struct page *pg =
++                              pfn_to_page(xen_extra_mem[i].start_pfn + j);
++
++                      xen_free_unpopulated_pages(1, &pg);
++              }
++
++              /* Zero so region is not also added to the balloon driver. */
++              xen_extra_mem[i].n_pfns = 0;
++      }
++
++      return 0;
++}
++#endif
+-- 
+2.43.0
+