From: Sasha Levin Date: Sun, 2 Feb 2025 04:05:20 +0000 (-0500) Subject: Fixes for 6.6 X-Git-Tag: v6.6.76~74 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1cbff33a71dfdd27becb5f957e36926da2d6c7a0;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.6 Signed-off-by: Sasha Levin --- diff --git a/queue-6.6/acpi-fan-cleanup-resources-in-the-error-path-of-.pro.patch b/queue-6.6/acpi-fan-cleanup-resources-in-the-error-path-of-.pro.patch new file mode 100644 index 0000000000..22fa7b053a --- /dev/null +++ b/queue-6.6/acpi-fan-cleanup-resources-in-the-error-path-of-.pro.patch @@ -0,0 +1,59 @@ +From 75c33b70ba86e5a2194ce9f11ac68cf9b0bc974d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Dec 2024 12:28:12 +0900 +Subject: ACPI: fan: cleanup resources in the error path of .probe() + +From: Joe Hattori + +[ Upstream commit c759bc8e9046f9812238f506d70f07d3ea4206d4 ] + +Call thermal_cooling_device_unregister() and sysfs_remove_link() in the +error path of acpi_fan_probe() to fix possible memory leak. + +This bug was found by an experimental static analysis tool that I am +developing. + +Fixes: 05a83d972293 ("ACPI: register ACPI Fan as generic thermal cooling device") +Signed-off-by: Joe Hattori +Link: https://patch.msgid.link/20241211032812.210164-1-joe@pf.is.s.u-tokyo.ac.jp +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/acpi/fan_core.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/drivers/acpi/fan_core.c b/drivers/acpi/fan_core.c +index 9dccbae9e8ea7..e416897e3931c 100644 +--- a/drivers/acpi/fan_core.c ++++ b/drivers/acpi/fan_core.c +@@ -367,19 +367,25 @@ static int acpi_fan_probe(struct platform_device *pdev) + result = sysfs_create_link(&pdev->dev.kobj, + &cdev->device.kobj, + "thermal_cooling"); +- if (result) ++ if (result) { + dev_err(&pdev->dev, "Failed to create sysfs link 'thermal_cooling'\n"); ++ goto err_unregister; ++ } + + result = sysfs_create_link(&cdev->device.kobj, + &pdev->dev.kobj, + "device"); + if (result) { + dev_err(&pdev->dev, "Failed to create sysfs link 'device'\n"); +- goto err_end; ++ goto err_remove_link; + } + + return 0; + ++err_remove_link: ++ sysfs_remove_link(&pdev->dev.kobj, "thermal_cooling"); ++err_unregister: ++ thermal_cooling_device_unregister(cdev); + err_end: + if (fan->acpi4) + acpi_fan_delete_attributes(device); +-- +2.39.5 + diff --git a/queue-6.6/afs-fix-cleanup-of-immediately-failed-async-calls.patch b/queue-6.6/afs-fix-cleanup-of-immediately-failed-async-calls.patch new file mode 100644 index 0000000000..f136cfd6ea --- /dev/null +++ b/queue-6.6/afs-fix-cleanup-of-immediately-failed-async-calls.patch @@ -0,0 +1,113 @@ +From cfed81a8d5c13f01233f69da497ac9f098cb1c19 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Dec 2024 20:41:14 +0000 +Subject: afs: Fix cleanup of immediately failed async calls + +From: David Howells + +[ Upstream commit 9750be93b2be12b6d92323b97d7c055099d279e6 ] + +If we manage to begin an async call, but fail to transmit any data on it +due to a signal, we then abort it which causes a race between the +notification of call completion from rxrpc and our attempt to cancel the +notification. The notification will be necessary, however, for async +FetchData to terminate the netfs subrequest. + +However, since we get a notification from rxrpc upon completion of a call +(aborted or otherwise), we can just leave it to that. + +This leads to calls not getting cleaned up, but appearing in +/proc/net/rxrpc/calls as being aborted with code 6. + +Fix this by making the "error_do_abort:" case of afs_make_call() abort the +call and then abandon it to the notification handler. + +Fixes: 34fa47612bfe ("afs: Fix race in async call refcounting") +Reported-by: Marc Dionne +Signed-off-by: David Howells +Link: https://lore.kernel.org/r/20241216204124.3752367-25-dhowells@redhat.com +cc: linux-afs@lists.infradead.org +Signed-off-by: Christian Brauner +Signed-off-by: Sasha Levin +--- + fs/afs/internal.h | 9 +++++++++ + fs/afs/rxrpc.c | 12 +++++++++--- + include/trace/events/afs.h | 2 ++ + 3 files changed, 20 insertions(+), 3 deletions(-) + +diff --git a/fs/afs/internal.h b/fs/afs/internal.h +index 8dcc09cf0adbe..2f135d19545b1 100644 +--- a/fs/afs/internal.h ++++ b/fs/afs/internal.h +@@ -1286,6 +1286,15 @@ extern void afs_send_simple_reply(struct afs_call *, const void *, size_t); + extern int afs_extract_data(struct afs_call *, bool); + extern int afs_protocol_error(struct afs_call *, enum afs_eproto_cause); + ++static inline void afs_see_call(struct afs_call *call, enum afs_call_trace why) ++{ ++ int r = refcount_read(&call->ref); ++ ++ trace_afs_call(call->debug_id, why, r, ++ atomic_read(&call->net->nr_outstanding_calls), ++ __builtin_return_address(0)); ++} ++ + static inline void afs_make_op_call(struct afs_operation *op, struct afs_call *call, + gfp_t gfp) + { +diff --git a/fs/afs/rxrpc.c b/fs/afs/rxrpc.c +index d642d06a453be..43154c70366ae 100644 +--- a/fs/afs/rxrpc.c ++++ b/fs/afs/rxrpc.c +@@ -396,11 +396,16 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp) + return; + + error_do_abort: +- if (ret != -ECONNABORTED) { ++ if (ret != -ECONNABORTED) + rxrpc_kernel_abort_call(call->net->socket, rxcall, + RX_USER_ABORT, ret, + afs_abort_send_data_error); +- } else { ++ if (call->async) { ++ afs_see_call(call, afs_call_trace_async_abort); ++ return; ++ } ++ ++ if (ret == -ECONNABORTED) { + len = 0; + iov_iter_kvec(&msg.msg_iter, ITER_DEST, NULL, 0, 0); + rxrpc_kernel_recv_data(call->net->socket, rxcall, +@@ -412,6 +417,8 @@ void afs_make_call(struct afs_addr_cursor *ac, struct afs_call *call, gfp_t gfp) + call->error = ret; + trace_afs_call_done(call); + error_kill_call: ++ if (call->async) ++ afs_see_call(call, afs_call_trace_async_kill); + if (call->type->done) + call->type->done(call); + +@@ -566,7 +573,6 @@ static void afs_deliver_to_call(struct afs_call *call) + abort_code = 0; + call_complete: + afs_set_call_complete(call, ret, remote_abort); +- state = AFS_CALL_COMPLETE; + goto done; + } + +diff --git a/include/trace/events/afs.h b/include/trace/events/afs.h +index d1ee4272d1cb8..ceb0146ffc7cd 100644 +--- a/include/trace/events/afs.h ++++ b/include/trace/events/afs.h +@@ -118,6 +118,8 @@ enum yfs_cm_operation { + */ + #define afs_call_traces \ + EM(afs_call_trace_alloc, "ALLOC") \ ++ EM(afs_call_trace_async_abort, "ASYAB") \ ++ EM(afs_call_trace_async_kill, "ASYKL") \ + EM(afs_call_trace_free, "FREE ") \ + EM(afs_call_trace_get, "GET ") \ + EM(afs_call_trace_put, "PUT ") \ +-- +2.39.5 + diff --git a/queue-6.6/afs-fix-directory-format-encoding-struct.patch b/queue-6.6/afs-fix-directory-format-encoding-struct.patch new file mode 100644 index 0000000000..a1785b7843 --- /dev/null +++ b/queue-6.6/afs-fix-directory-format-encoding-struct.patch @@ -0,0 +1,45 @@ +From 26afc23e0ff80105834cf04f14a08cb26c349997 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Dec 2024 20:41:03 +0000 +Subject: afs: Fix directory format encoding struct + +From: David Howells + +[ Upstream commit 07a10767853adcbdbf436dc91393b729b52c4e81 ] + +The AFS directory format structure, union afs_xdr_dir_block::meta, has too +many alloc counter slots declared and so pushes the hash table along and +over the data. This doesn't cause a problem at the moment because I'm +currently ignoring the hash table and only using the correct number of +alloc_ctrs in the code anyway. In future, however, I should start using +the hash table to try and speed up afs_lookup(). + +Fix this by using the correct constant to declare the counter array. + +Fixes: 4ea219a839bf ("afs: Split the directory content defs into a header") +Signed-off-by: David Howells +Link: https://lore.kernel.org/r/20241216204124.3752367-14-dhowells@redhat.com +cc: Marc Dionne +cc: linux-afs@lists.infradead.org +Signed-off-by: Christian Brauner +Signed-off-by: Sasha Levin +--- + fs/afs/xdr_fs.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/afs/xdr_fs.h b/fs/afs/xdr_fs.h +index 8ca8681645077..cc5f143d21a34 100644 +--- a/fs/afs/xdr_fs.h ++++ b/fs/afs/xdr_fs.h +@@ -88,7 +88,7 @@ union afs_xdr_dir_block { + + struct { + struct afs_xdr_dir_hdr hdr; +- u8 alloc_ctrs[AFS_DIR_MAX_BLOCKS]; ++ u8 alloc_ctrs[AFS_DIR_BLOCKS_WITH_CTR]; + __be16 hashtable[AFS_DIR_HASHTBL_SIZE]; + } meta; + +-- +2.39.5 + diff --git a/queue-6.6/afs-fix-eexist-error-returned-from-afs_rmdir-to-be-e.patch b/queue-6.6/afs-fix-eexist-error-returned-from-afs_rmdir-to-be-e.patch new file mode 100644 index 0000000000..880e720af9 --- /dev/null +++ b/queue-6.6/afs-fix-eexist-error-returned-from-afs_rmdir-to-be-e.patch @@ -0,0 +1,48 @@ +From 2c28603f089955b09fe12117dfa82aac1df648be Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Dec 2024 20:41:02 +0000 +Subject: afs: Fix EEXIST error returned from afs_rmdir() to be ENOTEMPTY + +From: David Howells + +[ Upstream commit b49194da2aff2c879dec9c59ef8dec0f2b0809ef ] + +AFS servers pass back a code indicating EEXIST when they're asked to remove +a directory that is not empty rather than ENOTEMPTY because not all the +systems that an AFS server can run on have the latter error available and +AFS preexisted the addition of that error in general. + +Fix afs_rmdir() to translate EEXIST to ENOTEMPTY. + +Fixes: 260a980317da ("[AFS]: Add "directory write" support.") +Signed-off-by: David Howells +Link: https://lore.kernel.org/r/20241216204124.3752367-13-dhowells@redhat.com +cc: Marc Dionne +cc: linux-afs@lists.infradead.org +Signed-off-by: Christian Brauner +Signed-off-by: Sasha Levin +--- + fs/afs/dir.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/fs/afs/dir.c b/fs/afs/dir.c +index 897569e1d3a90..cdd2abdc8975d 100644 +--- a/fs/afs/dir.c ++++ b/fs/afs/dir.c +@@ -1458,7 +1458,12 @@ static int afs_rmdir(struct inode *dir, struct dentry *dentry) + op->file[1].vnode = vnode; + } + +- return afs_do_sync_operation(op); ++ ret = afs_do_sync_operation(op); ++ ++ /* Not all systems that can host afs servers have ENOTEMPTY. */ ++ if (ret == -EEXIST) ++ ret = -ENOTEMPTY; ++ return ret; + + error: + return afs_put_operation(op); +-- +2.39.5 + diff --git a/queue-6.6/afs-fix-the-fallback-handling-for-the-yfs.removefile.patch b/queue-6.6/afs-fix-the-fallback-handling-for-the-yfs.removefile.patch new file mode 100644 index 0000000000..444a9ec7e0 --- /dev/null +++ b/queue-6.6/afs-fix-the-fallback-handling-for-the-yfs.removefile.patch @@ -0,0 +1,48 @@ +From b8aeab6d3cb58807a227d3dd1575f22088f734df Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Jan 2025 14:46:03 +0000 +Subject: afs: Fix the fallback handling for the YFS.RemoveFile2 RPC call + +From: David Howells + +[ Upstream commit e30458d690f35abb01de8b3cbc09285deb725d00 ] + +Fix a pair of bugs in the fallback handling for the YFS.RemoveFile2 RPC +call: + + (1) Fix the abort code check to also look for RXGEN_OPCODE. The lack of + this masks the second bug. + + (2) call->server is now not used for ordinary filesystem RPC calls that + have an operation descriptor. Fix to use call->op->server instead. + +Fixes: e49c7b2f6de7 ("afs: Build an abstraction around an "operation" concept") +Signed-off-by: David Howells +Link: https://lore.kernel.org/r/109541.1736865963@warthog.procyon.org.uk +cc: Marc Dionne +cc: linux-afs@lists.infradead.org +Signed-off-by: Christian Brauner +Signed-off-by: Sasha Levin +--- + fs/afs/yfsclient.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/fs/afs/yfsclient.c b/fs/afs/yfsclient.c +index 11571cca86c19..01f333e691d64 100644 +--- a/fs/afs/yfsclient.c ++++ b/fs/afs/yfsclient.c +@@ -655,8 +655,9 @@ static int yfs_deliver_fs_remove_file2(struct afs_call *call) + static void yfs_done_fs_remove_file2(struct afs_call *call) + { + if (call->error == -ECONNABORTED && +- call->abort_code == RX_INVALID_OPERATION) { +- set_bit(AFS_SERVER_FL_NO_RM2, &call->server->flags); ++ (call->abort_code == RX_INVALID_OPERATION || ++ call->abort_code == RXGEN_OPCODE)) { ++ set_bit(AFS_SERVER_FL_NO_RM2, &call->op->server->flags); + call->op->flags |= AFS_OPERATION_DOWNGRADE; + } + } +-- +2.39.5 + diff --git a/queue-6.6/alsa-hda-realtek-fixed-headphone-distorted-sound-on-.patch b/queue-6.6/alsa-hda-realtek-fixed-headphone-distorted-sound-on-.patch new file mode 100644 index 0000000000..f1a9db95bd --- /dev/null +++ b/queue-6.6/alsa-hda-realtek-fixed-headphone-distorted-sound-on-.patch @@ -0,0 +1,37 @@ +From 77207f7cddb130e6d95a726b70f6957a766421d7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Dec 2024 14:44:01 +0800 +Subject: ALSA: hda/realtek - Fixed headphone distorted sound on Acer Aspire + A115-31 laptop + +From: Kailang Yang + +[ Upstream commit 5cb4e5b056772e341b590755a976081776422053 ] + +Sound played through headphones is distorted. + +Fixes: 34ab5bbc6e82 ("ALSA: hda/realtek - Add Headset Mic supported Acer NB platform") +Closes: https://lore.kernel.org/linux-sound/e142749b-7714-4733-9452-918fbe328c8f@gmail.com/ +Signed-off-by: Kailang Yang +Link: https://lore.kernel.org/0a89b6c18ed94378a105fa61e9f290e4@realtek.com +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/pci/hda/patch_realtek.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c +index 739f8fd1792bd..0b679fd1b82ab 100644 +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -9726,6 +9726,7 @@ static const struct hda_quirk alc269_fixup_tbl[] = { + SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC), + SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC), ++ SND_PCI_QUIRK(0x1025, 0x1360, "Acer Aspire A115", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE), +-- +2.39.5 + diff --git a/queue-6.6/alsa-seq-make-dependency-on-ump-clearer.patch b/queue-6.6/alsa-seq-make-dependency-on-ump-clearer.patch new file mode 100644 index 0000000000..44fbad9ed9 --- /dev/null +++ b/queue-6.6/alsa-seq-make-dependency-on-ump-clearer.patch @@ -0,0 +1,53 @@ +From 2257f280a90676462cf6531240393a49bcb317fe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 1 Jan 2025 13:55:47 +0100 +Subject: ALSA: seq: Make dependency on UMP clearer + +From: Takashi Iwai + +[ Upstream commit 9001d515443518d72222ba4d58e247696b625071 ] + +CONFIG_SND_SEQ_UMP_CLIENT is a Kconfig for a sequencer client +corresponding to the UMP rawmidi, while we have another major knob +CONFIG_SND_SEQ_UMP that specifies whether the sequencer core supports +UMP packets or not. Strictly speaking both of them are independent, +but practically seen, it makes no sense to enable +CONFIG_SND_SEQ_UMP_CLIENT without UMP support itself. + +This patch makes such an implicit dependency clearer. Now +CONFIG_SND_SEQ_UMP_CLIENT depends on both CONFIG_SND_UMP and +CONFIG_SND_SEQ_UMP. Meanwhile, CONFIG_SND_SEQ_UMP is enabled as +default when CONFIG_SND_UMP is set. + +Fixes: 81fd444aa371 ("ALSA: seq: Bind UMP device") +Link: https://patch.msgid.link/20250101125548.25961-1-tiwai@suse.de +Signed-off-by: Takashi Iwai +Signed-off-by: Sasha Levin +--- + sound/core/seq/Kconfig | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/sound/core/seq/Kconfig b/sound/core/seq/Kconfig +index 0374bbf51cd4d..e4f58cb985d47 100644 +--- a/sound/core/seq/Kconfig ++++ b/sound/core/seq/Kconfig +@@ -62,7 +62,7 @@ config SND_SEQ_VIRMIDI + + config SND_SEQ_UMP + bool "Support for UMP events" +- default y if SND_SEQ_UMP_CLIENT ++ default SND_UMP + help + Say Y here to enable the support for handling UMP (Universal MIDI + Packet) events via ALSA sequencer infrastructure, which is an +@@ -71,6 +71,6 @@ config SND_SEQ_UMP + among legacy and UMP clients. + + config SND_SEQ_UMP_CLIENT +- def_tristate SND_UMP ++ def_tristate SND_UMP && SND_SEQ_UMP + + endif # SND_SEQUENCER +-- +2.39.5 + diff --git a/queue-6.6/alsa-seq-remove-redundant-tristate-for-snd_seq_ump_c.patch b/queue-6.6/alsa-seq-remove-redundant-tristate-for-snd_seq_ump_c.patch new file mode 100644 index 0000000000..d9b05899c4 --- /dev/null +++ b/queue-6.6/alsa-seq-remove-redundant-tristate-for-snd_seq_ump_c.patch @@ -0,0 +1,37 @@ +From 0cad958a5c764314e43ebc21d0ed53b4e0698d49 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 15 Feb 2024 22:53:04 +0900 +Subject: ALSA: seq: remove redundant 'tristate' for SND_SEQ_UMP_CLIENT + +From: Masahiro Yamada + +[ Upstream commit 8e8bc5000328a1ba8f93d43faf427e8ac31fb416 ] + +'def_tristate' is a shorthand for 'default' + 'tristate'. + +Another 'tristate' is redundant. + +Signed-off-by: Masahiro Yamada +Link: https://lore.kernel.org/r/20240215135304.1909431-1-masahiroy@kernel.org +Signed-off-by: Takashi Iwai +Stable-dep-of: 9001d5154435 ("ALSA: seq: Make dependency on UMP clearer") +Signed-off-by: Sasha Levin +--- + sound/core/seq/Kconfig | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/sound/core/seq/Kconfig b/sound/core/seq/Kconfig +index c14981daf9432..0374bbf51cd4d 100644 +--- a/sound/core/seq/Kconfig ++++ b/sound/core/seq/Kconfig +@@ -71,7 +71,6 @@ config SND_SEQ_UMP + among legacy and UMP clients. + + config SND_SEQ_UMP_CLIENT +- tristate + def_tristate SND_UMP + + endif # SND_SEQUENCER +-- +2.39.5 + diff --git a/queue-6.6/arm-at91-pm-change-bu-power-switch-to-automatic-mode.patch b/queue-6.6/arm-at91-pm-change-bu-power-switch-to-automatic-mode.patch new file mode 100644 index 0000000000..84b2859ed9 --- /dev/null +++ b/queue-6.6/arm-at91-pm-change-bu-power-switch-to-automatic-mode.patch @@ -0,0 +1,93 @@ +From 0c7f820c47ea78a4d064d4feec3ffeb49584b51e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 25 Nov 2024 17:56:48 +0100 +Subject: ARM: at91: pm: change BU Power Switch to automatic mode + +From: Nicolas Ferre + +[ Upstream commit 6fc5bdfa872b7da51b5507a1327a17c3db2fcf95 ] + +Change how the Backup Unit Power is configured and force the +automatic/hardware mode. +This change eliminates the need for software management of the power +switch, ensuring it transitions to the backup power source before +entering low power modes. + +This is done in the only location where this switch was configured. It's +usually done in the bootloader. + +Previously, the loss of the VDDANA (or VDDIN33) power source was not +automatically compensated by an alternative power source. This resulted +in the loss of Backup Unit content, including Backup Self-refresh low +power mode information, OTP emulation configuration, and boot +configuration, for instance. + +Fixes: ac809e7879b1 ("ARM: at91: pm: switch backup area to vbat in backup mode") +Signed-off-by: Nicolas Ferre +Link: https://lore.kernel.org/r/20241125165648.509162-1-nicolas.ferre@microchip.com +Signed-off-by: Claudiu Beznea +Signed-off-by: Sasha Levin +--- + arch/arm/mach-at91/pm.c | 31 ++++++++++++++++++++----------- + 1 file changed, 20 insertions(+), 11 deletions(-) + +diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c +index 1a26af0fabc71..22ecaf09d00f9 100644 +--- a/arch/arm/mach-at91/pm.c ++++ b/arch/arm/mach-at91/pm.c +@@ -591,7 +591,21 @@ static int at91_suspend_finish(unsigned long val) + return 0; + } + +-static void at91_pm_switch_ba_to_vbat(void) ++/** ++ * at91_pm_switch_ba_to_auto() - Configure Backup Unit Power Switch ++ * to automatic/hardware mode. ++ * ++ * The Backup Unit Power Switch can be managed either by software or hardware. ++ * Enabling hardware mode allows the automatic transition of power between ++ * VDDANA (or VDDIN33) and VDDBU (or VBAT, respectively), based on the ++ * availability of these power sources. ++ * ++ * If the Backup Unit Power Switch is already in automatic mode, no action is ++ * required. If it is in software-controlled mode, it is switched to automatic ++ * mode to enhance safety and eliminate the need for toggling between power ++ * sources. ++ */ ++static void at91_pm_switch_ba_to_auto(void) + { + unsigned int offset = offsetof(struct at91_pm_sfrbu_regs, pswbu); + unsigned int val; +@@ -602,24 +616,19 @@ static void at91_pm_switch_ba_to_vbat(void) + + val = readl(soc_pm.data.sfrbu + offset); + +- /* Already on VBAT. */ +- if (!(val & soc_pm.sfrbu_regs.pswbu.state)) ++ /* Already on auto/hardware. */ ++ if (!(val & soc_pm.sfrbu_regs.pswbu.ctrl)) + return; + +- val &= ~soc_pm.sfrbu_regs.pswbu.softsw; +- val |= soc_pm.sfrbu_regs.pswbu.key | soc_pm.sfrbu_regs.pswbu.ctrl; ++ val &= ~soc_pm.sfrbu_regs.pswbu.ctrl; ++ val |= soc_pm.sfrbu_regs.pswbu.key; + writel(val, soc_pm.data.sfrbu + offset); +- +- /* Wait for update. */ +- val = readl(soc_pm.data.sfrbu + offset); +- while (val & soc_pm.sfrbu_regs.pswbu.state) +- val = readl(soc_pm.data.sfrbu + offset); + } + + static void at91_pm_suspend(suspend_state_t state) + { + if (soc_pm.data.mode == AT91_PM_BACKUP) { +- at91_pm_switch_ba_to_vbat(); ++ at91_pm_switch_ba_to_auto(); + + cpu_suspend(0, at91_suspend_finish); + +-- +2.39.5 + diff --git a/queue-6.6/arm-dts-aspeed-yosemite4-add-required-properties-for.patch b/queue-6.6/arm-dts-aspeed-yosemite4-add-required-properties-for.patch new file mode 100644 index 0000000000..66a93f30ad --- /dev/null +++ b/queue-6.6/arm-dts-aspeed-yosemite4-add-required-properties-for.patch @@ -0,0 +1,47 @@ +From da5516b5deab4e157db5910138a0ae5d99c6d989 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Oct 2024 15:42:45 +0800 +Subject: ARM: dts: aspeed: yosemite4: Add required properties for IOE on fan + boards + +From: Ricky CX Wu + +[ Upstream commit c64ac96f8f8d957cdc6ec3c93dd9a6c4e6d78506 ] + +Add the required properties for IO expander on fan boards. + +Fixes: 2b8d94f4b4a4 ("ARM: dts: aspeed: yosemite4: add Facebook Yosemite 4 BMC") +Signed-off-by: Ricky CX Wu +Signed-off-by: Delphine CC Chiu +Link: https://patch.msgid.link/20241003074251.3818101-5-Delphine_CC_Chiu@wiwynn.com +Signed-off-by: Andrew Jeffery +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts b/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts +index ac15fee7245a1..e9eaffa9b504e 100644 +--- a/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts ++++ b/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts +@@ -463,6 +463,8 @@ + gpio@22{ + compatible = "ti,tca6424"; + reg = <0x22>; ++ gpio-controller; ++ #gpio-cells = <2>; + }; + + pwm@23{ +@@ -513,6 +515,8 @@ + gpio@22{ + compatible = "ti,tca6424"; + reg = <0x22>; ++ gpio-controller; ++ #gpio-cells = <2>; + }; + + pwm@23{ +-- +2.39.5 + diff --git a/queue-6.6/arm-dts-aspeed-yosemite4-correct-the-compatible-stri.patch b/queue-6.6/arm-dts-aspeed-yosemite4-correct-the-compatible-stri.patch new file mode 100644 index 0000000000..c5f4eb983e --- /dev/null +++ b/queue-6.6/arm-dts-aspeed-yosemite4-correct-the-compatible-stri.patch @@ -0,0 +1,46 @@ +From 4a290045ab7332733d81d39c8150a1401beeab4d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 27 Sep 2024 16:52:13 +0800 +Subject: ARM: dts: aspeed: yosemite4: correct the compatible string of adm1272 + +From: Ricky CX Wu + +[ Upstream commit ece3e20e3389ec8a32944ad44746ee379bf1d3eb ] + +Remove the space in the compatible string of adm1272 to match the +pattern of compatible. + +Fixes: 2b8d94f4b4a4 ("ARM: dts: aspeed: yosemite4: add Facebook Yosemite 4 BMC") +Signed-off-by: Ricky CX Wu +Signed-off-by: Delphine CC Chiu +Fixes: 2b8d94f4b4a4765d ("ARM: dts: aspeed: yosemite4: add Facebook Yosemite 4 BMC") +Reviewed-by: Andrew Jeffery +Link: https://patch.msgid.link/20240927085213.331127-1-Delphine_CC_Chiu@wiwynn.com +Signed-off-by: Andrew Jeffery +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts b/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts +index 64075cc41d927..ac15fee7245a1 100644 +--- a/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts ++++ b/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts +@@ -284,12 +284,12 @@ + &i2c11 { + status = "okay"; + power-sensor@10 { +- compatible = "adi, adm1272"; ++ compatible = "adi,adm1272"; + reg = <0x10>; + }; + + power-sensor@12 { +- compatible = "adi, adm1272"; ++ compatible = "adi,adm1272"; + reg = <0x12>; + }; + +-- +2.39.5 + diff --git a/queue-6.6/arm-dts-aspeed-yosemite4-correct-the-compatible-stri.patch-2077 b/queue-6.6/arm-dts-aspeed-yosemite4-correct-the-compatible-stri.patch-2077 new file mode 100644 index 0000000000..869c0022ce --- /dev/null +++ b/queue-6.6/arm-dts-aspeed-yosemite4-correct-the-compatible-stri.patch-2077 @@ -0,0 +1,77 @@ +From d36fe1f760d3c8e088aef07b37d95bf411f13622 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 3 Oct 2024 15:42:46 +0800 +Subject: ARM: dts: aspeed: yosemite4: correct the compatible string for + max31790 + +From: Ricky CX Wu + +[ Upstream commit b1a1ecb669bfa763ee5e86a038d7c9363eee7548 ] + +Fix the compatible string for max31790 to match the binding document. + +Fixes: 2b8d94f4b4a4 ("ARM: dts: aspeed: yosemite4: add Facebook Yosemite 4 BMC") +Signed-off-by: Ricky CX Wu +Signed-off-by: Delphine CC Chiu +Link: https://patch.msgid.link/20241003074251.3818101-6-Delphine_CC_Chiu@wiwynn.com +Signed-off-by: Andrew Jeffery +Signed-off-by: Sasha Levin +--- + .../dts/aspeed/aspeed-bmc-facebook-yosemite4.dts | 16 ++++------------ + 1 file changed, 4 insertions(+), 12 deletions(-) + +diff --git a/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts b/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts +index e9eaffa9b504e..f5d38a9f47638 100644 +--- a/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts ++++ b/arch/arm/boot/dts/aspeed/aspeed-bmc-facebook-yosemite4.dts +@@ -454,10 +454,8 @@ + }; + + pwm@20{ +- compatible = "max31790"; ++ compatible = "maxim,max31790"; + reg = <0x20>; +- #address-cells = <1>; +- #size-cells = <0>; + }; + + gpio@22{ +@@ -468,10 +466,8 @@ + }; + + pwm@23{ +- compatible = "max31790"; ++ compatible = "maxim,max31790"; + reg = <0x23>; +- #address-cells = <1>; +- #size-cells = <0>; + }; + + adc@33 { +@@ -506,10 +502,8 @@ + }; + + pwm@20{ +- compatible = "max31790"; ++ compatible = "maxim,max31790"; + reg = <0x20>; +- #address-cells = <1>; +- #size-cells = <0>; + }; + + gpio@22{ +@@ -520,10 +514,8 @@ + }; + + pwm@23{ +- compatible = "max31790"; ++ compatible = "maxim,max31790"; + reg = <0x23>; +- #address-cells = <1>; +- #size-cells = <0>; + }; + + adc@33 { +-- +2.39.5 + diff --git a/queue-6.6/arm-dts-mediatek-mt7623-fix-ir-nodename.patch b/queue-6.6/arm-dts-mediatek-mt7623-fix-ir-nodename.patch new file mode 100644 index 0000000000..e787cc50b5 --- /dev/null +++ b/queue-6.6/arm-dts-mediatek-mt7623-fix-ir-nodename.patch @@ -0,0 +1,42 @@ +From b953bf9f0aecca3ca11cdcbe32059fb6ea992f9d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 17 Jun 2024 11:46:33 +0200 +Subject: ARM: dts: mediatek: mt7623: fix IR nodename +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Rafał Miłecki + +[ Upstream commit 90234cf9b37c57201a24b78c217a91a8af774109 ] + +Fix following validation error: +arch/arm/boot/dts/mediatek/mt7623a-rfb-emmc.dtb: cir@10013000: $nodename:0: 'cir@10013000' does not match '^ir(-receiver)?(@[a-f0-9]+)?$' + from schema $id: http://devicetree.org/schemas/media/mediatek,mt7622-cir.yaml# + +Fixes: 91044f38dae7 ("arm: dts: mt7623: add ir nodes to the mt7623.dtsi file") +Cc: linux-media@vger.kernel.org +Signed-off-by: Rafał Miłecki +Link: https://lore.kernel.org/r/20240617094634.23173-1-zajec5@gmail.com +Signed-off-by: Matthias Brugger +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/mediatek/mt7623.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/mediatek/mt7623.dtsi b/arch/arm/boot/dts/mediatek/mt7623.dtsi +index f0b4a09004b31..9c5a52ce9351a 100644 +--- a/arch/arm/boot/dts/mediatek/mt7623.dtsi ++++ b/arch/arm/boot/dts/mediatek/mt7623.dtsi +@@ -308,7 +308,7 @@ + clock-names = "spi", "wrap"; + }; + +- cir: cir@10013000 { ++ cir: ir-receiver@10013000 { + compatible = "mediatek,mt7623-cir"; + reg = <0 0x10013000 0 0x1000>; + interrupts = ; +-- +2.39.5 + diff --git a/queue-6.6/arm-dts-microchip-sama5d27_wlsom1_ek-add-no-1-8-v-pr.patch b/queue-6.6/arm-dts-microchip-sama5d27_wlsom1_ek-add-no-1-8-v-pr.patch new file mode 100644 index 0000000000..6ebfb73152 --- /dev/null +++ b/queue-6.6/arm-dts-microchip-sama5d27_wlsom1_ek-add-no-1-8-v-pr.patch @@ -0,0 +1,45 @@ +From 72c81dfef250f19c3a9e3769ff2a10325f594d4b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Nov 2024 18:01:07 +0200 +Subject: ARM: dts: microchip: sama5d27_wlsom1_ek: Add no-1-8-v property to + sdmmc0 node + +From: Cristian Birsan + +[ Upstream commit 4d9e5965df04c0adf260c3009c55d5fe240f7286 ] + +Add no-1-8-v property to sdmmc0 node to keep VDDSDMMC power rail at 3.3V. +This property will stop the LDO regulator from switching to 1.8V when the +MMC core detects an UHS SD Card. VDDSDMMC power rail is used by all the +SDMMC interface pins in GPIO mode (PA0 - PA13). + +On this board, PA10 is used as GPIO to enable the power switch controlling +USB Vbus for the USB Host. The change is needed to fix the PA10 voltage +level to 3.3V instead of 1.8V. + +Fixes: 5d4c3cfb63fe ("ARM: dts: at91: sama5d27_wlsom1: add SAMA5D27 wlsom1 and wlsom1-ek") +Suggested-by: Mihai Sain +Signed-off-by: Cristian Birsan +Tested-by: Andrei Simion +Link: https://lore.kernel.org/r/20241119160107.598411-3-cristian.birsan@microchip.com +Signed-off-by: Claudiu Beznea +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/microchip/at91-sama5d27_wlsom1_ek.dts | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm/boot/dts/microchip/at91-sama5d27_wlsom1_ek.dts b/arch/arm/boot/dts/microchip/at91-sama5d27_wlsom1_ek.dts +index 15239834d886e..35a933eec5738 100644 +--- a/arch/arm/boot/dts/microchip/at91-sama5d27_wlsom1_ek.dts ++++ b/arch/arm/boot/dts/microchip/at91-sama5d27_wlsom1_ek.dts +@@ -197,6 +197,7 @@ + + &sdmmc0 { + bus-width = <4>; ++ no-1-8-v; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_sdmmc0_default>; + status = "okay"; +-- +2.39.5 + diff --git a/queue-6.6/arm-dts-microchip-sama5d27_wlsom1_ek-remove-mmc-ddr-.patch b/queue-6.6/arm-dts-microchip-sama5d27_wlsom1_ek-remove-mmc-ddr-.patch new file mode 100644 index 0000000000..744e8dbcf4 --- /dev/null +++ b/queue-6.6/arm-dts-microchip-sama5d27_wlsom1_ek-remove-mmc-ddr-.patch @@ -0,0 +1,39 @@ +From 1acadb117915ac4857ba094ba9543afcfb667075 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Dec 2023 09:25:37 +0200 +Subject: ARM: dts: microchip: sama5d27_wlsom1_ek: Remove mmc-ddr-3_3v property + from sdmmc0 node + +From: Mihai Sain + +[ Upstream commit 2a7f1848d9d65a4deb366726ff8f33c9c64ac43b ] + +On board the sdmmc0 interface is wired to a SD Card socket. +According with mmc-controller bindings, the mmc-ddr-3_3v property +is used for eMMC devices to enable high-speed DDR mode (3.3V I/O). +Remove the mmc-ddr-3_3v property from sdmmc0 node. + +Signed-off-by: Mihai Sain +Link: https://lore.kernel.org/r/20231204072537.2991-1-mihai.sain@microchip.com +Signed-off-by: Claudiu Beznea +Stable-dep-of: 4d9e5965df04 ("ARM: dts: microchip: sama5d27_wlsom1_ek: Add no-1-8-v property to sdmmc0 node") +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/microchip/at91-sama5d27_wlsom1_ek.dts | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/arch/arm/boot/dts/microchip/at91-sama5d27_wlsom1_ek.dts b/arch/arm/boot/dts/microchip/at91-sama5d27_wlsom1_ek.dts +index e055b9e2fe344..15239834d886e 100644 +--- a/arch/arm/boot/dts/microchip/at91-sama5d27_wlsom1_ek.dts ++++ b/arch/arm/boot/dts/microchip/at91-sama5d27_wlsom1_ek.dts +@@ -197,7 +197,6 @@ + + &sdmmc0 { + bus-width = <4>; +- mmc-ddr-3_3v; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_sdmmc0_default>; + status = "okay"; +-- +2.39.5 + diff --git a/queue-6.6/arm-dts-socfpga-use-reset-name-stmmaceth-ocp-instead.patch b/queue-6.6/arm-dts-socfpga-use-reset-name-stmmaceth-ocp-instead.patch new file mode 100644 index 0000000000..a03050918d --- /dev/null +++ b/queue-6.6/arm-dts-socfpga-use-reset-name-stmmaceth-ocp-instead.patch @@ -0,0 +1,104 @@ +From e2e9e31922b7121be8edb4b15403f86f0f19673b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 28 Oct 2024 15:59:07 +0100 +Subject: arm: dts: socfpga: use reset-name "stmmaceth-ocp" instead of "ahb" + +From: Mamta Shukla + +[ Upstream commit 62a40a0d5634834790f7166ab592be247390d857 ] + +The ahb reset is deasserted in probe before first register access, while the +stmmacheth-ocp reset needs to be asserted every time before changing the phy +mode in Arria10[1]. + +Changed in Upstream to "ahb"(331085a423b arm64: dts: socfpga: change the +reset-name of "stmmaceth-ocp" to "ahb" ).This change was intended for arm64 +socfpga and it is not applicable to Arria10. + +Further with STMMAC-SELFTEST Driver enabled, ethtool test also FAILS. +$ ethtool -t eth0 +[ 322.946709] socfpga-dwmac ff800000.ethernet eth0: entered promiscuous mode +[ 323.374558] socfpga-dwmac ff800000.ethernet eth0: left promiscuous mode +The test result is FAIL +The test extra info: + 1. MAC Loopback 0 + 2. PHY Loopback -110 + 3. MMC Counters -110 + 4. EEE -95 + 5. Hash Filter MC 0 + 6. Perfect Filter UC -110 + 7. MC Filter -110 + 8. UC Filter 0 + 9. Flow Control -110 +10. RSS -95 +11. VLAN Filtering -95 +12. VLAN Filtering (perf) -95 +13. Double VLAN Filter -95 +14. Double VLAN Filter (perf) -95 +15. Flexible RX Parser -95 +16. SA Insertion (desc) -95 +17. SA Replacement (desc) -95 +18. SA Insertion (reg) -95 +19. SA Replacement (reg) -95 +20. VLAN TX Insertion -95 +21. SVLAN TX Insertion -95 +22. L3 DA Filtering -95 +23. L3 SA Filtering -95 +24. L4 DA TCP Filtering -95 +25. L4 SA TCP Filtering -95 +26. L4 DA UDP Filtering -95 +27. L4 SA UDP Filtering -95 +28. ARP Offload -95 +29. Jumbo Frame -110 +30. Multichannel Jumbo -95 +31. Split Header -95 +32. TBS (ETF Scheduler) -95 + +[ 324.881327] socfpga-dwmac ff800000.ethernet eth0: Link is Down +[ 327.995360] socfpga-dwmac ff800000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx + +Link:[1] https://www.intel.com/content/www/us/en/docs/programmable/683711/21-2/functional-description-of-the-emac.html +Fixes: 331085a423b ("arm64: dts: socfpga: change the reset-name of "stmmaceth-ocp" to "ahb") +Signed-off-by: Mamta Shukla +Tested-by: Ahmad Fatoum +Reviewed-by: Ahmad Fatoum +Signed-off-by: Dinh Nguyen +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/intel/socfpga/socfpga_arria10.dtsi | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/boot/dts/intel/socfpga/socfpga_arria10.dtsi b/arch/arm/boot/dts/intel/socfpga/socfpga_arria10.dtsi +index f36063c57c7f2..72c55e5187ca8 100644 +--- a/arch/arm/boot/dts/intel/socfpga/socfpga_arria10.dtsi ++++ b/arch/arm/boot/dts/intel/socfpga/socfpga_arria10.dtsi +@@ -440,7 +440,7 @@ + clocks = <&l4_mp_clk>, <&peri_emac_ptp_clk>; + clock-names = "stmmaceth", "ptp_ref"; + resets = <&rst EMAC0_RESET>, <&rst EMAC0_OCP_RESET>; +- reset-names = "stmmaceth", "ahb"; ++ reset-names = "stmmaceth", "stmmaceth-ocp"; + snps,axi-config = <&socfpga_axi_setup>; + status = "disabled"; + }; +@@ -460,7 +460,7 @@ + clocks = <&l4_mp_clk>, <&peri_emac_ptp_clk>; + clock-names = "stmmaceth", "ptp_ref"; + resets = <&rst EMAC1_RESET>, <&rst EMAC1_OCP_RESET>; +- reset-names = "stmmaceth", "ahb"; ++ reset-names = "stmmaceth", "stmmaceth-ocp"; + snps,axi-config = <&socfpga_axi_setup>; + status = "disabled"; + }; +@@ -480,7 +480,7 @@ + clocks = <&l4_mp_clk>, <&peri_emac_ptp_clk>; + clock-names = "stmmaceth", "ptp_ref"; + resets = <&rst EMAC2_RESET>, <&rst EMAC2_OCP_RESET>; +- reset-names = "stmmaceth", "ahb"; ++ reset-names = "stmmaceth", "stmmaceth-ocp"; + snps,axi-config = <&socfpga_axi_setup>; + status = "disabled"; + }; +-- +2.39.5 + diff --git a/queue-6.6/arm-dts-stm32-deduplicate-serial-aliases-and-chosen-.patch b/queue-6.6/arm-dts-stm32-deduplicate-serial-aliases-and-chosen-.patch new file mode 100644 index 0000000000..1eaff335ce --- /dev/null +++ b/queue-6.6/arm-dts-stm32-deduplicate-serial-aliases-and-chosen-.patch @@ -0,0 +1,113 @@ +From ba235af2b2c69286a4cf9a59154c43a4fb54eb39 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Nov 2024 00:29:44 +0100 +Subject: ARM: dts: stm32: Deduplicate serial aliases and chosen node for + STM32MP15xx DHCOM SoM + +From: Marek Vasut + +[ Upstream commit 73317d327123472cb70e9ecbe050310f1d235e93 ] + +Deduplicate /aliases { serialN = ... } and /chosen node into +stm32mp15xx-dhcom-som.dtsi , since the content is identical +on all carrier boards using the STM32MP15xx DHCOM SoM. No +functional change. + +Signed-off-by: Marek Vasut +Reviewed-by: Christoph Niedermaier +Signed-off-by: Alexandre Torgue +Stable-dep-of: 479b8227ffc4 ("ARM: dts: stm32: Swap USART3 and UART8 alias on STM32MP15xx DHCOM SoM") +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/st/stm32mp15xx-dhcom-drc02.dtsi | 12 ------------ + arch/arm/boot/dts/st/stm32mp15xx-dhcom-pdk2.dtsi | 10 ---------- + arch/arm/boot/dts/st/stm32mp15xx-dhcom-picoitx.dtsi | 10 ---------- + arch/arm/boot/dts/st/stm32mp15xx-dhcom-som.dtsi | 7 +++++++ + 4 files changed, 7 insertions(+), 32 deletions(-) + +diff --git a/arch/arm/boot/dts/st/stm32mp15xx-dhcom-drc02.dtsi b/arch/arm/boot/dts/st/stm32mp15xx-dhcom-drc02.dtsi +index 35b1034aa3cf6..e4e114d8c3371 100644 +--- a/arch/arm/boot/dts/st/stm32mp15xx-dhcom-drc02.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp15xx-dhcom-drc02.dtsi +@@ -6,18 +6,6 @@ + #include + #include + +-/ { +- aliases { +- serial0 = &uart4; +- serial1 = &usart3; +- serial2 = &uart8; +- }; +- +- chosen { +- stdout-path = "serial0:115200n8"; +- }; +-}; +- + &adc { + status = "disabled"; + }; +diff --git a/arch/arm/boot/dts/st/stm32mp15xx-dhcom-pdk2.dtsi b/arch/arm/boot/dts/st/stm32mp15xx-dhcom-pdk2.dtsi +index 46b87a27d8b37..7050582837d58 100644 +--- a/arch/arm/boot/dts/st/stm32mp15xx-dhcom-pdk2.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp15xx-dhcom-pdk2.dtsi +@@ -7,16 +7,6 @@ + #include + + / { +- aliases { +- serial0 = &uart4; +- serial1 = &usart3; +- serial2 = &uart8; +- }; +- +- chosen { +- stdout-path = "serial0:115200n8"; +- }; +- + clk_ext_audio_codec: clock-codec { + compatible = "fixed-clock"; + #clock-cells = <0>; +diff --git a/arch/arm/boot/dts/st/stm32mp15xx-dhcom-picoitx.dtsi b/arch/arm/boot/dts/st/stm32mp15xx-dhcom-picoitx.dtsi +index abc595350e71a..81743a448607b 100644 +--- a/arch/arm/boot/dts/st/stm32mp15xx-dhcom-picoitx.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp15xx-dhcom-picoitx.dtsi +@@ -7,16 +7,6 @@ + #include + + / { +- aliases { +- serial0 = &uart4; +- serial1 = &usart3; +- serial2 = &uart8; +- }; +- +- chosen { +- stdout-path = "serial0:115200n8"; +- }; +- + led { + compatible = "gpio-leds"; + +diff --git a/arch/arm/boot/dts/st/stm32mp15xx-dhcom-som.dtsi b/arch/arm/boot/dts/st/stm32mp15xx-dhcom-som.dtsi +index 74a11ccc5333f..086d3a60ccce2 100644 +--- a/arch/arm/boot/dts/st/stm32mp15xx-dhcom-som.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp15xx-dhcom-som.dtsi +@@ -14,6 +14,13 @@ + ethernet1 = &ksz8851; + rtc0 = &hwrtc; + rtc1 = &rtc; ++ serial0 = &uart4; ++ serial1 = &usart3; ++ serial2 = &uart8; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; + }; + + memory@c0000000 { +-- +2.39.5 + diff --git a/queue-6.6/arm-dts-stm32-fix-ipcc-exti-declaration-on-stm32mp15.patch b/queue-6.6/arm-dts-stm32-fix-ipcc-exti-declaration-on-stm32mp15.patch new file mode 100644 index 0000000000..c4c956730d --- /dev/null +++ b/queue-6.6/arm-dts-stm32-fix-ipcc-exti-declaration-on-stm32mp15.patch @@ -0,0 +1,44 @@ +From e98ad82fdd6111582880ce49328a9d40aead5ddb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Dec 2024 18:17:59 +0100 +Subject: ARM: dts: stm32: Fix IPCC EXTI declaration on stm32mp151 + +From: Arnaud Pouliquen + +[ Upstream commit 4ea654242e0c75bdf6b45d3c619c5fdcb2e9312a ] + +The GIC IRQ type used for IPCC RX should be IRQ_TYPE_LEVEL_HIGH. +Replacing the interrupt with the EXTI event changes the type to +the numeric value 1, meaning IRQ_TYPE_EDGE_RISING. + +The issue is that EXTI event 61 is a direct event.The IRQ type of +direct events is not used by EXTI and is propagated to the parent +IRQ controller of EXTI, the GIC. + +Align the IRQ type to the value expected by the GIC by replacing +the second parameter "1" with IRQ_TYPE_LEVEL_HIGH. + +Fixes: 7d9802bb0e34 ("ARM: dts: stm32: remove the IPCC "wakeup" IRQ on stm32mp151") +Signed-off-by: Arnaud Pouliquen +Signed-off-by: Alexandre Torgue +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/st/stm32mp151.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/st/stm32mp151.dtsi b/arch/arm/boot/dts/st/stm32mp151.dtsi +index aec7fa5ab5d8c..fe79d5d40c116 100644 +--- a/arch/arm/boot/dts/st/stm32mp151.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp151.dtsi +@@ -1165,7 +1165,7 @@ + reg = <0x4c001000 0x400>; + st,proc-id = <0>; + interrupts-extended = +- <&exti 61 1>, ++ <&exti 61 IRQ_TYPE_LEVEL_HIGH>, + <&intc GIC_SPI 101 IRQ_TYPE_LEVEL_HIGH>; + interrupt-names = "rx", "tx"; + clocks = <&rcc IPCC>; +-- +2.39.5 + diff --git a/queue-6.6/arm-dts-stm32-swap-usart3-and-uart8-alias-on-stm32mp.patch b/queue-6.6/arm-dts-stm32-swap-usart3-and-uart8-alias-on-stm32mp.patch new file mode 100644 index 0000000000..fb817f72b2 --- /dev/null +++ b/queue-6.6/arm-dts-stm32-swap-usart3-and-uart8-alias-on-stm32mp.patch @@ -0,0 +1,41 @@ +From dc51d741207cd40cca32003ad578de586b02213e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 Dec 2024 23:36:25 +0100 +Subject: ARM: dts: stm32: Swap USART3 and UART8 alias on STM32MP15xx DHCOM SoM + +From: Marek Vasut + +[ Upstream commit 479b8227ffc433929ba49200182b6383569f9615 ] + +Swap USART3 and UART8 aliases on STM32MP15xx DHCOM SoM, +make sure UART8 is listed first, USART3 second, because +the UART8 is labeled as UART2 on the SoM pinout, while +USART3 is labeled as UART3 on the SoM pinout. + +Fixes: 34e0c7847dcf ("ARM: dts: stm32: Add DH Electronics DHCOM STM32MP1 SoM and PDK2 board") +Signed-off-by: Marek Vasut +Reviewed-by: Christoph Niedermaier +Signed-off-by: Alexandre Torgue +Signed-off-by: Sasha Levin +--- + arch/arm/boot/dts/st/stm32mp15xx-dhcom-som.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/boot/dts/st/stm32mp15xx-dhcom-som.dtsi b/arch/arm/boot/dts/st/stm32mp15xx-dhcom-som.dtsi +index 086d3a60ccce2..142d4a8731f8d 100644 +--- a/arch/arm/boot/dts/st/stm32mp15xx-dhcom-som.dtsi ++++ b/arch/arm/boot/dts/st/stm32mp15xx-dhcom-som.dtsi +@@ -15,8 +15,8 @@ + rtc0 = &hwrtc; + rtc1 = &rtc; + serial0 = &uart4; +- serial1 = &usart3; +- serial2 = &uart8; ++ serial1 = &uart8; ++ serial2 = &usart3; + }; + + chosen { +-- +2.39.5 + diff --git a/queue-6.6/arm-omap1-fix-up-the-retu-irq-on-nokia-770.patch b/queue-6.6/arm-omap1-fix-up-the-retu-irq-on-nokia-770.patch new file mode 100644 index 0000000000..0cad3f2010 --- /dev/null +++ b/queue-6.6/arm-omap1-fix-up-the-retu-irq-on-nokia-770.patch @@ -0,0 +1,38 @@ +From 33b95655173ccf714c22ec9dc7a407a17b9fcc87 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 1 Jan 2025 14:12:15 +0200 +Subject: ARM: omap1: Fix up the Retu IRQ on Nokia 770 + +From: Aaro Koskinen + +[ Upstream commit ad455e48bba7f21bb5108406da0854cf8dede8ea ] + +The Retu IRQ is off by one, as a result the power button does not work. +Fix it. + +Fixes: 084b6f216778 ("ARM: omap1: Fix up the Nokia 770 board device IRQs") +Signed-off-by: Aaro Koskinen +Reviewed-by: Linus Walleij +Link: https://lore.kernel.org/r/Z3UxH_fOzuftjnuX@darkstar.musicnaut.iki.fi +Signed-off-by: Kevin Hilman +Signed-off-by: Sasha Levin +--- + arch/arm/mach-omap1/board-nokia770.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c +index 3312ef93355da..a5bf5554800fe 100644 +--- a/arch/arm/mach-omap1/board-nokia770.c ++++ b/arch/arm/mach-omap1/board-nokia770.c +@@ -289,7 +289,7 @@ static struct gpiod_lookup_table nokia770_irq_gpio_table = { + GPIO_LOOKUP("gpio-0-15", 15, "ads7846_irq", + GPIO_ACTIVE_HIGH), + /* GPIO used for retu IRQ */ +- GPIO_LOOKUP("gpio-48-63", 15, "retu_irq", ++ GPIO_LOOKUP("gpio-48-63", 14, "retu_irq", + GPIO_ACTIVE_HIGH), + /* GPIO used for tahvo IRQ */ + GPIO_LOOKUP("gpio-32-47", 8, "tahvo_irq", +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-allwinner-a64-explicitly-assign-clock-pare.patch b/queue-6.6/arm64-dts-allwinner-a64-explicitly-assign-clock-pare.patch new file mode 100644 index 0000000000..5532bc4f88 --- /dev/null +++ b/queue-6.6/arm64-dts-allwinner-a64-explicitly-assign-clock-pare.patch @@ -0,0 +1,76 @@ +From a1cee6af68384f2a060ebb07ea65ea13b15d8ba2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Jan 2025 23:36:59 -0800 +Subject: arm64: dts: allwinner: a64: explicitly assign clock parent for TCON0 + +From: Vasily Khoruzhick + +[ Upstream commit 8715c91a836502929c637c76a26335ede8818acf ] + +TCON0 seems to need a different clock parent depending on output type. +For RGB it has to be PLL-VIDEO0-2X, while for DSI it has to be PLL-MIPI, +so select it explicitly. + +Video output doesn't work if incorrect clock is assigned. + +On my Pinebook I manually configured PLL-VIDEO0-2X and PLL-MIPI to the same +rate, and while video output works fine with PLL-VIDEO0-2X, it doesn't +work at all (as in no picture) with PLL-MIPI. + +Fixes: ca1170b69968 ("clk: sunxi-ng: a64: force select PLL_MIPI in TCON0 mux") +Reviewed-by: Dragan Simic +Reviewed-by: Chen-Yu Tsai +Tested-by: Frank Oltmanns # on PinePhone +Tested-by: Stuart Gathman # on OG Pinebook +Signed-off-by: Vasily Khoruzhick +Link: https://patch.msgid.link/20250104074035.1611136-4-anarsoul@gmail.com +Signed-off-by: Chen-Yu Tsai +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts | 2 ++ + arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts | 2 ++ + arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi | 2 ++ + 3 files changed, 6 insertions(+) + +diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts +index 50ed2e9f10ed0..6a69d00524944 100644 +--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts ++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinebook.dts +@@ -390,6 +390,8 @@ + &tcon0 { + pinctrl-names = "default"; + pinctrl-0 = <&lcd_rgb666_pins>; ++ assigned-clocks = <&ccu CLK_TCON0>; ++ assigned-clock-parents = <&ccu CLK_PLL_VIDEO0_2X>; + + status = "okay"; + }; +diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts +index 1128030e4c25b..d3e5eed84f364 100644 +--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts ++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-teres-i.dts +@@ -369,6 +369,8 @@ + &tcon0 { + pinctrl-names = "default"; + pinctrl-0 = <&lcd_rgb666_pins>; ++ assigned-clocks = <&ccu CLK_TCON0>; ++ assigned-clock-parents = <&ccu CLK_PLL_VIDEO0_2X>; + + status = "okay"; + }; +diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +index 57ac18738c995..7103298f6a1c2 100644 +--- a/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi ++++ b/arch/arm64/boot/dts/allwinner/sun50i-a64.dtsi +@@ -410,6 +410,8 @@ + clock-names = "ahb", "tcon-ch0"; + clock-output-names = "tcon-data-clock"; + #clock-cells = <0>; ++ assigned-clocks = <&ccu CLK_TCON0>; ++ assigned-clock-parents = <&ccu CLK_PLL_MIPI>; + resets = <&ccu RST_BUS_TCON0>, <&ccu RST_BUS_LVDS>; + reset-names = "lcd", "lvds"; + +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mediatek-add-per-soc-compatibles-for-keypa.patch b/queue-6.6/arm64-dts-mediatek-add-per-soc-compatibles-for-keypa.patch new file mode 100644 index 0000000000..58cb8b2d98 --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-add-per-soc-compatibles-for-keypa.patch @@ -0,0 +1,56 @@ +From 36e8133684fbbacad999da36a0a295dd33e5faf2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 25 Dec 2024 16:26:20 -0300 +Subject: arm64: dts: mediatek: add per-SoC compatibles for keypad nodes + +From: Val Packett + +[ Upstream commit 6139d9e9e397dc9711cf10f8f548a8f9da3b5323 ] + +The mt6779-keypad binding specifies using a compatible for the +actual SoC before the generic MT6779 one. + +Fixes: a8013418d35c ("arm64: dts: mediatek: mt8183: add keyboard node") +Fixes: 6ff945376556 ("arm64: dts: mediatek: Initial mt8365-evk support") +Signed-off-by: Val Packett +Reviewed-by: Mattijs Korpershoek +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20241225192631.25017-3-val@packett.cool +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8183.dtsi | 3 ++- + arch/arm64/boot/dts/mediatek/mt8365.dtsi | 3 ++- + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8183.dtsi b/arch/arm64/boot/dts/mediatek/mt8183.dtsi +index 8721a5ffca30a..d1b6355148620 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8183.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8183.dtsi +@@ -1026,7 +1026,8 @@ + }; + + keyboard: keyboard@10010000 { +- compatible = "mediatek,mt6779-keypad"; ++ compatible = "mediatek,mt8183-keypad", ++ "mediatek,mt6779-keypad"; + reg = <0 0x10010000 0 0x1000>; + interrupts = ; + clocks = <&clk26m>; +diff --git a/arch/arm64/boot/dts/mediatek/mt8365.dtsi b/arch/arm64/boot/dts/mediatek/mt8365.dtsi +index 413496c920695..62c5b50d3c5fb 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8365.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8365.dtsi +@@ -334,7 +334,8 @@ + }; + + keypad: keypad@10010000 { +- compatible = "mediatek,mt6779-keypad"; ++ compatible = "mediatek,mt8365-keypad", ++ "mediatek,mt6779-keypad"; + reg = <0 0x10010000 0 0x1000>; + wakeup-source; + interrupts = ; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mediatek-mt8173-elm-drop-regulator-compati.patch b/queue-6.6/arm64-dts-mediatek-mt8173-elm-drop-regulator-compati.patch new file mode 100644 index 0000000000..d622fa5fd1 --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-mt8173-elm-drop-regulator-compati.patch @@ -0,0 +1,213 @@ +From 10036dc653f06669ba52a139d4cb696ccdbcdb33 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Dec 2024 13:24:21 +0800 +Subject: arm64: dts: mediatek: mt8173-elm: Drop regulator-compatible property + +From: Chen-Yu Tsai + +[ Upstream commit 4b907b3ea5fba240808136cc5599d14b52230b39 ] + +The "regulator-compatible" property has been deprecated since 2012 in +commit 13511def87b9 ("regulator: deprecate regulator-compatible DT +property"), which is so old it's not even mentioned in the converted +regulator bindings YAML file. It is also not listed in the MT6397 +regulator bindings. Having them present produces a whole bunch of +validation errors: + + Unevaluated properties are not allowed ('regulator-compatible' was unexpected) + +Drop the "regulator-compatible" property from the board dts. The +property values are the same as the node name, so everything should +continue to work. + +Fixes: 689b937bedde ("arm64: dts: mediatek: add mt8173 elm and hana board") +Signed-off-by: Chen-Yu Tsai +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20241211052427.4178367-4-wenst@chromium.org +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi | 23 -------------------- + 1 file changed, 23 deletions(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi b/arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi +index 111495622cacd..855babfdd8f0e 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi +@@ -953,7 +953,6 @@ + compatible = "mediatek,mt6397-regulator"; + + mt6397_vpca15_reg: buck_vpca15 { +- regulator-compatible = "buck_vpca15"; + regulator-name = "vpca15"; + regulator-min-microvolt = < 700000>; + regulator-max-microvolt = <1350000>; +@@ -963,7 +962,6 @@ + }; + + mt6397_vpca7_reg: buck_vpca7 { +- regulator-compatible = "buck_vpca7"; + regulator-name = "vpca7"; + regulator-min-microvolt = < 700000>; + regulator-max-microvolt = <1350000>; +@@ -973,7 +971,6 @@ + }; + + mt6397_vsramca15_reg: buck_vsramca15 { +- regulator-compatible = "buck_vsramca15"; + regulator-name = "vsramca15"; + regulator-min-microvolt = < 700000>; + regulator-max-microvolt = <1350000>; +@@ -982,7 +979,6 @@ + }; + + mt6397_vsramca7_reg: buck_vsramca7 { +- regulator-compatible = "buck_vsramca7"; + regulator-name = "vsramca7"; + regulator-min-microvolt = < 700000>; + regulator-max-microvolt = <1350000>; +@@ -991,7 +987,6 @@ + }; + + mt6397_vcore_reg: buck_vcore { +- regulator-compatible = "buck_vcore"; + regulator-name = "vcore"; + regulator-min-microvolt = < 700000>; + regulator-max-microvolt = <1350000>; +@@ -1000,7 +995,6 @@ + }; + + mt6397_vgpu_reg: buck_vgpu { +- regulator-compatible = "buck_vgpu"; + regulator-name = "vgpu"; + regulator-min-microvolt = < 700000>; + regulator-max-microvolt = <1350000>; +@@ -1009,7 +1003,6 @@ + }; + + mt6397_vdrm_reg: buck_vdrm { +- regulator-compatible = "buck_vdrm"; + regulator-name = "vdrm"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1400000>; +@@ -1018,7 +1011,6 @@ + }; + + mt6397_vio18_reg: buck_vio18 { +- regulator-compatible = "buck_vio18"; + regulator-name = "vio18"; + regulator-min-microvolt = <1620000>; + regulator-max-microvolt = <1980000>; +@@ -1027,18 +1019,15 @@ + }; + + mt6397_vtcxo_reg: ldo_vtcxo { +- regulator-compatible = "ldo_vtcxo"; + regulator-name = "vtcxo"; + regulator-always-on; + }; + + mt6397_va28_reg: ldo_va28 { +- regulator-compatible = "ldo_va28"; + regulator-name = "va28"; + }; + + mt6397_vcama_reg: ldo_vcama { +- regulator-compatible = "ldo_vcama"; + regulator-name = "vcama"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; +@@ -1046,18 +1035,15 @@ + }; + + mt6397_vio28_reg: ldo_vio28 { +- regulator-compatible = "ldo_vio28"; + regulator-name = "vio28"; + regulator-always-on; + }; + + mt6397_vusb_reg: ldo_vusb { +- regulator-compatible = "ldo_vusb"; + regulator-name = "vusb"; + }; + + mt6397_vmc_reg: ldo_vmc { +- regulator-compatible = "ldo_vmc"; + regulator-name = "vmc"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; +@@ -1065,7 +1051,6 @@ + }; + + mt6397_vmch_reg: ldo_vmch { +- regulator-compatible = "ldo_vmch"; + regulator-name = "vmch"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3300000>; +@@ -1073,7 +1058,6 @@ + }; + + mt6397_vemc_3v3_reg: ldo_vemc3v3 { +- regulator-compatible = "ldo_vemc3v3"; + regulator-name = "vemc_3v3"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3300000>; +@@ -1081,7 +1065,6 @@ + }; + + mt6397_vgp1_reg: ldo_vgp1 { +- regulator-compatible = "ldo_vgp1"; + regulator-name = "vcamd"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; +@@ -1089,7 +1072,6 @@ + }; + + mt6397_vgp2_reg: ldo_vgp2 { +- regulator-compatible = "ldo_vgp2"; + regulator-name = "vcamio"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; +@@ -1097,7 +1079,6 @@ + }; + + mt6397_vgp3_reg: ldo_vgp3 { +- regulator-compatible = "ldo_vgp3"; + regulator-name = "vcamaf"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; +@@ -1105,7 +1086,6 @@ + }; + + mt6397_vgp4_reg: ldo_vgp4 { +- regulator-compatible = "ldo_vgp4"; + regulator-name = "vgp4"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <3300000>; +@@ -1113,7 +1093,6 @@ + }; + + mt6397_vgp5_reg: ldo_vgp5 { +- regulator-compatible = "ldo_vgp5"; + regulator-name = "vgp5"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <3000000>; +@@ -1121,7 +1100,6 @@ + }; + + mt6397_vgp6_reg: ldo_vgp6 { +- regulator-compatible = "ldo_vgp6"; + regulator-name = "vgp6"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; +@@ -1130,7 +1108,6 @@ + }; + + mt6397_vibr_reg: ldo_vibr { +- regulator-compatible = "ldo_vibr"; + regulator-name = "vibr"; + regulator-min-microvolt = <1300000>; + regulator-max-microvolt = <3300000>; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mediatek-mt8173-elm-fix-mt6397-pmic-sub-no.patch b/queue-6.6/arm64-dts-mediatek-mt8173-elm-fix-mt6397-pmic-sub-no.patch new file mode 100644 index 0000000000..382fc480dd --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-mt8173-elm-fix-mt6397-pmic-sub-no.patch @@ -0,0 +1,58 @@ +From 58453983df75f9850973c60bad10e3e9256528e2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Dec 2024 17:26:12 +0800 +Subject: arm64: dts: mediatek: mt8173-elm: Fix MT6397 PMIC sub-node names + +From: Chen-Yu Tsai + +[ Upstream commit beb06b727194f68b0a4b5183e50c88265ce185af ] + +The MT6397 PMIC bindings specify exact names for its sub-nodes. The +names used in the current dts don't match, causing a validation error. + +Fix up the names. Also drop the label for the regulators node, since +any reference should be against the individual regulator sub-nodes. + +Fixes: 689b937bedde ("arm64: dts: mediatek: add mt8173 elm and hana board") +Signed-off-by: Chen-Yu Tsai +Link: https://lore.kernel.org/r/20241210092614.3951748-1-wenst@chromium.org +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi b/arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi +index 855babfdd8f0e..8df919d39e5ba 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8173-elm.dtsi +@@ -938,7 +938,7 @@ + interrupt-controller; + #interrupt-cells = <2>; + +- clock: mt6397clock { ++ clock: clocks { + compatible = "mediatek,mt6397-clk"; + #clock-cells = <1>; + }; +@@ -949,7 +949,7 @@ + #gpio-cells = <2>; + }; + +- regulator: mt6397regulator { ++ regulators { + compatible = "mediatek,mt6397-regulator"; + + mt6397_vpca15_reg: buck_vpca15 { +@@ -1115,7 +1115,7 @@ + }; + }; + +- rtc: mt6397rtc { ++ rtc: rtc { + compatible = "mediatek,mt6397-rtc"; + }; + +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mediatek-mt8173-evb-drop-regulator-compati.patch b/queue-6.6/arm64-dts-mediatek-mt8173-evb-drop-regulator-compati.patch new file mode 100644 index 0000000000..6b0fddbf39 --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-mt8173-evb-drop-regulator-compati.patch @@ -0,0 +1,214 @@ +From 0aa4a620743eee86906fa4b367683828df55034e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Dec 2024 13:24:20 +0800 +Subject: arm64: dts: mediatek: mt8173-evb: Drop regulator-compatible property + +From: Chen-Yu Tsai + +[ Upstream commit a6d5983e40f5d5b219337569cdd269727f5a3e2e ] + +The "regulator-compatible" property has been deprecated since 2012 in +commit 13511def87b9 ("regulator: deprecate regulator-compatible DT +property"), which is so old it's not even mentioned in the converted +regulator bindings YAML file. It is also not listed in the MT6397 +regulator bindings. Having them present produces a whole bunch of +validation errors: + + Unevaluated properties are not allowed ('regulator-compatible' was unexpected) + +Drop the "regulator-compatible" property from the board dts. The +property values are the same as the node name, so everything should +continue to work. + +Fixes: 16ea61fc5614 ("arm64: dts: mt8173-evb: Add PMIC support") +Signed-off-by: Chen-Yu Tsai +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20241211052427.4178367-3-wenst@chromium.org +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8173-evb.dts | 23 --------------------- + 1 file changed, 23 deletions(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8173-evb.dts b/arch/arm64/boot/dts/mediatek/mt8173-evb.dts +index d258c80213b26..f9a84825b5cad 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8173-evb.dts ++++ b/arch/arm64/boot/dts/mediatek/mt8173-evb.dts +@@ -312,7 +312,6 @@ + compatible = "mediatek,mt6397-regulator"; + + mt6397_vpca15_reg: buck_vpca15 { +- regulator-compatible = "buck_vpca15"; + regulator-name = "vpca15"; + regulator-min-microvolt = < 700000>; + regulator-max-microvolt = <1350000>; +@@ -321,7 +320,6 @@ + }; + + mt6397_vpca7_reg: buck_vpca7 { +- regulator-compatible = "buck_vpca7"; + regulator-name = "vpca7"; + regulator-min-microvolt = < 700000>; + regulator-max-microvolt = <1350000>; +@@ -330,7 +328,6 @@ + }; + + mt6397_vsramca15_reg: buck_vsramca15 { +- regulator-compatible = "buck_vsramca15"; + regulator-name = "vsramca15"; + regulator-min-microvolt = < 700000>; + regulator-max-microvolt = <1350000>; +@@ -339,7 +336,6 @@ + }; + + mt6397_vsramca7_reg: buck_vsramca7 { +- regulator-compatible = "buck_vsramca7"; + regulator-name = "vsramca7"; + regulator-min-microvolt = < 700000>; + regulator-max-microvolt = <1350000>; +@@ -348,7 +344,6 @@ + }; + + mt6397_vcore_reg: buck_vcore { +- regulator-compatible = "buck_vcore"; + regulator-name = "vcore"; + regulator-min-microvolt = < 700000>; + regulator-max-microvolt = <1350000>; +@@ -357,7 +352,6 @@ + }; + + mt6397_vgpu_reg: buck_vgpu { +- regulator-compatible = "buck_vgpu"; + regulator-name = "vgpu"; + regulator-min-microvolt = < 700000>; + regulator-max-microvolt = <1350000>; +@@ -366,7 +360,6 @@ + }; + + mt6397_vdrm_reg: buck_vdrm { +- regulator-compatible = "buck_vdrm"; + regulator-name = "vdrm"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <1400000>; +@@ -375,7 +368,6 @@ + }; + + mt6397_vio18_reg: buck_vio18 { +- regulator-compatible = "buck_vio18"; + regulator-name = "vio18"; + regulator-min-microvolt = <1620000>; + regulator-max-microvolt = <1980000>; +@@ -384,19 +376,16 @@ + }; + + mt6397_vtcxo_reg: ldo_vtcxo { +- regulator-compatible = "ldo_vtcxo"; + regulator-name = "vtcxo"; + regulator-always-on; + }; + + mt6397_va28_reg: ldo_va28 { +- regulator-compatible = "ldo_va28"; + regulator-name = "va28"; + regulator-always-on; + }; + + mt6397_vcama_reg: ldo_vcama { +- regulator-compatible = "ldo_vcama"; + regulator-name = "vcama"; + regulator-min-microvolt = <1500000>; + regulator-max-microvolt = <2800000>; +@@ -404,18 +393,15 @@ + }; + + mt6397_vio28_reg: ldo_vio28 { +- regulator-compatible = "ldo_vio28"; + regulator-name = "vio28"; + regulator-always-on; + }; + + mt6397_vusb_reg: ldo_vusb { +- regulator-compatible = "ldo_vusb"; + regulator-name = "vusb"; + }; + + mt6397_vmc_reg: ldo_vmc { +- regulator-compatible = "ldo_vmc"; + regulator-name = "vmc"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; +@@ -423,7 +409,6 @@ + }; + + mt6397_vmch_reg: ldo_vmch { +- regulator-compatible = "ldo_vmch"; + regulator-name = "vmch"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3300000>; +@@ -431,7 +416,6 @@ + }; + + mt6397_vemc_3v3_reg: ldo_vemc3v3 { +- regulator-compatible = "ldo_vemc3v3"; + regulator-name = "vemc_3v3"; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3300000>; +@@ -439,7 +423,6 @@ + }; + + mt6397_vgp1_reg: ldo_vgp1 { +- regulator-compatible = "ldo_vgp1"; + regulator-name = "vcamd"; + regulator-min-microvolt = <1220000>; + regulator-max-microvolt = <3300000>; +@@ -447,7 +430,6 @@ + }; + + mt6397_vgp2_reg: ldo_vgp2 { +- regulator-compatible = "ldo_vgp2"; + regulator-name = "vcamio"; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <3300000>; +@@ -455,7 +437,6 @@ + }; + + mt6397_vgp3_reg: ldo_vgp3 { +- regulator-compatible = "ldo_vgp3"; + regulator-name = "vcamaf"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <3300000>; +@@ -463,7 +444,6 @@ + }; + + mt6397_vgp4_reg: ldo_vgp4 { +- regulator-compatible = "ldo_vgp4"; + regulator-name = "vgp4"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <3300000>; +@@ -471,7 +451,6 @@ + }; + + mt6397_vgp5_reg: ldo_vgp5 { +- regulator-compatible = "ldo_vgp5"; + regulator-name = "vgp5"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <3000000>; +@@ -479,7 +458,6 @@ + }; + + mt6397_vgp6_reg: ldo_vgp6 { +- regulator-compatible = "ldo_vgp6"; + regulator-name = "vgp6"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <3300000>; +@@ -487,7 +465,6 @@ + }; + + mt6397_vibr_reg: ldo_vibr { +- regulator-compatible = "ldo_vibr"; + regulator-name = "vibr"; + regulator-min-microvolt = <1300000>; + regulator-max-microvolt = <3300000>; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mediatek-mt8173-evb-fix-mt6397-pmic-sub-no.patch b/queue-6.6/arm64-dts-mediatek-mt8173-evb-fix-mt6397-pmic-sub-no.patch new file mode 100644 index 0000000000..cfcd55a24e --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-mt8173-evb-fix-mt6397-pmic-sub-no.patch @@ -0,0 +1,40 @@ +From 0bdf23e728e49ba7de63692aa68db8c6dafe43d3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Dec 2024 17:26:13 +0800 +Subject: arm64: dts: mediatek: mt8173-evb: Fix MT6397 PMIC sub-node names + +From: Chen-Yu Tsai + +[ Upstream commit 9545ba142865b9099d43c972b9ebcf463606499a ] + +The MT6397 PMIC bindings specify exact names for its sub-nodes. The +names used in the current dts don't match, causing a validation error. + +Fix up the names. Also drop the label for the regulators node, since +any reference should be against the individual regulator sub-nodes. + +Fixes: 16ea61fc5614 ("arm64: dts: mt8173-evb: Add PMIC support") +Signed-off-by: Chen-Yu Tsai +Link: https://lore.kernel.org/r/20241210092614.3951748-2-wenst@chromium.org +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8173-evb.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8173-evb.dts b/arch/arm64/boot/dts/mediatek/mt8173-evb.dts +index f9a84825b5cad..f6a70f22bd0c4 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8173-evb.dts ++++ b/arch/arm64/boot/dts/mediatek/mt8173-evb.dts +@@ -308,7 +308,7 @@ + interrupt-controller; + #interrupt-cells = <2>; + +- mt6397regulator: mt6397regulator { ++ regulators { + compatible = "mediatek,mt6397-regulator"; + + mt6397_vpca15_reg: buck_vpca15 { +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mediatek-mt8183-kenzo-support-second-sourc.patch b/queue-6.6/arm64-dts-mediatek-mt8183-kenzo-support-second-sourc.patch new file mode 100644 index 0000000000..8f871dbc75 --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-mt8183-kenzo-support-second-sourc.patch @@ -0,0 +1,47 @@ +From fc0516bcbe85953991441fd67ae16dca51583303 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 Dec 2024 05:27:47 +0000 +Subject: arm64: dts: mediatek: mt8183: kenzo: Support second source + touchscreen + +From: Hsin-Te Yuan + +[ Upstream commit 5ec5dc73c5ac0c6e06803dc3b5aea4493e856568 ] + +Some kenzo devices use second source touchscreen. + +Fixes: 0a9cefe21aec ("arm64: dts: mt8183: Add kukui-jacuzzi-kenzo board") +Signed-off-by: Hsin-Te Yuan +Link: https://lore.kernel.org/r/20241213-touchscreen-v3-1-7c1f670913f9@chromium.org +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + .../dts/mediatek/mt8183-kukui-jacuzzi-kenzo.dts | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi-kenzo.dts b/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi-kenzo.dts +index 8fa89db03e639..328294245a79d 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi-kenzo.dts ++++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi-kenzo.dts +@@ -11,3 +11,18 @@ + model = "Google kenzo sku17 board"; + compatible = "google,juniper-sku17", "google,juniper", "mediatek,mt8183"; + }; ++ ++&i2c0 { ++ touchscreen@40 { ++ compatible = "hid-over-i2c"; ++ reg = <0x40>; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&touchscreen_pins>; ++ ++ interrupts-extended = <&pio 155 IRQ_TYPE_LEVEL_LOW>; ++ ++ post-power-on-delay-ms = <70>; ++ hid-descr-addr = <0x0001>; ++ }; ++}; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mediatek-mt8183-kukui-jacuzzi-drop-pp3300_.patch b/queue-6.6/arm64-dts-mediatek-mt8183-kukui-jacuzzi-drop-pp3300_.patch new file mode 100644 index 0000000000..2a51040f45 --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-mt8183-kukui-jacuzzi-drop-pp3300_.patch @@ -0,0 +1,41 @@ +From d3cc08f388e36b68896e2515b91c5e738f912668 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 30 Oct 2024 15:02:20 +0800 +Subject: arm64: dts: mediatek: mt8183-kukui-jacuzzi: Drop pp3300_panel voltage + settings + +From: Chen-Yu Tsai + +[ Upstream commit 0b5b1c881a909f17c05ef4b1ccb421e077f6e466 ] + +The pp3300_panel fixed regulator is just a load switch. It does not have +any regulating capabilities. Thus having voltage constraints on it is +wrong. + +Remove the voltage constraints. + +Fixes: cabc71b08eb5 ("arm64: dts: mt8183: Add kukui-jacuzzi-damu board") +Signed-off-by: Chen-Yu Tsai +Link: https://lore.kernel.org/r/20241030070224.1006331-2-wenst@chromium.org +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi +index 629c4b7ecbc62..8e0575f8c1b27 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi.dtsi +@@ -39,8 +39,6 @@ + pp3300_panel: pp3300-panel { + compatible = "regulator-fixed"; + regulator-name = "pp3300_panel"; +- regulator-min-microvolt = <3300000>; +- regulator-max-microvolt = <3300000>; + pinctrl-names = "default"; + pinctrl-0 = <&pp3300_panel_pins>; + +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mediatek-mt8183-willow-support-second-sour.patch b/queue-6.6/arm64-dts-mediatek-mt8183-willow-support-second-sour.patch new file mode 100644 index 0000000000..4b513075b8 --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-mt8183-willow-support-second-sour.patch @@ -0,0 +1,50 @@ +From 73a92f43aaf0ed73a25799116c1f5bef2369c658 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 Dec 2024 05:27:48 +0000 +Subject: arm64: dts: mediatek: mt8183: willow: Support second source + touchscreen + +From: Hsin-Te Yuan + +[ Upstream commit 9594935260d76bffe200bea6cfab6ba0752e70d9 ] + +Some willow devices use second source touchscreen. + +Fixes: f006bcf1c972 ("arm64: dts: mt8183: Add kukui-jacuzzi-willow board") +Signed-off-by: Hsin-Te Yuan +Link: https://lore.kernel.org/r/20241213-touchscreen-v3-2-7c1f670913f9@chromium.org +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + .../dts/mediatek/mt8183-kukui-jacuzzi-willow.dtsi | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi-willow.dtsi b/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi-willow.dtsi +index 76d33540166f9..c942e461a177e 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi-willow.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi-willow.dtsi +@@ -6,6 +6,21 @@ + /dts-v1/; + #include "mt8183-kukui-jacuzzi.dtsi" + ++&i2c0 { ++ touchscreen@40 { ++ compatible = "hid-over-i2c"; ++ reg = <0x40>; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&touchscreen_pins>; ++ ++ interrupts-extended = <&pio 155 IRQ_TYPE_LEVEL_LOW>; ++ ++ post-power-on-delay-ms = <70>; ++ hid-descr-addr = <0x0001>; ++ }; ++}; ++ + &i2c2 { + trackpad@2c { + compatible = "hid-over-i2c"; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mediatek-mt8186-move-wakeup-to-mtu3-to-get.patch b/queue-6.6/arm64-dts-mediatek-mt8186-move-wakeup-to-mtu3-to-get.patch new file mode 100644 index 0000000000..5e43cb54ce --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-mt8186-move-wakeup-to-mtu3-to-get.patch @@ -0,0 +1,83 @@ +From 755e5c5b6070b3fef6a349e5438ab62113bae5b7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 6 Nov 2024 16:01:45 -0500 +Subject: arm64: dts: mediatek: mt8186: Move wakeup to MTU3 to get working + suspend +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Nícolas F. R. A. Prado + +[ Upstream commit 253b4e96f5783fddede1b82274a7b4e0aa57d761 ] + +The current DT has the wakeup-source and mediatek,syscon-wakeup +properties in the XHCI nodes, which configures USB wakeup after powering +down the XHCI hardware block. However, since the XHCI controller is +behind an MTU3 (USB3 DRD controller), the MTU3 only gets powered down +after USB wakeup has been configured, causing the system to detect a +wakeup, and results in broken suspend support as the system resumes +immediately. + +Move the wakeup properties to the MTU3 nodes so that USB wakeup is only +enabled after the MTU3 has powered down. + +With this change in place, it is possible to suspend and resume, and +also to wakeup through USB, as tested on the Google Steelix (Lenovo 300e +Yoga Chromebook Gen 4). + +Fixes: f6c3e61c5486 ("arm64: dts: mediatek: mt8186: Add MTU3 nodes") +Reported-by: Wojciech Macek +Suggested-by: AngeloGioacchino Del Regno +Signed-off-by: Nícolas F. R. A. Prado +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20241106-mt8186-suspend-with-usb-wakeup-v1-1-07734a4c8236@collabora.com +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8186.dtsi | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8186.dtsi b/arch/arm64/boot/dts/mediatek/mt8186.dtsi +index 2c184f9e0fc39..a63c59bc8e978 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8186.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8186.dtsi +@@ -1545,6 +1545,8 @@ + #address-cells = <2>; + #size-cells = <2>; + ranges; ++ wakeup-source; ++ mediatek,syscon-wakeup = <&pericfg 0x420 2>; + status = "disabled"; + + usb_host0: usb@11200000 { +@@ -1558,8 +1560,6 @@ + <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_XHCI>; + clock-names = "sys_ck", "ref_ck", "mcu_ck", "dma_ck", "xhci_ck"; + interrupts = ; +- mediatek,syscon-wakeup = <&pericfg 0x420 2>; +- wakeup-source; + status = "disabled"; + }; + }; +@@ -1611,6 +1611,8 @@ + #address-cells = <2>; + #size-cells = <2>; + ranges; ++ wakeup-source; ++ mediatek,syscon-wakeup = <&pericfg 0x424 2>; + status = "disabled"; + + usb_host1: usb@11280000 { +@@ -1624,8 +1626,6 @@ + <&infracfg_ao CLK_INFRA_AO_SSUSB_TOP_P1_XHCI>; + clock-names = "sys_ck", "ref_ck", "mcu_ck", "dma_ck","xhci_ck"; + interrupts = ; +- mediatek,syscon-wakeup = <&pericfg 0x424 2>; +- wakeup-source; + status = "disabled"; + }; + }; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mediatek-mt8192-asurada-drop-regulator-com.patch b/queue-6.6/arm64-dts-mediatek-mt8192-asurada-drop-regulator-com.patch new file mode 100644 index 0000000000..c4fe9c0500 --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-mt8192-asurada-drop-regulator-com.patch @@ -0,0 +1,61 @@ +From 5c8dad5ec2cf17f55875fc5fa194c184b49c3f8b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Dec 2024 13:24:22 +0800 +Subject: arm64: dts: mediatek: mt8192-asurada: Drop regulator-compatible + property + +From: Chen-Yu Tsai + +[ Upstream commit d1fb968551c8688652b8b817bb081fdc9c25cd48 ] + +The "regulator-compatible" property has been deprecated since 2012 in +commit 13511def87b9 ("regulator: deprecate regulator-compatible DT +property"), which is so old it's not even mentioned in the converted +regulator bindings YAML file. It should not have been used for new +submissions such as the MT6315. + +Drop the "regulator-compatible" property from the board dts. The +property values are the same as the node name, so everything should +continue to work. + +Fixes: 3183cb62b033 ("arm64: dts: mediatek: asurada: Add SPMI regulators") +Signed-off-by: Chen-Yu Tsai +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20241211052427.4178367-5-wenst@chromium.org +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi b/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi +index 6b4b7a7cd35ef..54e3ec168fa9a 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8192-asurada.dtsi +@@ -1391,7 +1391,6 @@ + + regulators { + mt6315_6_vbuck1: vbuck1 { +- regulator-compatible = "vbuck1"; + regulator-name = "Vbcpu"; + regulator-min-microvolt = <400000>; + regulator-max-microvolt = <1193750>; +@@ -1401,7 +1400,6 @@ + }; + + mt6315_6_vbuck3: vbuck3 { +- regulator-compatible = "vbuck3"; + regulator-name = "Vlcpu"; + regulator-min-microvolt = <400000>; + regulator-max-microvolt = <1193750>; +@@ -1418,7 +1416,6 @@ + + regulators { + mt6315_7_vbuck1: vbuck1 { +- regulator-compatible = "vbuck1"; + regulator-name = "Vgpu"; + regulator-min-microvolt = <400000>; + regulator-max-microvolt = <800000>; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mediatek-mt8195-cherry-drop-regulator-comp.patch b/queue-6.6/arm64-dts-mediatek-mt8195-cherry-drop-regulator-comp.patch new file mode 100644 index 0000000000..57833f326f --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-mt8195-cherry-drop-regulator-comp.patch @@ -0,0 +1,53 @@ +From c51321b7eddd299b5ea865415008f13028650133 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Dec 2024 13:24:23 +0800 +Subject: arm64: dts: mediatek: mt8195-cherry: Drop regulator-compatible + property + +From: Chen-Yu Tsai + +[ Upstream commit 4dbaa5d5def2c49e44efaa5e796c23d9b904be09 ] + +The "regulator-compatible" property has been deprecated since 2012 in +commit 13511def87b9 ("regulator: deprecate regulator-compatible DT +property"), which is so old it's not even mentioned in the converted +regulator bindings YAML file. It should not have been used for new +submissions such as the MT6315. + +Drop the "regulator-compatible" property from the board dts. The +property values are the same as the node name, so everything should +continue to work. + +Fixes: 260c04d425eb ("arm64: dts: mediatek: cherry: Enable MT6315 regulators on SPMI bus") +Signed-off-by: Chen-Yu Tsai +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20241211052427.4178367-6-wenst@chromium.org +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi +index b21663b46b519..e3b30543c2c64 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8195-cherry.dtsi +@@ -1203,7 +1203,6 @@ + + regulators { + mt6315_6_vbuck1: vbuck1 { +- regulator-compatible = "vbuck1"; + regulator-name = "Vbcpu"; + regulator-min-microvolt = <400000>; + regulator-max-microvolt = <1193750>; +@@ -1221,7 +1220,6 @@ + + regulators { + mt6315_7_vbuck1: vbuck1 { +- regulator-compatible = "vbuck1"; + regulator-name = "Vgpu"; + regulator-min-microvolt = <400000>; + regulator-max-microvolt = <1193750>; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mediatek-mt8195-demo-drop-regulator-compat.patch b/queue-6.6/arm64-dts-mediatek-mt8195-demo-drop-regulator-compat.patch new file mode 100644 index 0000000000..509c5f8ad5 --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-mt8195-demo-drop-regulator-compat.patch @@ -0,0 +1,108 @@ +From 46c63b6f08cf96f2f701a7cd5e06a325261edba9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Dec 2024 13:24:24 +0800 +Subject: arm64: dts: mediatek: mt8195-demo: Drop regulator-compatible property + +From: Chen-Yu Tsai + +[ Upstream commit 2a8af9b95f504260a6d8200a11f0ae5c90e9f787 ] + +The "regulator-compatible" property has been deprecated since 2012 in +commit 13511def87b9 ("regulator: deprecate regulator-compatible DT +property"), which is so old it's not even mentioned in the converted +regulator bindings YAML file. It is also not listed in the MT6360 +regulator and charger bindings. + +Drop the "regulator-compatible" property from the board dts. The MT6360 +bindings actually require the lowercase name, so with the property +present the regulators were likely not actually working. + +Fixes: 6147314aeedc ("arm64: dts: mediatek: Add device-tree for MT8195 Demo board") +Signed-off-by: Chen-Yu Tsai +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20241211052427.4178367-7-wenst@chromium.org +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8195-demo.dts | 9 --------- + 1 file changed, 9 deletions(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8195-demo.dts b/arch/arm64/boot/dts/mediatek/mt8195-demo.dts +index 9079e48aea23e..f56aeb81c4168 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8195-demo.dts ++++ b/arch/arm64/boot/dts/mediatek/mt8195-demo.dts +@@ -137,7 +137,6 @@ + richtek,vinovp-microvolt = <14500000>; + + otg_vbus_regulator: usb-otg-vbus-regulator { +- regulator-compatible = "usb-otg-vbus"; + regulator-name = "usb-otg-vbus"; + regulator-min-microvolt = <4425000>; + regulator-max-microvolt = <5825000>; +@@ -149,7 +148,6 @@ + LDO_VIN3-supply = <&mt6360_buck2>; + + mt6360_buck1: buck1 { +- regulator-compatible = "BUCK1"; + regulator-name = "mt6360,buck1"; + regulator-min-microvolt = <300000>; + regulator-max-microvolt = <1300000>; +@@ -160,7 +158,6 @@ + }; + + mt6360_buck2: buck2 { +- regulator-compatible = "BUCK2"; + regulator-name = "mt6360,buck2"; + regulator-min-microvolt = <300000>; + regulator-max-microvolt = <1300000>; +@@ -171,7 +168,6 @@ + }; + + mt6360_ldo1: ldo1 { +- regulator-compatible = "LDO1"; + regulator-name = "mt6360,ldo1"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <3600000>; +@@ -180,7 +176,6 @@ + }; + + mt6360_ldo2: ldo2 { +- regulator-compatible = "LDO2"; + regulator-name = "mt6360,ldo2"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <3600000>; +@@ -189,7 +184,6 @@ + }; + + mt6360_ldo3: ldo3 { +- regulator-compatible = "LDO3"; + regulator-name = "mt6360,ldo3"; + regulator-min-microvolt = <1200000>; + regulator-max-microvolt = <3600000>; +@@ -198,7 +192,6 @@ + }; + + mt6360_ldo5: ldo5 { +- regulator-compatible = "LDO5"; + regulator-name = "mt6360,ldo5"; + regulator-min-microvolt = <2700000>; + regulator-max-microvolt = <3600000>; +@@ -207,7 +200,6 @@ + }; + + mt6360_ldo6: ldo6 { +- regulator-compatible = "LDO6"; + regulator-name = "mt6360,ldo6"; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <2100000>; +@@ -216,7 +208,6 @@ + }; + + mt6360_ldo7: ldo7 { +- regulator-compatible = "LDO7"; + regulator-name = "mt6360,ldo7"; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <2100000>; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mediatek-mt8195-remove-suspend-breaking-re.patch b/queue-6.6/arm64-dts-mediatek-mt8195-remove-suspend-breaking-re.patch new file mode 100644 index 0000000000..ce41d174d0 --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-mt8195-remove-suspend-breaking-re.patch @@ -0,0 +1,55 @@ +From 3851af084788ecad980a204ba483802ffe94a67e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 18 Dec 2024 19:01:08 -0300 +Subject: arm64: dts: mediatek: mt8195: Remove suspend-breaking reset from + pcie1 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Nícolas F. R. A. Prado + +[ Upstream commit 3d7fdd8e38aafd4858935df2392762c1ab8fb40f ] + +The MAC reset for PCIe port 1 on MT8195 when asserted during suspend +causes the system to hang during resume with the following error (with +no_console_suspend enabled): + + mtk-pcie-gen3 112f8000.pcie: PCIe link down, current LTSSM state: detect.quiet (0x0) + mtk-pcie-gen3 112f8000.pcie: PM: dpm_run_callback(): genpd_resume_noirq+0x0/0x24 returns -110 + mtk-pcie-gen3 112f8000.pcie: PM: failed to resume noirq: error -110 + +This issue is specific to MT8195. On MT8192 with the PCIe reset, +MT8192_INFRA_RST4_PCIE_TOP_SWRST, added to the DT node, the issue is not +observed. + +Since without the reset, the PCIe controller and WiFi card connected to +it, work just as well, remove the reset to allow the system to suspend +and resume properly. + +Fixes: ecc0af6a3fe6 ("arm64: dts: mt8195: Add pcie and pcie phy nodes") +Signed-off-by: Nícolas F. R. A. Prado +Link: https://lore.kernel.org/r/20241218-mt8195-pcie1-reset-suspend-fix-v1-1-1c021dda42a6@collabora.com +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8195.dtsi | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8195.dtsi b/arch/arm64/boot/dts/mediatek/mt8195.dtsi +index 5a087404ccc2d..1cb22257adb36 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi +@@ -1572,9 +1572,6 @@ + phy-names = "pcie-phy"; + power-domains = <&spm MT8195_POWER_DOMAIN_PCIE_MAC_P1>; + +- resets = <&infracfg_ao MT8195_INFRA_RST2_PCIE_P1_SWRST>; +- reset-names = "mac"; +- + #interrupt-cells = <1>; + interrupt-map-mask = <0 0 0 7>; + interrupt-map = <0 0 0 1 &pcie_intc1 0>, +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mediatek-mt8516-add-i2c-clock-div-property.patch b/queue-6.6/arm64-dts-mediatek-mt8516-add-i2c-clock-div-property.patch new file mode 100644 index 0000000000..3f92be3187 --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-mt8516-add-i2c-clock-div-property.patch @@ -0,0 +1,74 @@ +From 97ea65e95da043f8a0af550a3febd8d4827d0398 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Dec 2024 16:05:06 -0300 +Subject: arm64: dts: mediatek: mt8516: add i2c clock-div property + +From: Val Packett + +[ Upstream commit eb72341fd92b7af510d236e5a8554d855ed38d3c ] + +Move the clock-div property from the pumpkin board dtsi to the SoC's +since it belongs to the SoC itself and is required on other devices. + +Fixes: 5236347bde42 ("arm64: dts: mediatek: add dtsi for MT8516") +Signed-off-by: Val Packett +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20241204190524.21862-4-val@packett.cool +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8516.dtsi | 3 +++ + arch/arm64/boot/dts/mediatek/pumpkin-common.dtsi | 2 -- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8516.dtsi b/arch/arm64/boot/dts/mediatek/mt8516.dtsi +index 576be8363ec1c..1ca1393fcc593 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8516.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8516.dtsi +@@ -344,6 +344,7 @@ + reg = <0 0x11009000 0 0x90>, + <0 0x11000180 0 0x80>; + interrupts = ; ++ clock-div = <2>; + clocks = <&topckgen CLK_TOP_I2C0>, + <&topckgen CLK_TOP_APDMA>; + clock-names = "main", "dma"; +@@ -358,6 +359,7 @@ + reg = <0 0x1100a000 0 0x90>, + <0 0x11000200 0 0x80>; + interrupts = ; ++ clock-div = <2>; + clocks = <&topckgen CLK_TOP_I2C1>, + <&topckgen CLK_TOP_APDMA>; + clock-names = "main", "dma"; +@@ -372,6 +374,7 @@ + reg = <0 0x1100b000 0 0x90>, + <0 0x11000280 0 0x80>; + interrupts = ; ++ clock-div = <2>; + clocks = <&topckgen CLK_TOP_I2C2>, + <&topckgen CLK_TOP_APDMA>; + clock-names = "main", "dma"; +diff --git a/arch/arm64/boot/dts/mediatek/pumpkin-common.dtsi b/arch/arm64/boot/dts/mediatek/pumpkin-common.dtsi +index ec8dfb3d1c6d6..a356db5fcc5f3 100644 +--- a/arch/arm64/boot/dts/mediatek/pumpkin-common.dtsi ++++ b/arch/arm64/boot/dts/mediatek/pumpkin-common.dtsi +@@ -47,7 +47,6 @@ + }; + + &i2c0 { +- clock-div = <2>; + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins_a>; + status = "okay"; +@@ -156,7 +155,6 @@ + }; + + &i2c2 { +- clock-div = <2>; + pinctrl-names = "default"; + pinctrl-0 = <&i2c2_pins_a>; + status = "okay"; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mediatek-mt8516-fix-gicv2-range.patch b/queue-6.6/arm64-dts-mediatek-mt8516-fix-gicv2-range.patch new file mode 100644 index 0000000000..d3f34659c0 --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-mt8516-fix-gicv2-range.patch @@ -0,0 +1,44 @@ +From 98b91c927dd48f10f7305f6ddfc2629ce93902fd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Dec 2024 16:05:04 -0300 +Subject: arm64: dts: mediatek: mt8516: fix GICv2 range + +From: Val Packett + +[ Upstream commit e3ee31e4409f051c021a30122f3c470f093a7386 ] + +On the MT8167 which is based on the MT8516 DTS, the following error +was appearing on boot, breaking interrupt operation: + +GICv2 detected, but range too small and irqchip.gicv2_force_probe not set + +Similar to what's been proposed for MT7622 which has the same issue, +fix by using the range reported by force_probe. + +Link: https://lore.kernel.org/all/YmhNSLgp%2Fyg8Vr1F@makrotopia.org/ +Fixes: 5236347bde42 ("arm64: dts: mediatek: add dtsi for MT8516") +Signed-off-by: Val Packett +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20241204190524.21862-2-val@packett.cool +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8516.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8516.dtsi b/arch/arm64/boot/dts/mediatek/mt8516.dtsi +index 9cbd6dd8f671a..1520c4caa1605 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8516.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8516.dtsi +@@ -268,7 +268,7 @@ + interrupt-parent = <&gic>; + interrupt-controller; + reg = <0 0x10310000 0 0x1000>, +- <0 0x10320000 0 0x1000>, ++ <0 0x1032f000 0 0x2000>, + <0 0x10340000 0 0x2000>, + <0 0x10360000 0 0x2000>; + interrupts = +Date: Wed, 4 Dec 2024 16:05:05 -0300 +Subject: arm64: dts: mediatek: mt8516: fix wdt irq type + +From: Val Packett + +[ Upstream commit 03a80442030e7147391738fb6cbe5fa0b3b91bb1 ] + +The GICv2 does not support EDGE_FALLING interrupts, so the watchdog +would refuse to attach due to a failing check coming from the GIC driver. + +Fixes: 5236347bde42 ("arm64: dts: mediatek: add dtsi for MT8516") +Signed-off-by: Val Packett +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20241204190524.21862-3-val@packett.cool +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8516.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8516.dtsi b/arch/arm64/boot/dts/mediatek/mt8516.dtsi +index 1520c4caa1605..576be8363ec1c 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8516.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8516.dtsi +@@ -206,7 +206,7 @@ + compatible = "mediatek,mt8516-wdt", + "mediatek,mt6589-wdt"; + reg = <0 0x10007000 0 0x1000>; +- interrupts = ; ++ interrupts = ; + #reset-cells = <1>; + }; + +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mediatek-mt8516-reserve-192-kib-for-tf-a.patch b/queue-6.6/arm64-dts-mediatek-mt8516-reserve-192-kib-for-tf-a.patch new file mode 100644 index 0000000000..79580647ef --- /dev/null +++ b/queue-6.6/arm64-dts-mediatek-mt8516-reserve-192-kib-for-tf-a.patch @@ -0,0 +1,43 @@ +From 19afb70d80f0660283e6111a8b6e9c35da872d03 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Dec 2024 16:05:07 -0300 +Subject: arm64: dts: mediatek: mt8516: reserve 192 KiB for TF-A + +From: Val Packett + +[ Upstream commit 2561c7d5d497b988deccc36fe5eac7fd50b937f8 ] + +The Android DTB for the related MT8167 reserves 0x30000. This is likely +correct for MT8516 Android devices as well, and there's never any harm +in reserving 64KiB more. + +Fixes: 5236347bde42 ("arm64: dts: mediatek: add dtsi for MT8516") +Signed-off-by: Val Packett +Reviewed-by: AngeloGioacchino Del Regno +Link: https://lore.kernel.org/r/20241204190524.21862-5-val@packett.cool +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8516.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8516.dtsi b/arch/arm64/boot/dts/mediatek/mt8516.dtsi +index 1ca1393fcc593..6b89505a64379 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8516.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8516.dtsi +@@ -144,10 +144,10 @@ + #size-cells = <2>; + ranges; + +- /* 128 KiB reserved for ARM Trusted Firmware (BL31) */ ++ /* 192 KiB reserved for ARM Trusted Firmware (BL31) */ + bl31_secmon_reserved: secmon@43000000 { + no-map; +- reg = <0 0x43000000 0 0x20000>; ++ reg = <0 0x43000000 0 0x30000>; + }; + }; + +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-mt8183-set-dmic-one-wire-mode-on-damu.patch b/queue-6.6/arm64-dts-mt8183-set-dmic-one-wire-mode-on-damu.patch new file mode 100644 index 0000000000..c0b3700838 --- /dev/null +++ b/queue-6.6/arm64-dts-mt8183-set-dmic-one-wire-mode-on-damu.patch @@ -0,0 +1,41 @@ +From 630f914e1fde2db68dd26d5c5da6459160e4e3ee Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Nov 2024 16:16:53 +0800 +Subject: arm64: dts: mt8183: set DMIC one-wire mode on Damu + +From: Hsin-Yi Wang + +[ Upstream commit 6c379e8b984815fc8f876e4bc78c4d563f13ddae ] + +Sets DMIC one-wire mode on Damu. + +Fixes: cabc71b08eb5 ("arm64: dts: mt8183: Add kukui-jacuzzi-damu board") +Signed-off-by: Hsin-Yi Wang +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Hsin-Te Yuan +Reviewed-by: Matthias Brugger +Link: https://lore.kernel.org/r/20241113-damu-v4-1-6911b69610dd@chromium.org +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi-damu.dts | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi-damu.dts b/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi-damu.dts +index 9a166dccd727c..8f95b7270c3fa 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi-damu.dts ++++ b/arch/arm64/boot/dts/mediatek/mt8183-kukui-jacuzzi-damu.dts +@@ -27,6 +27,10 @@ + hid-descr-addr = <0x0001>; + }; + ++&mt6358codec { ++ mediatek,dmic-mode = <1>; /* one-wire */ ++}; ++ + &qca_wifi { + qcom,ath10k-calibration-variant = "GO_DAMU"; + }; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-add-sm7125-device-tree.patch b/queue-6.6/arm64-dts-qcom-add-sm7125-device-tree.patch new file mode 100644 index 0000000000..352bef53c5 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-add-sm7125-device-tree.patch @@ -0,0 +1,49 @@ +From ff32c9ea291cfd9ad1b0091ec7162e72f399394c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 24 Aug 2023 11:15:06 +0200 +Subject: arm64: dts: qcom: Add SM7125 device tree + +From: David Wronek + +[ Upstream commit 72fbf05149bd451e7222c2ed1e3823972f19df9c ] + +The Snapdragon 720G (sm7125) is software-wise very similar to the +Snapdragon 7c with minor differences in clock speeds and as added here, +it uses the Kryo 465 instead of Kryo 468. + +Signed-off-by: David Wronek +Reviewed-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20230824091737.75813-4-davidwronek@gmail.com +Signed-off-by: Bjorn Andersson +Stable-dep-of: 092febd32a99 ("arm64: dts: qcom: sc7180: fix psci power domain node names") +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sm7125.dtsi | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + create mode 100644 arch/arm64/boot/dts/qcom/sm7125.dtsi + +diff --git a/arch/arm64/boot/dts/qcom/sm7125.dtsi b/arch/arm64/boot/dts/qcom/sm7125.dtsi +new file mode 100644 +index 0000000000000..12dd72859a433 +--- /dev/null ++++ b/arch/arm64/boot/dts/qcom/sm7125.dtsi +@@ -0,0 +1,16 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2021, The Linux Foundation. All rights reserved. ++ */ ++ ++#include "sc7180.dtsi" ++ ++/* SM7125 uses Kryo 465 instead of Kryo 468 */ ++&CPU0 { compatible = "qcom,kryo465"; }; ++&CPU1 { compatible = "qcom,kryo465"; }; ++&CPU2 { compatible = "qcom,kryo465"; }; ++&CPU3 { compatible = "qcom,kryo465"; }; ++&CPU4 { compatible = "qcom,kryo465"; }; ++&CPU5 { compatible = "qcom,kryo465"; }; ++&CPU6 { compatible = "qcom,kryo465"; }; ++&CPU7 { compatible = "qcom,kryo465"; }; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-move-common-parts-for-sa8775p-ride-va.patch b/queue-6.6/arm64-dts-qcom-move-common-parts-for-sa8775p-ride-va.patch new file mode 100644 index 0000000000..684161b8d6 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-move-common-parts-for-sa8775p-ride-va.patch @@ -0,0 +1,1709 @@ +From 5622211c6ab74db5aefac5b31e600e4f7dd855d9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 27 Jun 2024 13:42:11 +0200 +Subject: arm64: dts: qcom: move common parts for sa8775p-ride variants into a + .dtsi + +From: Bartosz Golaszewski + +[ Upstream commit fe15631117f8d85b1bc4e0c3b434c78be483a43d ] + +In order to support multiple revisions of the sa8775p-ride board, create +a .dtsi containing the common parts and split out the ethernet bits into +the actual board file as they will change in revision 3. + +Signed-off-by: Bartosz Golaszewski +Link: https://lore.kernel.org/r/20240627114212.25400-3-brgl@bgdev.pl +Signed-off-by: Bjorn Andersson +Stable-dep-of: 30f7dfd2c489 ("arm64: dts: qcom: sa8775p: Update sleep_clk frequency") +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sa8775p-ride.dts | 834 +-------------------- + arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi | 814 ++++++++++++++++++++ + 2 files changed, 835 insertions(+), 813 deletions(-) + create mode 100644 arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi + +diff --git a/arch/arm64/boot/dts/qcom/sa8775p-ride.dts b/arch/arm64/boot/dts/qcom/sa8775p-ride.dts +index 26ad05bd3b3ff..2e87fd760dbdd 100644 +--- a/arch/arm64/boot/dts/qcom/sa8775p-ride.dts ++++ b/arch/arm64/boot/dts/qcom/sa8775p-ride.dts +@@ -5,835 +5,43 @@ + + /dts-v1/; + +-#include +-#include +- +-#include "sa8775p.dtsi" +-#include "sa8775p-pmics.dtsi" ++#include "sa8775p-ride.dtsi" + + / { + model = "Qualcomm SA8775P Ride"; + compatible = "qcom,sa8775p-ride", "qcom,sa8775p"; +- +- aliases { +- ethernet0 = ðernet0; +- ethernet1 = ðernet1; +- i2c11 = &i2c11; +- i2c18 = &i2c18; +- serial0 = &uart10; +- serial1 = &uart12; +- serial2 = &uart17; +- spi16 = &spi16; +- ufshc1 = &ufs_mem_hc; +- }; +- +- chosen { +- stdout-path = "serial0:115200n8"; +- }; +-}; +- +-&apps_rsc { +- regulators-0 { +- compatible = "qcom,pmm8654au-rpmh-regulators"; +- qcom,pmic-id = "a"; +- +- vreg_s4a: smps4 { +- regulator-name = "vreg_s4a"; +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <1816000>; +- regulator-initial-mode = ; +- }; +- +- vreg_s5a: smps5 { +- regulator-name = "vreg_s5a"; +- regulator-min-microvolt = <1850000>; +- regulator-max-microvolt = <1996000>; +- regulator-initial-mode = ; +- }; +- +- vreg_s9a: smps9 { +- regulator-name = "vreg_s9a"; +- regulator-min-microvolt = <535000>; +- regulator-max-microvolt = <1120000>; +- regulator-initial-mode = ; +- }; +- +- vreg_l4a: ldo4 { +- regulator-name = "vreg_l4a"; +- regulator-min-microvolt = <788000>; +- regulator-max-microvolt = <1050000>; +- regulator-initial-mode = ; +- regulator-allow-set-load; +- regulator-allowed-modes = ; +- }; +- +- vreg_l5a: ldo5 { +- regulator-name = "vreg_l5a"; +- regulator-min-microvolt = <870000>; +- regulator-max-microvolt = <950000>; +- regulator-initial-mode = ; +- regulator-allow-set-load; +- regulator-allowed-modes = ; +- }; +- +- vreg_l6a: ldo6 { +- regulator-name = "vreg_l6a"; +- regulator-min-microvolt = <870000>; +- regulator-max-microvolt = <970000>; +- regulator-initial-mode = ; +- regulator-allow-set-load; +- regulator-allowed-modes = ; +- }; +- +- vreg_l7a: ldo7 { +- regulator-name = "vreg_l7a"; +- regulator-min-microvolt = <720000>; +- regulator-max-microvolt = <950000>; +- regulator-initial-mode = ; +- regulator-allow-set-load; +- regulator-allowed-modes = ; +- }; +- +- vreg_l8a: ldo8 { +- regulator-name = "vreg_l8a"; +- regulator-min-microvolt = <2504000>; +- regulator-max-microvolt = <3300000>; +- regulator-initial-mode = ; +- regulator-allow-set-load; +- regulator-allowed-modes = ; +- }; +- +- vreg_l9a: ldo9 { +- regulator-name = "vreg_l9a"; +- regulator-min-microvolt = <2970000>; +- regulator-max-microvolt = <3544000>; +- regulator-initial-mode = ; +- regulator-allow-set-load; +- regulator-allowed-modes = ; +- }; +- }; +- +- regulators-1 { +- compatible = "qcom,pmm8654au-rpmh-regulators"; +- qcom,pmic-id = "c"; +- +- vreg_l1c: ldo1 { +- regulator-name = "vreg_l1c"; +- regulator-min-microvolt = <1140000>; +- regulator-max-microvolt = <1260000>; +- regulator-initial-mode = ; +- regulator-allow-set-load; +- regulator-allowed-modes = ; +- }; +- +- vreg_l2c: ldo2 { +- regulator-name = "vreg_l2c"; +- regulator-min-microvolt = <900000>; +- regulator-max-microvolt = <1100000>; +- regulator-initial-mode = ; +- regulator-allow-set-load; +- regulator-allowed-modes = ; +- }; +- +- vreg_l3c: ldo3 { +- regulator-name = "vreg_l3c"; +- regulator-min-microvolt = <1100000>; +- regulator-max-microvolt = <1300000>; +- regulator-initial-mode = ; +- regulator-allow-set-load; +- regulator-allowed-modes = ; +- }; +- +- vreg_l4c: ldo4 { +- regulator-name = "vreg_l4c"; +- regulator-min-microvolt = <1200000>; +- regulator-max-microvolt = <1200000>; +- regulator-initial-mode = ; +- /* +- * FIXME: This should have regulator-allow-set-load but +- * we're getting an over-current fault from the PMIC +- * when switching to LPM. +- */ +- }; +- +- vreg_l5c: ldo5 { +- regulator-name = "vreg_l5c"; +- regulator-min-microvolt = <1100000>; +- regulator-max-microvolt = <1300000>; +- regulator-initial-mode = ; +- regulator-allow-set-load; +- regulator-allowed-modes = ; +- }; +- +- vreg_l6c: ldo6 { +- regulator-name = "vreg_l6c"; +- regulator-min-microvolt = <1620000>; +- regulator-max-microvolt = <1980000>; +- regulator-initial-mode = ; +- regulator-allow-set-load; +- regulator-allowed-modes = ; +- }; +- +- vreg_l7c: ldo7 { +- regulator-name = "vreg_l7c"; +- regulator-min-microvolt = <1620000>; +- regulator-max-microvolt = <2000000>; +- regulator-initial-mode = ; +- regulator-allow-set-load; +- regulator-allowed-modes = ; +- }; +- +- vreg_l8c: ldo8 { +- regulator-name = "vreg_l8c"; +- regulator-min-microvolt = <2400000>; +- regulator-max-microvolt = <3300000>; +- regulator-initial-mode = ; +- regulator-allow-set-load; +- regulator-allowed-modes = ; +- }; +- +- vreg_l9c: ldo9 { +- regulator-name = "vreg_l9c"; +- regulator-min-microvolt = <1650000>; +- regulator-max-microvolt = <2700000>; +- regulator-initial-mode = ; +- regulator-allow-set-load; +- regulator-allowed-modes = ; +- }; +- }; +- +- regulators-2 { +- compatible = "qcom,pmm8654au-rpmh-regulators"; +- qcom,pmic-id = "e"; +- +- vreg_s4e: smps4 { +- regulator-name = "vreg_s4e"; +- regulator-min-microvolt = <970000>; +- regulator-max-microvolt = <1520000>; +- regulator-initial-mode = ; +- }; +- +- vreg_s7e: smps7 { +- regulator-name = "vreg_s7e"; +- regulator-min-microvolt = <1010000>; +- regulator-max-microvolt = <1170000>; +- regulator-initial-mode = ; +- }; +- +- vreg_s9e: smps9 { +- regulator-name = "vreg_s9e"; +- regulator-min-microvolt = <300000>; +- regulator-max-microvolt = <570000>; +- regulator-initial-mode = ; +- }; +- +- vreg_l6e: ldo6 { +- regulator-name = "vreg_l6e"; +- regulator-min-microvolt = <1280000>; +- regulator-max-microvolt = <1450000>; +- regulator-initial-mode = ; +- regulator-allow-set-load; +- regulator-allowed-modes = ; +- }; +- +- vreg_l8e: ldo8 { +- regulator-name = "vreg_l8e"; +- regulator-min-microvolt = <1800000>; +- regulator-max-microvolt = <1950000>; +- regulator-initial-mode = ; +- regulator-allow-set-load; +- regulator-allowed-modes = ; +- }; +- }; + }; + + ðernet0 { + phy-mode = "sgmii"; +- phy-handle = <&sgmii_phy0>; +- +- pinctrl-0 = <ðernet0_default>; +- pinctrl-names = "default"; +- +- snps,mtl-rx-config = <&mtl_rx_setup>; +- snps,mtl-tx-config = <&mtl_tx_setup>; +- snps,ps-speed = <1000>; +- +- status = "okay"; +- +- mdio { +- compatible = "snps,dwmac-mdio"; +- #address-cells = <1>; +- #size-cells = <0>; +- +- sgmii_phy0: phy@8 { +- compatible = "ethernet-phy-id0141.0dd4"; +- reg = <0x8>; +- device_type = "ethernet-phy"; +- interrupts-extended = <&tlmm 7 IRQ_TYPE_EDGE_FALLING>; +- reset-gpios = <&pmm8654au_2_gpios 8 GPIO_ACTIVE_LOW>; +- reset-assert-us = <11000>; +- reset-deassert-us = <70000>; +- }; +- +- sgmii_phy1: phy@a { +- compatible = "ethernet-phy-id0141.0dd4"; +- reg = <0xa>; +- device_type = "ethernet-phy"; +- interrupts-extended = <&tlmm 26 IRQ_TYPE_EDGE_FALLING>; +- reset-gpios = <&pmm8654au_2_gpios 9 GPIO_ACTIVE_LOW>; +- reset-assert-us = <11000>; +- reset-deassert-us = <70000>; +- }; +- }; +- +- mtl_rx_setup: rx-queues-config { +- snps,rx-queues-to-use = <4>; +- snps,rx-sched-sp; +- +- queue0 { +- snps,dcb-algorithm; +- snps,map-to-dma-channel = <0x0>; +- snps,route-up; +- snps,priority = <0x1>; +- }; +- +- queue1 { +- snps,dcb-algorithm; +- snps,map-to-dma-channel = <0x1>; +- snps,route-ptp; +- }; +- +- queue2 { +- snps,avb-algorithm; +- snps,map-to-dma-channel = <0x2>; +- snps,route-avcp; +- }; +- +- queue3 { +- snps,avb-algorithm; +- snps,map-to-dma-channel = <0x3>; +- snps,priority = <0xc>; +- }; +- }; +- +- mtl_tx_setup: tx-queues-config { +- snps,tx-queues-to-use = <4>; +- snps,tx-sched-sp; +- +- queue0 { +- snps,dcb-algorithm; +- }; +- +- queue1 { +- snps,dcb-algorithm; +- }; +- +- queue2 { +- snps,avb-algorithm; +- snps,send_slope = <0x1000>; +- snps,idle_slope = <0x1000>; +- snps,high_credit = <0x3e800>; +- snps,low_credit = <0xffc18000>; +- }; +- +- queue3 { +- snps,avb-algorithm; +- snps,send_slope = <0x1000>; +- snps,idle_slope = <0x1000>; +- snps,high_credit = <0x3e800>; +- snps,low_credit = <0xffc18000>; +- }; +- }; + }; + + ðernet1 { + phy-mode = "sgmii"; +- phy-handle = <&sgmii_phy1>; +- +- snps,mtl-rx-config = <&mtl_rx_setup1>; +- snps,mtl-tx-config = <&mtl_tx_setup1>; +- snps,ps-speed = <1000>; +- +- status = "okay"; +- +- mtl_rx_setup1: rx-queues-config { +- snps,rx-queues-to-use = <4>; +- snps,rx-sched-sp; +- +- queue0 { +- snps,dcb-algorithm; +- snps,map-to-dma-channel = <0x0>; +- snps,route-up; +- snps,priority = <0x1>; +- }; +- +- queue1 { +- snps,dcb-algorithm; +- snps,map-to-dma-channel = <0x1>; +- snps,route-ptp; +- }; +- +- queue2 { +- snps,avb-algorithm; +- snps,map-to-dma-channel = <0x2>; +- snps,route-avcp; +- }; +- +- queue3 { +- snps,avb-algorithm; +- snps,map-to-dma-channel = <0x3>; +- snps,priority = <0xc>; +- }; +- }; +- +- mtl_tx_setup1: tx-queues-config { +- snps,tx-queues-to-use = <4>; +- snps,tx-sched-sp; +- +- queue0 { +- snps,dcb-algorithm; +- }; +- +- queue1 { +- snps,dcb-algorithm; +- }; +- +- queue2 { +- snps,avb-algorithm; +- snps,send_slope = <0x1000>; +- snps,idle_slope = <0x1000>; +- snps,high_credit = <0x3e800>; +- snps,low_credit = <0xffc18000>; +- }; +- +- queue3 { +- snps,avb-algorithm; +- snps,send_slope = <0x1000>; +- snps,idle_slope = <0x1000>; +- snps,high_credit = <0x3e800>; +- snps,low_credit = <0xffc18000>; +- }; +- }; +-}; +- +-&i2c11 { +- clock-frequency = <400000>; +- pinctrl-0 = <&qup_i2c11_default>; +- pinctrl-names = "default"; +- status = "okay"; +-}; +- +-&i2c18 { +- clock-frequency = <400000>; +- pinctrl-0 = <&qup_i2c18_default>; +- pinctrl-names = "default"; +- status = "okay"; +-}; +- +-&pmm8654au_0_gpios { +- gpio-line-names = "DS_EN", +- "POFF_COMPLETE", +- "UFS0_VER_ID", +- "FAST_POFF", +- "DBU1_PON_DONE", +- "AOSS_SLEEP", +- "CAM_DES0_EN", +- "CAM_DES1_EN", +- "CAM_DES2_EN", +- "CAM_DES3_EN", +- "UEFI", +- "ANALOG_PON_OPT"; +-}; +- +-&pmm8654au_0_pon_resin { +- linux,code = ; +- status = "okay"; +-}; +- +-&pmm8654au_1_gpios { +- gpio-line-names = "PMIC_C_ID0", +- "PMIC_C_ID1", +- "UFS1_VER_ID", +- "IPA_PWR", +- "", +- "WLAN_DBU4_EN", +- "WLAN_EN", +- "BT_EN", +- "USB2_PWR_EN", +- "USB2_FAULT"; +- +- usb2_en_state: usb2-en-state { +- pins = "gpio9"; +- function = "normal"; +- output-high; +- power-source = <0>; +- }; +-}; +- +-&pmm8654au_2_gpios { +- gpio-line-names = "PMIC_E_ID0", +- "PMIC_E_ID1", +- "USB0_PWR_EN", +- "USB0_FAULT", +- "SENSOR_IRQ_1", +- "SENSOR_IRQ_2", +- "SENSOR_RST", +- "SGMIIO0_RST", +- "SGMIIO1_RST", +- "USB1_PWR_ENABLE", +- "USB1_FAULT", +- "VMON_SPX8"; +- +- usb0_en_state: usb0-en-state { +- pins = "gpio3"; +- function = "normal"; +- output-high; +- power-source = <0>; +- }; +- +- usb1_en_state: usb1-en-state { +- pins = "gpio10"; +- function = "normal"; +- output-high; +- power-source = <0>; +- }; +-}; +- +-&pmm8654au_3_gpios { +- gpio-line-names = "PMIC_G_ID0", +- "PMIC_G_ID1", +- "GNSS_RST", +- "GNSS_EN", +- "GNSS_BOOT_MODE"; +-}; +- +-&qupv3_id_1 { +- status = "okay"; +-}; +- +-&qupv3_id_2 { +- status = "okay"; +-}; +- +-&serdes0 { +- phy-supply = <&vreg_l5a>; +- status = "okay"; +-}; +- +-&serdes1 { +- phy-supply = <&vreg_l5a>; +- status = "okay"; +-}; +- +-&sleep_clk { +- clock-frequency = <32764>; +-}; +- +-&spi16 { +- pinctrl-0 = <&qup_spi16_default>; +- pinctrl-names = "default"; +- status = "okay"; + }; + +-&tlmm { +- ethernet0_default: ethernet0-default-state { +- ethernet0_mdc: ethernet0-mdc-pins { +- pins = "gpio8"; +- function = "emac0_mdc"; +- drive-strength = <16>; +- bias-pull-up; +- }; +- +- ethernet0_mdio: ethernet0-mdio-pins { +- pins = "gpio9"; +- function = "emac0_mdio"; +- drive-strength = <16>; +- bias-pull-up; +- }; +- }; +- +- qup_uart10_default: qup-uart10-state { +- pins = "gpio46", "gpio47"; +- function = "qup1_se3"; +- }; +- +- qup_spi16_default: qup-spi16-state { +- pins = "gpio86", "gpio87", "gpio88", "gpio89"; +- function = "qup2_se2"; +- drive-strength = <6>; +- bias-disable; +- }; +- +- qup_i2c11_default: qup-i2c11-state { +- pins = "gpio48", "gpio49"; +- function = "qup1_se4"; +- drive-strength = <2>; +- bias-pull-up; +- }; +- +- qup_i2c18_default: qup-i2c18-state { +- pins = "gpio95", "gpio96"; +- function = "qup2_se4"; +- drive-strength = <2>; +- bias-pull-up; +- }; +- +- qup_uart12_default: qup-uart12-state { +- qup_uart12_cts: qup-uart12-cts-pins { +- pins = "gpio52"; +- function = "qup1_se5"; +- bias-disable; +- }; +- +- qup_uart12_rts: qup-uart12-rts-pins { +- pins = "gpio53"; +- function = "qup1_se5"; +- bias-pull-down; +- }; +- +- qup_uart12_tx: qup-uart12-tx-pins { +- pins = "gpio54"; +- function = "qup1_se5"; +- bias-pull-up; +- }; +- +- qup_uart12_rx: qup-uart12-rx-pins { +- pins = "gpio55"; +- function = "qup1_se5"; +- bias-pull-down; +- }; +- }; +- +- qup_uart17_default: qup-uart17-state { +- qup_uart17_cts: qup-uart17-cts-pins { +- pins = "gpio91"; +- function = "qup2_se3"; +- bias-disable; +- }; +- +- qup_uart17_rts: qup0-uart17-rts-pins { +- pins = "gpio92"; +- function = "qup2_se3"; +- bias-pull-down; +- }; +- +- qup_uart17_tx: qup0-uart17-tx-pins { +- pins = "gpio93"; +- function = "qup2_se3"; +- bias-pull-up; +- }; +- +- qup_uart17_rx: qup0-uart17-rx-pins { +- pins = "gpio94"; +- function = "qup2_se3"; +- bias-pull-down; +- }; +- }; ++&mdio { ++ compatible = "snps,dwmac-mdio"; ++ #address-cells = <1>; ++ #size-cells = <0>; + +- pcie0_default_state: pcie0-default-state { +- perst-pins { +- pins = "gpio2"; +- function = "gpio"; +- drive-strength = <2>; +- bias-pull-down; +- }; +- +- clkreq-pins { +- pins = "gpio1"; +- function = "pcie0_clkreq"; +- drive-strength = <2>; +- bias-pull-up; +- }; +- +- wake-pins { +- pins = "gpio0"; +- function = "gpio"; +- drive-strength = <2>; +- bias-pull-up; +- }; ++ sgmii_phy0: phy@8 { ++ compatible = "ethernet-phy-id0141.0dd4"; ++ reg = <0x8>; ++ device_type = "ethernet-phy"; ++ interrupts-extended = <&tlmm 7 IRQ_TYPE_EDGE_FALLING>; ++ reset-gpios = <&pmm8654au_2_gpios 8 GPIO_ACTIVE_LOW>; ++ reset-assert-us = <11000>; ++ reset-deassert-us = <70000>; + }; + +- pcie1_default_state: pcie1-default-state { +- perst-pins { +- pins = "gpio4"; +- function = "gpio"; +- drive-strength = <2>; +- bias-pull-down; +- }; +- +- clkreq-pins { +- pins = "gpio3"; +- function = "pcie1_clkreq"; +- drive-strength = <2>; +- bias-pull-up; +- }; +- +- wake-pins { +- pins = "gpio5"; +- function = "gpio"; +- drive-strength = <2>; +- bias-pull-up; +- }; ++ sgmii_phy1: phy@a { ++ compatible = "ethernet-phy-id0141.0dd4"; ++ reg = <0xa>; ++ device_type = "ethernet-phy"; ++ interrupts-extended = <&tlmm 26 IRQ_TYPE_EDGE_FALLING>; ++ reset-gpios = <&pmm8654au_2_gpios 9 GPIO_ACTIVE_LOW>; ++ reset-assert-us = <11000>; ++ reset-deassert-us = <70000>; + }; + }; +- +-&pcie0 { +- perst-gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; +- wake-gpios = <&tlmm 0 GPIO_ACTIVE_HIGH>; +- +- pinctrl-names = "default"; +- pinctrl-0 = <&pcie0_default_state>; +- +- status = "okay"; +-}; +- +-&pcie1 { +- perst-gpios = <&tlmm 4 GPIO_ACTIVE_LOW>; +- wake-gpios = <&tlmm 5 GPIO_ACTIVE_HIGH>; +- +- pinctrl-names = "default"; +- pinctrl-0 = <&pcie1_default_state>; +- +- status = "okay"; +-}; +- +-&pcie0_phy { +- vdda-phy-supply = <&vreg_l5a>; +- vdda-pll-supply = <&vreg_l1c>; +- +- status = "okay"; +-}; +- +-&pcie1_phy { +- vdda-phy-supply = <&vreg_l5a>; +- vdda-pll-supply = <&vreg_l1c>; +- +- status = "okay"; +-}; +- +-&uart10 { +- compatible = "qcom,geni-debug-uart"; +- pinctrl-0 = <&qup_uart10_default>; +- pinctrl-names = "default"; +- status = "okay"; +-}; +- +-&uart12 { +- pinctrl-0 = <&qup_uart12_default>; +- pinctrl-names = "default"; +- status = "okay"; +-}; +- +-&uart17 { +- pinctrl-0 = <&qup_uart17_default>; +- pinctrl-names = "default"; +- status = "okay"; +-}; +- +-&ufs_mem_hc { +- reset-gpios = <&tlmm 149 GPIO_ACTIVE_LOW>; +- vcc-supply = <&vreg_l8a>; +- vcc-max-microamp = <1100000>; +- vccq-supply = <&vreg_l4c>; +- vccq-max-microamp = <1200000>; +- +- status = "okay"; +-}; +- +-&ufs_mem_phy { +- vdda-phy-supply = <&vreg_l4a>; +- vdda-pll-supply = <&vreg_l1c>; +- +- status = "okay"; +-}; +- +-&usb_0 { +- pinctrl-names = "default"; +- pinctrl-0 = <&usb0_en_state>; +- +- status = "okay"; +-}; +- +-&usb_0_dwc3 { +- dr_mode = "peripheral"; +-}; +- +-&usb_0_hsphy { +- vdda-pll-supply = <&vreg_l7a>; +- vdda18-supply = <&vreg_l6c>; +- vdda33-supply = <&vreg_l9a>; +- +- status = "okay"; +-}; +- +-&usb_0_qmpphy { +- vdda-phy-supply = <&vreg_l1c>; +- vdda-pll-supply = <&vreg_l7a>; +- +- status = "okay"; +-}; +- +-&usb_1 { +- pinctrl-names = "default"; +- pinctrl-0 = <&usb1_en_state>; +- +- status = "okay"; +-}; +- +-&usb_1_dwc3 { +- dr_mode = "host"; +-}; +- +-&usb_1_hsphy { +- vdda-pll-supply = <&vreg_l7a>; +- vdda18-supply = <&vreg_l6c>; +- vdda33-supply = <&vreg_l9a>; +- +- status = "okay"; +-}; +- +-&usb_1_qmpphy { +- vdda-phy-supply = <&vreg_l1c>; +- vdda-pll-supply = <&vreg_l7a>; +- +- status = "okay"; +-}; +- +-&usb_2 { +- pinctrl-names = "default"; +- pinctrl-0 = <&usb2_en_state>; +- +- status = "okay"; +-}; +- +-&usb_2_dwc3 { +- dr_mode = "host"; +-}; +- +-&usb_2_hsphy { +- vdda-pll-supply = <&vreg_l7a>; +- vdda18-supply = <&vreg_l6c>; +- vdda33-supply = <&vreg_l9a>; +- +- status = "okay"; +-}; +- +-&xo_board_clk { +- clock-frequency = <38400000>; +-}; +diff --git a/arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi b/arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi +new file mode 100644 +index 0000000000000..2a6170623ea95 +--- /dev/null ++++ b/arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi +@@ -0,0 +1,814 @@ ++// SPDX-License-Identifier: BSD-3-Clause ++/* ++ * Copyright (c) 2023, Linaro Limited ++ */ ++ ++/dts-v1/; ++ ++#include ++#include ++ ++#include "sa8775p.dtsi" ++#include "sa8775p-pmics.dtsi" ++ ++/ { ++ aliases { ++ ethernet0 = ðernet0; ++ ethernet1 = ðernet1; ++ i2c11 = &i2c11; ++ i2c18 = &i2c18; ++ serial0 = &uart10; ++ serial1 = &uart12; ++ serial2 = &uart17; ++ spi16 = &spi16; ++ ufshc1 = &ufs_mem_hc; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++}; ++ ++&apps_rsc { ++ regulators-0 { ++ compatible = "qcom,pmm8654au-rpmh-regulators"; ++ qcom,pmic-id = "a"; ++ ++ vreg_s4a: smps4 { ++ regulator-name = "vreg_s4a"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1816000>; ++ regulator-initial-mode = ; ++ }; ++ ++ vreg_s5a: smps5 { ++ regulator-name = "vreg_s5a"; ++ regulator-min-microvolt = <1850000>; ++ regulator-max-microvolt = <1996000>; ++ regulator-initial-mode = ; ++ }; ++ ++ vreg_s9a: smps9 { ++ regulator-name = "vreg_s9a"; ++ regulator-min-microvolt = <535000>; ++ regulator-max-microvolt = <1120000>; ++ regulator-initial-mode = ; ++ }; ++ ++ vreg_l4a: ldo4 { ++ regulator-name = "vreg_l4a"; ++ regulator-min-microvolt = <788000>; ++ regulator-max-microvolt = <1050000>; ++ regulator-initial-mode = ; ++ regulator-allow-set-load; ++ regulator-allowed-modes = ; ++ }; ++ ++ vreg_l5a: ldo5 { ++ regulator-name = "vreg_l5a"; ++ regulator-min-microvolt = <870000>; ++ regulator-max-microvolt = <950000>; ++ regulator-initial-mode = ; ++ regulator-allow-set-load; ++ regulator-allowed-modes = ; ++ }; ++ ++ vreg_l6a: ldo6 { ++ regulator-name = "vreg_l6a"; ++ regulator-min-microvolt = <870000>; ++ regulator-max-microvolt = <970000>; ++ regulator-initial-mode = ; ++ regulator-allow-set-load; ++ regulator-allowed-modes = ; ++ }; ++ ++ vreg_l7a: ldo7 { ++ regulator-name = "vreg_l7a"; ++ regulator-min-microvolt = <720000>; ++ regulator-max-microvolt = <950000>; ++ regulator-initial-mode = ; ++ regulator-allow-set-load; ++ regulator-allowed-modes = ; ++ }; ++ ++ vreg_l8a: ldo8 { ++ regulator-name = "vreg_l8a"; ++ regulator-min-microvolt = <2504000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-initial-mode = ; ++ regulator-allow-set-load; ++ regulator-allowed-modes = ; ++ }; ++ ++ vreg_l9a: ldo9 { ++ regulator-name = "vreg_l9a"; ++ regulator-min-microvolt = <2970000>; ++ regulator-max-microvolt = <3544000>; ++ regulator-initial-mode = ; ++ regulator-allow-set-load; ++ regulator-allowed-modes = ; ++ }; ++ }; ++ ++ regulators-1 { ++ compatible = "qcom,pmm8654au-rpmh-regulators"; ++ qcom,pmic-id = "c"; ++ ++ vreg_l1c: ldo1 { ++ regulator-name = "vreg_l1c"; ++ regulator-min-microvolt = <1140000>; ++ regulator-max-microvolt = <1260000>; ++ regulator-initial-mode = ; ++ regulator-allow-set-load; ++ regulator-allowed-modes = ; ++ }; ++ ++ vreg_l2c: ldo2 { ++ regulator-name = "vreg_l2c"; ++ regulator-min-microvolt = <900000>; ++ regulator-max-microvolt = <1100000>; ++ regulator-initial-mode = ; ++ regulator-allow-set-load; ++ regulator-allowed-modes = ; ++ }; ++ ++ vreg_l3c: ldo3 { ++ regulator-name = "vreg_l3c"; ++ regulator-min-microvolt = <1100000>; ++ regulator-max-microvolt = <1300000>; ++ regulator-initial-mode = ; ++ regulator-allow-set-load; ++ regulator-allowed-modes = ; ++ }; ++ ++ vreg_l4c: ldo4 { ++ regulator-name = "vreg_l4c"; ++ regulator-min-microvolt = <1200000>; ++ regulator-max-microvolt = <1200000>; ++ regulator-initial-mode = ; ++ /* ++ * FIXME: This should have regulator-allow-set-load but ++ * we're getting an over-current fault from the PMIC ++ * when switching to LPM. ++ */ ++ }; ++ ++ vreg_l5c: ldo5 { ++ regulator-name = "vreg_l5c"; ++ regulator-min-microvolt = <1100000>; ++ regulator-max-microvolt = <1300000>; ++ regulator-initial-mode = ; ++ regulator-allow-set-load; ++ regulator-allowed-modes = ; ++ }; ++ ++ vreg_l6c: ldo6 { ++ regulator-name = "vreg_l6c"; ++ regulator-min-microvolt = <1620000>; ++ regulator-max-microvolt = <1980000>; ++ regulator-initial-mode = ; ++ regulator-allow-set-load; ++ regulator-allowed-modes = ; ++ }; ++ ++ vreg_l7c: ldo7 { ++ regulator-name = "vreg_l7c"; ++ regulator-min-microvolt = <1620000>; ++ regulator-max-microvolt = <2000000>; ++ regulator-initial-mode = ; ++ regulator-allow-set-load; ++ regulator-allowed-modes = ; ++ }; ++ ++ vreg_l8c: ldo8 { ++ regulator-name = "vreg_l8c"; ++ regulator-min-microvolt = <2400000>; ++ regulator-max-microvolt = <3300000>; ++ regulator-initial-mode = ; ++ regulator-allow-set-load; ++ regulator-allowed-modes = ; ++ }; ++ ++ vreg_l9c: ldo9 { ++ regulator-name = "vreg_l9c"; ++ regulator-min-microvolt = <1650000>; ++ regulator-max-microvolt = <2700000>; ++ regulator-initial-mode = ; ++ regulator-allow-set-load; ++ regulator-allowed-modes = ; ++ }; ++ }; ++ ++ regulators-2 { ++ compatible = "qcom,pmm8654au-rpmh-regulators"; ++ qcom,pmic-id = "e"; ++ ++ vreg_s4e: smps4 { ++ regulator-name = "vreg_s4e"; ++ regulator-min-microvolt = <970000>; ++ regulator-max-microvolt = <1520000>; ++ regulator-initial-mode = ; ++ }; ++ ++ vreg_s7e: smps7 { ++ regulator-name = "vreg_s7e"; ++ regulator-min-microvolt = <1010000>; ++ regulator-max-microvolt = <1170000>; ++ regulator-initial-mode = ; ++ }; ++ ++ vreg_s9e: smps9 { ++ regulator-name = "vreg_s9e"; ++ regulator-min-microvolt = <300000>; ++ regulator-max-microvolt = <570000>; ++ regulator-initial-mode = ; ++ }; ++ ++ vreg_l6e: ldo6 { ++ regulator-name = "vreg_l6e"; ++ regulator-min-microvolt = <1280000>; ++ regulator-max-microvolt = <1450000>; ++ regulator-initial-mode = ; ++ regulator-allow-set-load; ++ regulator-allowed-modes = ; ++ }; ++ ++ vreg_l8e: ldo8 { ++ regulator-name = "vreg_l8e"; ++ regulator-min-microvolt = <1800000>; ++ regulator-max-microvolt = <1950000>; ++ regulator-initial-mode = ; ++ regulator-allow-set-load; ++ regulator-allowed-modes = ; ++ }; ++ }; ++}; ++ ++ðernet0 { ++ phy-handle = <&sgmii_phy0>; ++ ++ pinctrl-0 = <ðernet0_default>; ++ pinctrl-names = "default"; ++ ++ snps,mtl-rx-config = <&mtl_rx_setup>; ++ snps,mtl-tx-config = <&mtl_tx_setup>; ++ snps,ps-speed = <1000>; ++ ++ status = "okay"; ++ ++ mdio: mdio { ++ compatible = "snps,dwmac-mdio"; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ }; ++ ++ mtl_rx_setup: rx-queues-config { ++ snps,rx-queues-to-use = <4>; ++ snps,rx-sched-sp; ++ ++ queue0 { ++ snps,dcb-algorithm; ++ snps,map-to-dma-channel = <0x0>; ++ snps,route-up; ++ snps,priority = <0x1>; ++ }; ++ ++ queue1 { ++ snps,dcb-algorithm; ++ snps,map-to-dma-channel = <0x1>; ++ snps,route-ptp; ++ }; ++ ++ queue2 { ++ snps,avb-algorithm; ++ snps,map-to-dma-channel = <0x2>; ++ snps,route-avcp; ++ }; ++ ++ queue3 { ++ snps,avb-algorithm; ++ snps,map-to-dma-channel = <0x3>; ++ snps,priority = <0xc>; ++ }; ++ }; ++ ++ mtl_tx_setup: tx-queues-config { ++ snps,tx-queues-to-use = <4>; ++ snps,tx-sched-sp; ++ ++ queue0 { ++ snps,dcb-algorithm; ++ }; ++ ++ queue1 { ++ snps,dcb-algorithm; ++ }; ++ ++ queue2 { ++ snps,avb-algorithm; ++ snps,send_slope = <0x1000>; ++ snps,idle_slope = <0x1000>; ++ snps,high_credit = <0x3e800>; ++ snps,low_credit = <0xffc18000>; ++ }; ++ ++ queue3 { ++ snps,avb-algorithm; ++ snps,send_slope = <0x1000>; ++ snps,idle_slope = <0x1000>; ++ snps,high_credit = <0x3e800>; ++ snps,low_credit = <0xffc18000>; ++ }; ++ }; ++}; ++ ++ðernet1 { ++ phy-handle = <&sgmii_phy1>; ++ ++ snps,mtl-rx-config = <&mtl_rx_setup1>; ++ snps,mtl-tx-config = <&mtl_tx_setup1>; ++ snps,ps-speed = <1000>; ++ ++ status = "okay"; ++ ++ mtl_rx_setup1: rx-queues-config { ++ snps,rx-queues-to-use = <4>; ++ snps,rx-sched-sp; ++ ++ queue0 { ++ snps,dcb-algorithm; ++ snps,map-to-dma-channel = <0x0>; ++ snps,route-up; ++ snps,priority = <0x1>; ++ }; ++ ++ queue1 { ++ snps,dcb-algorithm; ++ snps,map-to-dma-channel = <0x1>; ++ snps,route-ptp; ++ }; ++ ++ queue2 { ++ snps,avb-algorithm; ++ snps,map-to-dma-channel = <0x2>; ++ snps,route-avcp; ++ }; ++ ++ queue3 { ++ snps,avb-algorithm; ++ snps,map-to-dma-channel = <0x3>; ++ snps,priority = <0xc>; ++ }; ++ }; ++ ++ mtl_tx_setup1: tx-queues-config { ++ snps,tx-queues-to-use = <4>; ++ snps,tx-sched-sp; ++ ++ queue0 { ++ snps,dcb-algorithm; ++ }; ++ ++ queue1 { ++ snps,dcb-algorithm; ++ }; ++ ++ queue2 { ++ snps,avb-algorithm; ++ snps,send_slope = <0x1000>; ++ snps,idle_slope = <0x1000>; ++ snps,high_credit = <0x3e800>; ++ snps,low_credit = <0xffc18000>; ++ }; ++ ++ queue3 { ++ snps,avb-algorithm; ++ snps,send_slope = <0x1000>; ++ snps,idle_slope = <0x1000>; ++ snps,high_credit = <0x3e800>; ++ snps,low_credit = <0xffc18000>; ++ }; ++ }; ++}; ++ ++&i2c11 { ++ clock-frequency = <400000>; ++ pinctrl-0 = <&qup_i2c11_default>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&i2c18 { ++ clock-frequency = <400000>; ++ pinctrl-0 = <&qup_i2c18_default>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&pmm8654au_0_gpios { ++ gpio-line-names = "DS_EN", ++ "POFF_COMPLETE", ++ "UFS0_VER_ID", ++ "FAST_POFF", ++ "DBU1_PON_DONE", ++ "AOSS_SLEEP", ++ "CAM_DES0_EN", ++ "CAM_DES1_EN", ++ "CAM_DES2_EN", ++ "CAM_DES3_EN", ++ "UEFI", ++ "ANALOG_PON_OPT"; ++}; ++ ++&pmm8654au_0_pon_resin { ++ linux,code = ; ++ status = "okay"; ++}; ++ ++&pmm8654au_1_gpios { ++ gpio-line-names = "PMIC_C_ID0", ++ "PMIC_C_ID1", ++ "UFS1_VER_ID", ++ "IPA_PWR", ++ "", ++ "WLAN_DBU4_EN", ++ "WLAN_EN", ++ "BT_EN", ++ "USB2_PWR_EN", ++ "USB2_FAULT"; ++ ++ usb2_en_state: usb2-en-state { ++ pins = "gpio9"; ++ function = "normal"; ++ output-high; ++ power-source = <0>; ++ }; ++}; ++ ++&pmm8654au_2_gpios { ++ gpio-line-names = "PMIC_E_ID0", ++ "PMIC_E_ID1", ++ "USB0_PWR_EN", ++ "USB0_FAULT", ++ "SENSOR_IRQ_1", ++ "SENSOR_IRQ_2", ++ "SENSOR_RST", ++ "SGMIIO0_RST", ++ "SGMIIO1_RST", ++ "USB1_PWR_ENABLE", ++ "USB1_FAULT", ++ "VMON_SPX8"; ++ ++ usb0_en_state: usb0-en-state { ++ pins = "gpio3"; ++ function = "normal"; ++ output-high; ++ power-source = <0>; ++ }; ++ ++ usb1_en_state: usb1-en-state { ++ pins = "gpio10"; ++ function = "normal"; ++ output-high; ++ power-source = <0>; ++ }; ++}; ++ ++&pmm8654au_3_gpios { ++ gpio-line-names = "PMIC_G_ID0", ++ "PMIC_G_ID1", ++ "GNSS_RST", ++ "GNSS_EN", ++ "GNSS_BOOT_MODE"; ++}; ++ ++&qupv3_id_1 { ++ status = "okay"; ++}; ++ ++&qupv3_id_2 { ++ status = "okay"; ++}; ++ ++&serdes0 { ++ phy-supply = <&vreg_l5a>; ++ status = "okay"; ++}; ++ ++&serdes1 { ++ phy-supply = <&vreg_l5a>; ++ status = "okay"; ++}; ++ ++&sleep_clk { ++ clock-frequency = <32764>; ++}; ++ ++&spi16 { ++ pinctrl-0 = <&qup_spi16_default>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&tlmm { ++ ethernet0_default: ethernet0-default-state { ++ ethernet0_mdc: ethernet0-mdc-pins { ++ pins = "gpio8"; ++ function = "emac0_mdc"; ++ drive-strength = <16>; ++ bias-pull-up; ++ }; ++ ++ ethernet0_mdio: ethernet0-mdio-pins { ++ pins = "gpio9"; ++ function = "emac0_mdio"; ++ drive-strength = <16>; ++ bias-pull-up; ++ }; ++ }; ++ ++ qup_uart10_default: qup-uart10-state { ++ pins = "gpio46", "gpio47"; ++ function = "qup1_se3"; ++ }; ++ ++ qup_spi16_default: qup-spi16-state { ++ pins = "gpio86", "gpio87", "gpio88", "gpio89"; ++ function = "qup2_se2"; ++ drive-strength = <6>; ++ bias-disable; ++ }; ++ ++ qup_i2c11_default: qup-i2c11-state { ++ pins = "gpio48", "gpio49"; ++ function = "qup1_se4"; ++ drive-strength = <2>; ++ bias-pull-up; ++ }; ++ ++ qup_i2c18_default: qup-i2c18-state { ++ pins = "gpio95", "gpio96"; ++ function = "qup2_se4"; ++ drive-strength = <2>; ++ bias-pull-up; ++ }; ++ ++ qup_uart12_default: qup-uart12-state { ++ qup_uart12_cts: qup-uart12-cts-pins { ++ pins = "gpio52"; ++ function = "qup1_se5"; ++ bias-disable; ++ }; ++ ++ qup_uart12_rts: qup-uart12-rts-pins { ++ pins = "gpio53"; ++ function = "qup1_se5"; ++ bias-pull-down; ++ }; ++ ++ qup_uart12_tx: qup-uart12-tx-pins { ++ pins = "gpio54"; ++ function = "qup1_se5"; ++ bias-pull-up; ++ }; ++ ++ qup_uart12_rx: qup-uart12-rx-pins { ++ pins = "gpio55"; ++ function = "qup1_se5"; ++ bias-pull-down; ++ }; ++ }; ++ ++ qup_uart17_default: qup-uart17-state { ++ qup_uart17_cts: qup-uart17-cts-pins { ++ pins = "gpio91"; ++ function = "qup2_se3"; ++ bias-disable; ++ }; ++ ++ qup_uart17_rts: qup0-uart17-rts-pins { ++ pins = "gpio92"; ++ function = "qup2_se3"; ++ bias-pull-down; ++ }; ++ ++ qup_uart17_tx: qup0-uart17-tx-pins { ++ pins = "gpio93"; ++ function = "qup2_se3"; ++ bias-pull-up; ++ }; ++ ++ qup_uart17_rx: qup0-uart17-rx-pins { ++ pins = "gpio94"; ++ function = "qup2_se3"; ++ bias-pull-down; ++ }; ++ }; ++ ++ pcie0_default_state: pcie0-default-state { ++ perst-pins { ++ pins = "gpio2"; ++ function = "gpio"; ++ drive-strength = <2>; ++ bias-pull-down; ++ }; ++ ++ clkreq-pins { ++ pins = "gpio1"; ++ function = "pcie0_clkreq"; ++ drive-strength = <2>; ++ bias-pull-up; ++ }; ++ ++ wake-pins { ++ pins = "gpio0"; ++ function = "gpio"; ++ drive-strength = <2>; ++ bias-pull-up; ++ }; ++ }; ++ ++ pcie1_default_state: pcie1-default-state { ++ perst-pins { ++ pins = "gpio4"; ++ function = "gpio"; ++ drive-strength = <2>; ++ bias-pull-down; ++ }; ++ ++ clkreq-pins { ++ pins = "gpio3"; ++ function = "pcie1_clkreq"; ++ drive-strength = <2>; ++ bias-pull-up; ++ }; ++ ++ wake-pins { ++ pins = "gpio5"; ++ function = "gpio"; ++ drive-strength = <2>; ++ bias-pull-up; ++ }; ++ }; ++}; ++ ++&pcie0 { ++ perst-gpios = <&tlmm 2 GPIO_ACTIVE_LOW>; ++ wake-gpios = <&tlmm 0 GPIO_ACTIVE_HIGH>; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie0_default_state>; ++ ++ status = "okay"; ++}; ++ ++&pcie1 { ++ perst-gpios = <&tlmm 4 GPIO_ACTIVE_LOW>; ++ wake-gpios = <&tlmm 5 GPIO_ACTIVE_HIGH>; ++ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&pcie1_default_state>; ++ ++ status = "okay"; ++}; ++ ++&pcie0_phy { ++ vdda-phy-supply = <&vreg_l5a>; ++ vdda-pll-supply = <&vreg_l1c>; ++ ++ status = "okay"; ++}; ++ ++&pcie1_phy { ++ vdda-phy-supply = <&vreg_l5a>; ++ vdda-pll-supply = <&vreg_l1c>; ++ ++ status = "okay"; ++}; ++ ++&uart10 { ++ compatible = "qcom,geni-debug-uart"; ++ pinctrl-0 = <&qup_uart10_default>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&uart12 { ++ pinctrl-0 = <&qup_uart12_default>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&uart17 { ++ pinctrl-0 = <&qup_uart17_default>; ++ pinctrl-names = "default"; ++ status = "okay"; ++}; ++ ++&ufs_mem_hc { ++ reset-gpios = <&tlmm 149 GPIO_ACTIVE_LOW>; ++ vcc-supply = <&vreg_l8a>; ++ vcc-max-microamp = <1100000>; ++ vccq-supply = <&vreg_l4c>; ++ vccq-max-microamp = <1200000>; ++ ++ status = "okay"; ++}; ++ ++&ufs_mem_phy { ++ vdda-phy-supply = <&vreg_l4a>; ++ vdda-pll-supply = <&vreg_l1c>; ++ ++ status = "okay"; ++}; ++ ++&usb_0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&usb0_en_state>; ++ ++ status = "okay"; ++}; ++ ++&usb_0_dwc3 { ++ dr_mode = "peripheral"; ++}; ++ ++&usb_0_hsphy { ++ vdda-pll-supply = <&vreg_l7a>; ++ vdda18-supply = <&vreg_l6c>; ++ vdda33-supply = <&vreg_l9a>; ++ ++ status = "okay"; ++}; ++ ++&usb_0_qmpphy { ++ vdda-phy-supply = <&vreg_l1c>; ++ vdda-pll-supply = <&vreg_l7a>; ++ ++ status = "okay"; ++}; ++ ++&usb_1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&usb1_en_state>; ++ ++ status = "okay"; ++}; ++ ++&usb_1_dwc3 { ++ dr_mode = "host"; ++}; ++ ++&usb_1_hsphy { ++ vdda-pll-supply = <&vreg_l7a>; ++ vdda18-supply = <&vreg_l6c>; ++ vdda33-supply = <&vreg_l9a>; ++ ++ status = "okay"; ++}; ++ ++&usb_1_qmpphy { ++ vdda-phy-supply = <&vreg_l1c>; ++ vdda-pll-supply = <&vreg_l7a>; ++ ++ status = "okay"; ++}; ++ ++&usb_2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&usb2_en_state>; ++ ++ status = "okay"; ++}; ++ ++&usb_2_dwc3 { ++ dr_mode = "host"; ++}; ++ ++&usb_2_hsphy { ++ vdda-pll-supply = <&vreg_l7a>; ++ vdda18-supply = <&vreg_l6c>; ++ vdda33-supply = <&vreg_l9a>; ++ ++ status = "okay"; ++}; ++ ++&xo_board_clk { ++ clock-frequency = <38400000>; ++}; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-msm8916-correct-sleep-clock-frequency.patch b/queue-6.6/arm64-dts-qcom-msm8916-correct-sleep-clock-frequency.patch new file mode 100644 index 0000000000..1b8b2a582b --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-msm8916-correct-sleep-clock-frequency.patch @@ -0,0 +1,38 @@ +From 510aed8cbce794cb661c8cd286ad84066590ca2f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 12:17:00 +0200 +Subject: arm64: dts: qcom: msm8916: correct sleep clock frequency + +From: Dmitry Baryshkov + +[ Upstream commit f088b921890cef28862913e5627bb2e2b5f82125 ] + +The MSM8916 platform uses PM8916 to provide sleep clock. According to the +documentation, that clock has 32.7645 kHz frequency. Correct the sleep +clock definition. + +Fixes: f4fb6aeafaaa ("arm64: dts: qcom: msm8916: Add fixed rate on-board oscillators") +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20241224-fix-board-clocks-v3-1-e9b08fbeadd3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/msm8916.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qcom/msm8916.dtsi +index 961ceb83a91fa..6f5f96853ba1c 100644 +--- a/arch/arm64/boot/dts/qcom/msm8916.dtsi ++++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi +@@ -104,7 +104,7 @@ + sleep_clk: sleep-clk { + compatible = "fixed-clock"; + #clock-cells = <0>; +- clock-frequency = <32768>; ++ clock-frequency = <32764>; + }; + }; + +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-msm8939-correct-sleep-clock-frequency.patch b/queue-6.6/arm64-dts-qcom-msm8939-correct-sleep-clock-frequency.patch new file mode 100644 index 0000000000..3e0999c4fb --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-msm8939-correct-sleep-clock-frequency.patch @@ -0,0 +1,38 @@ +From 737e47cdd088a80a8622965c04b35ec03628f451 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 12:17:01 +0200 +Subject: arm64: dts: qcom: msm8939: correct sleep clock frequency + +From: Dmitry Baryshkov + +[ Upstream commit 5c775f586cde4fca3c5591c43b6dc8b243bc304c ] + +The MSM8939 platform uses PM8916 to provide sleep clock. According to the +documentation, that clock has 32.7645 kHz frequency. Correct the sleep +clock definition. + +Fixes: 61550c6c156c ("arm64: dts: qcom: Add msm8939 SoC") +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20241224-fix-board-clocks-v3-2-e9b08fbeadd3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/msm8939.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/msm8939.dtsi b/arch/arm64/boot/dts/qcom/msm8939.dtsi +index 3fd64cafe99c5..c844e01f9aa15 100644 +--- a/arch/arm64/boot/dts/qcom/msm8939.dtsi ++++ b/arch/arm64/boot/dts/qcom/msm8939.dtsi +@@ -33,7 +33,7 @@ + sleep_clk: sleep-clk { + compatible = "fixed-clock"; + #clock-cells = <0>; +- clock-frequency = <32768>; ++ clock-frequency = <32764>; + }; + }; + +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-msm8994-correct-sleep-clock-frequency.patch b/queue-6.6/arm64-dts-qcom-msm8994-correct-sleep-clock-frequency.patch new file mode 100644 index 0000000000..2c4f25e264 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-msm8994-correct-sleep-clock-frequency.patch @@ -0,0 +1,38 @@ +From 6e8d73d5a97cbd7900160b8f8b20fdc20f6ac488 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 12:17:02 +0200 +Subject: arm64: dts: qcom: msm8994: correct sleep clock frequency + +From: Dmitry Baryshkov + +[ Upstream commit a4148d869d47d8c86da0291dd95d411a5ebe90c8 ] + +The MSM8994 platform uses PM8994/6 to provide sleep clock. According to the +documentation, that clock has 32.7645 kHz frequency. Correct the sleep +clock definition. + +Fixes: feeaf56ac78d ("arm64: dts: msm8994 SoC and Huawei Angler (Nexus 6P) support") +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20241224-fix-board-clocks-v3-3-e9b08fbeadd3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/msm8994.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/msm8994.dtsi b/arch/arm64/boot/dts/qcom/msm8994.dtsi +index 875d50c574e95..a7f9259dda6de 100644 +--- a/arch/arm64/boot/dts/qcom/msm8994.dtsi ++++ b/arch/arm64/boot/dts/qcom/msm8994.dtsi +@@ -34,7 +34,7 @@ + sleep_clk: sleep-clk { + compatible = "fixed-clock"; + #clock-cells = <0>; +- clock-frequency = <32768>; ++ clock-frequency = <32764>; + clock-output-names = "sleep_clk"; + }; + }; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-msm8994-describe-usb-interrupts.patch b/queue-6.6/arm64-dts-qcom-msm8994-describe-usb-interrupts.patch new file mode 100644 index 0000000000..83c5d1b87f --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-msm8994-describe-usb-interrupts.patch @@ -0,0 +1,44 @@ +From 07c10eb80495e612bc6205bee3c7223a4dd31523 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 29 Nov 2024 23:12:48 +0100 +Subject: arm64: dts: qcom: msm8994: Describe USB interrupts + +From: Konrad Dybcio + +[ Upstream commit c910544d2234709660d60f80345c285616e73b1c ] + +Previously the interrupt lanes were not described, fix that. + +Fixes: d9be0bc95f25 ("arm64: dts: qcom: msm8994: Add USB support") +Signed-off-by: Konrad Dybcio +Tested-by: Petr Vorel +Link: https://lore.kernel.org/r/20241129-topic-qcom_usb_dtb_fixup-v1-4-cba24120c058@oss.qualcomm.com +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/msm8994.dtsi | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/arch/arm64/boot/dts/qcom/msm8994.dtsi b/arch/arm64/boot/dts/qcom/msm8994.dtsi +index c3262571520d3..875d50c574e95 100644 +--- a/arch/arm64/boot/dts/qcom/msm8994.dtsi ++++ b/arch/arm64/boot/dts/qcom/msm8994.dtsi +@@ -437,6 +437,15 @@ + #size-cells = <1>; + ranges; + ++ interrupts = , ++ , ++ , ++ ; ++ interrupt-names = "pwr_event", ++ "qusb2_phy", ++ "hs_phy_irq", ++ "ss_phy_irq"; ++ + clocks = <&gcc GCC_USB30_MASTER_CLK>, + <&gcc GCC_SYS_NOC_USB3_AXI_CLK>, + <&gcc GCC_USB30_SLEEP_CLK>, +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-msm8996-fix-up-usb3-interrupts.patch b/queue-6.6/arm64-dts-qcom-msm8996-fix-up-usb3-interrupts.patch new file mode 100644 index 0000000000..6c583e2df3 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-msm8996-fix-up-usb3-interrupts.patch @@ -0,0 +1,49 @@ +From 1e842b11257437b167d91961fb6b49128d270843 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 29 Nov 2024 23:12:47 +0100 +Subject: arm64: dts: qcom: msm8996: Fix up USB3 interrupts + +From: Konrad Dybcio + +[ Upstream commit 9cb9c9f4e1380da317a056afd26d66a835c5796c ] + +Add the missing interrupt lines and fix qusb2_phy being an impostor +of hs_phy_irq. + +This happens to also fix warnings such as: + +usb@6af8800: interrupt-names: ['hs_phy_irq', 'ss_phy_irq'] is too short + +Fixes: 4753492de9df ("arm64: dts: qcom: msm8996: Add usb3 interrupts") +Signed-off-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20241129-topic-qcom_usb_dtb_fixup-v1-3-cba24120c058@oss.qualcomm.com +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/msm8996.dtsi | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/msm8996.dtsi b/arch/arm64/boot/dts/qcom/msm8996.dtsi +index 1f7cbb35886db..70ef8c83e7b9f 100644 +--- a/arch/arm64/boot/dts/qcom/msm8996.dtsi ++++ b/arch/arm64/boot/dts/qcom/msm8996.dtsi +@@ -3046,9 +3046,14 @@ + #size-cells = <1>; + ranges; + +- interrupts = , ++ interrupts = , ++ , ++ , + ; +- interrupt-names = "hs_phy_irq", "ss_phy_irq"; ++ interrupt-names = "pwr_event", ++ "qusb2_phy", ++ "hs_phy_irq", ++ "ss_phy_irq"; + + clocks = <&gcc GCC_SYS_NOC_USB3_AXI_CLK>, + <&gcc GCC_USB30_MASTER_CLK>, +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-msm8996-xiaomi-gemini-fix-lp5562-led1.patch b/queue-6.6/arm64-dts-qcom-msm8996-xiaomi-gemini-fix-lp5562-led1.patch new file mode 100644 index 0000000000..0953c930fd --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-msm8996-xiaomi-gemini-fix-lp5562-led1.patch @@ -0,0 +1,38 @@ +From cb36f6893c06bccf17c30f5669e5300ea62a7363 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 6 Oct 2024 04:19:48 +0200 +Subject: arm64: dts: qcom: msm8996-xiaomi-gemini: Fix LP5562 LED1 reg property + +From: Marek Vasut + +[ Upstream commit 02e784c5023232c48c6ec79b52ac8929d4e4db34 ] + +The LP5562 led@1 reg property should likely be set to 1 to match +the unit. Fix it. + +Fixes: 4ac46b3682c5 ("arm64: dts: qcom: msm8996: xiaomi-gemini: Add support for Xiaomi Mi 5") +Signed-off-by: Marek Vasut +Reviewed-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20241006022012.366601-1-marex@denx.de +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/msm8996-xiaomi-gemini.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/msm8996-xiaomi-gemini.dts b/arch/arm64/boot/dts/qcom/msm8996-xiaomi-gemini.dts +index f8e9d90afab00..dbad8f57f2fa3 100644 +--- a/arch/arm64/boot/dts/qcom/msm8996-xiaomi-gemini.dts ++++ b/arch/arm64/boot/dts/qcom/msm8996-xiaomi-gemini.dts +@@ -64,7 +64,7 @@ + }; + + led@1 { +- reg = <0>; ++ reg = <1>; + chan-name = "button-backlight1"; + led-cur = /bits/ 8 <0x32>; + max-cur = /bits/ 8 <0xc8>; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-q-dr-u1000-correct-sleep-clock-freque.patch b/queue-6.6/arm64-dts-qcom-q-dr-u1000-correct-sleep-clock-freque.patch new file mode 100644 index 0000000000..c457b82ec3 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-q-dr-u1000-correct-sleep-clock-freque.patch @@ -0,0 +1,52 @@ +From 348ce7055598aae6f99913fb1efd9a59189fe880 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 12:17:04 +0200 +Subject: arm64: dts: qcom: q[dr]u1000: correct sleep clock frequency + +From: Dmitry Baryshkov + +[ Upstream commit 5546604e034b6c383b65676ff8615b346897eccd ] + +The Q[DR]U1000 platforms use PM8150 to provide sleep clock. According to +the documentation, that clock has 32.7645 kHz frequency. Correct the +sleep clock definition. + +Fixes: d1f2cfe2f669 ("arm64: dts: qcom: Add base QDU1000/QRU1000 IDP DTs") +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20241224-fix-board-clocks-v3-5-e9b08fbeadd3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/qdu1000-idp.dts | 2 +- + arch/arm64/boot/dts/qcom/qru1000-idp.dts | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/qdu1000-idp.dts b/arch/arm64/boot/dts/qcom/qdu1000-idp.dts +index 5a25cdec969eb..409f06978931a 100644 +--- a/arch/arm64/boot/dts/qcom/qdu1000-idp.dts ++++ b/arch/arm64/boot/dts/qcom/qdu1000-idp.dts +@@ -31,7 +31,7 @@ + + sleep_clk: sleep-clk { + compatible = "fixed-clock"; +- clock-frequency = <32000>; ++ clock-frequency = <32764>; + #clock-cells = <0>; + }; + }; +diff --git a/arch/arm64/boot/dts/qcom/qru1000-idp.dts b/arch/arm64/boot/dts/qcom/qru1000-idp.dts +index 2a862c83309e7..a3a7dcbc5e6d2 100644 +--- a/arch/arm64/boot/dts/qcom/qru1000-idp.dts ++++ b/arch/arm64/boot/dts/qcom/qru1000-idp.dts +@@ -31,7 +31,7 @@ + + sleep_clk: sleep-clk { + compatible = "fixed-clock"; +- clock-frequency = <32000>; ++ clock-frequency = <32764>; + #clock-cells = <0>; + }; + }; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-qcs404-correct-sleep-clock-frequency.patch b/queue-6.6/arm64-dts-qcom-qcs404-correct-sleep-clock-frequency.patch new file mode 100644 index 0000000000..2002daf498 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-qcs404-correct-sleep-clock-frequency.patch @@ -0,0 +1,38 @@ +From 76dfdac7ad73d5114d2857663aaeab843c0b79e0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 12:17:03 +0200 +Subject: arm64: dts: qcom: qcs404: correct sleep clock frequency + +From: Dmitry Baryshkov + +[ Upstream commit 1473ff0b69de68b23ce9874548cdabc64d72725e ] + +The QCS40x platforms use PMS405 to provide sleep clock. According to the +documentation, that clock has 32.7645 kHz frequency. Correct the sleep +clock definition. + +Fixes: 9181bb939984 ("arm64: dts: qcom: Add SDX75 platform and IDP board support") +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20241224-fix-board-clocks-v3-4-e9b08fbeadd3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/qcs404.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi b/arch/arm64/boot/dts/qcom/qcs404.dtsi +index 2721f32dfb710..cbe469cc159e9 100644 +--- a/arch/arm64/boot/dts/qcom/qcs404.dtsi ++++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi +@@ -28,7 +28,7 @@ + sleep_clk: sleep-clk { + compatible = "fixed-clock"; + #clock-cells = <0>; +- clock-frequency = <32768>; ++ clock-frequency = <32764>; + }; + }; + +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-qrb4210-rb2-correct-sleep-clock-frequ.patch b/queue-6.6/arm64-dts-qcom-qrb4210-rb2-correct-sleep-clock-frequ.patch new file mode 100644 index 0000000000..11e198b488 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-qrb4210-rb2-correct-sleep-clock-frequ.patch @@ -0,0 +1,38 @@ +From f4d4c059b18ab7aa528b297044fdc30a509e8a14 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 12:17:05 +0200 +Subject: arm64: dts: qcom: qrb4210-rb2: correct sleep clock frequency + +From: Dmitry Baryshkov + +[ Upstream commit 298192f365a343d84e9d2755e47bebebf0cfb82e ] + +Qualcomm RB2 board uses PM6125 to provide sleep clock. According to the +documentation, that clock has 32.7645 kHz frequency. Correct the sleep +clock definition. + +Fixes: 8d58a8c0d930 ("arm64: dts: qcom: Add base qrb4210-rb2 board dts") +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20241224-fix-board-clocks-v3-6-e9b08fbeadd3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/qrb4210-rb2.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/qrb4210-rb2.dts b/arch/arm64/boot/dts/qcom/qrb4210-rb2.dts +index 5def8c1154ceb..331b6a76560db 100644 +--- a/arch/arm64/boot/dts/qcom/qrb4210-rb2.dts ++++ b/arch/arm64/boot/dts/qcom/qrb4210-rb2.dts +@@ -492,7 +492,7 @@ + }; + + &sleep_clk { +- clock-frequency = <32000>; ++ clock-frequency = <32764>; + }; + + &tlmm { +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sa8775p-ride-describe-sgmii_phy0-irq.patch b/queue-6.6/arm64-dts-qcom-sa8775p-ride-describe-sgmii_phy0-irq.patch new file mode 100644 index 0000000000..2cb94e64b8 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sa8775p-ride-describe-sgmii_phy0-irq.patch @@ -0,0 +1,45 @@ +From d38cd7861603b035a896612e56a992744d02ebba Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 17 Aug 2023 16:37:16 -0500 +Subject: arm64: dts: qcom: sa8775p-ride: Describe sgmii_phy0 irq + +From: Andrew Halaney + +[ Upstream commit 1ff6569b0ffe7a2e311104cb3cd841983e484ac9 ] + +There's an irq hooked up, so let's describe it. + +Prior to commit 9757300d2750 +("pinctrl: qcom: Add intr_target_width field to support increased number of interrupt targets") +one would not see the IRQ fire, despite some (invasive) debugging +showing that the GPIO was in fact asserted, resulting in the interface +staying down. + +Now that the IRQ is properly routed we can describe it. + +Signed-off-by: Andrew Halaney +Reviewed-by: Bartosz Golaszewski +Reviewed-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20230817213815.638189-2-ahalaney@redhat.com +Signed-off-by: Bjorn Andersson +Stable-dep-of: 30f7dfd2c489 ("arm64: dts: qcom: sa8775p: Update sleep_clk frequency") +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sa8775p-ride.dts | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/qcom/sa8775p-ride.dts b/arch/arm64/boot/dts/qcom/sa8775p-ride.dts +index 81a7eeb9cfcd2..8fde6935cd6ec 100644 +--- a/arch/arm64/boot/dts/qcom/sa8775p-ride.dts ++++ b/arch/arm64/boot/dts/qcom/sa8775p-ride.dts +@@ -285,6 +285,7 @@ + compatible = "ethernet-phy-id0141.0dd4"; + reg = <0x8>; + device_type = "ethernet-phy"; ++ interrupts-extended = <&tlmm 7 IRQ_TYPE_EDGE_FALLING>; + reset-gpios = <&pmm8654au_2_gpios 8 GPIO_ACTIVE_LOW>; + reset-assert-us = <11000>; + reset-deassert-us = <70000>; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sa8775p-ride-describe-sgmii_phy1-irq.patch b/queue-6.6/arm64-dts-qcom-sa8775p-ride-describe-sgmii_phy1-irq.patch new file mode 100644 index 0000000000..085d76e779 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sa8775p-ride-describe-sgmii_phy1-irq.patch @@ -0,0 +1,45 @@ +From 4afb3d1e742ca81f9980c61f0b3897f31e175e4f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 17 Aug 2023 16:37:17 -0500 +Subject: arm64: dts: qcom: sa8775p-ride: Describe sgmii_phy1 irq + +From: Andrew Halaney + +[ Upstream commit 454557d0032d088b4f467f0c541f98edb01fe431 ] + +There's an irq hooked up, so let's describe it. + +Prior to commit 9757300d2750 +("pinctrl: qcom: Add intr_target_width field to support increased number of interrupt targets") +one would not see the IRQ fire, despite some (invasive) debugging +showing that the GPIO was in fact asserted, resulting in the interface +staying down. + +Now that the IRQ is properly routed we can describe it. + +Signed-off-by: Andrew Halaney +Reviewed-by: Bartosz Golaszewski +Reviewed-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20230817213815.638189-3-ahalaney@redhat.com +Signed-off-by: Bjorn Andersson +Stable-dep-of: 30f7dfd2c489 ("arm64: dts: qcom: sa8775p: Update sleep_clk frequency") +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sa8775p-ride.dts | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/qcom/sa8775p-ride.dts b/arch/arm64/boot/dts/qcom/sa8775p-ride.dts +index 8fde6935cd6ec..9760bb4b468c4 100644 +--- a/arch/arm64/boot/dts/qcom/sa8775p-ride.dts ++++ b/arch/arm64/boot/dts/qcom/sa8775p-ride.dts +@@ -295,6 +295,7 @@ + compatible = "ethernet-phy-id0141.0dd4"; + reg = <0xa>; + device_type = "ethernet-phy"; ++ interrupts-extended = <&tlmm 26 IRQ_TYPE_EDGE_FALLING>; + reset-gpios = <&pmm8654au_2_gpios 9 GPIO_ACTIVE_LOW>; + reset-assert-us = <11000>; + reset-deassert-us = <70000>; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sa8775p-ride-enable-pmm8654au_0_pon_r.patch b/queue-6.6/arm64-dts-qcom-sa8775p-ride-enable-pmm8654au_0_pon_r.patch new file mode 100644 index 0000000000..26635fd583 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sa8775p-ride-enable-pmm8654au_0_pon_r.patch @@ -0,0 +1,40 @@ +From d8ec6092f521759b01350c05fc5b52006dab6cd5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Nov 2023 17:35:02 +0530 +Subject: arm64: dts: qcom: sa8775p-ride: enable pmm8654au_0_pon_resin + +From: Shazad Hussain + +[ Upstream commit 81c8ec77b86fde629d5beea1ebe42caeea57c5a4 ] + +The volume down key is controlled by PMIC via the PON hardware on +sa8775p platform, so enable the same for sa8775p-ride. + +Signed-off-by: Shazad Hussain +Link: https://lore.kernel.org/r/20231107120503.28917-1-quic_shazhuss@quicinc.com +Signed-off-by: Bjorn Andersson +Stable-dep-of: 30f7dfd2c489 ("arm64: dts: qcom: sa8775p: Update sleep_clk frequency") +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sa8775p-ride.dts | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/arch/arm64/boot/dts/qcom/sa8775p-ride.dts b/arch/arm64/boot/dts/qcom/sa8775p-ride.dts +index 9760bb4b468c4..26ad05bd3b3ff 100644 +--- a/arch/arm64/boot/dts/qcom/sa8775p-ride.dts ++++ b/arch/arm64/boot/dts/qcom/sa8775p-ride.dts +@@ -461,6 +461,11 @@ + "ANALOG_PON_OPT"; + }; + ++&pmm8654au_0_pon_resin { ++ linux,code = ; ++ status = "okay"; ++}; ++ + &pmm8654au_1_gpios { + gpio-line-names = "PMIC_C_ID0", + "PMIC_C_ID1", +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sa8775p-update-sleep_clk-frequency.patch b/queue-6.6/arm64-dts-qcom-sa8775p-update-sleep_clk-frequency.patch new file mode 100644 index 0000000000..2391d1528a --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sa8775p-update-sleep_clk-frequency.patch @@ -0,0 +1,37 @@ +From 7d58fe7ec82e9d760b4c8a9f6e9e3782f97b708c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 25 Oct 2024 14:22:53 +0530 +Subject: arm64: dts: qcom: sa8775p: Update sleep_clk frequency + +From: Taniya Das + +[ Upstream commit 30f7dfd2c4899630becf477447e8bbe92683d2c6 ] + +Fix the sleep_clk frequency is 32000 on SA8775P. + +Fixes: 603f96d4c9d0 ("arm64: dts: qcom: add initial support for qcom sa8775p-ride") +Reviewed-by: Konrad Dybcio +Signed-off-by: Taniya Das +Link: https://lore.kernel.org/r/20241025-sa8775p-mm-v4-resend-patches-v6-1-329a2cac09ae@quicinc.com +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi b/arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi +index 2a6170623ea95..864ad109371ca 100644 +--- a/arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi ++++ b/arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi +@@ -517,7 +517,7 @@ + }; + + &sleep_clk { +- clock-frequency = <32764>; ++ clock-frequency = <32000>; + }; + + &spi16 { +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sc7180-change-labels-to-lower-case.patch b/queue-6.6/arm64-dts-qcom-sc7180-change-labels-to-lower-case.patch new file mode 100644 index 0000000000..5b8ed78439 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sc7180-change-labels-to-lower-case.patch @@ -0,0 +1,1064 @@ +From 40b34ac8e2e64af60d3cb1faa313d90c43a7f5bd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 22 Oct 2024 17:47:29 +0200 +Subject: arm64: dts: qcom: sc7180: change labels to lower-case + +From: Krzysztof Kozlowski + +[ Upstream commit e5f90735136562c0653714b43ff1aeb331600d24 ] + +DTS coding style expects labels to be lowercase. No functional impact. +Verified with comparing decompiled DTB (dtx_diff and fdtdump+diff). + +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20241022-dts-qcom-label-v3-4-0505bc7d2c56@linaro.org +Signed-off-by: Bjorn Andersson +Stable-dep-of: 092febd32a99 ("arm64: dts: qcom: sc7180: fix psci power domain node names") +Signed-off-by: Sasha Levin +--- + .../boot/dts/qcom/sc7180-firmware-tfa.dtsi | 84 ++-- + .../boot/dts/qcom/sc7180-trogdor-coachz.dtsi | 8 +- + .../dts/qcom/sc7180-trogdor-homestar.dtsi | 8 +- + .../dts/qcom/sc7180-trogdor-wormdingler.dtsi | 8 +- + arch/arm64/boot/dts/qcom/sc7180.dtsi | 362 +++++++++--------- + arch/arm64/boot/dts/qcom/sm7125.dtsi | 16 +- + 6 files changed, 243 insertions(+), 243 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/sc7180-firmware-tfa.dtsi b/arch/arm64/boot/dts/qcom/sc7180-firmware-tfa.dtsi +index ee35a454dbf6f..59162b3afcb84 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180-firmware-tfa.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180-firmware-tfa.dtsi +@@ -6,82 +6,82 @@ + * by Qualcomm firmware. + */ + +-&CPU0 { ++&cpu0 { + /delete-property/ power-domains; + /delete-property/ power-domain-names; + +- cpu-idle-states = <&LITTLE_CPU_SLEEP_0 +- &LITTLE_CPU_SLEEP_1 +- &CLUSTER_SLEEP_0>; ++ cpu-idle-states = <&little_cpu_sleep_0 ++ &little_cpu_sleep_1 ++ &cluster_sleep_0>; + }; + +-&CPU1 { ++&cpu1 { + /delete-property/ power-domains; + /delete-property/ power-domain-names; + +- cpu-idle-states = <&LITTLE_CPU_SLEEP_0 +- &LITTLE_CPU_SLEEP_1 +- &CLUSTER_SLEEP_0>; ++ cpu-idle-states = <&little_cpu_sleep_0 ++ &little_cpu_sleep_1 ++ &cluster_sleep_0>; + }; + +-&CPU2 { ++&cpu2 { + /delete-property/ power-domains; + /delete-property/ power-domain-names; + +- cpu-idle-states = <&LITTLE_CPU_SLEEP_0 +- &LITTLE_CPU_SLEEP_1 +- &CLUSTER_SLEEP_0>; ++ cpu-idle-states = <&little_cpu_sleep_0 ++ &little_cpu_sleep_1 ++ &cluster_sleep_0>; + }; + +-&CPU3 { ++&cpu3 { + /delete-property/ power-domains; + /delete-property/ power-domain-names; + +- cpu-idle-states = <&LITTLE_CPU_SLEEP_0 +- &LITTLE_CPU_SLEEP_1 +- &CLUSTER_SLEEP_0>; ++ cpu-idle-states = <&little_cpu_sleep_0 ++ &little_cpu_sleep_1 ++ &cluster_sleep_0>; + }; + +-&CPU4 { ++&cpu4 { + /delete-property/ power-domains; + /delete-property/ power-domain-names; + +- cpu-idle-states = <&LITTLE_CPU_SLEEP_0 +- &LITTLE_CPU_SLEEP_1 +- &CLUSTER_SLEEP_0>; ++ cpu-idle-states = <&little_cpu_sleep_0 ++ &little_cpu_sleep_1 ++ &cluster_sleep_0>; + }; + +-&CPU5 { ++&cpu5 { + /delete-property/ power-domains; + /delete-property/ power-domain-names; + +- cpu-idle-states = <&LITTLE_CPU_SLEEP_0 +- &LITTLE_CPU_SLEEP_1 +- &CLUSTER_SLEEP_0>; ++ cpu-idle-states = <&little_cpu_sleep_0 ++ &little_cpu_sleep_1 ++ &cluster_sleep_0>; + }; + +-&CPU6 { ++&cpu6 { + /delete-property/ power-domains; + /delete-property/ power-domain-names; + +- cpu-idle-states = <&BIG_CPU_SLEEP_0 +- &BIG_CPU_SLEEP_1 +- &CLUSTER_SLEEP_0>; ++ cpu-idle-states = <&big_cpu_sleep_0 ++ &big_cpu_sleep_1 ++ &cluster_sleep_0>; + }; + +-&CPU7 { ++&cpu7 { + /delete-property/ power-domains; + /delete-property/ power-domain-names; + +- cpu-idle-states = <&BIG_CPU_SLEEP_0 +- &BIG_CPU_SLEEP_1 +- &CLUSTER_SLEEP_0>; ++ cpu-idle-states = <&big_cpu_sleep_0 ++ &big_cpu_sleep_1 ++ &cluster_sleep_0>; + }; + + /delete-node/ &domain_idle_states; + + &idle_states { +- CLUSTER_SLEEP_0: cluster-sleep-0 { ++ cluster_sleep_0: cluster-sleep-0 { + compatible = "arm,idle-state"; + idle-state-name = "cluster-power-down"; + arm,psci-suspend-param = <0x40003444>; +@@ -92,15 +92,15 @@ + }; + }; + +-/delete-node/ &CPU_PD0; +-/delete-node/ &CPU_PD1; +-/delete-node/ &CPU_PD2; +-/delete-node/ &CPU_PD3; +-/delete-node/ &CPU_PD4; +-/delete-node/ &CPU_PD5; +-/delete-node/ &CPU_PD6; +-/delete-node/ &CPU_PD7; +-/delete-node/ &CLUSTER_PD; ++/delete-node/ &cpu_pd0; ++/delete-node/ &cpu_pd1; ++/delete-node/ &cpu_pd2; ++/delete-node/ &cpu_pd3; ++/delete-node/ &cpu_pd4; ++/delete-node/ &cpu_pd5; ++/delete-node/ &cpu_pd6; ++/delete-node/ &cpu_pd7; ++/delete-node/ &cluster_pd; + + &apps_rsc { + /delete-property/ power-domains; +diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +index c9adde64450c6..d338a8a0a9a96 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +@@ -53,14 +53,14 @@ + cooling-maps { + map0 { + trip = <&skin_temp_alert0>; +- cooling-device = <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + + map1 { + trip = <&skin_temp_alert1>; +- cooling-device = <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; +diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi +index a9e80acf97637..4452d04e4c547 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi +@@ -70,14 +70,14 @@ + cooling-maps { + map0 { + trip = <&skin_temp_alert0>; +- cooling-device = <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + + map1 { + trip = <&skin_temp_alert1>; +- cooling-device = <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; +diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi +index 61d0add3c8f6c..38335df3a275d 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi +@@ -77,14 +77,14 @@ + cooling-maps { + map0 { + trip = <&skin_temp_alert0>; +- cooling-device = <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + + map1 { + trip = <&skin_temp_alert1>; +- cooling-device = <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; +diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qcom/sc7180.dtsi +index 4e1178496682d..5db7b3bce368b 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi +@@ -74,28 +74,28 @@ + #address-cells = <2>; + #size-cells = <0>; + +- CPU0: cpu@0 { ++ cpu0: cpu@0 { + device_type = "cpu"; + compatible = "qcom,kryo468"; + reg = <0x0 0x0>; + clocks = <&cpufreq_hw 0>; + enable-method = "psci"; +- power-domains = <&CPU_PD0>; ++ power-domains = <&cpu_pd0>; + power-domain-names = "psci"; + capacity-dmips-mhz = <415>; + dynamic-power-coefficient = <137>; + operating-points-v2 = <&cpu0_opp_table>; + interconnects = <&gem_noc MASTER_APPSS_PROC 3 &mc_virt SLAVE_EBI1 3>, + <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>; +- next-level-cache = <&L2_0>; ++ next-level-cache = <&l2_0>; + #cooling-cells = <2>; + qcom,freq-domain = <&cpufreq_hw 0>; +- L2_0: l2-cache { ++ l2_0: l2-cache { + compatible = "cache"; + cache-level = <2>; + cache-unified; +- next-level-cache = <&L3_0>; +- L3_0: l3-cache { ++ next-level-cache = <&l3_0>; ++ l3_0: l3-cache { + compatible = "cache"; + cache-level = <3>; + cache-unified; +@@ -103,206 +103,206 @@ + }; + }; + +- CPU1: cpu@100 { ++ cpu1: cpu@100 { + device_type = "cpu"; + compatible = "qcom,kryo468"; + reg = <0x0 0x100>; + clocks = <&cpufreq_hw 0>; + enable-method = "psci"; +- power-domains = <&CPU_PD1>; ++ power-domains = <&cpu_pd1>; + power-domain-names = "psci"; + capacity-dmips-mhz = <415>; + dynamic-power-coefficient = <137>; +- next-level-cache = <&L2_100>; ++ next-level-cache = <&l2_100>; + operating-points-v2 = <&cpu0_opp_table>; + interconnects = <&gem_noc MASTER_APPSS_PROC 3 &mc_virt SLAVE_EBI1 3>, + <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>; + #cooling-cells = <2>; + qcom,freq-domain = <&cpufreq_hw 0>; +- L2_100: l2-cache { ++ l2_100: l2-cache { + compatible = "cache"; + cache-level = <2>; + cache-unified; +- next-level-cache = <&L3_0>; ++ next-level-cache = <&l3_0>; + }; + }; + +- CPU2: cpu@200 { ++ cpu2: cpu@200 { + device_type = "cpu"; + compatible = "qcom,kryo468"; + reg = <0x0 0x200>; + clocks = <&cpufreq_hw 0>; + enable-method = "psci"; +- power-domains = <&CPU_PD2>; ++ power-domains = <&cpu_pd2>; + power-domain-names = "psci"; + capacity-dmips-mhz = <415>; + dynamic-power-coefficient = <137>; +- next-level-cache = <&L2_200>; ++ next-level-cache = <&l2_200>; + operating-points-v2 = <&cpu0_opp_table>; + interconnects = <&gem_noc MASTER_APPSS_PROC 3 &mc_virt SLAVE_EBI1 3>, + <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>; + #cooling-cells = <2>; + qcom,freq-domain = <&cpufreq_hw 0>; +- L2_200: l2-cache { ++ l2_200: l2-cache { + compatible = "cache"; + cache-level = <2>; + cache-unified; +- next-level-cache = <&L3_0>; ++ next-level-cache = <&l3_0>; + }; + }; + +- CPU3: cpu@300 { ++ cpu3: cpu@300 { + device_type = "cpu"; + compatible = "qcom,kryo468"; + reg = <0x0 0x300>; + clocks = <&cpufreq_hw 0>; + enable-method = "psci"; +- power-domains = <&CPU_PD3>; ++ power-domains = <&cpu_pd3>; + power-domain-names = "psci"; + capacity-dmips-mhz = <415>; + dynamic-power-coefficient = <137>; +- next-level-cache = <&L2_300>; ++ next-level-cache = <&l2_300>; + operating-points-v2 = <&cpu0_opp_table>; + interconnects = <&gem_noc MASTER_APPSS_PROC 3 &mc_virt SLAVE_EBI1 3>, + <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>; + #cooling-cells = <2>; + qcom,freq-domain = <&cpufreq_hw 0>; +- L2_300: l2-cache { ++ l2_300: l2-cache { + compatible = "cache"; + cache-level = <2>; + cache-unified; +- next-level-cache = <&L3_0>; ++ next-level-cache = <&l3_0>; + }; + }; + +- CPU4: cpu@400 { ++ cpu4: cpu@400 { + device_type = "cpu"; + compatible = "qcom,kryo468"; + reg = <0x0 0x400>; + clocks = <&cpufreq_hw 0>; + enable-method = "psci"; +- power-domains = <&CPU_PD4>; ++ power-domains = <&cpu_pd4>; + power-domain-names = "psci"; + capacity-dmips-mhz = <415>; + dynamic-power-coefficient = <137>; +- next-level-cache = <&L2_400>; ++ next-level-cache = <&l2_400>; + operating-points-v2 = <&cpu0_opp_table>; + interconnects = <&gem_noc MASTER_APPSS_PROC 3 &mc_virt SLAVE_EBI1 3>, + <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>; + #cooling-cells = <2>; + qcom,freq-domain = <&cpufreq_hw 0>; +- L2_400: l2-cache { ++ l2_400: l2-cache { + compatible = "cache"; + cache-level = <2>; + cache-unified; +- next-level-cache = <&L3_0>; ++ next-level-cache = <&l3_0>; + }; + }; + +- CPU5: cpu@500 { ++ cpu5: cpu@500 { + device_type = "cpu"; + compatible = "qcom,kryo468"; + reg = <0x0 0x500>; + clocks = <&cpufreq_hw 0>; + enable-method = "psci"; +- power-domains = <&CPU_PD5>; ++ power-domains = <&cpu_pd5>; + power-domain-names = "psci"; + capacity-dmips-mhz = <415>; + dynamic-power-coefficient = <137>; +- next-level-cache = <&L2_500>; ++ next-level-cache = <&l2_500>; + operating-points-v2 = <&cpu0_opp_table>; + interconnects = <&gem_noc MASTER_APPSS_PROC 3 &mc_virt SLAVE_EBI1 3>, + <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>; + #cooling-cells = <2>; + qcom,freq-domain = <&cpufreq_hw 0>; +- L2_500: l2-cache { ++ l2_500: l2-cache { + compatible = "cache"; + cache-level = <2>; + cache-unified; +- next-level-cache = <&L3_0>; ++ next-level-cache = <&l3_0>; + }; + }; + +- CPU6: cpu@600 { ++ cpu6: cpu@600 { + device_type = "cpu"; + compatible = "qcom,kryo468"; + reg = <0x0 0x600>; + clocks = <&cpufreq_hw 1>; + enable-method = "psci"; +- power-domains = <&CPU_PD6>; ++ power-domains = <&cpu_pd6>; + power-domain-names = "psci"; + capacity-dmips-mhz = <1024>; + dynamic-power-coefficient = <480>; +- next-level-cache = <&L2_600>; ++ next-level-cache = <&l2_600>; + operating-points-v2 = <&cpu6_opp_table>; + interconnects = <&gem_noc MASTER_APPSS_PROC 3 &mc_virt SLAVE_EBI1 3>, + <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>; + #cooling-cells = <2>; + qcom,freq-domain = <&cpufreq_hw 1>; +- L2_600: l2-cache { ++ l2_600: l2-cache { + compatible = "cache"; + cache-level = <2>; + cache-unified; +- next-level-cache = <&L3_0>; ++ next-level-cache = <&l3_0>; + }; + }; + +- CPU7: cpu@700 { ++ cpu7: cpu@700 { + device_type = "cpu"; + compatible = "qcom,kryo468"; + reg = <0x0 0x700>; + clocks = <&cpufreq_hw 1>; + enable-method = "psci"; +- power-domains = <&CPU_PD7>; ++ power-domains = <&cpu_pd7>; + power-domain-names = "psci"; + capacity-dmips-mhz = <1024>; + dynamic-power-coefficient = <480>; +- next-level-cache = <&L2_700>; ++ next-level-cache = <&l2_700>; + operating-points-v2 = <&cpu6_opp_table>; + interconnects = <&gem_noc MASTER_APPSS_PROC 3 &mc_virt SLAVE_EBI1 3>, + <&osm_l3 MASTER_OSM_L3_APPS &osm_l3 SLAVE_OSM_L3>; + #cooling-cells = <2>; + qcom,freq-domain = <&cpufreq_hw 1>; +- L2_700: l2-cache { ++ l2_700: l2-cache { + compatible = "cache"; + cache-level = <2>; + cache-unified; +- next-level-cache = <&L3_0>; ++ next-level-cache = <&l3_0>; + }; + }; + + cpu-map { + cluster0 { + core0 { +- cpu = <&CPU0>; ++ cpu = <&cpu0>; + }; + + core1 { +- cpu = <&CPU1>; ++ cpu = <&cpu1>; + }; + + core2 { +- cpu = <&CPU2>; ++ cpu = <&cpu2>; + }; + + core3 { +- cpu = <&CPU3>; ++ cpu = <&cpu3>; + }; + + core4 { +- cpu = <&CPU4>; ++ cpu = <&cpu4>; + }; + + core5 { +- cpu = <&CPU5>; ++ cpu = <&cpu5>; + }; + + core6 { +- cpu = <&CPU6>; ++ cpu = <&cpu6>; + }; + + core7 { +- cpu = <&CPU7>; ++ cpu = <&cpu7>; + }; + }; + }; +@@ -310,7 +310,7 @@ + idle_states: idle-states { + entry-method = "psci"; + +- LITTLE_CPU_SLEEP_0: cpu-sleep-0-0 { ++ little_cpu_sleep_0: cpu-sleep-0-0 { + compatible = "arm,idle-state"; + idle-state-name = "little-power-down"; + arm,psci-suspend-param = <0x40000003>; +@@ -320,7 +320,7 @@ + local-timer-stop; + }; + +- LITTLE_CPU_SLEEP_1: cpu-sleep-0-1 { ++ little_cpu_sleep_1: cpu-sleep-0-1 { + compatible = "arm,idle-state"; + idle-state-name = "little-rail-power-down"; + arm,psci-suspend-param = <0x40000004>; +@@ -330,7 +330,7 @@ + local-timer-stop; + }; + +- BIG_CPU_SLEEP_0: cpu-sleep-1-0 { ++ big_cpu_sleep_0: cpu-sleep-1-0 { + compatible = "arm,idle-state"; + idle-state-name = "big-power-down"; + arm,psci-suspend-param = <0x40000003>; +@@ -340,7 +340,7 @@ + local-timer-stop; + }; + +- BIG_CPU_SLEEP_1: cpu-sleep-1-1 { ++ big_cpu_sleep_1: cpu-sleep-1-1 { + compatible = "arm,idle-state"; + idle-state-name = "big-rail-power-down"; + arm,psci-suspend-param = <0x40000004>; +@@ -352,7 +352,7 @@ + }; + + domain_idle_states: domain-idle-states { +- CLUSTER_SLEEP_PC: cluster-sleep-0 { ++ cluster_sleep_pc: cluster-sleep-0 { + compatible = "domain-idle-state"; + idle-state-name = "cluster-l3-power-collapse"; + arm,psci-suspend-param = <0x41000044>; +@@ -361,7 +361,7 @@ + min-residency-us = <6118>; + }; + +- CLUSTER_SLEEP_CX_RET: cluster-sleep-1 { ++ cluster_sleep_cx_ret: cluster-sleep-1 { + compatible = "domain-idle-state"; + idle-state-name = "cluster-cx-retention"; + arm,psci-suspend-param = <0x41001244>; +@@ -370,7 +370,7 @@ + min-residency-us = <8467>; + }; + +- CLUSTER_AOSS_SLEEP: cluster-sleep-2 { ++ cluster_aoss_sleep: cluster-sleep-2 { + compatible = "domain-idle-state"; + idle-state-name = "cluster-power-down"; + arm,psci-suspend-param = <0x4100b244>; +@@ -580,59 +580,59 @@ + compatible = "arm,psci-1.0"; + method = "smc"; + +- CPU_PD0: cpu0 { ++ cpu_pd0: cpu0 { + #power-domain-cells = <0>; +- power-domains = <&CLUSTER_PD>; +- domain-idle-states = <&LITTLE_CPU_SLEEP_0 &LITTLE_CPU_SLEEP_1>; ++ power-domains = <&cluster_pd>; ++ domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>; + }; + +- CPU_PD1: cpu1 { ++ cpu_pd1: cpu1 { + #power-domain-cells = <0>; +- power-domains = <&CLUSTER_PD>; +- domain-idle-states = <&LITTLE_CPU_SLEEP_0 &LITTLE_CPU_SLEEP_1>; ++ power-domains = <&cluster_pd>; ++ domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>; + }; + +- CPU_PD2: cpu2 { ++ cpu_pd2: cpu2 { + #power-domain-cells = <0>; +- power-domains = <&CLUSTER_PD>; +- domain-idle-states = <&LITTLE_CPU_SLEEP_0 &LITTLE_CPU_SLEEP_1>; ++ power-domains = <&cluster_pd>; ++ domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>; + }; + +- CPU_PD3: cpu3 { ++ cpu_pd3: cpu3 { + #power-domain-cells = <0>; +- power-domains = <&CLUSTER_PD>; +- domain-idle-states = <&LITTLE_CPU_SLEEP_0 &LITTLE_CPU_SLEEP_1>; ++ power-domains = <&cluster_pd>; ++ domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>; + }; + +- CPU_PD4: cpu4 { ++ cpu_pd4: cpu4 { + #power-domain-cells = <0>; +- power-domains = <&CLUSTER_PD>; +- domain-idle-states = <&LITTLE_CPU_SLEEP_0 &LITTLE_CPU_SLEEP_1>; ++ power-domains = <&cluster_pd>; ++ domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>; + }; + +- CPU_PD5: cpu5 { ++ cpu_pd5: cpu5 { + #power-domain-cells = <0>; +- power-domains = <&CLUSTER_PD>; +- domain-idle-states = <&LITTLE_CPU_SLEEP_0 &LITTLE_CPU_SLEEP_1>; ++ power-domains = <&cluster_pd>; ++ domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>; + }; + +- CPU_PD6: cpu6 { ++ cpu_pd6: cpu6 { + #power-domain-cells = <0>; +- power-domains = <&CLUSTER_PD>; +- domain-idle-states = <&BIG_CPU_SLEEP_0 &BIG_CPU_SLEEP_1>; ++ power-domains = <&cluster_pd>; ++ domain-idle-states = <&big_cpu_sleep_0 &big_cpu_sleep_1>; + }; + +- CPU_PD7: cpu7 { ++ cpu_pd7: cpu7 { + #power-domain-cells = <0>; +- power-domains = <&CLUSTER_PD>; +- domain-idle-states = <&BIG_CPU_SLEEP_0 &BIG_CPU_SLEEP_1>; ++ power-domains = <&cluster_pd>; ++ domain-idle-states = <&big_cpu_sleep_0 &big_cpu_sleep_1>; + }; + +- CLUSTER_PD: cpu-cluster0 { ++ cluster_pd: cpu-cluster0 { + #power-domain-cells = <0>; +- domain-idle-states = <&CLUSTER_SLEEP_PC +- &CLUSTER_SLEEP_CX_RET +- &CLUSTER_AOSS_SLEEP>; ++ domain-idle-states = <&cluster_sleep_pc ++ &cluster_sleep_cx_ret ++ &cluster_aoss_sleep>; + }; + }; + +@@ -2465,7 +2465,7 @@ + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0 0x07040000 0 0x1000>; + +- cpu = <&CPU0>; ++ cpu = <&cpu0>; + + clocks = <&aoss_qmp>; + clock-names = "apb_pclk"; +@@ -2485,7 +2485,7 @@ + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0 0x07140000 0 0x1000>; + +- cpu = <&CPU1>; ++ cpu = <&cpu1>; + + clocks = <&aoss_qmp>; + clock-names = "apb_pclk"; +@@ -2505,7 +2505,7 @@ + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0 0x07240000 0 0x1000>; + +- cpu = <&CPU2>; ++ cpu = <&cpu2>; + + clocks = <&aoss_qmp>; + clock-names = "apb_pclk"; +@@ -2525,7 +2525,7 @@ + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0 0x07340000 0 0x1000>; + +- cpu = <&CPU3>; ++ cpu = <&cpu3>; + + clocks = <&aoss_qmp>; + clock-names = "apb_pclk"; +@@ -2545,7 +2545,7 @@ + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0 0x07440000 0 0x1000>; + +- cpu = <&CPU4>; ++ cpu = <&cpu4>; + + clocks = <&aoss_qmp>; + clock-names = "apb_pclk"; +@@ -2565,7 +2565,7 @@ + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0 0x07540000 0 0x1000>; + +- cpu = <&CPU5>; ++ cpu = <&cpu5>; + + clocks = <&aoss_qmp>; + clock-names = "apb_pclk"; +@@ -2585,7 +2585,7 @@ + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0 0x07640000 0 0x1000>; + +- cpu = <&CPU6>; ++ cpu = <&cpu6>; + + clocks = <&aoss_qmp>; + clock-names = "apb_pclk"; +@@ -2605,7 +2605,7 @@ + compatible = "arm,coresight-etm4x", "arm,primecell"; + reg = <0 0x07740000 0 0x1000>; + +- cpu = <&CPU7>; ++ cpu = <&cpu7>; + + clocks = <&aoss_qmp>; + clock-names = "apb_pclk"; +@@ -3645,7 +3645,7 @@ + , + , + ; +- power-domains = <&CLUSTER_PD>; ++ power-domains = <&cluster_pd>; + + rpmhcc: clock-controller { + compatible = "qcom,sc7180-rpmh-clk"; +@@ -3854,21 +3854,21 @@ + cooling-maps { + map0 { + trip = <&cpu0_alert0>; +- cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + map1 { + trip = <&cpu0_alert1>; +- cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; +@@ -3902,21 +3902,21 @@ + cooling-maps { + map0 { + trip = <&cpu1_alert0>; +- cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + map1 { + trip = <&cpu1_alert1>; +- cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; +@@ -3950,21 +3950,21 @@ + cooling-maps { + map0 { + trip = <&cpu2_alert0>; +- cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + map1 { + trip = <&cpu2_alert1>; +- cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; +@@ -3998,21 +3998,21 @@ + cooling-maps { + map0 { + trip = <&cpu3_alert0>; +- cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + map1 { + trip = <&cpu3_alert1>; +- cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; +@@ -4046,21 +4046,21 @@ + cooling-maps { + map0 { + trip = <&cpu4_alert0>; +- cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + map1 { + trip = <&cpu4_alert1>; +- cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; +@@ -4094,21 +4094,21 @@ + cooling-maps { + map0 { + trip = <&cpu5_alert0>; +- cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + map1 { + trip = <&cpu5_alert1>; +- cooling-device = <&CPU0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu4 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu5 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; +@@ -4142,13 +4142,13 @@ + cooling-maps { + map0 { + trip = <&cpu6_alert0>; +- cooling-device = <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + map1 { + trip = <&cpu6_alert1>; +- cooling-device = <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; +@@ -4182,13 +4182,13 @@ + cooling-maps { + map0 { + trip = <&cpu7_alert0>; +- cooling-device = <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + map1 { + trip = <&cpu7_alert1>; +- cooling-device = <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; +@@ -4222,13 +4222,13 @@ + cooling-maps { + map0 { + trip = <&cpu8_alert0>; +- cooling-device = <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + map1 { + trip = <&cpu8_alert1>; +- cooling-device = <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; +@@ -4262,13 +4262,13 @@ + cooling-maps { + map0 { + trip = <&cpu9_alert0>; +- cooling-device = <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + map1 { + trip = <&cpu9_alert1>; +- cooling-device = <&CPU6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, +- <&CPU7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; ++ cooling-device = <&cpu6 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, ++ <&cpu7 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + }; + }; +diff --git a/arch/arm64/boot/dts/qcom/sm7125.dtsi b/arch/arm64/boot/dts/qcom/sm7125.dtsi +index 12dd72859a433..a53145a610a3c 100644 +--- a/arch/arm64/boot/dts/qcom/sm7125.dtsi ++++ b/arch/arm64/boot/dts/qcom/sm7125.dtsi +@@ -6,11 +6,11 @@ + #include "sc7180.dtsi" + + /* SM7125 uses Kryo 465 instead of Kryo 468 */ +-&CPU0 { compatible = "qcom,kryo465"; }; +-&CPU1 { compatible = "qcom,kryo465"; }; +-&CPU2 { compatible = "qcom,kryo465"; }; +-&CPU3 { compatible = "qcom,kryo465"; }; +-&CPU4 { compatible = "qcom,kryo465"; }; +-&CPU5 { compatible = "qcom,kryo465"; }; +-&CPU6 { compatible = "qcom,kryo465"; }; +-&CPU7 { compatible = "qcom,kryo465"; }; ++&cpu0 { compatible = "qcom,kryo465"; }; ++&cpu1 { compatible = "qcom,kryo465"; }; ++&cpu2 { compatible = "qcom,kryo465"; }; ++&cpu3 { compatible = "qcom,kryo465"; }; ++&cpu4 { compatible = "qcom,kryo465"; }; ++&cpu5 { compatible = "qcom,kryo465"; }; ++&cpu6 { compatible = "qcom,kryo465"; }; ++&cpu7 { compatible = "qcom,kryo465"; }; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sc7180-fix-psci-power-domain-node-nam.patch b/queue-6.6/arm64-dts-qcom-sc7180-fix-psci-power-domain-node-nam.patch new file mode 100644 index 0000000000..c1e036409c --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sc7180-fix-psci-power-domain-node-nam.patch @@ -0,0 +1,96 @@ +From 96002010a6ca6520f23f5394a09145f99e9899ff Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Dec 2024 13:44:48 +0100 +Subject: arm64: dts: qcom: sc7180: fix psci power domain node names + +From: Neil Armstrong + +[ Upstream commit 092febd32a99800902f865ed86b83314faa9c7e4 ] + +Rename the psci power domain node names to match the bindings. + +This Fixes: +sc7180-acer-aspire1.dts: psci: 'cpu-cluster0', 'cpu0', 'cpu1', 'cpu2', 'cpu3', 'cpu4', 'cpu5', 'cpu6', 'cpu7' do not match any of the regexes: '^power-domain-', 'pinctrl-[0-9]+' + +Reviewed-by: Douglas Anderson +Reviewed-by: Dmitry Baryshkov +Signed-off-by: Neil Armstrong +Link: https://lore.kernel.org/r/20241230-topic-misc-dt-fixes-v4-5-1e6880e9dda3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sc7180.dtsi | 18 +++++++++--------- + 1 file changed, 9 insertions(+), 9 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qcom/sc7180.dtsi +index 5db7b3bce368b..7758136d71d64 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi +@@ -580,55 +580,55 @@ + compatible = "arm,psci-1.0"; + method = "smc"; + +- cpu_pd0: cpu0 { ++ cpu_pd0: power-domain-cpu0 { + #power-domain-cells = <0>; + power-domains = <&cluster_pd>; + domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>; + }; + +- cpu_pd1: cpu1 { ++ cpu_pd1: power-domain-cpu1 { + #power-domain-cells = <0>; + power-domains = <&cluster_pd>; + domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>; + }; + +- cpu_pd2: cpu2 { ++ cpu_pd2: power-domain-cpu2 { + #power-domain-cells = <0>; + power-domains = <&cluster_pd>; + domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>; + }; + +- cpu_pd3: cpu3 { ++ cpu_pd3: power-domain-cpu3 { + #power-domain-cells = <0>; + power-domains = <&cluster_pd>; + domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>; + }; + +- cpu_pd4: cpu4 { ++ cpu_pd4: power-domain-cpu4 { + #power-domain-cells = <0>; + power-domains = <&cluster_pd>; + domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>; + }; + +- cpu_pd5: cpu5 { ++ cpu_pd5: power-domain-cpu5 { + #power-domain-cells = <0>; + power-domains = <&cluster_pd>; + domain-idle-states = <&little_cpu_sleep_0 &little_cpu_sleep_1>; + }; + +- cpu_pd6: cpu6 { ++ cpu_pd6: power-domain-cpu6 { + #power-domain-cells = <0>; + power-domains = <&cluster_pd>; + domain-idle-states = <&big_cpu_sleep_0 &big_cpu_sleep_1>; + }; + +- cpu_pd7: cpu7 { ++ cpu_pd7: power-domain-cpu7 { + #power-domain-cells = <0>; + power-domains = <&cluster_pd>; + domain-idle-states = <&big_cpu_sleep_0 &big_cpu_sleep_1>; + }; + +- cluster_pd: cpu-cluster0 { ++ cluster_pd: power-domain-cluster { + #power-domain-cells = <0>; + domain-idle-states = <&cluster_sleep_pc + &cluster_sleep_cx_ret +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sc7180-remove-thermal-zone-polling-de.patch b/queue-6.6/arm64-dts-qcom-sc7180-remove-thermal-zone-polling-de.patch new file mode 100644 index 0000000000..bca2673b3f --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sc7180-remove-thermal-zone-polling-de.patch @@ -0,0 +1,326 @@ +From 5070f8ca808372274d549371c4651cfc3732e6ad Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 May 2024 13:59:39 +0200 +Subject: arm64: dts: qcom: sc7180-*: Remove thermal zone polling delays + +From: Konrad Dybcio + +[ Upstream commit 7cd2d9080a6eb281701f7303b1699719640380d0 ] + +All of the thermal zone suppliers are interrupt-driven, remove the +bogus and unnecessary polling that only wastes CPU time. + +Signed-off-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20240510-topic-msm-polling-cleanup-v2-16-436ca4218da2@linaro.org +Signed-off-by: Bjorn Andersson +Stable-dep-of: 9180b38d706c ("arm64: dts: qcom: sc7180-trogdor-pompom: rename 5v-choke thermal zone") +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/pm6150.dtsi | 2 +- + arch/arm64/boot/dts/qcom/pm6150l.dtsi | 3 --- + .../boot/dts/qcom/sc7180-trogdor-coachz.dtsi | 1 - + .../dts/qcom/sc7180-trogdor-homestar.dtsi | 1 - + .../boot/dts/qcom/sc7180-trogdor-pompom.dtsi | 3 --- + .../dts/qcom/sc7180-trogdor-wormdingler.dtsi | 1 - + arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 3 --- + arch/arm64/boot/dts/qcom/sc7180.dtsi | 25 ------------------- + 8 files changed, 1 insertion(+), 38 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/pm6150.dtsi b/arch/arm64/boot/dts/qcom/pm6150.dtsi +index 7d4d1f2767ed6..7ae14c53ca8fb 100644 +--- a/arch/arm64/boot/dts/qcom/pm6150.dtsi ++++ b/arch/arm64/boot/dts/qcom/pm6150.dtsi +@@ -13,7 +13,7 @@ + thermal-zones { + pm6150_thermal: pm6150-thermal { + polling-delay-passive = <100>; +- polling-delay = <0>; ++ + thermal-sensors = <&pm6150_temp>; + + trips { +diff --git a/arch/arm64/boot/dts/qcom/pm6150l.dtsi b/arch/arm64/boot/dts/qcom/pm6150l.dtsi +index d13a1ab7c20b3..a20e9b9993b28 100644 +--- a/arch/arm64/boot/dts/qcom/pm6150l.dtsi ++++ b/arch/arm64/boot/dts/qcom/pm6150l.dtsi +@@ -10,9 +10,6 @@ + / { + thermal-zones { + pm6150l-thermal { +- polling-delay-passive = <0>; +- polling-delay = <0>; +- + thermal-sensors = <&pm6150l_temp>; + + trips { +diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +index a532cc4aac474..c9adde64450c6 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +@@ -26,7 +26,6 @@ + thermal-zones { + skin_temp_thermal: skin-temp-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&pm6150_adc_tm 1>; + sustainable-power = <965>; +diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi +index b27dcd2ec856f..a9e80acf97637 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi +@@ -43,7 +43,6 @@ + thermal-zones { + skin_temp_thermal: skin-temp-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&pm6150_adc_tm 1>; + sustainable-power = <965>; +diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi +index fd944842dd6cd..b5ef846e2191e 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi +@@ -13,9 +13,6 @@ + / { + thermal-zones { + 5v-choke-thermal { +- polling-delay-passive = <0>; +- polling-delay = <250>; +- + thermal-sensors = <&pm6150_adc_tm 1>; + + trips { +diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi +index 2f6a340ddd2ae..61d0add3c8f6c 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-wormdingler.dtsi +@@ -50,7 +50,6 @@ + thermal-zones { + skin_temp_thermal: skin-temp-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&pm6150_adc_tm 1>; + sustainable-power = <574>; +diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +index c2f5e9f6679d6..906e616422706 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +@@ -21,9 +21,6 @@ + / { + thermal-zones { + charger_thermal: charger-thermal { +- polling-delay-passive = <0>; +- polling-delay = <0>; +- + thermal-sensors = <&pm6150_adc_tm 0>; + + trips { +diff --git a/arch/arm64/boot/dts/qcom/sc7180.dtsi b/arch/arm64/boot/dts/qcom/sc7180.dtsi +index 68b1c017a9fd5..4e1178496682d 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180.dtsi +@@ -3827,7 +3827,6 @@ + thermal-zones { + cpu0_thermal: cpu0-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens0 1>; + sustainable-power = <1052>; +@@ -3876,7 +3875,6 @@ + + cpu1_thermal: cpu1-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens0 2>; + sustainable-power = <1052>; +@@ -3925,7 +3923,6 @@ + + cpu2_thermal: cpu2-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens0 3>; + sustainable-power = <1052>; +@@ -3974,7 +3971,6 @@ + + cpu3_thermal: cpu3-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens0 4>; + sustainable-power = <1052>; +@@ -4023,7 +4019,6 @@ + + cpu4_thermal: cpu4-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens0 5>; + sustainable-power = <1052>; +@@ -4072,7 +4067,6 @@ + + cpu5_thermal: cpu5-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens0 6>; + sustainable-power = <1052>; +@@ -4121,7 +4115,6 @@ + + cpu6_thermal: cpu6-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens0 9>; + sustainable-power = <1425>; +@@ -4162,7 +4155,6 @@ + + cpu7_thermal: cpu7-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens0 10>; + sustainable-power = <1425>; +@@ -4203,7 +4195,6 @@ + + cpu8_thermal: cpu8-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens0 11>; + sustainable-power = <1425>; +@@ -4244,7 +4235,6 @@ + + cpu9_thermal: cpu9-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens0 12>; + sustainable-power = <1425>; +@@ -4285,7 +4275,6 @@ + + aoss0-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens0 0>; + +@@ -4306,7 +4295,6 @@ + + cpuss0-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens0 7>; + +@@ -4326,7 +4314,6 @@ + + cpuss1-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens0 8>; + +@@ -4346,7 +4333,6 @@ + + gpuss0-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens0 13>; + +@@ -4374,7 +4360,6 @@ + + gpuss1-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens0 14>; + +@@ -4402,7 +4387,6 @@ + + aoss1-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens1 0>; + +@@ -4423,7 +4407,6 @@ + + cwlan-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens1 1>; + +@@ -4444,7 +4427,6 @@ + + audio-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens1 2>; + +@@ -4465,7 +4447,6 @@ + + ddr-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens1 3>; + +@@ -4486,7 +4467,6 @@ + + q6-hvx-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens1 4>; + +@@ -4507,7 +4487,6 @@ + + camera-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens1 5>; + +@@ -4528,7 +4507,6 @@ + + mdm-core-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens1 6>; + +@@ -4549,7 +4527,6 @@ + + mdm-dsp-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens1 7>; + +@@ -4570,7 +4547,6 @@ + + npu-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens1 8>; + +@@ -4591,7 +4567,6 @@ + + video-thermal { + polling-delay-passive = <250>; +- polling-delay = <0>; + + thermal-sensors = <&tsens1 9>; + +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sc7180-trogdor-pompom-rename-5v-choke.patch b/queue-6.6/arm64-dts-qcom-sc7180-trogdor-pompom-rename-5v-choke.patch new file mode 100644 index 0000000000..c98c8e4554 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sc7180-trogdor-pompom-rename-5v-choke.patch @@ -0,0 +1,46 @@ +From c559a87da98c1e86095be38aa6b20d15444788e8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Dec 2024 13:44:47 +0100 +Subject: arm64: dts: qcom: sc7180-trogdor-pompom: rename 5v-choke thermal zone + +From: Neil Armstrong + +[ Upstream commit 9180b38d706c29ed212181a77999c35ae9ff6879 ] + +Rename the 5v-choke thermal zone to satisfy the bindings. + +This fixes: +sc7180-trogdor-pompom-r2-lte.dts: thermal-zones: '5v-choke-thermal' does not match any of the regexes: '^[a-zA-Z][a-zA-Z0-9\\-]{1,10}-thermal$', 'pinctrl-[0-9]+' + from schema $id: http://devicetree.org/schemas/thermal/thermal-zones.yaml# + +Reviewed-by: Douglas Anderson +Reviewed-by: Dmitry Baryshkov +Signed-off-by: Neil Armstrong +Link: https://lore.kernel.org/r/20241230-topic-misc-dt-fixes-v4-4-1e6880e9dda3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi +index b5ef846e2191e..7a05d502620f3 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-pompom.dtsi +@@ -12,11 +12,11 @@ + + / { + thermal-zones { +- 5v-choke-thermal { ++ choke-5v-thermal { + thermal-sensors = <&pm6150_adc_tm 1>; + + trips { +- 5v-choke-crit { ++ choke-5v-crit { + temperature = <125000>; + hysteresis = <1000>; + type = "critical"; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sc7180-trogdor-quackingstick-add-miss.patch b/queue-6.6/arm64-dts-qcom-sc7180-trogdor-quackingstick-add-miss.patch new file mode 100644 index 0000000000..69c9eb94b0 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sc7180-trogdor-quackingstick-add-miss.patch @@ -0,0 +1,42 @@ +From 03455ca60782af1bf2b5bdb6924d3294a1518b9b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Dec 2024 13:44:46 +0100 +Subject: arm64: dts: qcom: sc7180-trogdor-quackingstick: add missing + avee-supply + +From: Neil Armstrong + +[ Upstream commit aa09de104d421e7ff8d8cde9af98568ce62a002c ] + +The bindings requires the avee-supply, use the same regulator as +the avdd (positive voltage) which would also provide the negative +voltage by definition. + +The fixes: +sc7180-trogdor-quackingstick-r0.dts: panel@0: 'avee-supply' is a required property + from schema $id: http://devicetree.org/schemas/display/panel/boe,tv101wum-nl6.yaml# + +Reviewed-by: Douglas Anderson +Signed-off-by: Neil Armstrong +Link: https://lore.kernel.org/r/20241230-topic-misc-dt-fixes-v4-3-1e6880e9dda3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi b/arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi +index 62ab6427dd65d..e1e31e0fc0e14 100644 +--- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-quackingstick.dtsi +@@ -84,6 +84,7 @@ + pinctrl-names = "default"; + pinctrl-0 = <&lcd_rst>; + avdd-supply = <&ppvar_lcd>; ++ avee-supply = <&ppvar_lcd>; + pp1800-supply = <&v1p8_disp>; + pp3300-supply = <&pp3300_dx_edp>; + backlight = <&backlight>; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sc7280-correct-sleep-clock-frequency.patch b/queue-6.6/arm64-dts-qcom-sc7280-correct-sleep-clock-frequency.patch new file mode 100644 index 0000000000..4d36ee385e --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sc7280-correct-sleep-clock-frequency.patch @@ -0,0 +1,38 @@ +From caa9ea3bbd702a1527bfda0d942d1ba0b6ac70c6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 12:17:07 +0200 +Subject: arm64: dts: qcom: sc7280: correct sleep clock frequency + +From: Dmitry Baryshkov + +[ Upstream commit f6ccdca14eac545320ab03d6ca91ca343e7372e5 ] + +The SC7280 platform uses PMK8350 to provide sleep clock. According to the +documentation, that clock has 32.7645 kHz frequency. Correct the sleep +clock definition. + +Fixes: 7a1f4e7f740d ("arm64: dts: qcom: sc7280: Add basic dts/dtsi files for sc7280 soc") +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20241224-fix-board-clocks-v3-8-e9b08fbeadd3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sc7280.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/sc7280.dtsi b/arch/arm64/boot/dts/qcom/sc7280.dtsi +index 149c7962f2cbb..81e95604ef987 100644 +--- a/arch/arm64/boot/dts/qcom/sc7280.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc7280.dtsi +@@ -80,7 +80,7 @@ + + sleep_clk: sleep-clk { + compatible = "fixed-clock"; +- clock-frequency = <32000>; ++ clock-frequency = <32764>; + #clock-cells = <0>; + }; + }; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sc8280xp-fix-up-remoteproc-register-s.patch b/queue-6.6/arm64-dts-qcom-sc8280xp-fix-up-remoteproc-register-s.patch new file mode 100644 index 0000000000..108ed16050 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sc8280xp-fix-up-remoteproc-register-s.patch @@ -0,0 +1,58 @@ +From c9a9882c32d57613ea73cd82e508e58a287db814 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Dec 2024 23:19:37 +0100 +Subject: arm64: dts: qcom: sc8280xp: Fix up remoteproc register space sizes + +From: Konrad Dybcio + +[ Upstream commit 7ec7e327286182c65d0b5b81dff498d620fe9e8c ] + +Make sure the remoteproc reg ranges reflect the entire register space +they refer to. + +Since they're unused by the driver, there's no functional change. + +Fixes: 152d1faf1e2f ("arm64: dts: qcom: add SC8280XP platform") +Signed-off-by: Konrad Dybcio +Reviewed-by: Bryan O'Donoghue +Link: https://lore.kernel.org/r/20241212-topic-8280_rproc_reg-v1-1-bd1c696e91b0@oss.qualcomm.com +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sc8280xp.dtsi | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/sc8280xp.dtsi b/arch/arm64/boot/dts/qcom/sc8280xp.dtsi +index 6425c74edd60c..3e70e79ce24b0 100644 +--- a/arch/arm64/boot/dts/qcom/sc8280xp.dtsi ++++ b/arch/arm64/boot/dts/qcom/sc8280xp.dtsi +@@ -2642,7 +2642,7 @@ + + remoteproc_adsp: remoteproc@3000000 { + compatible = "qcom,sc8280xp-adsp-pas"; +- reg = <0 0x03000000 0 0x100>; ++ reg = <0 0x03000000 0 0x10000>; + + interrupts-extended = <&intc GIC_SPI 162 IRQ_TYPE_LEVEL_HIGH>, + <&smp2p_adsp_in 0 IRQ_TYPE_EDGE_RISING>, +@@ -4399,7 +4399,7 @@ + + remoteproc_nsp0: remoteproc@1b300000 { + compatible = "qcom,sc8280xp-nsp0-pas"; +- reg = <0 0x1b300000 0 0x100>; ++ reg = <0 0x1b300000 0 0x10000>; + + interrupts-extended = <&intc GIC_SPI 578 IRQ_TYPE_LEVEL_HIGH>, + <&smp2p_nsp0_in 0 IRQ_TYPE_EDGE_RISING>, +@@ -4530,7 +4530,7 @@ + + remoteproc_nsp1: remoteproc@21300000 { + compatible = "qcom,sc8280xp-nsp1-pas"; +- reg = <0 0x21300000 0 0x100>; ++ reg = <0 0x21300000 0 0x10000>; + + interrupts-extended = <&intc GIC_SPI 887 IRQ_TYPE_LEVEL_HIGH>, + <&smp2p_nsp1_in 0 IRQ_TYPE_EDGE_RISING>, +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sdm845-db845c-navigation-mezzanine-co.patch b/queue-6.6/arm64-dts-qcom-sdm845-db845c-navigation-mezzanine-co.patch new file mode 100644 index 0000000000..6c8c032527 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sdm845-db845c-navigation-mezzanine-co.patch @@ -0,0 +1,84 @@ +From 90ca473310fd0702a35613622b063a09a6d50f13 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 25 Oct 2024 16:43:24 +0100 +Subject: arm64: dts: qcom: sdm845-db845c-navigation-mezzanine: Convert + mezzanine riser to dtso + +From: Bryan O'Donoghue + +[ Upstream commit 30df676a31b7a4881352097d8ae7c2bb83515a17 ] + +Convert the navigation / camera mezzanine from its own dts to a dtso. A +small amount of additional includes / address / cell size change needs to +be applied to convert. + +Tested-by: Bryan O'Donoghue # rb3 +Signed-off-by: Bryan O'Donoghue +Reviewed-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20241025-b4-linux-next-24-10-25-camss-dts-fixups-v1-2-cdff2f1a5792@linaro.org +[bjorn: Corrected up makefile syntax, added missing cells for cci_i2c1] +Signed-off-by: Bjorn Andersson +Stable-dep-of: 80b47f14d543 ("arm64: dts: qcom: sdm845-db845c-navigation-mezzanine: remove disabled ov7251 camera") +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/Makefile | 3 +++ + ...ine.dts => sdm845-db845c-navigation-mezzanine.dtso} | 10 +++++++++- + 2 files changed, 12 insertions(+), 1 deletion(-) + rename arch/arm64/boot/dts/qcom/{sdm845-db845c-navigation-mezzanine.dts => sdm845-db845c-navigation-mezzanine.dtso} (91%) + +diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile +index 2cca20563a1d6..0da076db0418d 100644 +--- a/arch/arm64/boot/dts/qcom/Makefile ++++ b/arch/arm64/boot/dts/qcom/Makefile +@@ -171,6 +171,9 @@ dtb-$(CONFIG_ARCH_QCOM) += sdm845-cheza-r1.dtb + dtb-$(CONFIG_ARCH_QCOM) += sdm845-cheza-r2.dtb + dtb-$(CONFIG_ARCH_QCOM) += sdm845-cheza-r3.dtb + dtb-$(CONFIG_ARCH_QCOM) += sdm845-db845c.dtb ++ ++sdm845-db845c-navigation-mezzanine-dtbs := sdm845-db845c.dtb sdm845-db845c-navigation-mezzanine.dtbo ++ + dtb-$(CONFIG_ARCH_QCOM) += sdm845-db845c-navigation-mezzanine.dtb + dtb-$(CONFIG_ARCH_QCOM) += sdm845-lg-judyln.dtb + dtb-$(CONFIG_ARCH_QCOM) += sdm845-lg-judyp.dtb +diff --git a/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dts b/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso +similarity index 91% +rename from arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dts +rename to arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso +index a21caa6f3fa25..b5f717d0ddd97 100644 +--- a/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dts ++++ b/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso +@@ -4,8 +4,10 @@ + */ + + /dts-v1/; ++/plugin/; + +-#include "sdm845-db845c.dts" ++#include ++#include + + &camss { + vdda-phy-supply = <&vreg_l1a_0p875>; +@@ -28,6 +30,9 @@ + }; + + &cci_i2c0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ + camera@10 { + compatible = "ovti,ov8856"; + reg = <0x10>; +@@ -65,6 +70,9 @@ + }; + + &cci_i2c1 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ + camera@60 { + compatible = "ovti,ov7251"; + +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sdm845-db845c-navigation-mezzanine-re.patch b/queue-6.6/arm64-dts-qcom-sdm845-db845c-navigation-mezzanine-re.patch new file mode 100644 index 0000000000..3c9e00350e --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sdm845-db845c-navigation-mezzanine-re.patch @@ -0,0 +1,83 @@ +From ad43b973f84743f96257e60ea65846431af54dee Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Dec 2024 13:44:45 +0100 +Subject: arm64: dts: qcom: sdm845-db845c-navigation-mezzanine: remove disabled + ov7251 camera + +From: Neil Armstrong + +[ Upstream commit 80b47f14d5433068dd6738c9e6e17ff6648bae41 ] + +The ov7251node has bindings check errors in the endpoint, and the +camera node was disabled since the beginning. Even when switching the +node to okay, the endpoint description to the csiphy is missing along +with the csiphy parameters. + +Drop the ov7251 camera entirely until it's properly described. + +This obviously fixes: +sdm845-db845c-navigation-mezzanine.dtso: camera@60: port:endpoint:data-lanes: [0, 1] is too long + from schema $id: http://devicetree.org/schemas/media/i2c/ovti,ov7251.yaml# + +Reviewed-by: Konrad Dybcio +Signed-off-by: Neil Armstrong +Link: https://lore.kernel.org/r/20241230-topic-misc-dt-fixes-v4-2-1e6880e9dda3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + .../sdm845-db845c-navigation-mezzanine.dtso | 42 ------------------- + 1 file changed, 42 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso b/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso +index b5f717d0ddd97..51f1a4883ab8f 100644 +--- a/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso ++++ b/arch/arm64/boot/dts/qcom/sdm845-db845c-navigation-mezzanine.dtso +@@ -68,45 +68,3 @@ + }; + }; + }; +- +-&cci_i2c1 { +- #address-cells = <1>; +- #size-cells = <0>; +- +- camera@60 { +- compatible = "ovti,ov7251"; +- +- /* I2C address as per ov7251.txt linux documentation */ +- reg = <0x60>; +- +- /* CAM3_RST_N */ +- enable-gpios = <&tlmm 21 GPIO_ACTIVE_HIGH>; +- pinctrl-names = "default"; +- pinctrl-0 = <&cam3_default>; +- +- clocks = <&clock_camcc CAM_CC_MCLK3_CLK>; +- clock-names = "xclk"; +- clock-frequency = <24000000>; +- +- /* +- * The &vreg_s4a_1p8 trace always powered on. +- * +- * The 2.8V vdda-supply regulator is enabled when the +- * vreg_s4a_1p8 trace is pulled high. +- * It too is represented by a fixed regulator. +- * +- * No 1.2V vddd-supply regulator is used. +- */ +- vdddo-supply = <&vreg_lvs1a_1p8>; +- vdda-supply = <&cam3_avdd_2v8>; +- +- status = "disabled"; +- +- port { +- ov7251_ep: endpoint { +- data-lanes = <0 1>; +-/* remote-endpoint = <&csiphy3_ep>; */ +- }; +- }; +- }; +-}; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sdm845-fix-interrupt-types-of-camss-i.patch b/queue-6.6/arm64-dts-qcom-sdm845-fix-interrupt-types-of-camss-i.patch new file mode 100644 index 0000000000..b29fe4f074 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sdm845-fix-interrupt-types-of-camss-i.patch @@ -0,0 +1,56 @@ +From 046b5b9015b03986c9dd5df56144e94edd2b7788 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 27 Nov 2024 14:29:49 +0200 +Subject: arm64: dts: qcom: sdm845: Fix interrupt types of camss interrupts + +From: Vladimir Zapolskiy + +[ Upstream commit cb96722b728e81ad97f5b5b20dea64cd294a5452 ] + +Qualcomm IP catalog says that all CAMSS interrupts is edge rising, +fix it in the CAMSS device tree node for sdm845 SoC. + +Fixes: d48a6698a6b7 ("arm64: dts: qcom: sdm845: Add CAMSS ISP node") +Signed-off-by: Vladimir Zapolskiy +Reviewed-by: Bryan O'Donoghue +Link: https://lore.kernel.org/r/20241127122950.885982-6-vladimir.zapolskiy@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sdm845.dtsi | 20 ++++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/sdm845.dtsi b/arch/arm64/boot/dts/qcom/sdm845.dtsi +index dcdc8a0cd1819..4ea693a075856 100644 +--- a/arch/arm64/boot/dts/qcom/sdm845.dtsi ++++ b/arch/arm64/boot/dts/qcom/sdm845.dtsi +@@ -4244,16 +4244,16 @@ + "vfe1", + "vfe_lite"; + +- interrupts = , +- , +- , +- , +- , +- , +- , +- , +- , +- ; ++ interrupts = , ++ , ++ , ++ , ++ , ++ , ++ , ++ , ++ , ++ ; + interrupt-names = "csid0", + "csid1", + "csid2", +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sdx75-correct-sleep-clock-frequency.patch b/queue-6.6/arm64-dts-qcom-sdx75-correct-sleep-clock-frequency.patch new file mode 100644 index 0000000000..74bdb32cbf --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sdx75-correct-sleep-clock-frequency.patch @@ -0,0 +1,38 @@ +From d26c665bb839ef370bb513b721b089b7dfe51a54 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 12:17:08 +0200 +Subject: arm64: dts: qcom: sdx75: correct sleep clock frequency + +From: Dmitry Baryshkov + +[ Upstream commit b8021da9ddc65fa041e12ea1e0ff2dfce5c926eb ] + +The SDX75 platform uses PMK8550 to provide sleep clock. According to the +documentation, that clock has 32.7645 kHz frequency. Correct the sleep +clock definition. + +Fixes: 9181bb939984 ("arm64: dts: qcom: Add SDX75 platform and IDP board support") +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20241224-fix-board-clocks-v3-9-e9b08fbeadd3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sdx75.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/sdx75.dtsi b/arch/arm64/boot/dts/qcom/sdx75.dtsi +index e180aa4023eca..0d1b5712c5067 100644 +--- a/arch/arm64/boot/dts/qcom/sdx75.dtsi ++++ b/arch/arm64/boot/dts/qcom/sdx75.dtsi +@@ -29,7 +29,7 @@ + + sleep_clk: sleep-clk { + compatible = "fixed-clock"; +- clock-frequency = <32000>; ++ clock-frequency = <32764>; + #clock-cells = <0>; + }; + }; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sm4450-correct-sleep-clock-frequency.patch b/queue-6.6/arm64-dts-qcom-sm4450-correct-sleep-clock-frequency.patch new file mode 100644 index 0000000000..f49965489e --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sm4450-correct-sleep-clock-frequency.patch @@ -0,0 +1,38 @@ +From 999ca21977a12f6871b9e5a03baed0e75d44eed1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 12:17:09 +0200 +Subject: arm64: dts: qcom: sm4450: correct sleep clock frequency + +From: Dmitry Baryshkov + +[ Upstream commit 158e67cf3619dbb5b9914bb364889041f4b90eea ] + +The SM4450 platform uses PM4450 to provide sleep clock. According to the +documentation, that clock has 32.7645 kHz frequency. Correct the sleep +clock definition. + +Fixes: 7a1fd03e7410 ("arm64: dts: qcom: Adds base SM4450 DTSI") +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20241224-fix-board-clocks-v3-10-e9b08fbeadd3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sm4450.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/sm4450.dtsi b/arch/arm64/boot/dts/qcom/sm4450.dtsi +index c4e5b33f5169c..51240f45c8e84 100644 +--- a/arch/arm64/boot/dts/qcom/sm4450.dtsi ++++ b/arch/arm64/boot/dts/qcom/sm4450.dtsi +@@ -23,7 +23,7 @@ + + sleep_clk: sleep-clk { + compatible = "fixed-clock"; +- clock-frequency = <32000>; ++ clock-frequency = <32764>; + #clock-cells = <0>; + }; + }; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sm6125-correct-sleep-clock-frequency.patch b/queue-6.6/arm64-dts-qcom-sm6125-correct-sleep-clock-frequency.patch new file mode 100644 index 0000000000..eeaabeee32 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sm6125-correct-sleep-clock-frequency.patch @@ -0,0 +1,38 @@ +From 1f0cfa060a2c9a748c5df35159fb8f9359c5367e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 12:17:10 +0200 +Subject: arm64: dts: qcom: sm6125: correct sleep clock frequency + +From: Dmitry Baryshkov + +[ Upstream commit b3c547e1507862f0e4d46432b665c5c6e61e14d6 ] + +The SM6125 platform uses PM6125 to provide sleep clock. According to the +documentation, that clock has 32.7645 kHz frequency. Correct the sleep +clock definition. + +Fixes: cff4bbaf2a2d ("arm64: dts: qcom: Add support for SM6125") +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20241224-fix-board-clocks-v3-11-e9b08fbeadd3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sm6125.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/sm6125.dtsi b/arch/arm64/boot/dts/qcom/sm6125.dtsi +index 07081088ba146..2b2c55132f673 100644 +--- a/arch/arm64/boot/dts/qcom/sm6125.dtsi ++++ b/arch/arm64/boot/dts/qcom/sm6125.dtsi +@@ -28,7 +28,7 @@ + sleep_clk: sleep-clk { + compatible = "fixed-clock"; + #clock-cells = <0>; +- clock-frequency = <32000>; ++ clock-frequency = <32764>; + clock-output-names = "sleep_clk"; + }; + }; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sm6375-correct-sleep-clock-frequency.patch b/queue-6.6/arm64-dts-qcom-sm6375-correct-sleep-clock-frequency.patch new file mode 100644 index 0000000000..289bc738f0 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sm6375-correct-sleep-clock-frequency.patch @@ -0,0 +1,38 @@ +From 9156a698a8155d1225bf49dbd3eedf06f83d24bd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 12:17:11 +0200 +Subject: arm64: dts: qcom: sm6375: correct sleep clock frequency + +From: Dmitry Baryshkov + +[ Upstream commit 223382c94f1f07c475d39713e4c058401480b441 ] + +The SM6375 platform uses PM6125 to provide sleep clock. According to the +documentation, that clock has 32.7645 kHz frequency. Correct the sleep +clock definition. + +Fixes: 59d34ca97f91 ("arm64: dts: qcom: Add initial device tree for SM6375") +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20241224-fix-board-clocks-v3-12-e9b08fbeadd3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sm6375.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/sm6375.dtsi b/arch/arm64/boot/dts/qcom/sm6375.dtsi +index e56f7ea4ebc6a..c5f7715626a09 100644 +--- a/arch/arm64/boot/dts/qcom/sm6375.dtsi ++++ b/arch/arm64/boot/dts/qcom/sm6375.dtsi +@@ -29,7 +29,7 @@ + + sleep_clk: sleep-clk { + compatible = "fixed-clock"; +- clock-frequency = <32000>; ++ clock-frequency = <32764>; + #clock-cells = <0>; + }; + }; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sm7225-fairphone-fp4-drop-extra-qcom-.patch b/queue-6.6/arm64-dts-qcom-sm7225-fairphone-fp4-drop-extra-qcom-.patch new file mode 100644 index 0000000000..79312a2e73 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sm7225-fairphone-fp4-drop-extra-qcom-.patch @@ -0,0 +1,38 @@ +From 2f92c3d0ab94c3c97486b8a6c09b5e069c7740d1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 Dec 2024 09:55:01 +0100 +Subject: arm64: dts: qcom: sm7225-fairphone-fp4: Drop extra qcom,msm-id value + +From: Luca Weiss + +[ Upstream commit 7fb88e0d4dc1a40a29d49b603faa1484334c60f3 ] + +The ID 434 is for SM6350 while 459 is for SM7225. Fairphone 4 is only +SM7225, so drop the unused 434 entry. + +Fixes: 4cbea668767d ("arm64: dts: qcom: sm7225: Add device tree for Fairphone 4") +Signed-off-by: Luca Weiss +Reviewed-by: Konrad Dybcio +Link: https://lore.kernel.org/r/20241220-fp4-msm-id-v1-1-2b75af02032a@fairphone.com +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts b/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts +index 18171c5d8a387..c010e86134ff9 100644 +--- a/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts ++++ b/arch/arm64/boot/dts/qcom/sm7225-fairphone-fp4.dts +@@ -26,7 +26,7 @@ + chassis-type = "handset"; + + /* required for bootloader to select correct board */ +- qcom,msm-id = <434 0x10000>, <459 0x10000>; ++ qcom,msm-id = <459 0x10000>; + qcom,board-id = <8 32>; + + aliases { +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sm8150-microsoft-surface-duo-fix-typo.patch b/queue-6.6/arm64-dts-qcom-sm8150-microsoft-surface-duo-fix-typo.patch new file mode 100644 index 0000000000..0c078da805 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sm8150-microsoft-surface-duo-fix-typo.patch @@ -0,0 +1,53 @@ +From 3d6ea6e8790778fc52a5c1b982367d5a8c0595bb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Dec 2024 13:44:49 +0100 +Subject: arm64: dts: qcom: sm8150-microsoft-surface-duo: fix typos in da7280 + properties + +From: Neil Armstrong + +[ Upstream commit 9875adffb87da5c40f4013e55104f5e2fc071c2a ] + +The dlg,const-op-mode & dlg,periodic-op-mode were mis-names with twice +the "dlg," prefix, drop one to match the bindings. + +This fixes: +sm8150-microsoft-surface-duo.dtb: da7280@4a: 'dlg,const-op-mode' is a required property + from schema $id: http://devicetree.org/schemas/input/dlg,da7280.yaml# +m8150-microsoft-surface-duo.dtb: da7280@4a: 'dlg,periodic-op-mode' is a required property + from schema $id: http://devicetree.org/schemas/input/dlg,da7280.yaml# +sm8150-microsoft-surface-duo.dtb: da7280@4a: 'dlg,dlg,const-op-mode', 'dlg,dlg,periodic-op-mode' do not match any of the regexes: 'pinctrl-[0-9]+' + from schema $id: http://devicetree.org/schemas/input/dlg,da7280.yaml# + +With the dlg,da7280.yaml converted from dlg,da7280.txt at [1]. + +[1] https://lore.kernel.org/all/20241206-topic-misc-da7280-convert-v2-1-1c3539f75604@linaro.org/ + +Fixes: d1f781db47a8 ("arm64: dts: qcom: add initial device-tree for Microsoft Surface Duo") +Reviewed-by: Dmitry Baryshkov +Signed-off-by: Neil Armstrong +Link: https://lore.kernel.org/r/20241230-topic-misc-dt-fixes-v4-6-1e6880e9dda3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sm8150-microsoft-surface-duo.dts | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/sm8150-microsoft-surface-duo.dts b/arch/arm64/boot/dts/qcom/sm8150-microsoft-surface-duo.dts +index b039773c44653..a1323a8b8e6bf 100644 +--- a/arch/arm64/boot/dts/qcom/sm8150-microsoft-surface-duo.dts ++++ b/arch/arm64/boot/dts/qcom/sm8150-microsoft-surface-duo.dts +@@ -376,8 +376,8 @@ + pinctrl-0 = <&da7280_intr_default>; + + dlg,actuator-type = "LRA"; +- dlg,dlg,const-op-mode = <1>; +- dlg,dlg,periodic-op-mode = <1>; ++ dlg,const-op-mode = <1>; ++ dlg,periodic-op-mode = <1>; + dlg,nom-microvolt = <2000000>; + dlg,abs-max-microvolt = <2000000>; + dlg,imax-microamp = <129000>; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sm8250-correct-sleep-clock-frequency.patch b/queue-6.6/arm64-dts-qcom-sm8250-correct-sleep-clock-frequency.patch new file mode 100644 index 0000000000..cbf6bc3773 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sm8250-correct-sleep-clock-frequency.patch @@ -0,0 +1,38 @@ +From 3c9e8ad76f0b9536d2e6f61b740fa0b468dede8f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 12:17:12 +0200 +Subject: arm64: dts: qcom: sm8250: correct sleep clock frequency + +From: Dmitry Baryshkov + +[ Upstream commit 75420e437eed69fa95d1d7c339dad86dea35319a ] + +The SM8250 platform uses PM8150 to provide sleep clock. According to the +documentation, that clock has 32.7645 kHz frequency. Correct the sleep +clock definition. + +Fixes: 9ff8b0591fcf ("arm64: dts: qcom: sm8250: use the right clock-freqency for sleep-clk") +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20241224-fix-board-clocks-v3-13-e9b08fbeadd3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sm8250.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qcom/sm8250.dtsi +index b522d19f3a132..88e8f0437e938 100644 +--- a/arch/arm64/boot/dts/qcom/sm8250.dtsi ++++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi +@@ -85,7 +85,7 @@ + + sleep_clk: sleep-clk { + compatible = "fixed-clock"; +- clock-frequency = <32768>; ++ clock-frequency = <32764>; + #clock-cells = <0>; + }; + }; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sm8250-fix-interrupt-types-of-camss-i.patch b/queue-6.6/arm64-dts-qcom-sm8250-fix-interrupt-types-of-camss-i.patch new file mode 100644 index 0000000000..fb46ccb8d2 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sm8250-fix-interrupt-types-of-camss-i.patch @@ -0,0 +1,64 @@ +From 57feb353dcbd89b3f35cc2b4a3be9aed67d6f60f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 27 Nov 2024 14:29:50 +0200 +Subject: arm64: dts: qcom: sm8250: Fix interrupt types of camss interrupts + +From: Vladimir Zapolskiy + +[ Upstream commit 6c7bba42ebc3da56e64d4aec4c4a31dd454e05fd ] + +Qualcomm IP catalog says that all CAMSS interrupts is edge rising, +fix it in the CAMSS device tree node for sm8250 SoC. + +Fixes: 30325603b910 ("arm64: dts: qcom: sm8250: camss: Add CAMSS block definition") +Signed-off-by: Vladimir Zapolskiy +Reviewed-by: Bryan O'Donoghue +Link: https://lore.kernel.org/r/20241127122950.885982-7-vladimir.zapolskiy@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sm8250.dtsi | 28 ++++++++++++++-------------- + 1 file changed, 14 insertions(+), 14 deletions(-) + +diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qcom/sm8250.dtsi +index 88e8f0437e938..21bbffc4e5a28 100644 +--- a/arch/arm64/boot/dts/qcom/sm8250.dtsi ++++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi +@@ -4121,20 +4121,20 @@ + "vfe_lite0", + "vfe_lite1"; + +- interrupts = , +- , +- , +- , +- , +- , +- , +- , +- , +- , +- , +- , +- , +- ; ++ interrupts = , ++ , ++ , ++ , ++ , ++ , ++ , ++ , ++ , ++ , ++ , ++ , ++ , ++ ; + interrupt-names = "csiphy0", + "csiphy1", + "csiphy2", +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sm8350-correct-sleep-clock-frequency.patch b/queue-6.6/arm64-dts-qcom-sm8350-correct-sleep-clock-frequency.patch new file mode 100644 index 0000000000..c86f7e3c91 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sm8350-correct-sleep-clock-frequency.patch @@ -0,0 +1,38 @@ +From f26fc3255da3d06dba79c1a71ab80ee197d0a40f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 12:17:13 +0200 +Subject: arm64: dts: qcom: sm8350: correct sleep clock frequency + +From: Dmitry Baryshkov + +[ Upstream commit f4cc8c75cfc5d06084a31da2ff67e477565f0cae ] + +The SM8350 platform uses PMK8350 to provide sleep clock. According to the +documentation, that clock has 32.7645 kHz frequency. Correct the sleep +clock definition. + +Fixes: b7e8f433a673 ("arm64: dts: qcom: Add basic devicetree support for SM8350 SoC") +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20241224-fix-board-clocks-v3-14-e9b08fbeadd3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sm8350.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/sm8350.dtsi b/arch/arm64/boot/dts/qcom/sm8350.dtsi +index d4f1b36c7aebe..dded95fa52f07 100644 +--- a/arch/arm64/boot/dts/qcom/sm8350.dtsi ++++ b/arch/arm64/boot/dts/qcom/sm8350.dtsi +@@ -40,7 +40,7 @@ + + sleep_clk: sleep-clk { + compatible = "fixed-clock"; +- clock-frequency = <32000>; ++ clock-frequency = <32764>; + #clock-cells = <0>; + }; + }; +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-qcom-sm8450-correct-sleep-clock-frequency.patch b/queue-6.6/arm64-dts-qcom-sm8450-correct-sleep-clock-frequency.patch new file mode 100644 index 0000000000..a216ea6230 --- /dev/null +++ b/queue-6.6/arm64-dts-qcom-sm8450-correct-sleep-clock-frequency.patch @@ -0,0 +1,38 @@ +From b8503d52c8031bb34524321e869188c19ea523f8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 12:17:14 +0200 +Subject: arm64: dts: qcom: sm8450: correct sleep clock frequency + +From: Dmitry Baryshkov + +[ Upstream commit c375ff3b887abf376607d4769c1114c5e3b6ea72 ] + +The SM8450 platform uses PMK8350 to provide sleep clock. According to the +documentation, that clock has 32.7645 kHz frequency. Correct the sleep +clock definition. + +Fixes: 5188049c9b36 ("arm64: dts: qcom: Add base SM8450 DTSI") +Signed-off-by: Dmitry Baryshkov +Link: https://lore.kernel.org/r/20241224-fix-board-clocks-v3-15-e9b08fbeadd3@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/qcom/sm8450.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/qcom/sm8450.dtsi b/arch/arm64/boot/dts/qcom/sm8450.dtsi +index a34f460240a07..007689d7f4fa2 100644 +--- a/arch/arm64/boot/dts/qcom/sm8450.dtsi ++++ b/arch/arm64/boot/dts/qcom/sm8450.dtsi +@@ -40,7 +40,7 @@ + sleep_clk: sleep-clk { + compatible = "fixed-clock"; + #clock-cells = <0>; +- clock-frequency = <32000>; ++ clock-frequency = <32764>; + }; + }; + +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-ti-k3-am62-remove-duplicate-gicr-reg.patch b/queue-6.6/arm64-dts-ti-k3-am62-remove-duplicate-gicr-reg.patch new file mode 100644 index 0000000000..4d73053247 --- /dev/null +++ b/queue-6.6/arm64-dts-ti-k3-am62-remove-duplicate-gicr-reg.patch @@ -0,0 +1,37 @@ +From 2fc0d4783f4a5dc45841c017a014d54d95b16823 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Dec 2024 14:59:24 -0600 +Subject: arm64: dts: ti: k3-am62: Remove duplicate GICR reg + +From: Bryan Brattlof + +[ Upstream commit 72c691d77ea5d0c4636fd3e9f0ad80d813c7d1a7 ] + +The GIC Redistributor control register range is mapped twice. Remove +the extra entry from the reg range. + +Fixes: f1d17330a5be ("arm64: dts: ti: Introduce base support for AM62x SoC") +Reported-by: Bin Liu +Signed-off-by: Bryan Brattlof +Link: https://lore.kernel.org/r/20241210-am62-gic-fixup-v1-1-758b4d5b4a0a@ti.com +Signed-off-by: Nishanth Menon +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/ti/k3-am62-main.dtsi | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/ti/k3-am62-main.dtsi b/arch/arm64/boot/dts/ti/k3-am62-main.dtsi +index a9b47ab92a02c..f156167b4e8a7 100644 +--- a/arch/arm64/boot/dts/ti/k3-am62-main.dtsi ++++ b/arch/arm64/boot/dts/ti/k3-am62-main.dtsi +@@ -23,7 +23,6 @@ + interrupt-controller; + reg = <0x00 0x01800000 0x00 0x10000>, /* GICD */ + <0x00 0x01880000 0x00 0xc0000>, /* GICR */ +- <0x00 0x01880000 0x00 0xc0000>, /* GICR */ + <0x01 0x00000000 0x00 0x2000>, /* GICC */ + <0x01 0x00010000 0x00 0x1000>, /* GICH */ + <0x01 0x00020000 0x00 0x2000>; /* GICV */ +-- +2.39.5 + diff --git a/queue-6.6/arm64-dts-ti-k3-am62a-remove-duplicate-gicr-reg.patch b/queue-6.6/arm64-dts-ti-k3-am62a-remove-duplicate-gicr-reg.patch new file mode 100644 index 0000000000..773a1ff390 --- /dev/null +++ b/queue-6.6/arm64-dts-ti-k3-am62a-remove-duplicate-gicr-reg.patch @@ -0,0 +1,37 @@ +From eeb121222f62345354195a8668f40dcd539e10a1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Dec 2024 14:59:25 -0600 +Subject: arm64: dts: ti: k3-am62a: Remove duplicate GICR reg + +From: Bryan Brattlof + +[ Upstream commit 6f0232577e260cdbc25508e27bb0b75ade7e7ebc ] + +The GIC Redistributor control range is mapped twice. Remove the extra +entry from the reg range. + +Fixes: 5fc6b1b62639 ("arm64: dts: ti: Introduce AM62A7 family of SoCs") +Reported-by: Bin Liu +Signed-off-by: Bryan Brattlof +Link: https://lore.kernel.org/r/20241210-am62-gic-fixup-v1-2-758b4d5b4a0a@ti.com +Signed-off-by: Nishanth Menon +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/ti/k3-am62a-main.dtsi | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/ti/k3-am62a-main.dtsi b/arch/arm64/boot/dts/ti/k3-am62a-main.dtsi +index de36abb243f10..1497f7c8adfaf 100644 +--- a/arch/arm64/boot/dts/ti/k3-am62a-main.dtsi ++++ b/arch/arm64/boot/dts/ti/k3-am62a-main.dtsi +@@ -18,7 +18,6 @@ + compatible = "arm,gic-v3"; + reg = <0x00 0x01800000 0x00 0x10000>, /* GICD */ + <0x00 0x01880000 0x00 0xc0000>, /* GICR */ +- <0x00 0x01880000 0x00 0xc0000>, /* GICR */ + <0x01 0x00000000 0x00 0x2000>, /* GICC */ + <0x01 0x00010000 0x00 0x1000>, /* GICH */ + <0x01 0x00020000 0x00 0x2000>; /* GICV */ +-- +2.39.5 + diff --git a/queue-6.6/arm64-tegra-fix-dma-id-for-spi2.patch b/queue-6.6/arm64-tegra-fix-dma-id-for-spi2.patch new file mode 100644 index 0000000000..ef3b74c826 --- /dev/null +++ b/queue-6.6/arm64-tegra-fix-dma-id-for-spi2.patch @@ -0,0 +1,36 @@ +From 194312bc3b9889df6340af3b8f9ccc78c1c0c590 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Dec 2024 16:22:00 +0530 +Subject: arm64: tegra: Fix DMA ID for SPI2 + +From: Akhil R + +[ Upstream commit 346bf459db26325c09ed841fdfd6678de1b1cb3a ] + +DMA ID for SPI2 is '16'. Update the incorrect value in the devicetree. + +Fixes: bb9667d8187b ("arm64: tegra: Add SPI device tree nodes for Tegra234") +Signed-off-by: Akhil R +Link: https://lore.kernel.org/r/20241206105201.53596-1-akhilrajeev@nvidia.com +Signed-off-by: Thierry Reding +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/nvidia/tegra234.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi +index ac69eacf8a6ba..be30072fb7471 100644 +--- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi ++++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi +@@ -1794,7 +1794,7 @@ + assigned-clock-parents = <&bpmp TEGRA234_CLK_PLLP_OUT0>; + resets = <&bpmp TEGRA234_RESET_SPI2>; + reset-names = "spi"; +- dmas = <&gpcdma 19>, <&gpcdma 19>; ++ dmas = <&gpcdma 16>, <&gpcdma 16>; + dma-names = "rx", "tx"; + dma-coherent; + status = "disabled"; +-- +2.39.5 + diff --git a/queue-6.6/asoc-intel-avs-abstract-ipc-handling.patch b/queue-6.6/asoc-intel-avs-abstract-ipc-handling.patch new file mode 100644 index 0000000000..e426254045 --- /dev/null +++ b/queue-6.6/asoc-intel-avs-abstract-ipc-handling.patch @@ -0,0 +1,295 @@ +From 3416faf5c40142a330b1d0346cb5b6eee84f149d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 20 Feb 2024 12:50:29 +0100 +Subject: ASoC: Intel: avs: Abstract IPC handling +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Cezary Rojewski + +[ Upstream commit 7576e2f4d99df6efabb77f52b9539fd345233aee ] + +Servicing IPCs on CNL platforms and onward differs from the existing +one. To make room for these, enrich platform descriptor with fields +representing crucial IPC registers and utilize them throughout the code. + +While cleaning up device descriptors, reduce the number of code lines by +assigning 'min_fw_version' within a single line. + +Reviewed-by: Amadeusz Sławiński +Signed-off-by: Cezary Rojewski +Link: https://msgid.link/r/20240220115035.770402-5-cezary.rojewski@intel.com +Signed-off-by: Mark Brown +Stable-dep-of: bca0fa5f6b5e ("ASoC: Intel: avs: Do not readq() u32 registers") +Signed-off-by: Sasha Levin +--- + sound/soc/intel/avs/avs.h | 22 ++++++++++++--- + sound/soc/intel/avs/core.c | 47 ++++++++++++++++++++------------- + sound/soc/intel/avs/ipc.c | 36 ++++++++++++++----------- + sound/soc/intel/avs/loader.c | 2 +- + sound/soc/intel/avs/registers.h | 6 ++--- + 5 files changed, 72 insertions(+), 41 deletions(-) + +diff --git a/sound/soc/intel/avs/avs.h b/sound/soc/intel/avs/avs.h +index fd394bb6479ba..1fd501a6a62d9 100644 +--- a/sound/soc/intel/avs/avs.h ++++ b/sound/soc/intel/avs/avs.h +@@ -73,6 +73,23 @@ extern const struct avs_dsp_ops avs_apl_dsp_ops; + #define avs_platattr_test(adev, attr) \ + ((adev)->spec->attributes & AVS_PLATATTR_##attr) + ++struct avs_sram_spec { ++ const u32 base_offset; ++ const u32 window_size; ++ const u32 rom_status_offset; ++}; ++ ++struct avs_hipc_spec { ++ const u32 req_offset; ++ const u32 req_ext_offset; ++ const u32 req_busy_mask; ++ const u32 ack_offset; ++ const u32 ack_done_mask; ++ const u32 rsp_offset; ++ const u32 rsp_busy_mask; ++ const u32 ctl_offset; ++}; ++ + /* Platform specific descriptor */ + struct avs_spec { + const char *name; +@@ -82,9 +99,8 @@ struct avs_spec { + + const u32 core_init_mask; /* used during DSP boot */ + const u64 attributes; /* bitmask of AVS_PLATATTR_* */ +- const u32 sram_base_offset; +- const u32 sram_window_size; +- const u32 rom_status; ++ const struct avs_sram_spec *sram; ++ const struct avs_hipc_spec *hipc; + }; + + struct avs_fw_entry { +diff --git a/sound/soc/intel/avs/core.c b/sound/soc/intel/avs/core.c +index 3a36c71bbd502..63e4356e8caf9 100644 +--- a/sound/soc/intel/avs/core.c ++++ b/sound/soc/intel/avs/core.c +@@ -712,36 +712,47 @@ static const struct dev_pm_ops avs_dev_pm = { + SET_RUNTIME_PM_OPS(avs_runtime_suspend, avs_runtime_resume, NULL) + }; + ++static const struct avs_sram_spec skl_sram_spec = { ++ .base_offset = SKL_ADSP_SRAM_BASE_OFFSET, ++ .window_size = SKL_ADSP_SRAM_WINDOW_SIZE, ++ .rom_status_offset = SKL_ADSP_SRAM_BASE_OFFSET, ++}; ++ ++static const struct avs_sram_spec apl_sram_spec = { ++ .base_offset = APL_ADSP_SRAM_BASE_OFFSET, ++ .window_size = APL_ADSP_SRAM_WINDOW_SIZE, ++ .rom_status_offset = APL_ADSP_SRAM_BASE_OFFSET, ++}; ++ ++static const struct avs_hipc_spec skl_hipc_spec = { ++ .req_offset = SKL_ADSP_REG_HIPCI, ++ .req_ext_offset = SKL_ADSP_REG_HIPCIE, ++ .req_busy_mask = SKL_ADSP_HIPCI_BUSY, ++ .ack_offset = SKL_ADSP_REG_HIPCIE, ++ .ack_done_mask = SKL_ADSP_HIPCIE_DONE, ++ .rsp_offset = SKL_ADSP_REG_HIPCT, ++ .rsp_busy_mask = SKL_ADSP_HIPCT_BUSY, ++ .ctl_offset = SKL_ADSP_REG_HIPCCTL, ++}; ++ + static const struct avs_spec skl_desc = { + .name = "skl", +- .min_fw_version = { +- .major = 9, +- .minor = 21, +- .hotfix = 0, +- .build = 4732, +- }, ++ .min_fw_version = { 9, 21, 0, 4732 }, + .dsp_ops = &avs_skl_dsp_ops, + .core_init_mask = 1, + .attributes = AVS_PLATATTR_CLDMA, +- .sram_base_offset = SKL_ADSP_SRAM_BASE_OFFSET, +- .sram_window_size = SKL_ADSP_SRAM_WINDOW_SIZE, +- .rom_status = SKL_ADSP_SRAM_BASE_OFFSET, ++ .sram = &skl_sram_spec, ++ .hipc = &skl_hipc_spec, + }; + + static const struct avs_spec apl_desc = { + .name = "apl", +- .min_fw_version = { +- .major = 9, +- .minor = 22, +- .hotfix = 1, +- .build = 4323, +- }, ++ .min_fw_version = { 9, 22, 1, 4323 }, + .dsp_ops = &avs_apl_dsp_ops, + .core_init_mask = 3, + .attributes = AVS_PLATATTR_IMR, +- .sram_base_offset = APL_ADSP_SRAM_BASE_OFFSET, +- .sram_window_size = APL_ADSP_SRAM_WINDOW_SIZE, +- .rom_status = APL_ADSP_SRAM_BASE_OFFSET, ++ .sram = &apl_sram_spec, ++ .hipc = &skl_hipc_spec, + }; + + static const struct pci_device_id avs_ids[] = { +diff --git a/sound/soc/intel/avs/ipc.c b/sound/soc/intel/avs/ipc.c +index bdf013c3dd12e..74f676fdfba29 100644 +--- a/sound/soc/intel/avs/ipc.c ++++ b/sound/soc/intel/avs/ipc.c +@@ -305,6 +305,7 @@ irqreturn_t avs_dsp_irq_handler(int irq, void *dev_id) + { + struct avs_dev *adev = dev_id; + struct avs_ipc *ipc = adev->ipc; ++ const struct avs_spec *const spec = adev->spec; + u32 adspis, hipc_rsp, hipc_ack; + irqreturn_t ret = IRQ_NONE; + +@@ -312,35 +313,35 @@ irqreturn_t avs_dsp_irq_handler(int irq, void *dev_id) + if (adspis == UINT_MAX || !(adspis & AVS_ADSP_ADSPIS_IPC)) + return ret; + +- hipc_ack = snd_hdac_adsp_readl(adev, SKL_ADSP_REG_HIPCIE); +- hipc_rsp = snd_hdac_adsp_readl(adev, SKL_ADSP_REG_HIPCT); ++ hipc_ack = snd_hdac_adsp_readl(adev, spec->hipc->ack_offset); ++ hipc_rsp = snd_hdac_adsp_readl(adev, spec->hipc->rsp_offset); + + /* DSP acked host's request */ +- if (hipc_ack & SKL_ADSP_HIPCIE_DONE) { ++ if (hipc_ack & spec->hipc->ack_done_mask) { + /* + * As an extra precaution, mask done interrupt. Code executed + * due to complete() found below does not assume any masking. + */ +- snd_hdac_adsp_updatel(adev, SKL_ADSP_REG_HIPCCTL, ++ snd_hdac_adsp_updatel(adev, spec->hipc->ctl_offset, + AVS_ADSP_HIPCCTL_DONE, 0); + + complete(&ipc->done_completion); + + /* tell DSP it has our attention */ +- snd_hdac_adsp_updatel(adev, SKL_ADSP_REG_HIPCIE, +- SKL_ADSP_HIPCIE_DONE, +- SKL_ADSP_HIPCIE_DONE); ++ snd_hdac_adsp_updatel(adev, spec->hipc->ack_offset, ++ spec->hipc->ack_done_mask, ++ spec->hipc->ack_done_mask); + /* unmask done interrupt */ +- snd_hdac_adsp_updatel(adev, SKL_ADSP_REG_HIPCCTL, ++ snd_hdac_adsp_updatel(adev, spec->hipc->ctl_offset, + AVS_ADSP_HIPCCTL_DONE, + AVS_ADSP_HIPCCTL_DONE); + ret = IRQ_HANDLED; + } + + /* DSP sent new response to process */ +- if (hipc_rsp & SKL_ADSP_HIPCT_BUSY) { ++ if (hipc_rsp & spec->hipc->rsp_busy_mask) { + /* mask busy interrupt */ +- snd_hdac_adsp_updatel(adev, SKL_ADSP_REG_HIPCCTL, ++ snd_hdac_adsp_updatel(adev, spec->hipc->ctl_offset, + AVS_ADSP_HIPCCTL_BUSY, 0); + + ret = IRQ_WAKE_THREAD; +@@ -379,10 +380,11 @@ irqreturn_t avs_dsp_irq_thread(int irq, void *dev_id) + static bool avs_ipc_is_busy(struct avs_ipc *ipc) + { + struct avs_dev *adev = to_avs_dev(ipc->dev); ++ const struct avs_spec *const spec = adev->spec; + u32 hipc_rsp; + +- hipc_rsp = snd_hdac_adsp_readl(adev, SKL_ADSP_REG_HIPCT); +- return hipc_rsp & SKL_ADSP_HIPCT_BUSY; ++ hipc_rsp = snd_hdac_adsp_readl(adev, spec->hipc->rsp_offset); ++ return hipc_rsp & spec->hipc->rsp_busy_mask; + } + + static int avs_ipc_wait_busy_completion(struct avs_ipc *ipc, int timeout) +@@ -440,9 +442,10 @@ static void avs_ipc_msg_init(struct avs_ipc *ipc, struct avs_ipc_msg *reply) + + static void avs_dsp_send_tx(struct avs_dev *adev, struct avs_ipc_msg *tx, bool read_fwregs) + { ++ const struct avs_spec *const spec = adev->spec; + u64 reg = ULONG_MAX; + +- tx->header |= SKL_ADSP_HIPCI_BUSY; ++ tx->header |= spec->hipc->req_busy_mask; + if (read_fwregs) + reg = readq(avs_sram_addr(adev, AVS_FW_REGS_WINDOW)); + +@@ -450,8 +453,8 @@ static void avs_dsp_send_tx(struct avs_dev *adev, struct avs_ipc_msg *tx, bool r + + if (tx->size) + memcpy_toio(avs_downlink_addr(adev), tx->data, tx->size); +- snd_hdac_adsp_writel(adev, SKL_ADSP_REG_HIPCIE, tx->header >> 32); +- snd_hdac_adsp_writel(adev, SKL_ADSP_REG_HIPCI, tx->header & UINT_MAX); ++ snd_hdac_adsp_writel(adev, spec->hipc->req_ext_offset, tx->header >> 32); ++ snd_hdac_adsp_writel(adev, spec->hipc->req_offset, tx->header & UINT_MAX); + } + + static int avs_dsp_do_send_msg(struct avs_dev *adev, struct avs_ipc_msg *request, +@@ -586,6 +589,7 @@ int avs_dsp_send_rom_msg(struct avs_dev *adev, struct avs_ipc_msg *request) + + void avs_dsp_interrupt_control(struct avs_dev *adev, bool enable) + { ++ const struct avs_spec *const spec = adev->spec; + u32 value, mask; + + /* +@@ -597,7 +601,7 @@ void avs_dsp_interrupt_control(struct avs_dev *adev, bool enable) + + mask = AVS_ADSP_HIPCCTL_DONE | AVS_ADSP_HIPCCTL_BUSY; + value = enable ? mask : 0; +- snd_hdac_adsp_updatel(adev, SKL_ADSP_REG_HIPCCTL, mask, value); ++ snd_hdac_adsp_updatel(adev, spec->hipc->ctl_offset, mask, value); + } + + int avs_ipc_init(struct avs_ipc *ipc, struct device *dev) +diff --git a/sound/soc/intel/avs/loader.c b/sound/soc/intel/avs/loader.c +index 56bb0a59249d5..fe0340c798efe 100644 +--- a/sound/soc/intel/avs/loader.c ++++ b/sound/soc/intel/avs/loader.c +@@ -306,7 +306,7 @@ avs_hda_init_rom(struct avs_dev *adev, unsigned int dma_id, bool purge) + } + + /* await ROM init */ +- ret = snd_hdac_adsp_readq_poll(adev, spec->rom_status, reg, ++ ret = snd_hdac_adsp_readq_poll(adev, spec->sram->rom_status_offset, reg, + (reg & 0xF) == AVS_ROM_INIT_DONE || + (reg & 0xF) == APL_ROM_FW_ENTERED, + AVS_ROM_INIT_POLLING_US, APL_ROM_INIT_TIMEOUT_US); +diff --git a/sound/soc/intel/avs/registers.h b/sound/soc/intel/avs/registers.h +index 2b464e466ed52..5c1dce46f71d8 100644 +--- a/sound/soc/intel/avs/registers.h ++++ b/sound/soc/intel/avs/registers.h +@@ -55,7 +55,7 @@ + #define APL_ADSP_SRAM_WINDOW_SIZE 0x20000 + + /* Constants used when accessing SRAM, space shared with firmware */ +-#define AVS_FW_REG_BASE(adev) ((adev)->spec->sram_base_offset) ++#define AVS_FW_REG_BASE(adev) ((adev)->spec->sram->base_offset) + #define AVS_FW_REG_STATUS(adev) (AVS_FW_REG_BASE(adev) + 0x0) + #define AVS_FW_REG_ERROR_CODE(adev) (AVS_FW_REG_BASE(adev) + 0x4) + +@@ -70,8 +70,8 @@ + + /* registry I/O helpers */ + #define avs_sram_offset(adev, window_idx) \ +- ((adev)->spec->sram_base_offset + \ +- (adev)->spec->sram_window_size * (window_idx)) ++ ((adev)->spec->sram->base_offset + \ ++ (adev)->spec->sram->window_size * (window_idx)) + + #define avs_sram_addr(adev, window_idx) \ + ((adev)->dsp_ba + avs_sram_offset(adev, window_idx)) +-- +2.39.5 + diff --git a/queue-6.6/asoc-intel-avs-do-not-readq-u32-registers.patch b/queue-6.6/asoc-intel-avs-do-not-readq-u32-registers.patch new file mode 100644 index 0000000000..fb90cebd77 --- /dev/null +++ b/queue-6.6/asoc-intel-avs-do-not-readq-u32-registers.patch @@ -0,0 +1,36 @@ +From e6433d7735fada5db138d2adf653997a0f487ea2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Jan 2025 13:22:04 +0100 +Subject: ASoC: Intel: avs: Do not readq() u32 registers + +From: Cezary Rojewski + +[ Upstream commit bca0fa5f6b5e96c03daac1ed62b1e5c5057a2048 ] + +Register reporting ROM status is 4-bytes wide. + +Fixes: 092cf7b26a48 ("ASoC: Intel: avs: Code loading over HDA") +Signed-off-by: Cezary Rojewski +Link: https://patch.msgid.link/20250109122216.3667847-2-cezary.rojewski@intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/intel/avs/loader.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/intel/avs/loader.c b/sound/soc/intel/avs/loader.c +index fe0340c798efe..5c4ae3927ed24 100644 +--- a/sound/soc/intel/avs/loader.c ++++ b/sound/soc/intel/avs/loader.c +@@ -306,7 +306,7 @@ avs_hda_init_rom(struct avs_dev *adev, unsigned int dma_id, bool purge) + } + + /* await ROM init */ +- ret = snd_hdac_adsp_readq_poll(adev, spec->sram->rom_status_offset, reg, ++ ret = snd_hdac_adsp_readl_poll(adev, spec->sram->rom_status_offset, reg, + (reg & 0xF) == AVS_ROM_INIT_DONE || + (reg & 0xF) == APL_ROM_FW_ENTERED, + AVS_ROM_INIT_POLLING_US, APL_ROM_INIT_TIMEOUT_US); +-- +2.39.5 + diff --git a/queue-6.6/asoc-intel-avs-fix-theoretical-infinite-loop.patch b/queue-6.6/asoc-intel-avs-fix-theoretical-infinite-loop.patch new file mode 100644 index 0000000000..7ab732bc94 --- /dev/null +++ b/queue-6.6/asoc-intel-avs-fix-theoretical-infinite-loop.patch @@ -0,0 +1,40 @@ +From a4f37bec7e73c2283d9a419c217fdc5c35976bd7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Jan 2025 13:22:06 +0100 +Subject: ASoC: Intel: avs: Fix theoretical infinite loop + +From: Cezary Rojewski + +[ Upstream commit cf4d74256fe103ece7b2647550e6c063048e5682 ] + +While 'stack_dump_size' is a u32 bitfield of 16 bits, u32 has a bigger +upper bound than the type u16 of loop counter 'offset' what in theory +may lead to infinite loop condition. + +Found out by Coverity static analyzer. + +Fixes: c8c960c10971 ("ASoC: Intel: avs: APL-based platforms support") +Signed-off-by: Cezary Rojewski +Link: https://patch.msgid.link/20250109122216.3667847-4-cezary.rojewski@intel.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/intel/avs/apl.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/sound/soc/intel/avs/apl.c b/sound/soc/intel/avs/apl.c +index 24c06568b3e82..25c389632db4f 100644 +--- a/sound/soc/intel/avs/apl.c ++++ b/sound/soc/intel/avs/apl.c +@@ -107,7 +107,7 @@ static int avs_apl_coredump(struct avs_dev *adev, union avs_notify_msg *msg) + struct avs_apl_log_buffer_layout layout; + void __iomem *addr, *buf; + size_t dump_size; +- u16 offset = 0; ++ u32 offset = 0; + u8 *dump, *pos; + + dump_size = AVS_FW_REGS_SIZE + msg->ext.coredump.stack_dump_size; +-- +2.39.5 + diff --git a/queue-6.6/asoc-intel-avs-prefix-skl-apl-specific-members.patch b/queue-6.6/asoc-intel-avs-prefix-skl-apl-specific-members.patch new file mode 100644 index 0000000000..cd13c5707e --- /dev/null +++ b/queue-6.6/asoc-intel-avs-prefix-skl-apl-specific-members.patch @@ -0,0 +1,375 @@ +From 542e3d5aca7e6aee9d26efd5abae4158462cce39 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 20 Feb 2024 12:50:28 +0100 +Subject: ASoC: Intel: avs: Prefix SKL/APL-specific members +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Cezary Rojewski + +[ Upstream commit a8f858d98f016a0209edaf1518fd45a5e5c62d47 ] + +Prefix members that are platform-specific with 'avs_' to improve code +cohesiveness and reduce the chance for naming-conflics with other +drivers. + +Reviewed-by: Amadeusz Sławiński +Signed-off-by: Cezary Rojewski +Link: https://msgid.link/r/20240220115035.770402-4-cezary.rojewski@intel.com +Signed-off-by: Mark Brown +Stable-dep-of: bca0fa5f6b5e ("ASoC: Intel: avs: Do not readq() u32 registers") +Signed-off-by: Sasha Levin +--- + sound/soc/intel/avs/apl.c | 51 +++++++++++++++++----------------- + sound/soc/intel/avs/avs.h | 18 ++++++------ + sound/soc/intel/avs/core.c | 4 +-- + sound/soc/intel/avs/messages.h | 10 +++---- + sound/soc/intel/avs/skl.c | 30 ++++++++++---------- + 5 files changed, 56 insertions(+), 57 deletions(-) + +diff --git a/sound/soc/intel/avs/apl.c b/sound/soc/intel/avs/apl.c +index 1860099c782a7..24c06568b3e82 100644 +--- a/sound/soc/intel/avs/apl.c ++++ b/sound/soc/intel/avs/apl.c +@@ -14,10 +14,10 @@ + #include "topology.h" + + static int __maybe_unused +-apl_enable_logs(struct avs_dev *adev, enum avs_log_enable enable, u32 aging_period, +- u32 fifo_full_period, unsigned long resource_mask, u32 *priorities) ++avs_apl_enable_logs(struct avs_dev *adev, enum avs_log_enable enable, u32 aging_period, ++ u32 fifo_full_period, unsigned long resource_mask, u32 *priorities) + { +- struct apl_log_state_info *info; ++ struct avs_apl_log_state_info *info; + u32 size, num_cores = adev->hw_cfg.dsp_cores; + int ret, i; + +@@ -48,9 +48,9 @@ apl_enable_logs(struct avs_dev *adev, enum avs_log_enable enable, u32 aging_peri + return 0; + } + +-static int apl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg) ++static int avs_apl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg) + { +- struct apl_log_buffer_layout layout; ++ struct avs_apl_log_buffer_layout layout; + void __iomem *addr, *buf; + + addr = avs_log_buffer_addr(adev, msg->log.core); +@@ -63,11 +63,11 @@ static int apl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg + /* consume the logs regardless of consumer presence */ + goto update_read_ptr; + +- buf = apl_log_payload_addr(addr); ++ buf = avs_apl_log_payload_addr(addr); + + if (layout.read_ptr > layout.write_ptr) { + avs_dump_fw_log(adev, buf + layout.read_ptr, +- apl_log_payload_size(adev) - layout.read_ptr); ++ avs_apl_log_payload_size(adev) - layout.read_ptr); + layout.read_ptr = 0; + } + avs_dump_fw_log_wakeup(adev, buf + layout.read_ptr, layout.write_ptr - layout.read_ptr); +@@ -77,7 +77,8 @@ static int apl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg + return 0; + } + +-static int apl_wait_log_entry(struct avs_dev *adev, u32 core, struct apl_log_buffer_layout *layout) ++static int avs_apl_wait_log_entry(struct avs_dev *adev, u32 core, ++ struct avs_apl_log_buffer_layout *layout) + { + unsigned long timeout; + void __iomem *addr; +@@ -99,11 +100,11 @@ static int apl_wait_log_entry(struct avs_dev *adev, u32 core, struct apl_log_buf + } + + /* reads log header and tests its type */ +-#define apl_is_entry_stackdump(addr) ((readl(addr) >> 30) & 0x1) ++#define avs_apl_is_entry_stackdump(addr) ((readl(addr) >> 30) & 0x1) + +-static int apl_coredump(struct avs_dev *adev, union avs_notify_msg *msg) ++static int avs_apl_coredump(struct avs_dev *adev, union avs_notify_msg *msg) + { +- struct apl_log_buffer_layout layout; ++ struct avs_apl_log_buffer_layout layout; + void __iomem *addr, *buf; + size_t dump_size; + u16 offset = 0; +@@ -124,9 +125,9 @@ static int apl_coredump(struct avs_dev *adev, union avs_notify_msg *msg) + if (!addr) + goto exit; + +- buf = apl_log_payload_addr(addr); ++ buf = avs_apl_log_payload_addr(addr); + memcpy_fromio(&layout, addr, sizeof(layout)); +- if (!apl_is_entry_stackdump(buf + layout.read_ptr)) { ++ if (!avs_apl_is_entry_stackdump(buf + layout.read_ptr)) { + union avs_notify_msg lbs_msg = AVS_NOTIFICATION(LOG_BUFFER_STATUS); + + /* +@@ -142,11 +143,11 @@ static int apl_coredump(struct avs_dev *adev, union avs_notify_msg *msg) + do { + u32 count; + +- if (apl_wait_log_entry(adev, msg->ext.coredump.core_id, &layout)) ++ if (avs_apl_wait_log_entry(adev, msg->ext.coredump.core_id, &layout)) + break; + + if (layout.read_ptr > layout.write_ptr) { +- count = apl_log_payload_size(adev) - layout.read_ptr; ++ count = avs_apl_log_payload_size(adev) - layout.read_ptr; + memcpy_fromio(pos + offset, buf + layout.read_ptr, count); + layout.read_ptr = 0; + offset += count; +@@ -165,7 +166,7 @@ static int apl_coredump(struct avs_dev *adev, union avs_notify_msg *msg) + return 0; + } + +-static bool apl_lp_streaming(struct avs_dev *adev) ++static bool avs_apl_lp_streaming(struct avs_dev *adev) + { + struct avs_path *path; + +@@ -201,7 +202,7 @@ static bool apl_lp_streaming(struct avs_dev *adev) + return true; + } + +-static bool apl_d0ix_toggle(struct avs_dev *adev, struct avs_ipc_msg *tx, bool wake) ++static bool avs_apl_d0ix_toggle(struct avs_dev *adev, struct avs_ipc_msg *tx, bool wake) + { + /* wake in all cases */ + if (wake) +@@ -215,10 +216,10 @@ static bool apl_d0ix_toggle(struct avs_dev *adev, struct avs_ipc_msg *tx, bool w + * Note: for cAVS 1.5+ and 1.8, D0IX is LP-firmware transition, + * not the power-gating mechanism known from cAVS 2.0. + */ +- return apl_lp_streaming(adev); ++ return avs_apl_lp_streaming(adev); + } + +-static int apl_set_d0ix(struct avs_dev *adev, bool enable) ++static int avs_apl_set_d0ix(struct avs_dev *adev, bool enable) + { + bool streaming = false; + int ret; +@@ -231,7 +232,7 @@ static int apl_set_d0ix(struct avs_dev *adev, bool enable) + return AVS_IPC_RET(ret); + } + +-const struct avs_dsp_ops apl_dsp_ops = { ++const struct avs_dsp_ops avs_apl_dsp_ops = { + .power = avs_dsp_core_power, + .reset = avs_dsp_core_reset, + .stall = avs_dsp_core_stall, +@@ -241,10 +242,10 @@ const struct avs_dsp_ops apl_dsp_ops = { + .load_basefw = avs_hda_load_basefw, + .load_lib = avs_hda_load_library, + .transfer_mods = avs_hda_transfer_modules, +- .log_buffer_offset = skl_log_buffer_offset, +- .log_buffer_status = apl_log_buffer_status, +- .coredump = apl_coredump, +- .d0ix_toggle = apl_d0ix_toggle, +- .set_d0ix = apl_set_d0ix, ++ .log_buffer_offset = avs_skl_log_buffer_offset, ++ .log_buffer_status = avs_apl_log_buffer_status, ++ .coredump = avs_apl_coredump, ++ .d0ix_toggle = avs_apl_d0ix_toggle, ++ .set_d0ix = avs_apl_set_d0ix, + AVS_SET_ENABLE_LOGS_OP(apl) + }; +diff --git a/sound/soc/intel/avs/avs.h b/sound/soc/intel/avs/avs.h +index 0cf38c9e768e7..fd394bb6479ba 100644 +--- a/sound/soc/intel/avs/avs.h ++++ b/sound/soc/intel/avs/avs.h +@@ -64,8 +64,8 @@ struct avs_dsp_ops { + #define avs_dsp_op(adev, op, ...) \ + ((adev)->spec->dsp_ops->op(adev, ## __VA_ARGS__)) + +-extern const struct avs_dsp_ops skl_dsp_ops; +-extern const struct avs_dsp_ops apl_dsp_ops; ++extern const struct avs_dsp_ops avs_skl_dsp_ops; ++extern const struct avs_dsp_ops avs_apl_dsp_ops; + + #define AVS_PLATATTR_CLDMA BIT_ULL(0) + #define AVS_PLATATTR_IMR BIT_ULL(1) +@@ -264,7 +264,7 @@ void avs_ipc_block(struct avs_ipc *ipc); + int avs_dsp_disable_d0ix(struct avs_dev *adev); + int avs_dsp_enable_d0ix(struct avs_dev *adev); + +-int skl_log_buffer_offset(struct avs_dev *adev, u32 core); ++int avs_skl_log_buffer_offset(struct avs_dev *adev, u32 core); + + /* Firmware resources management */ + +@@ -358,21 +358,21 @@ static inline int avs_log_buffer_status_locked(struct avs_dev *adev, union avs_n + return ret; + } + +-struct apl_log_buffer_layout { ++struct avs_apl_log_buffer_layout { + u32 read_ptr; + u32 write_ptr; + u8 buffer[]; + } __packed; + +-#define apl_log_payload_size(adev) \ +- (avs_log_buffer_size(adev) - sizeof(struct apl_log_buffer_layout)) ++#define avs_apl_log_payload_size(adev) \ ++ (avs_log_buffer_size(adev) - sizeof(struct avs_apl_log_buffer_layout)) + +-#define apl_log_payload_addr(addr) \ +- (addr + sizeof(struct apl_log_buffer_layout)) ++#define avs_apl_log_payload_addr(addr) \ ++ (addr + sizeof(struct avs_apl_log_buffer_layout)) + + #ifdef CONFIG_DEBUG_FS + #define AVS_SET_ENABLE_LOGS_OP(name) \ +- .enable_logs = name##_enable_logs ++ .enable_logs = avs_##name##_enable_logs + + bool avs_logging_fw(struct avs_dev *adev); + void avs_dump_fw_log(struct avs_dev *adev, const void __iomem *src, unsigned int len); +diff --git a/sound/soc/intel/avs/core.c b/sound/soc/intel/avs/core.c +index 859b217fc761b..3a36c71bbd502 100644 +--- a/sound/soc/intel/avs/core.c ++++ b/sound/soc/intel/avs/core.c +@@ -720,7 +720,7 @@ static const struct avs_spec skl_desc = { + .hotfix = 0, + .build = 4732, + }, +- .dsp_ops = &skl_dsp_ops, ++ .dsp_ops = &avs_skl_dsp_ops, + .core_init_mask = 1, + .attributes = AVS_PLATATTR_CLDMA, + .sram_base_offset = SKL_ADSP_SRAM_BASE_OFFSET, +@@ -736,7 +736,7 @@ static const struct avs_spec apl_desc = { + .hotfix = 1, + .build = 4323, + }, +- .dsp_ops = &apl_dsp_ops, ++ .dsp_ops = &avs_apl_dsp_ops, + .core_init_mask = 3, + .attributes = AVS_PLATATTR_IMR, + .sram_base_offset = APL_ADSP_SRAM_BASE_OFFSET, +diff --git a/sound/soc/intel/avs/messages.h b/sound/soc/intel/avs/messages.h +index 7f23a304b4a94..9540401b093c1 100644 +--- a/sound/soc/intel/avs/messages.h ++++ b/sound/soc/intel/avs/messages.h +@@ -357,21 +357,21 @@ enum avs_skl_log_priority { + AVS_SKL_LOG_VERBOSE, + }; + +-struct skl_log_state { ++struct avs_skl_log_state { + u32 enable; + u32 min_priority; + } __packed; + +-struct skl_log_state_info { ++struct avs_skl_log_state_info { + u32 core_mask; +- struct skl_log_state logs_core[]; ++ struct avs_skl_log_state logs_core[]; + } __packed; + +-struct apl_log_state_info { ++struct avs_apl_log_state_info { + u32 aging_timer_period; + u32 fifo_full_timer_period; + u32 core_mask; +- struct skl_log_state logs_core[]; ++ struct avs_skl_log_state logs_core[]; + } __packed; + + int avs_ipc_set_enable_logs(struct avs_dev *adev, u8 *log_info, size_t size); +diff --git a/sound/soc/intel/avs/skl.c b/sound/soc/intel/avs/skl.c +index 6bb8bbc70442b..7ea8d91b54d2e 100644 +--- a/sound/soc/intel/avs/skl.c ++++ b/sound/soc/intel/avs/skl.c +@@ -13,10 +13,10 @@ + #include "messages.h" + + static int __maybe_unused +-skl_enable_logs(struct avs_dev *adev, enum avs_log_enable enable, u32 aging_period, +- u32 fifo_full_period, unsigned long resource_mask, u32 *priorities) ++avs_skl_enable_logs(struct avs_dev *adev, enum avs_log_enable enable, u32 aging_period, ++ u32 fifo_full_period, unsigned long resource_mask, u32 *priorities) + { +- struct skl_log_state_info *info; ++ struct avs_skl_log_state_info *info; + u32 size, num_cores = adev->hw_cfg.dsp_cores; + int ret, i; + +@@ -45,7 +45,7 @@ skl_enable_logs(struct avs_dev *adev, enum avs_log_enable enable, u32 aging_peri + return 0; + } + +-int skl_log_buffer_offset(struct avs_dev *adev, u32 core) ++int avs_skl_log_buffer_offset(struct avs_dev *adev, u32 core) + { + return core * avs_log_buffer_size(adev); + } +@@ -53,8 +53,7 @@ int skl_log_buffer_offset(struct avs_dev *adev, u32 core) + /* fw DbgLogWp registers */ + #define FW_REGS_DBG_LOG_WP(core) (0x30 + 0x4 * core) + +-static int +-skl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg) ++static int avs_skl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg) + { + void __iomem *buf; + u16 size, write, offset; +@@ -74,7 +73,7 @@ skl_log_buffer_status(struct avs_dev *adev, union avs_notify_msg *msg) + return 0; + } + +-static int skl_coredump(struct avs_dev *adev, union avs_notify_msg *msg) ++static int avs_skl_coredump(struct avs_dev *adev, union avs_notify_msg *msg) + { + u8 *dump; + +@@ -88,20 +87,19 @@ static int skl_coredump(struct avs_dev *adev, union avs_notify_msg *msg) + return 0; + } + +-static bool +-skl_d0ix_toggle(struct avs_dev *adev, struct avs_ipc_msg *tx, bool wake) ++static bool avs_skl_d0ix_toggle(struct avs_dev *adev, struct avs_ipc_msg *tx, bool wake) + { + /* unsupported on cAVS 1.5 hw */ + return false; + } + +-static int skl_set_d0ix(struct avs_dev *adev, bool enable) ++static int avs_skl_set_d0ix(struct avs_dev *adev, bool enable) + { + /* unsupported on cAVS 1.5 hw */ + return 0; + } + +-const struct avs_dsp_ops skl_dsp_ops = { ++const struct avs_dsp_ops avs_skl_dsp_ops = { + .power = avs_dsp_core_power, + .reset = avs_dsp_core_reset, + .stall = avs_dsp_core_stall, +@@ -111,10 +109,10 @@ const struct avs_dsp_ops skl_dsp_ops = { + .load_basefw = avs_cldma_load_basefw, + .load_lib = avs_cldma_load_library, + .transfer_mods = avs_cldma_transfer_modules, +- .log_buffer_offset = skl_log_buffer_offset, +- .log_buffer_status = skl_log_buffer_status, +- .coredump = skl_coredump, +- .d0ix_toggle = skl_d0ix_toggle, +- .set_d0ix = skl_set_d0ix, ++ .log_buffer_offset = avs_skl_log_buffer_offset, ++ .log_buffer_status = avs_skl_log_buffer_status, ++ .coredump = avs_skl_coredump, ++ .d0ix_toggle = avs_skl_d0ix_toggle, ++ .set_d0ix = avs_skl_set_d0ix, + AVS_SET_ENABLE_LOGS_OP(skl) + }; +-- +2.39.5 + diff --git a/queue-6.6/asoc-renesas-rz-ssi-use-only-the-proper-amount-of-di.patch b/queue-6.6/asoc-renesas-rz-ssi-use-only-the-proper-amount-of-di.patch new file mode 100644 index 0000000000..888d7f768b --- /dev/null +++ b/queue-6.6/asoc-renesas-rz-ssi-use-only-the-proper-amount-of-di.patch @@ -0,0 +1,41 @@ +From f80b4d874b7c7a9eebc40e92de9b177f501d5378 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Dec 2024 19:09:34 +0200 +Subject: ASoC: renesas: rz-ssi: Use only the proper amount of dividers + +From: Claudiu Beznea + +[ Upstream commit 55c209cd4318c701e6e88e0b2512a0f12dd02a7d ] + +There is no need to populate the ckdv[] with invalid dividers as that +part will not be indexed anyway. The ssi->audio_mck/bclk_rate should +always be >= 0. While at it, change the ckdv type as u8, as the divider +128 was previously using the s8 sign bit. + +Signed-off-by: Claudiu Beznea +Fixes: 03e786bd43410fa9 ("ASoC: sh: Add RZ/G2L SSIF-2 driver") +Reviewed-by: Geert Uytterhoeven +Link: https://patch.msgid.link/20241210170953.2936724-6-claudiu.beznea.uj@bp.renesas.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/sh/rz-ssi.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/sound/soc/sh/rz-ssi.c b/sound/soc/sh/rz-ssi.c +index 1588b93cc35d0..353863f49b313 100644 +--- a/sound/soc/sh/rz-ssi.c ++++ b/sound/soc/sh/rz-ssi.c +@@ -245,8 +245,7 @@ static void rz_ssi_stream_quit(struct rz_ssi_priv *ssi, + static int rz_ssi_clk_setup(struct rz_ssi_priv *ssi, unsigned int rate, + unsigned int channels) + { +- static s8 ckdv[16] = { 1, 2, 4, 8, 16, 32, 64, 128, +- 6, 12, 24, 48, 96, -1, -1, -1 }; ++ static u8 ckdv[] = { 1, 2, 4, 8, 16, 32, 64, 128, 6, 12, 24, 48, 96 }; + unsigned int channel_bits = 32; /* System Word Length */ + unsigned long bclk_rate = rate * channels * channel_bits; + unsigned int div; +-- +2.39.5 + diff --git a/queue-6.6/asoc-sun4i-spdif-add-clock-multiplier-settings.patch b/queue-6.6/asoc-sun4i-spdif-add-clock-multiplier-settings.patch new file mode 100644 index 0000000000..6a384324a0 --- /dev/null +++ b/queue-6.6/asoc-sun4i-spdif-add-clock-multiplier-settings.patch @@ -0,0 +1,86 @@ +From 8cc91a01b4a1bce2c48929abbe579c85b7bfaffe Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Nov 2024 17:55:29 +0100 +Subject: ASoC: sun4i-spdif: Add clock multiplier settings + +From: George Lander + +[ Upstream commit 0a2319308de88b9e819c0b43d0fccd857123eb31 ] + +There have been intermittent issues with the SPDIF output on H3 +and H2+ devices which has been fixed by setting the s_clk to 4 +times the audio pll. +Add a quirk for the clock multiplier as not every supported SoC +requires it. Without the multiplier, the audio at normal sampling +rates was distorted and did not play at higher sampling rates. + +Fixes: 1bd92af877ab ("ASoC: sun4i-spdif: Add support for the H3 SoC") +Signed-off-by: George Lander +Signed-off-by: Marcus Cooper +Link: https://patch.msgid.link/20241111165600.57219-2-codekipper@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/sunxi/sun4i-spdif.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/sound/soc/sunxi/sun4i-spdif.c b/sound/soc/sunxi/sun4i-spdif.c +index 2347aeb049bcc..e482238388de1 100644 +--- a/sound/soc/sunxi/sun4i-spdif.c ++++ b/sound/soc/sunxi/sun4i-spdif.c +@@ -177,6 +177,7 @@ struct sun4i_spdif_quirks { + unsigned int reg_dac_txdata; + bool has_reset; + unsigned int val_fctl_ftx; ++ unsigned int mclk_multiplier; + }; + + struct sun4i_spdif_dev { +@@ -314,6 +315,7 @@ static int sun4i_spdif_hw_params(struct snd_pcm_substream *substream, + default: + return -EINVAL; + } ++ mclk *= host->quirks->mclk_multiplier; + + ret = clk_set_rate(host->spdif_clk, mclk); + if (ret < 0) { +@@ -348,6 +350,7 @@ static int sun4i_spdif_hw_params(struct snd_pcm_substream *substream, + default: + return -EINVAL; + } ++ mclk_div *= host->quirks->mclk_multiplier; + + reg_val = 0; + reg_val |= SUN4I_SPDIF_TXCFG_ASS; +@@ -541,24 +544,28 @@ static struct snd_soc_dai_driver sun4i_spdif_dai = { + static const struct sun4i_spdif_quirks sun4i_a10_spdif_quirks = { + .reg_dac_txdata = SUN4I_SPDIF_TXFIFO, + .val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX, ++ .mclk_multiplier = 1, + }; + + static const struct sun4i_spdif_quirks sun6i_a31_spdif_quirks = { + .reg_dac_txdata = SUN4I_SPDIF_TXFIFO, + .val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX, + .has_reset = true, ++ .mclk_multiplier = 1, + }; + + static const struct sun4i_spdif_quirks sun8i_h3_spdif_quirks = { + .reg_dac_txdata = SUN8I_SPDIF_TXFIFO, + .val_fctl_ftx = SUN4I_SPDIF_FCTL_FTX, + .has_reset = true, ++ .mclk_multiplier = 4, + }; + + static const struct sun4i_spdif_quirks sun50i_h6_spdif_quirks = { + .reg_dac_txdata = SUN8I_SPDIF_TXFIFO, + .val_fctl_ftx = SUN50I_H6_SPDIF_FCTL_FTX, + .has_reset = true, ++ .mclk_multiplier = 1, + }; + + static const struct of_device_id sun4i_spdif_of_match[] = { +-- +2.39.5 + diff --git a/queue-6.6/ax25-rcu-protect-dev-ax25_ptr.patch b/queue-6.6/ax25-rcu-protect-dev-ax25_ptr.patch new file mode 100644 index 0000000000..de3efe4a15 --- /dev/null +++ b/queue-6.6/ax25-rcu-protect-dev-ax25_ptr.patch @@ -0,0 +1,340 @@ +From 66b24035551abbcc3e7d9e6c07e7cce591769eaa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Jan 2025 21:05:14 +0000 +Subject: ax25: rcu protect dev->ax25_ptr + +From: Eric Dumazet + +[ Upstream commit 95fc45d1dea8e1253f8ec58abc5befb71553d666 ] + +syzbot found a lockdep issue [1]. + +We should remove ax25 RTNL dependency in ax25_setsockopt() + +This should also fix a variety of possible UAF in ax25. + +[1] + +WARNING: possible circular locking dependency detected +6.13.0-rc3-syzkaller-00762-g9268abe611b0 #0 Not tainted +------------------------------------------------------ +syz.5.1818/12806 is trying to acquire lock: + ffffffff8fcb3988 (rtnl_mutex){+.+.}-{4:4}, at: ax25_setsockopt+0xa55/0xe90 net/ax25/af_ax25.c:680 + +but task is already holding lock: + ffff8880617ac258 (sk_lock-AF_AX25){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1618 [inline] + ffff8880617ac258 (sk_lock-AF_AX25){+.+.}-{0:0}, at: ax25_setsockopt+0x209/0xe90 net/ax25/af_ax25.c:574 + +which lock already depends on the new lock. + +the existing dependency chain (in reverse order) is: + +-> #1 (sk_lock-AF_AX25){+.+.}-{0:0}: + lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849 + lock_sock_nested+0x48/0x100 net/core/sock.c:3642 + lock_sock include/net/sock.h:1618 [inline] + ax25_kill_by_device net/ax25/af_ax25.c:101 [inline] + ax25_device_event+0x24d/0x580 net/ax25/af_ax25.c:146 + notifier_call_chain+0x1a5/0x3f0 kernel/notifier.c:85 + __dev_notify_flags+0x207/0x400 + dev_change_flags+0xf0/0x1a0 net/core/dev.c:9026 + dev_ifsioc+0x7c8/0xe70 net/core/dev_ioctl.c:563 + dev_ioctl+0x719/0x1340 net/core/dev_ioctl.c:820 + sock_do_ioctl+0x240/0x460 net/socket.c:1234 + sock_ioctl+0x626/0x8e0 net/socket.c:1339 + vfs_ioctl fs/ioctl.c:51 [inline] + __do_sys_ioctl fs/ioctl.c:906 [inline] + __se_sys_ioctl+0xf5/0x170 fs/ioctl.c:892 + do_syscall_x64 arch/x86/entry/common.c:52 [inline] + do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 + entry_SYSCALL_64_after_hwframe+0x77/0x7f + +-> #0 (rtnl_mutex){+.+.}-{4:4}: + check_prev_add kernel/locking/lockdep.c:3161 [inline] + check_prevs_add kernel/locking/lockdep.c:3280 [inline] + validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904 + __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5226 + lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849 + __mutex_lock_common kernel/locking/mutex.c:585 [inline] + __mutex_lock+0x1ac/0xee0 kernel/locking/mutex.c:735 + ax25_setsockopt+0xa55/0xe90 net/ax25/af_ax25.c:680 + do_sock_setsockopt+0x3af/0x720 net/socket.c:2324 + __sys_setsockopt net/socket.c:2349 [inline] + __do_sys_setsockopt net/socket.c:2355 [inline] + __se_sys_setsockopt net/socket.c:2352 [inline] + __x64_sys_setsockopt+0x1ee/0x280 net/socket.c:2352 + do_syscall_x64 arch/x86/entry/common.c:52 [inline] + do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 + entry_SYSCALL_64_after_hwframe+0x77/0x7f + +other info that might help us debug this: + + Possible unsafe locking scenario: + + CPU0 CPU1 + ---- ---- + lock(sk_lock-AF_AX25); + lock(rtnl_mutex); + lock(sk_lock-AF_AX25); + lock(rtnl_mutex); + + *** DEADLOCK *** + +1 lock held by syz.5.1818/12806: + #0: ffff8880617ac258 (sk_lock-AF_AX25){+.+.}-{0:0}, at: lock_sock include/net/sock.h:1618 [inline] + #0: ffff8880617ac258 (sk_lock-AF_AX25){+.+.}-{0:0}, at: ax25_setsockopt+0x209/0xe90 net/ax25/af_ax25.c:574 + +stack backtrace: +CPU: 1 UID: 0 PID: 12806 Comm: syz.5.1818 Not tainted 6.13.0-rc3-syzkaller-00762-g9268abe611b0 #0 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 +Call Trace: + + __dump_stack lib/dump_stack.c:94 [inline] + dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 + print_circular_bug+0x13a/0x1b0 kernel/locking/lockdep.c:2074 + check_noncircular+0x36a/0x4a0 kernel/locking/lockdep.c:2206 + check_prev_add kernel/locking/lockdep.c:3161 [inline] + check_prevs_add kernel/locking/lockdep.c:3280 [inline] + validate_chain+0x18ef/0x5920 kernel/locking/lockdep.c:3904 + __lock_acquire+0x1397/0x2100 kernel/locking/lockdep.c:5226 + lock_acquire+0x1ed/0x550 kernel/locking/lockdep.c:5849 + __mutex_lock_common kernel/locking/mutex.c:585 [inline] + __mutex_lock+0x1ac/0xee0 kernel/locking/mutex.c:735 + ax25_setsockopt+0xa55/0xe90 net/ax25/af_ax25.c:680 + do_sock_setsockopt+0x3af/0x720 net/socket.c:2324 + __sys_setsockopt net/socket.c:2349 [inline] + __do_sys_setsockopt net/socket.c:2355 [inline] + __se_sys_setsockopt net/socket.c:2352 [inline] + __x64_sys_setsockopt+0x1ee/0x280 net/socket.c:2352 + do_syscall_x64 arch/x86/entry/common.c:52 [inline] + do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 + entry_SYSCALL_64_after_hwframe+0x77/0x7f +RIP: 0033:0x7f7b62385d29 + +Fixes: c433570458e4 ("ax25: fix a use-after-free in ax25_fillin_cb()") +Reported-by: syzbot +Signed-off-by: Eric Dumazet +Reviewed-by: Kuniyuki Iwashima +Link: https://patch.msgid.link/20250103210514.87290-1-edumazet@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + include/linux/netdevice.h | 2 +- + include/net/ax25.h | 10 +++++----- + net/ax25/af_ax25.c | 12 ++++++------ + net/ax25/ax25_dev.c | 4 ++-- + net/ax25/ax25_ip.c | 3 ++- + net/ax25/ax25_out.c | 22 +++++++++++++++++----- + net/ax25/ax25_route.c | 2 ++ + 7 files changed, 35 insertions(+), 20 deletions(-) + +diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h +index 1576e7443eee5..8b5121eb8757e 100644 +--- a/include/linux/netdevice.h ++++ b/include/linux/netdevice.h +@@ -2217,7 +2217,7 @@ struct net_device { + void *atalk_ptr; + #endif + #if IS_ENABLED(CONFIG_AX25) +- void *ax25_ptr; ++ struct ax25_dev __rcu *ax25_ptr; + #endif + #if IS_ENABLED(CONFIG_CFG80211) + struct wireless_dev *ieee80211_ptr; +diff --git a/include/net/ax25.h b/include/net/ax25.h +index c2a85fd3f5ea4..ef79023f1a286 100644 +--- a/include/net/ax25.h ++++ b/include/net/ax25.h +@@ -229,6 +229,7 @@ typedef struct ax25_dev { + #endif + refcount_t refcount; + bool device_up; ++ struct rcu_head rcu; + } ax25_dev; + + typedef struct ax25_cb { +@@ -288,9 +289,8 @@ static inline void ax25_dev_hold(ax25_dev *ax25_dev) + + static inline void ax25_dev_put(ax25_dev *ax25_dev) + { +- if (refcount_dec_and_test(&ax25_dev->refcount)) { +- kfree(ax25_dev); +- } ++ if (refcount_dec_and_test(&ax25_dev->refcount)) ++ kfree_rcu(ax25_dev, rcu); + } + static inline __be16 ax25_type_trans(struct sk_buff *skb, struct net_device *dev) + { +@@ -333,9 +333,9 @@ void ax25_digi_invert(const ax25_digi *, ax25_digi *); + extern spinlock_t ax25_dev_lock; + + #if IS_ENABLED(CONFIG_AX25) +-static inline ax25_dev *ax25_dev_ax25dev(struct net_device *dev) ++static inline ax25_dev *ax25_dev_ax25dev(const struct net_device *dev) + { +- return dev->ax25_ptr; ++ return rcu_dereference_rtnl(dev->ax25_ptr); + } + #endif + +diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c +index 26a3095bec462..0f66dd8715bd8 100644 +--- a/net/ax25/af_ax25.c ++++ b/net/ax25/af_ax25.c +@@ -467,7 +467,7 @@ static int ax25_ctl_ioctl(const unsigned int cmd, void __user *arg) + goto out_put; + } + +-static void ax25_fillin_cb_from_dev(ax25_cb *ax25, ax25_dev *ax25_dev) ++static void ax25_fillin_cb_from_dev(ax25_cb *ax25, const ax25_dev *ax25_dev) + { + ax25->rtt = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T1]) / 2; + ax25->t1 = msecs_to_jiffies(ax25_dev->values[AX25_VALUES_T1]); +@@ -677,22 +677,22 @@ static int ax25_setsockopt(struct socket *sock, int level, int optname, + break; + } + +- rtnl_lock(); +- dev = __dev_get_by_name(&init_net, devname); ++ rcu_read_lock(); ++ dev = dev_get_by_name_rcu(&init_net, devname); + if (!dev) { +- rtnl_unlock(); ++ rcu_read_unlock(); + res = -ENODEV; + break; + } + + ax25->ax25_dev = ax25_dev_ax25dev(dev); + if (!ax25->ax25_dev) { +- rtnl_unlock(); ++ rcu_read_unlock(); + res = -ENODEV; + break; + } + ax25_fillin_cb(ax25, ax25->ax25_dev); +- rtnl_unlock(); ++ rcu_read_unlock(); + break; + + default: +diff --git a/net/ax25/ax25_dev.c b/net/ax25/ax25_dev.c +index 67ae6b8c52989..0715f9b152756 100644 +--- a/net/ax25/ax25_dev.c ++++ b/net/ax25/ax25_dev.c +@@ -87,7 +87,7 @@ void ax25_dev_device_up(struct net_device *dev) + + spin_lock_bh(&ax25_dev_lock); + list_add(&ax25_dev->list, &ax25_dev_list); +- dev->ax25_ptr = ax25_dev; ++ rcu_assign_pointer(dev->ax25_ptr, ax25_dev); + spin_unlock_bh(&ax25_dev_lock); + + ax25_register_dev_sysctl(ax25_dev); +@@ -122,7 +122,7 @@ void ax25_dev_device_down(struct net_device *dev) + } + } + +- dev->ax25_ptr = NULL; ++ RCU_INIT_POINTER(dev->ax25_ptr, NULL); + spin_unlock_bh(&ax25_dev_lock); + netdev_put(dev, &ax25_dev->dev_tracker); + ax25_dev_put(ax25_dev); +diff --git a/net/ax25/ax25_ip.c b/net/ax25/ax25_ip.c +index 36249776c021e..215d4ccf12b91 100644 +--- a/net/ax25/ax25_ip.c ++++ b/net/ax25/ax25_ip.c +@@ -122,6 +122,7 @@ netdev_tx_t ax25_ip_xmit(struct sk_buff *skb) + if (dev == NULL) + dev = skb->dev; + ++ rcu_read_lock(); + if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) { + kfree_skb(skb); + goto put; +@@ -202,7 +203,7 @@ netdev_tx_t ax25_ip_xmit(struct sk_buff *skb) + ax25_queue_xmit(skb, dev); + + put: +- ++ rcu_read_unlock(); + ax25_route_lock_unuse(); + return NETDEV_TX_OK; + } +diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c +index 3db76d2470e95..8bca2ace98e51 100644 +--- a/net/ax25/ax25_out.c ++++ b/net/ax25/ax25_out.c +@@ -39,10 +39,14 @@ ax25_cb *ax25_send_frame(struct sk_buff *skb, int paclen, const ax25_address *sr + * specified. + */ + if (paclen == 0) { +- if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) ++ rcu_read_lock(); ++ ax25_dev = ax25_dev_ax25dev(dev); ++ if (!ax25_dev) { ++ rcu_read_unlock(); + return NULL; +- ++ } + paclen = ax25_dev->values[AX25_VALUES_PACLEN]; ++ rcu_read_unlock(); + } + + /* +@@ -53,13 +57,19 @@ ax25_cb *ax25_send_frame(struct sk_buff *skb, int paclen, const ax25_address *sr + return ax25; /* It already existed */ + } + +- if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) ++ rcu_read_lock(); ++ ax25_dev = ax25_dev_ax25dev(dev); ++ if (!ax25_dev) { ++ rcu_read_unlock(); + return NULL; ++ } + +- if ((ax25 = ax25_create_cb()) == NULL) ++ if ((ax25 = ax25_create_cb()) == NULL) { ++ rcu_read_unlock(); + return NULL; +- ++ } + ax25_fillin_cb(ax25, ax25_dev); ++ rcu_read_unlock(); + + ax25->source_addr = *src; + ax25->dest_addr = *dest; +@@ -358,7 +368,9 @@ void ax25_queue_xmit(struct sk_buff *skb, struct net_device *dev) + { + unsigned char *ptr; + ++ rcu_read_lock(); + skb->protocol = ax25_type_trans(skb, ax25_fwd_dev(dev)); ++ rcu_read_unlock(); + + ptr = skb_push(skb, 1); + *ptr = 0x00; /* KISS */ +diff --git a/net/ax25/ax25_route.c b/net/ax25/ax25_route.c +index b7c4d656a94b7..69de75db0c9c2 100644 +--- a/net/ax25/ax25_route.c ++++ b/net/ax25/ax25_route.c +@@ -406,6 +406,7 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr) + ax25_route_lock_unuse(); + return -EHOSTUNREACH; + } ++ rcu_read_lock(); + if ((ax25->ax25_dev = ax25_dev_ax25dev(ax25_rt->dev)) == NULL) { + err = -EHOSTUNREACH; + goto put; +@@ -442,6 +443,7 @@ int ax25_rt_autobind(ax25_cb *ax25, ax25_address *addr) + } + + put: ++ rcu_read_unlock(); + ax25_route_lock_unuse(); + return err; + } +-- +2.39.5 + diff --git a/queue-6.6/bgmac-reduce-max-frame-size-to-support-just-mtu-1500.patch b/queue-6.6/bgmac-reduce-max-frame-size-to-support-just-mtu-1500.patch new file mode 100644 index 0000000000..c311adbd9d --- /dev/null +++ b/queue-6.6/bgmac-reduce-max-frame-size-to-support-just-mtu-1500.patch @@ -0,0 +1,73 @@ +From cc67217e50f49fa494892503033ee26ad75c9f80 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Jan 2025 09:51:59 -0800 +Subject: bgmac: reduce max frame size to support just MTU 1500 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Rafał Miłecki + +[ Upstream commit 752e5fcc2e77358936d36ef8e522d6439372e201 ] + +bgmac allocates new replacement buffer before handling each received +frame. Allocating & DMA-preparing 9724 B each time consumes a lot of CPU +time. Ideally bgmac should just respect currently set MTU but it isn't +the case right now. For now just revert back to the old limited frame +size. + +This change bumps NAT masquerade speed by ~95%. + +Since commit 8218f62c9c9b ("mm: page_frag: use initial zero offset for +page_frag_alloc_align()"), the bgmac driver fails to open its network +interface successfully and runs out of memory in the following call +stack: + +bgmac_open + -> bgmac_dma_init + -> bgmac_dma_rx_skb_for_slot + -> netdev_alloc_frag + +BGMAC_RX_ALLOC_SIZE = 10048 and PAGE_FRAG_CACHE_MAX_SIZE = 32768. + +Eventually we land into __page_frag_alloc_align() with the following +parameters across multiple successive calls: + +__page_frag_alloc_align: fragsz=10048, align_mask=-1, size=32768, offset=0 +__page_frag_alloc_align: fragsz=10048, align_mask=-1, size=32768, offset=10048 +__page_frag_alloc_align: fragsz=10048, align_mask=-1, size=32768, offset=20096 +__page_frag_alloc_align: fragsz=10048, align_mask=-1, size=32768, offset=30144 + +So in that case we do indeed have offset + fragsz (40192) > size (32768) +and so we would eventually return NULL. Reverting to the older 1500 +bytes MTU allows the network driver to be usable again. + +Fixes: 8c7da63978f1 ("bgmac: configure MTU and add support for frames beyond 8192 byte size") +Signed-off-by: Rafał Miłecki +[florian: expand commit message about recent commits] +Reviewed-by: Simon Horman +Signed-off-by: Florian Fainelli +Link: https://patch.msgid.link/20250127175159.1788246-1-florian.fainelli@broadcom.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/broadcom/bgmac.h | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/broadcom/bgmac.h b/drivers/net/ethernet/broadcom/bgmac.h +index d73ef262991d6..6fee9a41839c0 100644 +--- a/drivers/net/ethernet/broadcom/bgmac.h ++++ b/drivers/net/ethernet/broadcom/bgmac.h +@@ -328,8 +328,7 @@ + #define BGMAC_RX_FRAME_OFFSET 30 /* There are 2 unused bytes between header and real data */ + #define BGMAC_RX_BUF_OFFSET (NET_SKB_PAD + NET_IP_ALIGN - \ + BGMAC_RX_FRAME_OFFSET) +-/* Jumbo frame size with FCS */ +-#define BGMAC_RX_MAX_FRAME_SIZE 9724 ++#define BGMAC_RX_MAX_FRAME_SIZE 1536 + #define BGMAC_RX_BUF_SIZE (BGMAC_RX_FRAME_OFFSET + BGMAC_RX_MAX_FRAME_SIZE) + #define BGMAC_RX_ALLOC_SIZE (SKB_DATA_ALIGN(BGMAC_RX_BUF_SIZE + BGMAC_RX_BUF_OFFSET) + \ + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) +-- +2.39.5 + diff --git a/queue-6.6/block-retry-call-probe-after-request_module-in-blk_r.patch b/queue-6.6/block-retry-call-probe-after-request_module-in-blk_r.patch new file mode 100644 index 0000000000..67aee3ce1c --- /dev/null +++ b/queue-6.6/block-retry-call-probe-after-request_module-in-blk_r.patch @@ -0,0 +1,85 @@ +From efa24b69e68a9f5bff42a60b83bd8c31f1727eef Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Dec 2024 19:04:35 +0800 +Subject: block: retry call probe after request_module in blk_request_module + +From: Yang Erkun + +[ Upstream commit 457ef47c08d2979f3e59ce66267485c3faed70c8 ] + +Set kernel config: + + CONFIG_BLK_DEV_LOOP=m + CONFIG_BLK_DEV_LOOP_MIN_COUNT=0 + +Do latter: + + mknod loop0 b 7 0 + exec 4<> loop0 + +Before commit e418de3abcda ("block: switch gendisk lookup to a simple +xarray"), lookup_gendisk will first use base_probe to load module loop, +and then the retry will call loop_probe to prepare the loop disk. Finally +open for this disk will success. However, after this commit, we lose the +retry logic, and open will fail with ENXIO. Block device autoloading is +deprecated and will be removed soon, but maybe we should keep open success +until we really remove it. So, give a retry to fix it. + +Fixes: e418de3abcda ("block: switch gendisk lookup to a simple xarray") +Suggested-by: Christoph Hellwig +Signed-off-by: Yang Erkun +Reviewed-by: Christoph Hellwig +Link: https://lore.kernel.org/r/20241209110435.3670985-1-yangerkun@huaweicloud.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + block/genhd.c | 22 +++++++++++++++++----- + 1 file changed, 17 insertions(+), 5 deletions(-) + +diff --git a/block/genhd.c b/block/genhd.c +index 6d704c37f26e7..8f72539e08dea 100644 +--- a/block/genhd.c ++++ b/block/genhd.c +@@ -763,7 +763,7 @@ static ssize_t disk_badblocks_store(struct device *dev, + } + + #ifdef CONFIG_BLOCK_LEGACY_AUTOLOAD +-void blk_request_module(dev_t devt) ++static bool blk_probe_dev(dev_t devt) + { + unsigned int major = MAJOR(devt); + struct blk_major_name **n; +@@ -773,14 +773,26 @@ void blk_request_module(dev_t devt) + if ((*n)->major == major && (*n)->probe) { + (*n)->probe(devt); + mutex_unlock(&major_names_lock); +- return; ++ return true; + } + } + mutex_unlock(&major_names_lock); ++ return false; ++} ++ ++void blk_request_module(dev_t devt) ++{ ++ int error; ++ ++ if (blk_probe_dev(devt)) ++ return; + +- if (request_module("block-major-%d-%d", MAJOR(devt), MINOR(devt)) > 0) +- /* Make old-style 2.4 aliases work */ +- request_module("block-major-%d", MAJOR(devt)); ++ error = request_module("block-major-%d-%d", MAJOR(devt), MINOR(devt)); ++ /* Make old-style 2.4 aliases work */ ++ if (error > 0) ++ error = request_module("block-major-%d", MAJOR(devt)); ++ if (!error) ++ blk_probe_dev(devt); + } + #endif /* CONFIG_BLOCK_LEGACY_AUTOLOAD */ + +-- +2.39.5 + diff --git a/queue-6.6/bluetooth-btnxpuart-fix-glitches-seen-in-dual-a2dp-s.patch b/queue-6.6/bluetooth-btnxpuart-fix-glitches-seen-in-dual-a2dp-s.patch new file mode 100644 index 0000000000..2d8ce0e6fe --- /dev/null +++ b/queue-6.6/bluetooth-btnxpuart-fix-glitches-seen-in-dual-a2dp-s.patch @@ -0,0 +1,50 @@ +From 34420109529465201959e9e0269299cdb9c94035 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Jan 2025 19:49:46 +0530 +Subject: Bluetooth: btnxpuart: Fix glitches seen in dual A2DP streaming + +From: Neeraj Sanjay Kale + +[ Upstream commit 7de119bb79a63f6a1959b83117a98734914fb0b0 ] + +This fixes a regression caused by previous commit for fixing truncated +ACL data, which is causing some intermittent glitches when running two +A2DP streams. + +serdev_device_write_buf() is the root cause of the glitch, which is +reverted, and the TX work will continue to write until the queue is empty. + +This change fixes both issues. No A2DP streaming glitches or truncated +ACL data issue observed. + +Fixes: 8023dd220425 ("Bluetooth: btnxpuart: Fix driver sending truncated data") +Fixes: 689ca16e5232 ("Bluetooth: NXP: Add protocol support for NXP Bluetooth chipsets") +Signed-off-by: Neeraj Sanjay Kale +Signed-off-by: Luiz Augusto von Dentz +Signed-off-by: Sasha Levin +--- + drivers/bluetooth/btnxpuart.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c +index e809bb2dbe5e0..a4274d8c7faaf 100644 +--- a/drivers/bluetooth/btnxpuart.c ++++ b/drivers/bluetooth/btnxpuart.c +@@ -1280,13 +1280,12 @@ static void btnxpuart_tx_work(struct work_struct *work) + + while ((skb = nxp_dequeue(nxpdev))) { + len = serdev_device_write_buf(serdev, skb->data, skb->len); +- serdev_device_wait_until_sent(serdev, 0); + hdev->stat.byte_tx += len; + + skb_pull(skb, len); + if (skb->len > 0) { + skb_queue_head(&nxpdev->txq, skb); +- break; ++ continue; + } + + switch (hci_skb_pkt_type(skb)) { +-- +2.39.5 + diff --git a/queue-6.6/bpf-bpf_local_storage-always-use-bpf_mem_alloc-in-pr.patch b/queue-6.6/bpf-bpf_local_storage-always-use-bpf_mem_alloc-in-pr.patch new file mode 100644 index 0000000000..28ce82645d --- /dev/null +++ b/queue-6.6/bpf-bpf_local_storage-always-use-bpf_mem_alloc-in-pr.patch @@ -0,0 +1,77 @@ +From 523b95022577339c722da6a8c2b27b83a0a4d817 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 18 Dec 2024 11:30:00 -0800 +Subject: bpf: bpf_local_storage: Always use bpf_mem_alloc in PREEMPT_RT + +From: Martin KaFai Lau + +[ Upstream commit 8eef6ac4d70eb1f0099fff93321d90ce8fa49ee1 ] + +In PREEMPT_RT, kmalloc(GFP_ATOMIC) is still not safe in non preemptible +context. bpf_mem_alloc must be used in PREEMPT_RT. This patch is +to enforce bpf_mem_alloc in the bpf_local_storage when CONFIG_PREEMPT_RT +is enabled. + +[ 35.118559] BUG: sleeping function called from invalid context at kernel/locking/spinlock_rt.c:48 +[ 35.118566] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1832, name: test_progs +[ 35.118569] preempt_count: 1, expected: 0 +[ 35.118571] RCU nest depth: 1, expected: 1 +[ 35.118577] INFO: lockdep is turned off. + ... +[ 35.118647] __might_resched+0x433/0x5b0 +[ 35.118677] rt_spin_lock+0xc3/0x290 +[ 35.118700] ___slab_alloc+0x72/0xc40 +[ 35.118723] __kmalloc_noprof+0x13f/0x4e0 +[ 35.118732] bpf_map_kzalloc+0xe5/0x220 +[ 35.118740] bpf_selem_alloc+0x1d2/0x7b0 +[ 35.118755] bpf_local_storage_update+0x2fa/0x8b0 +[ 35.118784] bpf_sk_storage_get_tracing+0x15a/0x1d0 +[ 35.118791] bpf_prog_9a118d86fca78ebb_trace_inet_sock_set_state+0x44/0x66 +[ 35.118795] bpf_trace_run3+0x222/0x400 +[ 35.118820] __bpf_trace_inet_sock_set_state+0x11/0x20 +[ 35.118824] trace_inet_sock_set_state+0x112/0x130 +[ 35.118830] inet_sk_state_store+0x41/0x90 +[ 35.118836] tcp_set_state+0x3b3/0x640 + +There is no need to adjust the gfp_flags passing to the +bpf_mem_cache_alloc_flags() which only honors the GFP_KERNEL. +The verifier has ensured GFP_KERNEL is passed only in sleepable context. + +It has been an old issue since the first introduction of the +bpf_local_storage ~5 years ago, so this patch targets the bpf-next. + +bpf_mem_alloc is needed to solve it, so the Fixes tag is set +to the commit when bpf_mem_alloc was first used in the bpf_local_storage. + +Fixes: 08a7ce384e33 ("bpf: Use bpf_mem_cache_alloc/free in bpf_local_storage_elem") +Reported-by: Alexei Starovoitov +Signed-off-by: Martin KaFai Lau +Link: https://lore.kernel.org/r/20241218193000.2084281-1-martin.lau@linux.dev +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + kernel/bpf/bpf_local_storage.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/kernel/bpf/bpf_local_storage.c b/kernel/bpf/bpf_local_storage.c +index e8d02212da703..b4c6b9b3cb421 100644 +--- a/kernel/bpf/bpf_local_storage.c ++++ b/kernel/bpf/bpf_local_storage.c +@@ -823,8 +823,12 @@ bpf_local_storage_map_alloc(union bpf_attr *attr, + smap->elem_size = offsetof(struct bpf_local_storage_elem, + sdata.data[attr->value_size]); + +- smap->bpf_ma = bpf_ma; +- if (bpf_ma) { ++ /* In PREEMPT_RT, kmalloc(GFP_ATOMIC) is still not safe in non ++ * preemptible context. Thus, enforce all storages to use ++ * bpf_mem_alloc when CONFIG_PREEMPT_RT is enabled. ++ */ ++ smap->bpf_ma = IS_ENABLED(CONFIG_PREEMPT_RT) ? true : bpf_ma; ++ if (smap->bpf_ma) { + err = bpf_mem_alloc_init(&smap->selem_ma, smap->elem_size, false); + if (err) + goto free_smap; +-- +2.39.5 + diff --git a/queue-6.6/bpf-send-signals-asynchronously-if-preemptible.patch b/queue-6.6/bpf-send-signals-asynchronously-if-preemptible.patch new file mode 100644 index 0000000000..e3771296f1 --- /dev/null +++ b/queue-6.6/bpf-send-signals-asynchronously-if-preemptible.patch @@ -0,0 +1,42 @@ +From 3365bb6a19b5191d4729fbcd98a5f06fe2bebf18 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Jan 2025 10:36:47 +0000 +Subject: bpf: Send signals asynchronously if !preemptible + +From: Puranjay Mohan + +[ Upstream commit 87c544108b612512b254c8f79aa5c0a8546e2cc4 ] + +BPF programs can execute in all kinds of contexts and when a program +running in a non-preemptible context uses the bpf_send_signal() kfunc, +it will cause issues because this kfunc can sleep. +Change `irqs_disabled()` to `!preemptible()`. + +Reported-by: syzbot+97da3d7e0112d59971de@syzkaller.appspotmail.com +Closes: https://lore.kernel.org/all/67486b09.050a0220.253251.0084.GAE@google.com/ +Fixes: 1bc7896e9ef4 ("bpf: Fix deadlock with rq_lock in bpf_send_signal()") +Signed-off-by: Puranjay Mohan +Acked-by: Yonghong Song +Link: https://lore.kernel.org/r/20250115103647.38487-1-puranjay@kernel.org +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + kernel/trace/bpf_trace.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c +index 5f12bb727b850..9d8f60e0cb554 100644 +--- a/kernel/trace/bpf_trace.c ++++ b/kernel/trace/bpf_trace.c +@@ -853,7 +853,7 @@ static int bpf_send_signal_common(u32 sig, enum pid_type type) + if (unlikely(is_global_init(current))) + return -EPERM; + +- if (irqs_disabled()) { ++ if (!preemptible()) { + /* Do an early check on signal validity. Otherwise, + * the error is lost in deferred irq_work. + */ +-- +2.39.5 + diff --git a/queue-6.6/bpf-tcp-mark-bpf_load_hdr_opt-arg2-as-read-write.patch b/queue-6.6/bpf-tcp-mark-bpf_load_hdr_opt-arg2-as-read-write.patch new file mode 100644 index 0000000000..a93f2a09ba --- /dev/null +++ b/queue-6.6/bpf-tcp-mark-bpf_load_hdr_opt-arg2-as-read-write.patch @@ -0,0 +1,44 @@ +From 630de385dcc984b16b3c816b69c11e387c94123e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Jan 2025 13:28:43 -0700 +Subject: bpf: tcp: Mark bpf_load_hdr_opt() arg2 as read-write + +From: Daniel Xu + +[ Upstream commit 8ac412a3361173e3000b16167af3d1f6f90af613 ] + +MEM_WRITE attribute is defined as: "Non-presence of MEM_WRITE means that +MEM is only being read". bpf_load_hdr_opt() both reads and writes from +its arg2 - void *search_res. + +This matters a lot for the next commit where we more precisely track +stack accesses. Without this annotation, the verifier will make false +assumptions about the contents of memory written to by helpers and +possibly prune valid branches. + +Fixes: 6fad274f06f0 ("bpf: Add MEM_WRITE attribute") +Acked-by: Martin KaFai Lau +Signed-off-by: Daniel Xu +Link: https://lore.kernel.org/r/730e45f8c39be2a5f3d8c4406cceca9d574cbf14.1736886479.git.dxu@dxuuu.xyz +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + net/core/filter.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/core/filter.c b/net/core/filter.c +index 5881944f1681c..84992279f4b10 100644 +--- a/net/core/filter.c ++++ b/net/core/filter.c +@@ -7604,7 +7604,7 @@ static const struct bpf_func_proto bpf_sock_ops_load_hdr_opt_proto = { + .gpl_only = false, + .ret_type = RET_INTEGER, + .arg1_type = ARG_PTR_TO_CTX, +- .arg2_type = ARG_PTR_TO_MEM, ++ .arg2_type = ARG_PTR_TO_MEM | MEM_WRITE, + .arg3_type = ARG_CONST_SIZE, + .arg4_type = ARG_ANYTHING, + }; +-- +2.39.5 + diff --git a/queue-6.6/buffer-make-folio_create_empty_buffers-return-a-buff.patch b/queue-6.6/buffer-make-folio_create_empty_buffers-return-a-buff.patch new file mode 100644 index 0000000000..9e90a29d3d --- /dev/null +++ b/queue-6.6/buffer-make-folio_create_empty_buffers-return-a-buff.patch @@ -0,0 +1,119 @@ +From a527328a2fe173a7c65cf8e956f15fbd953cef49 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Oct 2023 21:10:49 +0100 +Subject: buffer: make folio_create_empty_buffers() return a buffer_head + +From: Matthew Wilcox (Oracle) + +[ Upstream commit 3decb8564eff88a2533f83b01cec2cf9259c3eaf ] + +Patch series "Finish the create_empty_buffers() transition", v2. + +Pankaj recently added folio_create_empty_buffers() as the folio equivalent +to create_empty_buffers(). This patch set finishes the conversion by +first converting all remaining filesystems to call +folio_create_empty_buffers(), then renaming it back to +create_empty_buffers(). I took the opportunity to make a few +simplifications like making folio_create_empty_buffers() return the head +buffer and extracting get_nth_bh() from nilfs2. + +A few of the patches in this series aren't directly related to +create_empty_buffers(), but I saw them while I was working on this and +thought they'd be easy enough to add to this series. Compile-tested only, +other than ext4. + +This patch (of 26): + +Almost all callers want to know the first BH that was allocated for this +folio. We already have that handy, so return it. + +Link: https://lkml.kernel.org/r/20231016201114.1928083-1-willy@infradead.org +Link: https://lkml.kernel.org/r/20231016201114.1928083-3-willy@infradead.org +Signed-off-by: Matthew Wilcox (Oracle) +Reviewed-by: Pankaj Raghav +Cc: Andreas Gruenbacher +Cc: Ryusuke Konishi +Signed-off-by: Andrew Morton +Stable-dep-of: 367a9bffabe0 ("nilfs2: protect access to buffers with no active references") +Signed-off-by: Sasha Levin +--- + fs/buffer.c | 24 +++++++++++++----------- + include/linux/buffer_head.h | 4 ++-- + 2 files changed, 15 insertions(+), 13 deletions(-) + +diff --git a/fs/buffer.c b/fs/buffer.c +index ecd8b47507ff8..4b86e971efd8a 100644 +--- a/fs/buffer.c ++++ b/fs/buffer.c +@@ -1640,8 +1640,8 @@ EXPORT_SYMBOL(block_invalidate_folio); + * block_dirty_folio() via private_lock. try_to_free_buffers + * is already excluded via the folio lock. + */ +-void folio_create_empty_buffers(struct folio *folio, unsigned long blocksize, +- unsigned long b_state) ++struct buffer_head *folio_create_empty_buffers(struct folio *folio, ++ unsigned long blocksize, unsigned long b_state) + { + struct buffer_head *bh, *head, *tail; + +@@ -1667,6 +1667,8 @@ void folio_create_empty_buffers(struct folio *folio, unsigned long blocksize, + } + folio_attach_private(folio, head); + spin_unlock(&folio->mapping->private_lock); ++ ++ return head; + } + EXPORT_SYMBOL(folio_create_empty_buffers); + +@@ -1768,13 +1770,15 @@ static struct buffer_head *folio_create_buffers(struct folio *folio, + struct inode *inode, + unsigned int b_state) + { ++ struct buffer_head *bh; ++ + BUG_ON(!folio_test_locked(folio)); + +- if (!folio_buffers(folio)) +- folio_create_empty_buffers(folio, +- 1 << READ_ONCE(inode->i_blkbits), +- b_state); +- return folio_buffers(folio); ++ bh = folio_buffers(folio); ++ if (!bh) ++ bh = folio_create_empty_buffers(folio, ++ 1 << READ_ONCE(inode->i_blkbits), b_state); ++ return bh; + } + + /* +@@ -2678,10 +2682,8 @@ int block_truncate_page(struct address_space *mapping, + return PTR_ERR(folio); + + bh = folio_buffers(folio); +- if (!bh) { +- folio_create_empty_buffers(folio, blocksize, 0); +- bh = folio_buffers(folio); +- } ++ if (!bh) ++ bh = folio_create_empty_buffers(folio, blocksize, 0); + + /* Find the buffer that contains "offset" */ + offset = offset_in_folio(folio, from); +diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h +index 44e9de51eedfb..572030db2f061 100644 +--- a/include/linux/buffer_head.h ++++ b/include/linux/buffer_head.h +@@ -203,8 +203,8 @@ struct buffer_head *alloc_page_buffers(struct page *page, unsigned long size, + bool retry); + void create_empty_buffers(struct page *, unsigned long, + unsigned long b_state); +-void folio_create_empty_buffers(struct folio *folio, unsigned long blocksize, +- unsigned long b_state); ++struct buffer_head *folio_create_empty_buffers(struct folio *folio, ++ unsigned long blocksize, unsigned long b_state); + void end_buffer_read_sync(struct buffer_head *bh, int uptodate); + void end_buffer_write_sync(struct buffer_head *bh, int uptodate); + void end_buffer_async_write(struct buffer_head *bh, int uptodate); +-- +2.39.5 + diff --git a/queue-6.6/cifs-use-cifs_autodisable_serverino-for-disabling-ci.patch b/queue-6.6/cifs-use-cifs_autodisable_serverino-for-disabling-ci.patch new file mode 100644 index 0000000000..0cc735efb6 --- /dev/null +++ b/queue-6.6/cifs-use-cifs_autodisable_serverino-for-disabling-ci.patch @@ -0,0 +1,44 @@ +From be1476df49a8f194b17ce6c462236beb9d4c01a2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Jan 2025 21:38:48 +0100 +Subject: cifs: Use cifs_autodisable_serverino() for disabling + CIFS_MOUNT_SERVER_INUM in readdir.c +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pali Rohár + +[ Upstream commit 015683d4ed0d23698c71f2194f09bd17dbfad044 ] + +In all other places is used function cifs_autodisable_serverino() for +disabling CIFS_MOUNT_SERVER_INUM mount flag. So use is also in readir.c +_initiate_cifs_search() function. Benefit of cifs_autodisable_serverino() +is that it also prints dmesg message that server inode numbers are being +disabled. + +Fixes: ec06aedd4454 ("cifs: clean up handling when server doesn't consistently support inode numbers") +Fixes: f534dc994397 ("cifs: clear server inode number flag while autodisabling") +Signed-off-by: Pali Rohár +Signed-off-by: Steve French +Signed-off-by: Sasha Levin +--- + fs/smb/client/readdir.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/smb/client/readdir.c b/fs/smb/client/readdir.c +index 3cffdf3975a21..75929a0a56f96 100644 +--- a/fs/smb/client/readdir.c ++++ b/fs/smb/client/readdir.c +@@ -413,7 +413,7 @@ _initiate_cifs_search(const unsigned int xid, struct file *file, + cifsFile->invalidHandle = false; + } else if ((rc == -EOPNOTSUPP) && + (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) { +- cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_SERVER_INUM; ++ cifs_autodisable_serverino(cifs_sb); + goto ffirst_retry; + } + error_exit: +-- +2.39.5 + diff --git a/queue-6.6/clk-analogbits-fix-incorrect-calculation-of-vco-rate.patch b/queue-6.6/clk-analogbits-fix-incorrect-calculation-of-vco-rate.patch new file mode 100644 index 0000000000..19ceb681ca --- /dev/null +++ b/queue-6.6/clk-analogbits-fix-incorrect-calculation-of-vco-rate.patch @@ -0,0 +1,41 @@ +From f3b892e1d8a75063d70d2b641982f6d7d0f92a45 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 29 Aug 2024 23:16:39 -0700 +Subject: clk: analogbits: Fix incorrect calculation of vco rate delta + +From: Bo Gan + +[ Upstream commit d7f12857f095ef38523399d47e68787b357232f6 ] + +In wrpll_configure_for_rate() we try to determine the best PLL +configuration for a target rate. However, in the loop where we try +values of R, we should compare the derived `vco` with `target_vco_rate`. +However, we were in fact comparing it with `target_rate`, which is +actually after Q shift. This is incorrect, and sometimes can result in +suboptimal clock rates. Fix it. + +Fixes: 7b9487a9a5c4 ("clk: analogbits: add Wide-Range PLL library") +Signed-off-by: Bo Gan +Link: https://lore.kernel.org/r/20240830061639.2316-1-ganboing@gmail.com +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + drivers/clk/analogbits/wrpll-cln28hpc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/clk/analogbits/wrpll-cln28hpc.c b/drivers/clk/analogbits/wrpll-cln28hpc.c +index 09ca823563993..d8ae392959969 100644 +--- a/drivers/clk/analogbits/wrpll-cln28hpc.c ++++ b/drivers/clk/analogbits/wrpll-cln28hpc.c +@@ -291,7 +291,7 @@ int wrpll_configure_for_rate(struct wrpll_cfg *c, u32 target_rate, + vco = vco_pre * f; + } + +- delta = abs(target_rate - vco); ++ delta = abs(target_vco_rate - vco); + if (delta < best_delta) { + best_delta = delta; + best_r = r; +-- +2.39.5 + diff --git a/queue-6.6/clk-fix-an-of-node-reference-leak-in-of_clk_get_pare.patch b/queue-6.6/clk-fix-an-of-node-reference-leak-in-of_clk_get_pare.patch new file mode 100644 index 0000000000..742c53ed34 --- /dev/null +++ b/queue-6.6/clk-fix-an-of-node-reference-leak-in-of_clk_get_pare.patch @@ -0,0 +1,44 @@ +From 842b18dc3992f500072c9911888722af3fb3bb24 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Dec 2024 22:09:12 +0900 +Subject: clk: fix an OF node reference leak in of_clk_get_parent_name() + +From: Joe Hattori + +[ Upstream commit 28fa3291cad1c201967ef93edc6e7f8ccc9afbc0 ] + +Current implementation of of_clk_get_parent_name() leaks an OF node +reference on error path. Add a of_node_put() call before returning an +error. + +This bug was found by an experimental static analysis tool that I am +developing. + +Fixes: 8da411cc1964 ("clk: let of_clk_get_parent_name() fail for invalid clock-indices") +Signed-off-by: Joe Hattori +Link: https://lore.kernel.org/r/20241210130913.3615205-1-joe@pf.is.s.u-tokyo.ac.jp +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + drivers/clk/clk.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c +index f795773b322a3..5bbd036f5295f 100644 +--- a/drivers/clk/clk.c ++++ b/drivers/clk/clk.c +@@ -5343,8 +5343,10 @@ const char *of_clk_get_parent_name(const struct device_node *np, int index) + count++; + } + /* We went off the end of 'clock-indices' without finding it */ +- if (of_property_present(clkspec.np, "clock-indices") && !found) ++ if (of_property_present(clkspec.np, "clock-indices") && !found) { ++ of_node_put(clkspec.np); + return NULL; ++ } + + if (of_property_read_string_index(clkspec.np, "clock-output-names", + index, +-- +2.39.5 + diff --git a/queue-6.6/clk-imx8mp-fix-clkout1-2-support.patch b/queue-6.6/clk-imx8mp-fix-clkout1-2-support.patch new file mode 100644 index 0000000000..bdcd77b120 --- /dev/null +++ b/queue-6.6/clk-imx8mp-fix-clkout1-2-support.patch @@ -0,0 +1,45 @@ +From f59c30dbeaa5b978d98e160f580c168869b24ed1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Nov 2024 02:36:54 +0100 +Subject: clk: imx8mp: Fix clkout1/2 support + +From: Marek Vasut + +[ Upstream commit a9b7c84d22fb1687d63ca2a386773015cf59436b ] + +The CLKOUTn may be fed from PLL1/2/3, but the PLL1/2/3 has to be enabled +first by setting PLL_CLKE bit 11 in CCM_ANALOG_SYS_PLLn_GEN_CTRL register. +The CCM_ANALOG_SYS_PLLn_GEN_CTRL bit 11 is modeled by plln_out clock. Fix +the clock tree and place the clkout1/2 under plln_sel instead of plain plln +to let the clock subsystem correctly control the bit 11 and enable the PLL +in case the CLKOUTn is supplied by PLL1/2/3. + +Fixes: 43896f56b59e ("clk: imx8mp: add clkout1/2 support") +Signed-off-by: Marek Vasut +Reviewed-by: Peng Fan +Link: https://lore.kernel.org/r/20241112013718.333771-1-marex@denx.de +Signed-off-by: Abel Vesa +Signed-off-by: Sasha Levin +--- + drivers/clk/imx/clk-imx8mp.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/clk/imx/clk-imx8mp.c b/drivers/clk/imx/clk-imx8mp.c +index e561ff7b135fb..747f5397692e5 100644 +--- a/drivers/clk/imx/clk-imx8mp.c ++++ b/drivers/clk/imx/clk-imx8mp.c +@@ -399,8 +399,9 @@ static const char * const imx8mp_dram_core_sels[] = {"dram_pll_out", "dram_alt_r + + static const char * const imx8mp_clkout_sels[] = {"audio_pll1_out", "audio_pll2_out", "video_pll1_out", + "dummy", "dummy", "gpu_pll_out", "vpu_pll_out", +- "arm_pll_out", "sys_pll1", "sys_pll2", "sys_pll3", +- "dummy", "dummy", "osc_24m", "dummy", "osc_32k"}; ++ "arm_pll_out", "sys_pll1_out", "sys_pll2_out", ++ "sys_pll3_out", "dummy", "dummy", "osc_24m", ++ "dummy", "osc_32k"}; + + static struct clk_hw **hws; + static struct clk_hw_onecell_data *clk_hw_data; +-- +2.39.5 + diff --git a/queue-6.6/clk-qcom-gcc-sdm845-do-not-use-shared-clk_ops-for-qu.patch b/queue-6.6/clk-qcom-gcc-sdm845-do-not-use-shared-clk_ops-for-qu.patch new file mode 100644 index 0000000000..d47d510d0e --- /dev/null +++ b/queue-6.6/clk-qcom-gcc-sdm845-do-not-use-shared-clk_ops-for-qu.patch @@ -0,0 +1,185 @@ +From 1d555d300bd82c704541fcf81bf12399a07b9336 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Dec 2024 23:19:12 +0530 +Subject: clk: qcom: gcc-sdm845: Do not use shared clk_ops for QUPs + +From: Amit Pundir + +[ Upstream commit f760a4bb5e927a133dcd75f7b69ccae2a331e42c ] + +Similar to the earlier fixes meant for sm8x50 and x1e platforms, +we have to stop using the shared clk ops for sdm845 QUPs as well. + +As Stephen Boyd pointed out in earlier fixes, there wasn't a problem +to mark QUP clks shared until we started parking shared RCGs at clk +registration time in commit 01a0a6cc8cfd ("clk: qcom: Park shared RCGs +upon registration"). Parking at init is actually harmful to the UART +when earlycon is used. If the device is pumping out data while the +frequency changes and we see garbage on the serial console until the +driver can probe and actually set a proper frequency. + +This patch reverts the QUP clk sharing ops part of commit 06391eddb60a +("clk: qcom: Add Global Clock controller (GCC) driver for SDM845"), so +that the QUPs on sdm845 don't get parked during clk registration and +break UART operations. + +Fixes: 01a0a6cc8cfd ("clk: qcom: Park shared RCGs upon registration") +Signed-off-by: Amit Pundir +Link: https://lore.kernel.org/r/20241209174912.2526928-1-amit.pundir@linaro.org +Signed-off-by: Bjorn Andersson +Signed-off-by: Sasha Levin +--- + drivers/clk/qcom/gcc-sdm845.c | 32 ++++++++++++++++---------------- + 1 file changed, 16 insertions(+), 16 deletions(-) + +diff --git a/drivers/clk/qcom/gcc-sdm845.c b/drivers/clk/qcom/gcc-sdm845.c +index ea4c3bf4fb9bf..1a23bfd9356d5 100644 +--- a/drivers/clk/qcom/gcc-sdm845.c ++++ b/drivers/clk/qcom/gcc-sdm845.c +@@ -454,7 +454,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s0_clk_src_init = { + .name = "gcc_qupv3_wrap0_s0_clk_src", + .parent_data = gcc_parent_data_0, + .num_parents = ARRAY_SIZE(gcc_parent_data_0), +- .ops = &clk_rcg2_shared_ops, ++ .ops = &clk_rcg2_ops, + }; + + static struct clk_rcg2 gcc_qupv3_wrap0_s0_clk_src = { +@@ -470,7 +470,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s1_clk_src_init = { + .name = "gcc_qupv3_wrap0_s1_clk_src", + .parent_data = gcc_parent_data_0, + .num_parents = ARRAY_SIZE(gcc_parent_data_0), +- .ops = &clk_rcg2_shared_ops, ++ .ops = &clk_rcg2_ops, + }; + + static struct clk_rcg2 gcc_qupv3_wrap0_s1_clk_src = { +@@ -486,7 +486,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s2_clk_src_init = { + .name = "gcc_qupv3_wrap0_s2_clk_src", + .parent_data = gcc_parent_data_0, + .num_parents = ARRAY_SIZE(gcc_parent_data_0), +- .ops = &clk_rcg2_shared_ops, ++ .ops = &clk_rcg2_ops, + }; + + static struct clk_rcg2 gcc_qupv3_wrap0_s2_clk_src = { +@@ -502,7 +502,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s3_clk_src_init = { + .name = "gcc_qupv3_wrap0_s3_clk_src", + .parent_data = gcc_parent_data_0, + .num_parents = ARRAY_SIZE(gcc_parent_data_0), +- .ops = &clk_rcg2_shared_ops, ++ .ops = &clk_rcg2_ops, + }; + + static struct clk_rcg2 gcc_qupv3_wrap0_s3_clk_src = { +@@ -518,7 +518,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s4_clk_src_init = { + .name = "gcc_qupv3_wrap0_s4_clk_src", + .parent_data = gcc_parent_data_0, + .num_parents = ARRAY_SIZE(gcc_parent_data_0), +- .ops = &clk_rcg2_shared_ops, ++ .ops = &clk_rcg2_ops, + }; + + static struct clk_rcg2 gcc_qupv3_wrap0_s4_clk_src = { +@@ -534,7 +534,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s5_clk_src_init = { + .name = "gcc_qupv3_wrap0_s5_clk_src", + .parent_data = gcc_parent_data_0, + .num_parents = ARRAY_SIZE(gcc_parent_data_0), +- .ops = &clk_rcg2_shared_ops, ++ .ops = &clk_rcg2_ops, + }; + + static struct clk_rcg2 gcc_qupv3_wrap0_s5_clk_src = { +@@ -550,7 +550,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s6_clk_src_init = { + .name = "gcc_qupv3_wrap0_s6_clk_src", + .parent_data = gcc_parent_data_0, + .num_parents = ARRAY_SIZE(gcc_parent_data_0), +- .ops = &clk_rcg2_shared_ops, ++ .ops = &clk_rcg2_ops, + }; + + static struct clk_rcg2 gcc_qupv3_wrap0_s6_clk_src = { +@@ -566,7 +566,7 @@ static struct clk_init_data gcc_qupv3_wrap0_s7_clk_src_init = { + .name = "gcc_qupv3_wrap0_s7_clk_src", + .parent_data = gcc_parent_data_0, + .num_parents = ARRAY_SIZE(gcc_parent_data_0), +- .ops = &clk_rcg2_shared_ops, ++ .ops = &clk_rcg2_ops, + }; + + static struct clk_rcg2 gcc_qupv3_wrap0_s7_clk_src = { +@@ -582,7 +582,7 @@ static struct clk_init_data gcc_qupv3_wrap1_s0_clk_src_init = { + .name = "gcc_qupv3_wrap1_s0_clk_src", + .parent_data = gcc_parent_data_0, + .num_parents = ARRAY_SIZE(gcc_parent_data_0), +- .ops = &clk_rcg2_shared_ops, ++ .ops = &clk_rcg2_ops, + }; + + static struct clk_rcg2 gcc_qupv3_wrap1_s0_clk_src = { +@@ -598,7 +598,7 @@ static struct clk_init_data gcc_qupv3_wrap1_s1_clk_src_init = { + .name = "gcc_qupv3_wrap1_s1_clk_src", + .parent_data = gcc_parent_data_0, + .num_parents = ARRAY_SIZE(gcc_parent_data_0), +- .ops = &clk_rcg2_shared_ops, ++ .ops = &clk_rcg2_ops, + }; + + static struct clk_rcg2 gcc_qupv3_wrap1_s1_clk_src = { +@@ -614,7 +614,7 @@ static struct clk_init_data gcc_qupv3_wrap1_s2_clk_src_init = { + .name = "gcc_qupv3_wrap1_s2_clk_src", + .parent_data = gcc_parent_data_0, + .num_parents = ARRAY_SIZE(gcc_parent_data_0), +- .ops = &clk_rcg2_shared_ops, ++ .ops = &clk_rcg2_ops, + }; + + static struct clk_rcg2 gcc_qupv3_wrap1_s2_clk_src = { +@@ -630,7 +630,7 @@ static struct clk_init_data gcc_qupv3_wrap1_s3_clk_src_init = { + .name = "gcc_qupv3_wrap1_s3_clk_src", + .parent_data = gcc_parent_data_0, + .num_parents = ARRAY_SIZE(gcc_parent_data_0), +- .ops = &clk_rcg2_shared_ops, ++ .ops = &clk_rcg2_ops, + }; + + static struct clk_rcg2 gcc_qupv3_wrap1_s3_clk_src = { +@@ -646,7 +646,7 @@ static struct clk_init_data gcc_qupv3_wrap1_s4_clk_src_init = { + .name = "gcc_qupv3_wrap1_s4_clk_src", + .parent_data = gcc_parent_data_0, + .num_parents = ARRAY_SIZE(gcc_parent_data_0), +- .ops = &clk_rcg2_shared_ops, ++ .ops = &clk_rcg2_ops, + }; + + static struct clk_rcg2 gcc_qupv3_wrap1_s4_clk_src = { +@@ -662,7 +662,7 @@ static struct clk_init_data gcc_qupv3_wrap1_s5_clk_src_init = { + .name = "gcc_qupv3_wrap1_s5_clk_src", + .parent_data = gcc_parent_data_0, + .num_parents = ARRAY_SIZE(gcc_parent_data_0), +- .ops = &clk_rcg2_shared_ops, ++ .ops = &clk_rcg2_ops, + }; + + static struct clk_rcg2 gcc_qupv3_wrap1_s5_clk_src = { +@@ -678,7 +678,7 @@ static struct clk_init_data gcc_qupv3_wrap1_s6_clk_src_init = { + .name = "gcc_qupv3_wrap1_s6_clk_src", + .parent_data = gcc_parent_data_0, + .num_parents = ARRAY_SIZE(gcc_parent_data_0), +- .ops = &clk_rcg2_shared_ops, ++ .ops = &clk_rcg2_ops, + }; + + static struct clk_rcg2 gcc_qupv3_wrap1_s6_clk_src = { +@@ -694,7 +694,7 @@ static struct clk_init_data gcc_qupv3_wrap1_s7_clk_src_init = { + .name = "gcc_qupv3_wrap1_s7_clk_src", + .parent_data = gcc_parent_data_0, + .num_parents = ARRAY_SIZE(gcc_parent_data_0), +- .ops = &clk_rcg2_shared_ops, ++ .ops = &clk_rcg2_ops, + }; + + static struct clk_rcg2 gcc_qupv3_wrap1_s7_clk_src = { +-- +2.39.5 + diff --git a/queue-6.6/clk-ralink-mtmips-remove-duplicated-xtal-clock-for-r.patch b/queue-6.6/clk-ralink-mtmips-remove-duplicated-xtal-clock-for-r.patch new file mode 100644 index 0000000000..8f2264067a --- /dev/null +++ b/queue-6.6/clk-ralink-mtmips-remove-duplicated-xtal-clock-for-r.patch @@ -0,0 +1,38 @@ +From 776e29762a7a4953a978ae7ab847d9491594b54e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 Jan 2025 10:36:36 +0100 +Subject: clk: ralink: mtmips: remove duplicated 'xtal' clock for Ralink SoC + RT3883 + +From: Sergio Paracuellos + +[ Upstream commit 830d8062d25581cf0beaa334486eea06834044da ] + +Ralink SoC RT3883 has already 'xtal' defined as a base clock so there is no +need to redefine it again in fixed clocks section. Hence, remove the duplicate +one from there. + +Fixes: d34db686a3d7 ("clk: ralink: mtmips: fix clocks probe order in oldest ralink SoCs") +Signed-off-by: Sergio Paracuellos +Link: https://lore.kernel.org/r/20250108093636.265033-1-sergio.paracuellos@gmail.com +Signed-off-by: Stephen Boyd +Signed-off-by: Sasha Levin +--- + drivers/clk/ralink/clk-mtmips.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/clk/ralink/clk-mtmips.c b/drivers/clk/ralink/clk-mtmips.c +index 76285fbbdeaa2..4b5d8b741e4e1 100644 +--- a/drivers/clk/ralink/clk-mtmips.c ++++ b/drivers/clk/ralink/clk-mtmips.c +@@ -264,7 +264,6 @@ static int mtmips_register_pherip_clocks(struct device_node *np, + } + + static struct mtmips_clk_fixed rt3883_fixed_clocks[] = { +- CLK_FIXED("xtal", NULL, 40000000), + CLK_FIXED("periph", "xtal", 40000000) + }; + +-- +2.39.5 + diff --git a/queue-6.6/clk-si5351-allow-plls-to-be-adjusted-without-reset.patch b/queue-6.6/clk-si5351-allow-plls-to-be-adjusted-without-reset.patch new file mode 100644 index 0000000000..27af239089 --- /dev/null +++ b/queue-6.6/clk-si5351-allow-plls-to-be-adjusted-without-reset.patch @@ -0,0 +1,150 @@ +From 20bddaea7810797a6f0d2569e80fc22be86d7801 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 24 Nov 2023 14:17:44 +0100 +Subject: clk: si5351: allow PLLs to be adjusted without reset +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Alvin Å ipraga + +[ Upstream commit b2adbc9cea752539f6421e9d4642408f666c1251 ] + +Introduce a new PLL reset mode flag which controls whether or not to +reset a PLL after adjusting its rate. The mode can be configured through +platform data or device tree. + +Since commit 6dc669a22c77 ("clk: si5351: Add PLL soft reset"), the +driver unconditionally resets a PLL whenever its rate is adjusted. +The rationale was that a PLL reset was required to get three outputs +working at the same time. Before this change, the driver never reset the +PLLs. + +Commit b26ff127c52c ("clk: si5351: Apply PLL soft reset before enabling +the outputs") subsequently introduced an option to reset the PLL when +enabling a clock output that sourced it. Here, the rationale was that +this is required to get a deterministic phase relationship between +multiple output clocks. + +This clearly shows that it is useful to reset the PLLs in applications +where multiple clock outputs are used. However, the Si5351 also allows +for glitch-free rate adjustment of its PLLs if one avoids resetting the +PLL. In our audio application where a single Si5351 clock output is used +to supply a runtime adjustable bit clock, this unconditional PLL reset +behaviour introduces unwanted glitches in the clock output. + +It would appear that the problem being solved in the former commit +may be solved by using the optional device tree property introduced in +the latter commit, obviating the need for an unconditional PLL reset +after rate adjustment. But it's not OK to break the default behaviour of +the driver, and it cannot be assumed that all device trees are using the +property introduced in the latter commit. Hence, the new behaviour is +made opt-in. + +Cc: Sebastian Hesselbarth +Cc: Rabeeh Khoury +Cc: Jacob Siverskog +Cc: Sergej Sawazki +Signed-off-by: Alvin Å ipraga +Acked-by: Sebastian Hesselbarth +Link: https://lore.kernel.org/r/20231124-alvin-clk-si5351-no-pll-reset-v6-3-69b82311cb90@bang-olufsen.dk +Signed-off-by: Stephen Boyd +Stable-dep-of: 28fa3291cad1 ("clk: fix an OF node reference leak in of_clk_get_parent_name()") +Signed-off-by: Sasha Levin +--- + drivers/clk/clk-si5351.c | 47 ++++++++++++++++++++++++++-- + include/linux/platform_data/si5351.h | 2 ++ + 2 files changed, 46 insertions(+), 3 deletions(-) + +diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c +index 00fb9b09e030c..95d7afb8cfc6a 100644 +--- a/drivers/clk/clk-si5351.c ++++ b/drivers/clk/clk-si5351.c +@@ -506,6 +506,8 @@ static int si5351_pll_set_rate(struct clk_hw *hw, unsigned long rate, + { + struct si5351_hw_data *hwdata = + container_of(hw, struct si5351_hw_data, hw); ++ struct si5351_platform_data *pdata = ++ hwdata->drvdata->client->dev.platform_data; + u8 reg = (hwdata->num == 0) ? SI5351_PLLA_PARAMETERS : + SI5351_PLLB_PARAMETERS; + +@@ -518,9 +520,10 @@ static int si5351_pll_set_rate(struct clk_hw *hw, unsigned long rate, + (hwdata->params.p2 == 0) ? SI5351_CLK_INTEGER_MODE : 0); + + /* Do a pll soft reset on the affected pll */ +- si5351_reg_write(hwdata->drvdata, SI5351_PLL_RESET, +- hwdata->num == 0 ? SI5351_PLL_RESET_A : +- SI5351_PLL_RESET_B); ++ if (pdata->pll_reset[hwdata->num]) ++ si5351_reg_write(hwdata->drvdata, SI5351_PLL_RESET, ++ hwdata->num == 0 ? SI5351_PLL_RESET_A : ++ SI5351_PLL_RESET_B); + + dev_dbg(&hwdata->drvdata->client->dev, + "%s - %s: p1 = %lu, p2 = %lu, p3 = %lu, parent_rate = %lu, rate = %lu\n", +@@ -1222,6 +1225,44 @@ static int si5351_dt_parse(struct i2c_client *client, + } + } + ++ /* ++ * Parse PLL reset mode. For compatibility with older device trees, the ++ * default is to always reset a PLL after setting its rate. ++ */ ++ pdata->pll_reset[0] = true; ++ pdata->pll_reset[1] = true; ++ ++ of_property_for_each_u32(np, "silabs,pll-reset-mode", prop, p, num) { ++ if (num >= 2) { ++ dev_err(&client->dev, ++ "invalid pll %d on pll-reset-mode prop\n", num); ++ return -EINVAL; ++ } ++ ++ p = of_prop_next_u32(prop, p, &val); ++ if (!p) { ++ dev_err(&client->dev, ++ "missing pll-reset-mode for pll %d\n", num); ++ return -EINVAL; ++ } ++ ++ switch (val) { ++ case 0: ++ /* Reset PLL whenever its rate is adjusted */ ++ pdata->pll_reset[num] = true; ++ break; ++ case 1: ++ /* Don't reset PLL whenever its rate is adjusted */ ++ pdata->pll_reset[num] = false; ++ break; ++ default: ++ dev_err(&client->dev, ++ "invalid pll-reset-mode %d for pll %d\n", val, ++ num); ++ return -EINVAL; ++ } ++ } ++ + /* per clkout properties */ + for_each_child_of_node(np, child) { + if (of_property_read_u32(child, "reg", &num)) { +diff --git a/include/linux/platform_data/si5351.h b/include/linux/platform_data/si5351.h +index c71a2dd661437..5f412a615532b 100644 +--- a/include/linux/platform_data/si5351.h ++++ b/include/linux/platform_data/si5351.h +@@ -105,10 +105,12 @@ struct si5351_clkout_config { + * @clk_xtal: xtal input clock + * @clk_clkin: clkin input clock + * @pll_src: array of pll source clock setting ++ * @pll_reset: array indicating if plls should be reset after setting the rate + * @clkout: array of clkout configuration + */ + struct si5351_platform_data { + enum si5351_pll_src pll_src[2]; ++ bool pll_reset[2]; + struct si5351_clkout_config clkout[8]; + }; + +-- +2.39.5 + diff --git a/queue-6.6/clk-sunxi-ng-a64-drop-redundant-clk_pll_video0_2x-an.patch b/queue-6.6/clk-sunxi-ng-a64-drop-redundant-clk_pll_video0_2x-an.patch new file mode 100644 index 0000000000..c0e1aa5f7f --- /dev/null +++ b/queue-6.6/clk-sunxi-ng-a64-drop-redundant-clk_pll_video0_2x-an.patch @@ -0,0 +1,48 @@ +From 667458e7745338151e5f739f35681f274a957a47 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Jan 2025 23:36:58 -0800 +Subject: clk: sunxi-ng: a64: drop redundant CLK_PLL_VIDEO0_2X and CLK_PLL_MIPI + +From: Vasily Khoruzhick + +[ Upstream commit 0f368cb7ef103f284f75e962c4c89da5aa8ccec7 ] + +Drop redundant CLK_PLL_VIDEO0_2X and CLK_PLL.MIPI. These are now +defined in dt-bindings/clock/sun50i-a64-ccu.h + +Fixes: ca1170b69968 ("clk: sunxi-ng: a64: force select PLL_MIPI in TCON0 mux") +Reviewed-by: Dragan Simic +Reviewed-by: Chen-Yu Tsai +Tested-by: Frank Oltmanns # on pinephone +Tested-by: Stuart Gathman # on OG pinebook +Signed-off-by: Vasily Khoruzhick +Link: https://patch.msgid.link/20250104074035.1611136-3-anarsoul@gmail.com +Signed-off-by: Chen-Yu Tsai +Signed-off-by: Sasha Levin +--- + drivers/clk/sunxi-ng/ccu-sun50i-a64.h | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.h b/drivers/clk/sunxi-ng/ccu-sun50i-a64.h +index a8c11c0b4e067..dfba88a5ad0f7 100644 +--- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.h ++++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.h +@@ -21,7 +21,6 @@ + + /* PLL_VIDEO0 exported for HDMI PHY */ + +-#define CLK_PLL_VIDEO0_2X 8 + #define CLK_PLL_VE 9 + #define CLK_PLL_DDR0 10 + +@@ -32,7 +31,6 @@ + #define CLK_PLL_PERIPH1_2X 14 + #define CLK_PLL_VIDEO1 15 + #define CLK_PLL_GPU 16 +-#define CLK_PLL_MIPI 17 + #define CLK_PLL_HSIC 18 + #define CLK_PLL_DE 19 + #define CLK_PLL_DDR1 20 +-- +2.39.5 + diff --git a/queue-6.6/clk-sunxi-ng-a64-stop-force-selecting-pll-mipi-as-tc.patch b/queue-6.6/clk-sunxi-ng-a64-stop-force-selecting-pll-mipi-as-tc.patch new file mode 100644 index 0000000000..b25e70dbf2 --- /dev/null +++ b/queue-6.6/clk-sunxi-ng-a64-stop-force-selecting-pll-mipi-as-tc.patch @@ -0,0 +1,76 @@ +From ac5f3d56f3ab285c33a8c7cafbdae24f0584515b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Jan 2025 23:37:00 -0800 +Subject: clk: sunxi-ng: a64: stop force-selecting PLL-MIPI as TCON0 parent + +From: Vasily Khoruzhick + +[ Upstream commit 383ca7bee8a93be9ff5a072936981c2710d2856b ] + +Stop force-selecting PLL-MIPI as TCON0 parent, since it breaks video +output on Pinebook that uses RGB to eDP bridge. + +Partially revert commit ca1170b69968 ("clk: sunxi-ng: a64: force +select PLL_MIPI in TCON0 mux"), while still leaving +CLK_SET_RATE_NO_REPARENT flag set, since we do not want the clock to +be reparented. + +The issue is that apparently different TCON0 outputs require a different +clock, or the mux might be selecting the output type. + +I did an experiment: I manually configured PLL_MIPI and PLL_VIDEO0_2X +to the same clock rate and flipped the switch with devmem. Experiment +clearly showed that whenever PLL_MIPI is selected as TCON0 clock parent, +the video output stops working. + +Therefore, TCON0 clock parent corresponding to the output type must be +assigned in the device tree. + +Fixes: ca1170b69968 ("clk: sunxi-ng: a64: force select PLL_MIPI in TCON0 mux") +Reviewed-by: Dragan Simic +Reviewed-by: Chen-Yu Tsai +Tested-by: Frank Oltmanns # on PinePhone +Tested-by: Stuart Gathman # on OG Pinebook +Signed-off-by: Vasily Khoruzhick +Link: https://patch.msgid.link/20250104074035.1611136-5-anarsoul@gmail.com +Signed-off-by: Chen-Yu Tsai +Signed-off-by: Sasha Levin +--- + drivers/clk/sunxi-ng/ccu-sun50i-a64.c | 13 ++++--------- + 1 file changed, 4 insertions(+), 9 deletions(-) + +diff --git a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c +index 6a4b2b9ef30a8..aee1a2f14c951 100644 +--- a/drivers/clk/sunxi-ng/ccu-sun50i-a64.c ++++ b/drivers/clk/sunxi-ng/ccu-sun50i-a64.c +@@ -533,11 +533,11 @@ static SUNXI_CCU_M_WITH_MUX_GATE(de_clk, "de", de_parents, + CLK_SET_RATE_PARENT); + + /* +- * DSI output seems to work only when PLL_MIPI selected. Set it and prevent +- * the mux from reparenting. ++ * Experiments showed that RGB output requires pll-video0-2x, while DSI ++ * requires pll-mipi. It will not work with incorrect clock, the screen will ++ * be blank. ++ * sun50i-a64.dtsi assigns pll-mipi as TCON0 parent by default + */ +-#define SUN50I_A64_TCON0_CLK_REG 0x118 +- + static const char * const tcon0_parents[] = { "pll-mipi", "pll-video0-2x" }; + static const u8 tcon0_table[] = { 0, 2, }; + static SUNXI_CCU_MUX_TABLE_WITH_GATE_CLOSEST(tcon0_clk, "tcon0", tcon0_parents, +@@ -957,11 +957,6 @@ static int sun50i_a64_ccu_probe(struct platform_device *pdev) + + writel(0x515, reg + SUN50I_A64_PLL_MIPI_REG); + +- /* Set PLL MIPI as parent for TCON0 */ +- val = readl(reg + SUN50I_A64_TCON0_CLK_REG); +- val &= ~GENMASK(26, 24); +- writel(val | (0 << 24), reg + SUN50I_A64_TCON0_CLK_REG); +- + ret = devm_sunxi_ccu_probe(&pdev->dev, reg, &sun50i_a64_ccu_desc); + if (ret) + return ret; +-- +2.39.5 + diff --git a/queue-6.6/cpufreq-acpi-fix-max-frequency-computation.patch b/queue-6.6/cpufreq-acpi-fix-max-frequency-computation.patch new file mode 100644 index 0000000000..9cf906cf0d --- /dev/null +++ b/queue-6.6/cpufreq-acpi-fix-max-frequency-computation.patch @@ -0,0 +1,122 @@ +From 63c03b02ad9ccb1fcb873179d275ef18d1ca9e8f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Jan 2025 10:11:07 +0530 +Subject: cpufreq: ACPI: Fix max-frequency computation + +From: Gautham R. Shenoy + +[ Upstream commit 0834667545962ef1c5e8684ed32b45d9c574acd3 ] + +Commit 3c55e94c0ade ("cpufreq: ACPI: Extend frequency tables to cover +boost frequencies") introduced an assumption in acpi_cpufreq_cpu_init() +that the first entry in the P-state table was the nominal frequency. +This assumption is incorrect. The frequency corresponding to the P0 +P-State need not be the same as the nominal frequency advertised via +CPPC. + +Since the driver is using the CPPC.highest_perf and CPPC.nominal_perf +to compute the boost-ratio, it makes sense to use CPPC.nominal_freq to +compute the max-frequency. CPPC.nominal_freq is advertised on +platforms supporting CPPC revisions 3 or higher. + +Hence, fallback to using the first entry in the P-State table only on +platforms that do not advertise CPPC.nominal_freq. + +Fixes: 3c55e94c0ade ("cpufreq: ACPI: Extend frequency tables to cover boost frequencies") +Tested-by: Dhananjay Ugwekar +Signed-off-by: Gautham R. Shenoy +Reviewed-by: Mario Limonciello +Link: https://patch.msgid.link/20250113044107.566-1-gautham.shenoy@amd.com +[ rjw: Retain reverse X-mas tree ordering of local variable declarations ] +[ rjw: Subject and changelog edits ] +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/acpi-cpufreq.c | 36 +++++++++++++++++++++++++--------- + 1 file changed, 27 insertions(+), 9 deletions(-) + +diff --git a/drivers/cpufreq/acpi-cpufreq.c b/drivers/cpufreq/acpi-cpufreq.c +index 4ac3a35dcd983..0615e7fa20ad7 100644 +--- a/drivers/cpufreq/acpi-cpufreq.c ++++ b/drivers/cpufreq/acpi-cpufreq.c +@@ -628,7 +628,14 @@ static int acpi_cpufreq_blacklist(struct cpuinfo_x86 *c) + #endif + + #ifdef CONFIG_ACPI_CPPC_LIB +-static u64 get_max_boost_ratio(unsigned int cpu) ++/* ++ * get_max_boost_ratio: Computes the max_boost_ratio as the ratio ++ * between the highest_perf and the nominal_perf. ++ * ++ * Returns the max_boost_ratio for @cpu. Returns the CPPC nominal ++ * frequency via @nominal_freq if it is non-NULL pointer. ++ */ ++static u64 get_max_boost_ratio(unsigned int cpu, u64 *nominal_freq) + { + struct cppc_perf_caps perf_caps; + u64 highest_perf, nominal_perf; +@@ -651,6 +658,9 @@ static u64 get_max_boost_ratio(unsigned int cpu) + + nominal_perf = perf_caps.nominal_perf; + ++ if (nominal_freq) ++ *nominal_freq = perf_caps.nominal_freq; ++ + if (!highest_perf || !nominal_perf) { + pr_debug("CPU%d: highest or nominal performance missing\n", cpu); + return 0; +@@ -663,8 +673,12 @@ static u64 get_max_boost_ratio(unsigned int cpu) + + return div_u64(highest_perf << SCHED_CAPACITY_SHIFT, nominal_perf); + } ++ + #else +-static inline u64 get_max_boost_ratio(unsigned int cpu) { return 0; } ++static inline u64 get_max_boost_ratio(unsigned int cpu, u64 *nominal_freq) ++{ ++ return 0; ++} + #endif + + static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) +@@ -674,9 +688,9 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) + struct acpi_cpufreq_data *data; + unsigned int cpu = policy->cpu; + struct cpuinfo_x86 *c = &cpu_data(cpu); ++ u64 max_boost_ratio, nominal_freq = 0; + unsigned int valid_states = 0; + unsigned int result = 0; +- u64 max_boost_ratio; + unsigned int i; + #ifdef CONFIG_SMP + static int blacklisted; +@@ -826,16 +840,20 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy) + } + freq_table[valid_states].frequency = CPUFREQ_TABLE_END; + +- max_boost_ratio = get_max_boost_ratio(cpu); ++ max_boost_ratio = get_max_boost_ratio(cpu, &nominal_freq); + if (max_boost_ratio) { +- unsigned int freq = freq_table[0].frequency; ++ unsigned int freq = nominal_freq; + + /* +- * Because the loop above sorts the freq_table entries in the +- * descending order, freq is the maximum frequency in the table. +- * Assume that it corresponds to the CPPC nominal frequency and +- * use it to set cpuinfo.max_freq. ++ * The loop above sorts the freq_table entries in the ++ * descending order. If ACPI CPPC has not advertised ++ * the nominal frequency (this is possible in CPPC ++ * revisions prior to 3), then use the first entry in ++ * the pstate table as a proxy for nominal frequency. + */ ++ if (!freq) ++ freq = freq_table[0].frequency; ++ + policy->cpuinfo.max_freq = freq * max_boost_ratio >> SCHED_CAPACITY_SHIFT; + } else { + /* +-- +2.39.5 + diff --git a/queue-6.6/cpufreq-qcom-fix-qcom_cpufreq_hw_recalc_rate-to-quer.patch b/queue-6.6/cpufreq-qcom-fix-qcom_cpufreq_hw_recalc_rate-to-quer.patch new file mode 100644 index 0000000000..8946569a1d --- /dev/null +++ b/queue-6.6/cpufreq-qcom-fix-qcom_cpufreq_hw_recalc_rate-to-quer.patch @@ -0,0 +1,114 @@ +From 8c038debeeca7a17285e694e91d6ccf80882ca35 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 5 Dec 2024 22:20:28 +0530 +Subject: cpufreq: qcom: Fix qcom_cpufreq_hw_recalc_rate() to query LUT if LMh + IRQ is not available + +From: Manivannan Sadhasivam + +[ Upstream commit 85d8b11351a8f15d6ec7a5e97909861cb3b6bcec ] + +Currently, qcom_cpufreq_hw_recalc_rate() returns the LMh throttled +frequency for the domain even if LMh IRQ is not available. But as per +qcom_cpufreq_hw_get(), the driver has to query LUT entries to get the +actual frequency of the domain. So do the same in +qcom_cpufreq_hw_recalc_rate(). + +While doing so, refactor the existing qcom_cpufreq_hw_get() function so +that qcom_cpufreq_hw_recalc_rate() can make use of the existing code and +avoid code duplication. This also requires setting the +qcom_cpufreq_data::policy even if LMh IRQ is not available. + +Fixes: 4370232c727b ("cpufreq: qcom-hw: Add CPU clock provider support") +Signed-off-by: Manivannan Sadhasivam +Signed-off-by: Viresh Kumar +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/qcom-cpufreq-hw.c | 21 +++++++++++---------- + 1 file changed, 11 insertions(+), 10 deletions(-) + +diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c +index 70b0f21968a01..3a4305df5c119 100644 +--- a/drivers/cpufreq/qcom-cpufreq-hw.c ++++ b/drivers/cpufreq/qcom-cpufreq-hw.c +@@ -142,14 +142,12 @@ static unsigned long qcom_lmh_get_throttle_freq(struct qcom_cpufreq_data *data) + } + + /* Get the frequency requested by the cpufreq core for the CPU */ +-static unsigned int qcom_cpufreq_get_freq(unsigned int cpu) ++static unsigned int qcom_cpufreq_get_freq(struct cpufreq_policy *policy) + { + struct qcom_cpufreq_data *data; + const struct qcom_cpufreq_soc_data *soc_data; +- struct cpufreq_policy *policy; + unsigned int index; + +- policy = cpufreq_cpu_get_raw(cpu); + if (!policy) + return 0; + +@@ -162,12 +160,10 @@ static unsigned int qcom_cpufreq_get_freq(unsigned int cpu) + return policy->freq_table[index].frequency; + } + +-static unsigned int qcom_cpufreq_hw_get(unsigned int cpu) ++static unsigned int __qcom_cpufreq_hw_get(struct cpufreq_policy *policy) + { + struct qcom_cpufreq_data *data; +- struct cpufreq_policy *policy; + +- policy = cpufreq_cpu_get_raw(cpu); + if (!policy) + return 0; + +@@ -176,7 +172,12 @@ static unsigned int qcom_cpufreq_hw_get(unsigned int cpu) + if (data->throttle_irq >= 0) + return qcom_lmh_get_throttle_freq(data) / HZ_PER_KHZ; + +- return qcom_cpufreq_get_freq(cpu); ++ return qcom_cpufreq_get_freq(policy); ++} ++ ++static unsigned int qcom_cpufreq_hw_get(unsigned int cpu) ++{ ++ return __qcom_cpufreq_hw_get(cpufreq_cpu_get_raw(cpu)); + } + + static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy, +@@ -362,7 +363,7 @@ static void qcom_lmh_dcvs_notify(struct qcom_cpufreq_data *data) + * If h/w throttled frequency is higher than what cpufreq has requested + * for, then stop polling and switch back to interrupt mechanism. + */ +- if (throttled_freq >= qcom_cpufreq_get_freq(cpu)) ++ if (throttled_freq >= qcom_cpufreq_get_freq(cpufreq_cpu_get_raw(cpu))) + enable_irq(data->throttle_irq); + else + mod_delayed_work(system_highpri_wq, &data->throttle_work, +@@ -440,7 +441,6 @@ static int qcom_cpufreq_hw_lmh_init(struct cpufreq_policy *policy, int index) + return data->throttle_irq; + + data->cancel_throttle = false; +- data->policy = policy; + + mutex_init(&data->throttle_lock); + INIT_DEFERRABLE_WORK(&data->throttle_work, qcom_lmh_dcvs_poll); +@@ -551,6 +551,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy) + + policy->driver_data = data; + policy->dvfs_possible_from_any_cpu = true; ++ data->policy = policy; + + ret = qcom_cpufreq_hw_read_lut(cpu_dev, policy); + if (ret) { +@@ -623,7 +624,7 @@ static unsigned long qcom_cpufreq_hw_recalc_rate(struct clk_hw *hw, unsigned lon + { + struct qcom_cpufreq_data *data = container_of(hw, struct qcom_cpufreq_data, cpu_clk); + +- return qcom_lmh_get_throttle_freq(data); ++ return __qcom_cpufreq_hw_get(data->policy) * HZ_PER_KHZ; + } + + static const struct clk_ops qcom_cpufreq_hw_clk_ops = { +-- +2.39.5 + diff --git a/queue-6.6/cpufreq-qcom-implement-clk_ops-determine_rate-for-qc.patch b/queue-6.6/cpufreq-qcom-implement-clk_ops-determine_rate-for-qc.patch new file mode 100644 index 0000000000..cf15b59ae1 --- /dev/null +++ b/queue-6.6/cpufreq-qcom-implement-clk_ops-determine_rate-for-qc.patch @@ -0,0 +1,67 @@ +From 95cc7a93aac6917cb6acd939dc5e70b45b9dd863 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 5 Dec 2024 22:20:29 +0530 +Subject: cpufreq: qcom: Implement clk_ops::determine_rate() for qcom_cpufreq* + clocks + +From: Manivannan Sadhasivam + +[ Upstream commit a9ba290d0b829012574b6821ba08815046e60c94 ] + +determine_rate() callback is used by the clk_set_rate() API to get the +closest rate of the target rate supported by the clock. If this callback +is not implemented (nor round_rate() callback), then the API will assume +that the clock cannot set the requested rate. And since there is no parent, +it will return -EINVAL. + +This is not an issue right now as clk_set_rate() mistakenly compares the +target rate with cached rate and bails out early. But once that is fixed +to compare the target rate with the actual rate of the clock (returned by +recalc_rate()), then clk_set_rate() for this clock will start to fail as +below: + +cpu cpu0: _opp_config_clk_single: failed to set clock rate: -22 + +So implement the determine_rate() callback that just returns the actual +rate at which the clock is passed to the CPUs in a domain. + +Fixes: 4370232c727b ("cpufreq: qcom-hw: Add CPU clock provider support") +Reported-by: Johan Hovold +Suggested-by: Stephen Boyd +Signed-off-by: Manivannan Sadhasivam +Reviewed-by: Stephen Boyd +Signed-off-by: Viresh Kumar +Signed-off-by: Sasha Levin +--- + drivers/cpufreq/qcom-cpufreq-hw.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c +index 3a4305df5c119..92c0fc4a3cf60 100644 +--- a/drivers/cpufreq/qcom-cpufreq-hw.c ++++ b/drivers/cpufreq/qcom-cpufreq-hw.c +@@ -627,8 +627,21 @@ static unsigned long qcom_cpufreq_hw_recalc_rate(struct clk_hw *hw, unsigned lon + return __qcom_cpufreq_hw_get(data->policy) * HZ_PER_KHZ; + } + ++/* ++ * Since we cannot determine the closest rate of the target rate, let's just ++ * return the actual rate at which the clock is running at. This is needed to ++ * make clk_set_rate() API work properly. ++ */ ++static int qcom_cpufreq_hw_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) ++{ ++ req->rate = qcom_cpufreq_hw_recalc_rate(hw, 0); ++ ++ return 0; ++} ++ + static const struct clk_ops qcom_cpufreq_hw_clk_ops = { + .recalc_rate = qcom_cpufreq_hw_recalc_rate, ++ .determine_rate = qcom_cpufreq_hw_determine_rate, + }; + + static int qcom_cpufreq_hw_driver_probe(struct platform_device *pdev) +-- +2.39.5 + diff --git a/queue-6.6/cpufreq-schedutil-fix-superfluous-updates-caused-by-.patch b/queue-6.6/cpufreq-schedutil-fix-superfluous-updates-caused-by-.patch new file mode 100644 index 0000000000..e8aa808fd9 --- /dev/null +++ b/queue-6.6/cpufreq-schedutil-fix-superfluous-updates-caused-by-.patch @@ -0,0 +1,64 @@ +From f8176b4ea50c5903420240bdd9babdb665e8e6d9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Dec 2024 17:57:32 -0800 +Subject: cpufreq: schedutil: Fix superfluous updates caused by + need_freq_update + +From: Sultan Alsawaf (unemployed) + +[ Upstream commit 8e461a1cb43d69d2fc8a97e61916dce571e6bb31 ] + +A redundant frequency update is only truly needed when there is a policy +limits change with a driver that specifies CPUFREQ_NEED_UPDATE_LIMITS. + +In spite of that, drivers specifying CPUFREQ_NEED_UPDATE_LIMITS receive a +frequency update _all the time_, not just for a policy limits change, +because need_freq_update is never cleared. + +Furthermore, ignore_dl_rate_limit()'s usage of need_freq_update also leads +to a redundant frequency update, regardless of whether or not the driver +specifies CPUFREQ_NEED_UPDATE_LIMITS, when the next chosen frequency is the +same as the current one. + +Fix the superfluous updates by only honoring CPUFREQ_NEED_UPDATE_LIMITS +when there's a policy limits change, and clearing need_freq_update when a +requisite redundant update occurs. + +This is neatly achieved by moving up the CPUFREQ_NEED_UPDATE_LIMITS test +and instead setting need_freq_update to false in sugov_update_next_freq(). + +Fixes: 600f5badb78c ("cpufreq: schedutil: Don't skip freq update when limits change") +Signed-off-by: Sultan Alsawaf (unemployed) +Reviewed-by: Christian Loehle +Link: https://patch.msgid.link/20241212015734.41241-2-sultan@kerneltoast.com +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + kernel/sched/cpufreq_schedutil.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/kernel/sched/cpufreq_schedutil.c b/kernel/sched/cpufreq_schedutil.c +index 458d359f5991c..a49f136014ce6 100644 +--- a/kernel/sched/cpufreq_schedutil.c ++++ b/kernel/sched/cpufreq_schedutil.c +@@ -83,7 +83,7 @@ static bool sugov_should_update_freq(struct sugov_policy *sg_policy, u64 time) + + if (unlikely(sg_policy->limits_changed)) { + sg_policy->limits_changed = false; +- sg_policy->need_freq_update = true; ++ sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS); + return true; + } + +@@ -96,7 +96,7 @@ static bool sugov_update_next_freq(struct sugov_policy *sg_policy, u64 time, + unsigned int next_freq) + { + if (sg_policy->need_freq_update) +- sg_policy->need_freq_update = cpufreq_driver_test_flags(CPUFREQ_NEED_UPDATE_LIMITS); ++ sg_policy->need_freq_update = false; + else if (sg_policy->next_freq == next_freq) + return false; + +-- +2.39.5 + diff --git a/queue-6.6/cpupower-fix-tsc-mhz-calculation.patch b/queue-6.6/cpupower-fix-tsc-mhz-calculation.patch new file mode 100644 index 0000000000..f2b8c4fcbe --- /dev/null +++ b/queue-6.6/cpupower-fix-tsc-mhz-calculation.patch @@ -0,0 +1,114 @@ +From 9a4445cddc2d79276189a85e988e00bfcc03a897 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Dec 2024 10:14:59 +0800 +Subject: cpupower: fix TSC MHz calculation + +From: He Rongguang + +[ Upstream commit 9d6c0e58514f8b57cd9c2c755e41623d6a966025 ] + +Commit 'cpupower: Make TSC read per CPU for Mperf monitor' (c2adb1877b7) +changes TSC counter reads per cpu, but left time diff global (from start +of all cpus to end of all cpus), thus diff(time) is too large for a +cpu's tsc counting, resulting in far less than acutal TSC_Mhz and thus +`cpupower monitor` showing far less than actual cpu realtime frequency. + +/proc/cpuinfo shows frequency: +cat /proc/cpuinfo | egrep -e 'processor' -e 'MHz' +... +processor : 171 +cpu MHz : 4108.498 +... + +before fix (System 100% busy): + | Mperf || Idle_Stats + CPU| C0 | Cx | Freq || POLL | C1 | C2 + 171| 0.77| 99.23| 2279|| 0.00| 0.00| 0.00 + +after fix (System 100% busy): + | Mperf || Idle_Stats + CPU| C0 | Cx | Freq || POLL | C1 | C2 + 171| 0.46| 99.54| 4095|| 0.00| 0.00| 0.00 + +Fixes: c2adb1877b76 ("cpupower: Make TSC read per CPU for Mperf monitor") +Signed-off-by: He Rongguang +Signed-off-by: Shuah Khan +Signed-off-by: Sasha Levin +--- + .../cpupower/utils/idle_monitor/mperf_monitor.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c b/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c +index ae6af354a81db..08a399b0be286 100644 +--- a/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c ++++ b/tools/power/cpupower/utils/idle_monitor/mperf_monitor.c +@@ -33,7 +33,7 @@ static int mperf_get_count_percent(unsigned int self_id, double *percent, + unsigned int cpu); + static int mperf_get_count_freq(unsigned int id, unsigned long long *count, + unsigned int cpu); +-static struct timespec time_start, time_end; ++static struct timespec *time_start, *time_end; + + static cstate_t mperf_cstates[MPERF_CSTATE_COUNT] = { + { +@@ -174,7 +174,7 @@ static int mperf_get_count_percent(unsigned int id, double *percent, + dprint("%s: TSC Ref - mperf_diff: %llu, tsc_diff: %llu\n", + mperf_cstates[id].name, mperf_diff, tsc_diff); + } else if (max_freq_mode == MAX_FREQ_SYSFS) { +- timediff = max_frequency * timespec_diff_us(time_start, time_end); ++ timediff = max_frequency * timespec_diff_us(time_start[cpu], time_end[cpu]); + *percent = 100.0 * mperf_diff / timediff; + dprint("%s: MAXFREQ - mperf_diff: %llu, time_diff: %llu\n", + mperf_cstates[id].name, mperf_diff, timediff); +@@ -207,7 +207,7 @@ static int mperf_get_count_freq(unsigned int id, unsigned long long *count, + if (max_freq_mode == MAX_FREQ_TSC_REF) { + /* Calculate max_freq from TSC count */ + tsc_diff = tsc_at_measure_end[cpu] - tsc_at_measure_start[cpu]; +- time_diff = timespec_diff_us(time_start, time_end); ++ time_diff = timespec_diff_us(time_start[cpu], time_end[cpu]); + max_frequency = tsc_diff / time_diff; + } + +@@ -226,9 +226,8 @@ static int mperf_start(void) + { + int cpu; + +- clock_gettime(CLOCK_REALTIME, &time_start); +- + for (cpu = 0; cpu < cpu_count; cpu++) { ++ clock_gettime(CLOCK_REALTIME, &time_start[cpu]); + mperf_get_tsc(&tsc_at_measure_start[cpu]); + mperf_init_stats(cpu); + } +@@ -243,9 +242,9 @@ static int mperf_stop(void) + for (cpu = 0; cpu < cpu_count; cpu++) { + mperf_measure_stats(cpu); + mperf_get_tsc(&tsc_at_measure_end[cpu]); ++ clock_gettime(CLOCK_REALTIME, &time_end[cpu]); + } + +- clock_gettime(CLOCK_REALTIME, &time_end); + return 0; + } + +@@ -349,6 +348,8 @@ struct cpuidle_monitor *mperf_register(void) + aperf_current_count = calloc(cpu_count, sizeof(unsigned long long)); + tsc_at_measure_start = calloc(cpu_count, sizeof(unsigned long long)); + tsc_at_measure_end = calloc(cpu_count, sizeof(unsigned long long)); ++ time_start = calloc(cpu_count, sizeof(struct timespec)); ++ time_end = calloc(cpu_count, sizeof(struct timespec)); + mperf_monitor.name_len = strlen(mperf_monitor.name); + return &mperf_monitor; + } +@@ -361,6 +362,8 @@ void mperf_unregister(void) + free(aperf_current_count); + free(tsc_at_measure_start); + free(tsc_at_measure_end); ++ free(time_start); ++ free(time_end); + free(is_valid); + } + +-- +2.39.5 + diff --git a/queue-6.6/crypto-api-fix-boot-up-self-test-race.patch b/queue-6.6/crypto-api-fix-boot-up-self-test-race.patch new file mode 100644 index 0000000000..4a3b3c15f1 --- /dev/null +++ b/queue-6.6/crypto-api-fix-boot-up-self-test-race.patch @@ -0,0 +1,54 @@ +From a144664791bfadf0ee3696eab865318a189b3783 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Nov 2024 09:29:02 +0800 +Subject: crypto: api - Fix boot-up self-test race + +From: Herbert Xu + +[ Upstream commit 8dd458cbc5be9ce4427ffce7a9dcdbff4dfc4ac9 ] + +During the boot process self-tests are postponed so that all +algorithms are registered when the test starts. In the event +that algorithms are still being registered during these tests, +which can occur either because the algorithm is registered at +late_initcall, or because a self-test itself triggers the creation +of an instance, some self-tests may never start at all. + +Fix this by setting the flag at the start of crypto_start_tests. + +Note that this race is theoretical and has never been observed +in practice. + +Fixes: adad556efcdd ("crypto: api - Fix built-in testing dependency failures") +Signed-off-by: Herbert Xu +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + crypto/algapi.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/crypto/algapi.c b/crypto/algapi.c +index b3a6086042530..f287085a21fa2 100644 +--- a/crypto/algapi.c ++++ b/crypto/algapi.c +@@ -1059,6 +1059,8 @@ static void __init crypto_start_tests(void) + if (IS_ENABLED(CONFIG_CRYPTO_MANAGER_DISABLE_TESTS)) + return; + ++ set_crypto_boot_test_finished(); ++ + for (;;) { + struct crypto_larval *larval = NULL; + struct crypto_alg *q; +@@ -1091,8 +1093,6 @@ static void __init crypto_start_tests(void) + + crypto_wait_for_test(larval); + } +- +- set_crypto_boot_test_finished(); + } + + static int __init crypto_algapi_init(void) +-- +2.39.5 + diff --git a/queue-6.6/crypto-caam-use-jobr-s-space-to-access-page-0-regs.patch b/queue-6.6/crypto-caam-use-jobr-s-space-to-access-page-0-regs.patch new file mode 100644 index 0000000000..701b1d9dfd --- /dev/null +++ b/queue-6.6/crypto-caam-use-jobr-s-space-to-access-page-0-regs.patch @@ -0,0 +1,50 @@ +From 63c3efe7a76f146740115d5175759b6610eff069 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 26 Nov 2024 12:16:07 +0530 +Subject: crypto: caam - use JobR's space to access page 0 regs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Gaurav Jain + +[ Upstream commit 73a7496c218b7ca19ba276f54758e7f0adf269c5 ] + +On iMX8DXL/QM/QXP(SECO) & iMX8ULP(ELE) SoCs, access to controller +region(CAAM page 0) is not permitted from non secure world. +use JobR's register space to access page 0 registers. + +Fixes: 6a83830f649a ("crypto: caam - warn if blob_gen key is insecure") +Signed-off-by: Gaurav Jain +Reviewed-by: Ahmad Fatoum +Reviewed-by: Horia Geantă +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + drivers/crypto/caam/blob_gen.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/crypto/caam/blob_gen.c b/drivers/crypto/caam/blob_gen.c +index 87781c1534ee5..079a22cc9f02b 100644 +--- a/drivers/crypto/caam/blob_gen.c ++++ b/drivers/crypto/caam/blob_gen.c +@@ -2,6 +2,7 @@ + /* + * Copyright (C) 2015 Pengutronix, Steffen Trumtrar + * Copyright (C) 2021 Pengutronix, Ahmad Fatoum ++ * Copyright 2024 NXP + */ + + #define pr_fmt(fmt) "caam blob_gen: " fmt +@@ -104,7 +105,7 @@ int caam_process_blob(struct caam_blob_priv *priv, + } + + ctrlpriv = dev_get_drvdata(jrdev->parent); +- moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->ctrl->perfmon.status)); ++ moo = FIELD_GET(CSTA_MOO, rd_reg32(&ctrlpriv->jr[0]->perfmon.status)); + if (moo != CSTA_MOO_SECURE && moo != CSTA_MOO_TRUSTED) + dev_warn(jrdev, + "using insecure test key, enable HAB to use unique device key!\n"); +-- +2.39.5 + diff --git a/queue-6.6/crypto-hisilicon-sec2-fix-for-aead-icv-error.patch b/queue-6.6/crypto-hisilicon-sec2-fix-for-aead-icv-error.patch new file mode 100644 index 0000000000..a132f3fbbf --- /dev/null +++ b/queue-6.6/crypto-hisilicon-sec2-fix-for-aead-icv-error.patch @@ -0,0 +1,320 @@ +From b5b9b1308a128859abb032c985235de82a7e992f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 Dec 2024 17:13:34 +0800 +Subject: crypto: hisilicon/sec2 - fix for aead icv error + +From: Wenkai Lin + +[ Upstream commit fd337f852b2677b53d0859a47b58e6e6bd189f30 ] + +When the AEAD algorithm is used for encryption or decryption, +the input authentication length varies, the hardware needs to +obtain the input length to pass the integrity check verification. +Currently, the driver uses a fixed authentication length,which +causes decryption failure, so the length configuration is modified. +In addition, the step of setting the auth length is unnecessary, +so it was deleted from the setkey function. + +Fixes: 2f072d75d1ab ("crypto: hisilicon - Add aead support on SEC2") +Signed-off-by: Wenkai Lin +Signed-off-by: Chenghai Huang +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + drivers/crypto/hisilicon/sec2/sec.h | 1 - + drivers/crypto/hisilicon/sec2/sec_crypto.c | 101 +++++++++------------ + drivers/crypto/hisilicon/sec2/sec_crypto.h | 11 --- + 3 files changed, 44 insertions(+), 69 deletions(-) + +diff --git a/drivers/crypto/hisilicon/sec2/sec.h b/drivers/crypto/hisilicon/sec2/sec.h +index 410c83712e285..714bfd7c28752 100644 +--- a/drivers/crypto/hisilicon/sec2/sec.h ++++ b/drivers/crypto/hisilicon/sec2/sec.h +@@ -90,7 +90,6 @@ struct sec_auth_ctx { + dma_addr_t a_key_dma; + u8 *a_key; + u8 a_key_len; +- u8 mac_len; + u8 a_alg; + bool fallback; + struct crypto_shash *hash_tfm; +diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hisilicon/sec2/sec_crypto.c +index 7b5012cf1ffac..908fb7106a44b 100644 +--- a/drivers/crypto/hisilicon/sec2/sec_crypto.c ++++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c +@@ -953,15 +953,14 @@ static int sec_aead_mac_init(struct sec_aead_req *req) + struct aead_request *aead_req = req->aead_req; + struct crypto_aead *tfm = crypto_aead_reqtfm(aead_req); + size_t authsize = crypto_aead_authsize(tfm); +- u8 *mac_out = req->out_mac; + struct scatterlist *sgl = aead_req->src; ++ u8 *mac_out = req->out_mac; + size_t copy_size; + off_t skip_size; + + /* Copy input mac */ + skip_size = aead_req->assoclen + aead_req->cryptlen - authsize; +- copy_size = sg_pcopy_to_buffer(sgl, sg_nents(sgl), mac_out, +- authsize, skip_size); ++ copy_size = sg_pcopy_to_buffer(sgl, sg_nents(sgl), mac_out, authsize, skip_size); + if (unlikely(copy_size != authsize)) + return -EINVAL; + +@@ -1143,7 +1142,6 @@ static int sec_aead_fallback_setkey(struct sec_auth_ctx *a_ctx, + static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key, + const u32 keylen, const enum sec_hash_alg a_alg, + const enum sec_calg c_alg, +- const enum sec_mac_len mac_len, + const enum sec_cmode c_mode) + { + struct sec_ctx *ctx = crypto_aead_ctx(tfm); +@@ -1155,7 +1153,6 @@ static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key, + + ctx->a_ctx.a_alg = a_alg; + ctx->c_ctx.c_alg = c_alg; +- ctx->a_ctx.mac_len = mac_len; + c_ctx->c_mode = c_mode; + + if (c_mode == SEC_CMODE_CCM || c_mode == SEC_CMODE_GCM) { +@@ -1191,10 +1188,9 @@ static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key, + goto bad_key; + } + +- if ((ctx->a_ctx.mac_len & SEC_SQE_LEN_RATE_MASK) || +- (ctx->a_ctx.a_key_len & SEC_SQE_LEN_RATE_MASK)) { ++ if (ctx->a_ctx.a_key_len & SEC_SQE_LEN_RATE_MASK) { + ret = -EINVAL; +- dev_err(dev, "MAC or AUTH key length error!\n"); ++ dev_err(dev, "AUTH key length error!\n"); + goto bad_key; + } + +@@ -1206,27 +1202,19 @@ static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key, + } + + +-#define GEN_SEC_AEAD_SETKEY_FUNC(name, aalg, calg, maclen, cmode) \ +-static int sec_setkey_##name(struct crypto_aead *tfm, const u8 *key, \ +- u32 keylen) \ +-{ \ +- return sec_aead_setkey(tfm, key, keylen, aalg, calg, maclen, cmode);\ +-} +- +-GEN_SEC_AEAD_SETKEY_FUNC(aes_cbc_sha1, SEC_A_HMAC_SHA1, +- SEC_CALG_AES, SEC_HMAC_SHA1_MAC, SEC_CMODE_CBC) +-GEN_SEC_AEAD_SETKEY_FUNC(aes_cbc_sha256, SEC_A_HMAC_SHA256, +- SEC_CALG_AES, SEC_HMAC_SHA256_MAC, SEC_CMODE_CBC) +-GEN_SEC_AEAD_SETKEY_FUNC(aes_cbc_sha512, SEC_A_HMAC_SHA512, +- SEC_CALG_AES, SEC_HMAC_SHA512_MAC, SEC_CMODE_CBC) +-GEN_SEC_AEAD_SETKEY_FUNC(aes_ccm, 0, SEC_CALG_AES, +- SEC_HMAC_CCM_MAC, SEC_CMODE_CCM) +-GEN_SEC_AEAD_SETKEY_FUNC(aes_gcm, 0, SEC_CALG_AES, +- SEC_HMAC_GCM_MAC, SEC_CMODE_GCM) +-GEN_SEC_AEAD_SETKEY_FUNC(sm4_ccm, 0, SEC_CALG_SM4, +- SEC_HMAC_CCM_MAC, SEC_CMODE_CCM) +-GEN_SEC_AEAD_SETKEY_FUNC(sm4_gcm, 0, SEC_CALG_SM4, +- SEC_HMAC_GCM_MAC, SEC_CMODE_GCM) ++#define GEN_SEC_AEAD_SETKEY_FUNC(name, aalg, calg, cmode) \ ++static int sec_setkey_##name(struct crypto_aead *tfm, const u8 *key, u32 keylen) \ ++{ \ ++ return sec_aead_setkey(tfm, key, keylen, aalg, calg, cmode); \ ++} ++ ++GEN_SEC_AEAD_SETKEY_FUNC(aes_cbc_sha1, SEC_A_HMAC_SHA1, SEC_CALG_AES, SEC_CMODE_CBC) ++GEN_SEC_AEAD_SETKEY_FUNC(aes_cbc_sha256, SEC_A_HMAC_SHA256, SEC_CALG_AES, SEC_CMODE_CBC) ++GEN_SEC_AEAD_SETKEY_FUNC(aes_cbc_sha512, SEC_A_HMAC_SHA512, SEC_CALG_AES, SEC_CMODE_CBC) ++GEN_SEC_AEAD_SETKEY_FUNC(aes_ccm, 0, SEC_CALG_AES, SEC_CMODE_CCM) ++GEN_SEC_AEAD_SETKEY_FUNC(aes_gcm, 0, SEC_CALG_AES, SEC_CMODE_GCM) ++GEN_SEC_AEAD_SETKEY_FUNC(sm4_ccm, 0, SEC_CALG_SM4, SEC_CMODE_CCM) ++GEN_SEC_AEAD_SETKEY_FUNC(sm4_gcm, 0, SEC_CALG_SM4, SEC_CMODE_GCM) + + static int sec_aead_sgl_map(struct sec_ctx *ctx, struct sec_req *req) + { +@@ -1474,9 +1462,10 @@ static void sec_skcipher_callback(struct sec_ctx *ctx, struct sec_req *req, + static void set_aead_auth_iv(struct sec_ctx *ctx, struct sec_req *req) + { + struct aead_request *aead_req = req->aead_req.aead_req; +- struct sec_cipher_req *c_req = &req->c_req; ++ struct crypto_aead *tfm = crypto_aead_reqtfm(aead_req); ++ size_t authsize = crypto_aead_authsize(tfm); + struct sec_aead_req *a_req = &req->aead_req; +- size_t authsize = ctx->a_ctx.mac_len; ++ struct sec_cipher_req *c_req = &req->c_req; + u32 data_size = aead_req->cryptlen; + u8 flage = 0; + u8 cm, cl; +@@ -1517,10 +1506,8 @@ static void set_aead_auth_iv(struct sec_ctx *ctx, struct sec_req *req) + static void sec_aead_set_iv(struct sec_ctx *ctx, struct sec_req *req) + { + struct aead_request *aead_req = req->aead_req.aead_req; +- struct crypto_aead *tfm = crypto_aead_reqtfm(aead_req); +- size_t authsize = crypto_aead_authsize(tfm); +- struct sec_cipher_req *c_req = &req->c_req; + struct sec_aead_req *a_req = &req->aead_req; ++ struct sec_cipher_req *c_req = &req->c_req; + + memcpy(c_req->c_ivin, aead_req->iv, ctx->c_ctx.ivsize); + +@@ -1528,15 +1515,11 @@ static void sec_aead_set_iv(struct sec_ctx *ctx, struct sec_req *req) + /* + * CCM 16Byte Cipher_IV: {1B_Flage,13B_IV,2B_counter}, + * the counter must set to 0x01 ++ * CCM 16Byte Auth_IV: {1B_AFlage,13B_IV,2B_Ptext_length} + */ +- ctx->a_ctx.mac_len = authsize; +- /* CCM 16Byte Auth_IV: {1B_AFlage,13B_IV,2B_Ptext_length} */ + set_aead_auth_iv(ctx, req); +- } +- +- /* GCM 12Byte Cipher_IV == Auth_IV */ +- if (ctx->c_ctx.c_mode == SEC_CMODE_GCM) { +- ctx->a_ctx.mac_len = authsize; ++ } else if (ctx->c_ctx.c_mode == SEC_CMODE_GCM) { ++ /* GCM 12Byte Cipher_IV == Auth_IV */ + memcpy(a_req->a_ivin, c_req->c_ivin, SEC_AIV_SIZE); + } + } +@@ -1546,9 +1529,11 @@ static void sec_auth_bd_fill_xcm(struct sec_auth_ctx *ctx, int dir, + { + struct sec_aead_req *a_req = &req->aead_req; + struct aead_request *aq = a_req->aead_req; ++ struct crypto_aead *tfm = crypto_aead_reqtfm(aq); ++ size_t authsize = crypto_aead_authsize(tfm); + + /* C_ICV_Len is MAC size, 0x4 ~ 0x10 */ +- sec_sqe->type2.icvw_kmode |= cpu_to_le16((u16)ctx->mac_len); ++ sec_sqe->type2.icvw_kmode |= cpu_to_le16((u16)authsize); + + /* mode set to CCM/GCM, don't set {A_Alg, AKey_Len, MAC_Len} */ + sec_sqe->type2.a_key_addr = sec_sqe->type2.c_key_addr; +@@ -1572,9 +1557,11 @@ static void sec_auth_bd_fill_xcm_v3(struct sec_auth_ctx *ctx, int dir, + { + struct sec_aead_req *a_req = &req->aead_req; + struct aead_request *aq = a_req->aead_req; ++ struct crypto_aead *tfm = crypto_aead_reqtfm(aq); ++ size_t authsize = crypto_aead_authsize(tfm); + + /* C_ICV_Len is MAC size, 0x4 ~ 0x10 */ +- sqe3->c_icv_key |= cpu_to_le16((u16)ctx->mac_len << SEC_MAC_OFFSET_V3); ++ sqe3->c_icv_key |= cpu_to_le16((u16)authsize << SEC_MAC_OFFSET_V3); + + /* mode set to CCM/GCM, don't set {A_Alg, AKey_Len, MAC_Len} */ + sqe3->a_key_addr = sqe3->c_key_addr; +@@ -1598,11 +1585,12 @@ static void sec_auth_bd_fill_ex(struct sec_auth_ctx *ctx, int dir, + struct sec_aead_req *a_req = &req->aead_req; + struct sec_cipher_req *c_req = &req->c_req; + struct aead_request *aq = a_req->aead_req; ++ struct crypto_aead *tfm = crypto_aead_reqtfm(aq); ++ size_t authsize = crypto_aead_authsize(tfm); + + sec_sqe->type2.a_key_addr = cpu_to_le64(ctx->a_key_dma); + +- sec_sqe->type2.mac_key_alg = +- cpu_to_le32(ctx->mac_len / SEC_SQE_LEN_RATE); ++ sec_sqe->type2.mac_key_alg = cpu_to_le32(authsize / SEC_SQE_LEN_RATE); + + sec_sqe->type2.mac_key_alg |= + cpu_to_le32((u32)((ctx->a_key_len) / +@@ -1652,11 +1640,13 @@ static void sec_auth_bd_fill_ex_v3(struct sec_auth_ctx *ctx, int dir, + struct sec_aead_req *a_req = &req->aead_req; + struct sec_cipher_req *c_req = &req->c_req; + struct aead_request *aq = a_req->aead_req; ++ struct crypto_aead *tfm = crypto_aead_reqtfm(aq); ++ size_t authsize = crypto_aead_authsize(tfm); + + sqe3->a_key_addr = cpu_to_le64(ctx->a_key_dma); + + sqe3->auth_mac_key |= +- cpu_to_le32((u32)(ctx->mac_len / ++ cpu_to_le32((u32)(authsize / + SEC_SQE_LEN_RATE) << SEC_MAC_OFFSET_V3); + + sqe3->auth_mac_key |= +@@ -1707,9 +1697,9 @@ static void sec_aead_callback(struct sec_ctx *c, struct sec_req *req, int err) + { + struct aead_request *a_req = req->aead_req.aead_req; + struct crypto_aead *tfm = crypto_aead_reqtfm(a_req); ++ size_t authsize = crypto_aead_authsize(tfm); + struct sec_aead_req *aead_req = &req->aead_req; + struct sec_cipher_req *c_req = &req->c_req; +- size_t authsize = crypto_aead_authsize(tfm); + struct sec_qp_ctx *qp_ctx = req->qp_ctx; + struct aead_request *backlog_aead_req; + struct sec_req *backlog_req; +@@ -1722,10 +1712,8 @@ static void sec_aead_callback(struct sec_ctx *c, struct sec_req *req, int err) + if (!err && c_req->encrypt) { + struct scatterlist *sgl = a_req->dst; + +- sz = sg_pcopy_from_buffer(sgl, sg_nents(sgl), +- aead_req->out_mac, +- authsize, a_req->cryptlen + +- a_req->assoclen); ++ sz = sg_pcopy_from_buffer(sgl, sg_nents(sgl), aead_req->out_mac, ++ authsize, a_req->cryptlen + a_req->assoclen); + if (unlikely(sz != authsize)) { + dev_err(c->dev, "copy out mac err!\n"); + err = -EINVAL; +@@ -2264,7 +2252,7 @@ static int sec_aead_spec_check(struct sec_ctx *ctx, struct sec_req *sreq) + { + struct aead_request *req = sreq->aead_req.aead_req; + struct crypto_aead *tfm = crypto_aead_reqtfm(req); +- size_t authsize = crypto_aead_authsize(tfm); ++ size_t sz = crypto_aead_authsize(tfm); + u8 c_mode = ctx->c_ctx.c_mode; + struct device *dev = ctx->dev; + int ret; +@@ -2275,9 +2263,8 @@ static int sec_aead_spec_check(struct sec_ctx *ctx, struct sec_req *sreq) + return -EINVAL; + } + +- if (unlikely((c_mode == SEC_CMODE_GCM && authsize < DES_BLOCK_SIZE) || +- (c_mode == SEC_CMODE_CCM && (authsize < MIN_MAC_LEN || +- authsize & MAC_LEN_MASK)))) { ++ if (unlikely((c_mode == SEC_CMODE_GCM && sz < DES_BLOCK_SIZE) || ++ (c_mode == SEC_CMODE_CCM && (sz < MIN_MAC_LEN || sz & MAC_LEN_MASK)))) { + dev_err(dev, "aead input mac length error!\n"); + return -EINVAL; + } +@@ -2297,7 +2284,7 @@ static int sec_aead_spec_check(struct sec_ctx *ctx, struct sec_req *sreq) + if (sreq->c_req.encrypt) + sreq->c_req.c_len = req->cryptlen; + else +- sreq->c_req.c_len = req->cryptlen - authsize; ++ sreq->c_req.c_len = req->cryptlen - sz; + if (c_mode == SEC_CMODE_CBC) { + if (unlikely(sreq->c_req.c_len & (AES_BLOCK_SIZE - 1))) { + dev_err(dev, "aead crypto length error!\n"); +@@ -2323,7 +2310,7 @@ static int sec_aead_param_check(struct sec_ctx *ctx, struct sec_req *sreq) + + if (ctx->sec->qm.ver == QM_HW_V2) { + if (unlikely(!req->cryptlen || (!sreq->c_req.encrypt && +- req->cryptlen <= authsize))) { ++ req->cryptlen <= authsize))) { + ctx->a_ctx.fallback = true; + return -EINVAL; + } +diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.h b/drivers/crypto/hisilicon/sec2/sec_crypto.h +index d033f63b583f8..db3fceb88e693 100644 +--- a/drivers/crypto/hisilicon/sec2/sec_crypto.h ++++ b/drivers/crypto/hisilicon/sec2/sec_crypto.h +@@ -23,17 +23,6 @@ enum sec_hash_alg { + SEC_A_HMAC_SHA512 = 0x15, + }; + +-enum sec_mac_len { +- SEC_HMAC_CCM_MAC = 16, +- SEC_HMAC_GCM_MAC = 16, +- SEC_SM3_MAC = 32, +- SEC_HMAC_SM3_MAC = 32, +- SEC_HMAC_MD5_MAC = 16, +- SEC_HMAC_SHA1_MAC = 20, +- SEC_HMAC_SHA256_MAC = 32, +- SEC_HMAC_SHA512_MAC = 64, +-}; +- + enum sec_cmode { + SEC_CMODE_ECB = 0x0, + SEC_CMODE_CBC = 0x1, +-- +2.39.5 + diff --git a/queue-6.6/crypto-hisilicon-sec2-fix-for-aead-invalid-authsize.patch b/queue-6.6/crypto-hisilicon-sec2-fix-for-aead-invalid-authsize.patch new file mode 100644 index 0000000000..ced81a79c2 --- /dev/null +++ b/queue-6.6/crypto-hisilicon-sec2-fix-for-aead-invalid-authsize.patch @@ -0,0 +1,205 @@ +From e7f8b75caa3d76e6893afb932a7f26ad9af26bec Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 Dec 2024 17:13:35 +0800 +Subject: crypto: hisilicon/sec2 - fix for aead invalid authsize + +From: Wenkai Lin + +[ Upstream commit a5a9d959936499a3106a1bf3b9070875d0d3dec4 ] + +When the digest alg is HMAC-SHAx or another, the authsize may be less +than 4 bytes and mac_len of the BD is set to zero, the hardware considers +it a BD configuration error and reports a ras error, so the sec driver +needs to switch to software calculation in this case, this patch add a +check for it and remove unnecessary check that has been done by crypto. + +Fixes: 2f072d75d1ab ("crypto: hisilicon - Add aead support on SEC2") +Signed-off-by: Wenkai Lin +Signed-off-by: Chenghai Huang +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + drivers/crypto/hisilicon/sec2/sec.h | 2 +- + drivers/crypto/hisilicon/sec2/sec_crypto.c | 64 +++++++++++----------- + 2 files changed, 34 insertions(+), 32 deletions(-) + +diff --git a/drivers/crypto/hisilicon/sec2/sec.h b/drivers/crypto/hisilicon/sec2/sec.h +index 714bfd7c28752..30c2b1a64695c 100644 +--- a/drivers/crypto/hisilicon/sec2/sec.h ++++ b/drivers/crypto/hisilicon/sec2/sec.h +@@ -37,6 +37,7 @@ struct sec_aead_req { + u8 *a_ivin; + dma_addr_t a_ivin_dma; + struct aead_request *aead_req; ++ bool fallback; + }; + + /* SEC request of Crypto */ +@@ -91,7 +92,6 @@ struct sec_auth_ctx { + u8 *a_key; + u8 a_key_len; + u8 a_alg; +- bool fallback; + struct crypto_shash *hash_tfm; + struct crypto_aead *fallback_aead_tfm; + }; +diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hisilicon/sec2/sec_crypto.c +index 908fb7106a44b..8a6dd2513370a 100644 +--- a/drivers/crypto/hisilicon/sec2/sec_crypto.c ++++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c +@@ -1123,10 +1123,7 @@ static int sec_aead_setauthsize(struct crypto_aead *aead, unsigned int authsize) + struct sec_ctx *ctx = crypto_tfm_ctx(tfm); + struct sec_auth_ctx *a_ctx = &ctx->a_ctx; + +- if (unlikely(a_ctx->fallback_aead_tfm)) +- return crypto_aead_setauthsize(a_ctx->fallback_aead_tfm, authsize); +- +- return 0; ++ return crypto_aead_setauthsize(a_ctx->fallback_aead_tfm, authsize); + } + + static int sec_aead_fallback_setkey(struct sec_auth_ctx *a_ctx, +@@ -1163,13 +1160,7 @@ static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key, + } + memcpy(c_ctx->c_key, key, keylen); + +- if (unlikely(a_ctx->fallback_aead_tfm)) { +- ret = sec_aead_fallback_setkey(a_ctx, tfm, key, keylen); +- if (ret) +- return ret; +- } +- +- return 0; ++ return sec_aead_fallback_setkey(a_ctx, tfm, key, keylen); + } + + ret = crypto_authenc_extractkeys(&keys, key, keylen); +@@ -1194,6 +1185,12 @@ static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key, + goto bad_key; + } + ++ ret = sec_aead_fallback_setkey(a_ctx, tfm, key, keylen); ++ if (ret) { ++ dev_err(dev, "set sec fallback key err!\n"); ++ goto bad_key; ++ } ++ + return 0; + + bad_key: +@@ -1921,8 +1918,10 @@ static void sec_aead_exit(struct crypto_aead *tfm) + + static int sec_aead_ctx_init(struct crypto_aead *tfm, const char *hash_name) + { ++ struct aead_alg *alg = crypto_aead_alg(tfm); + struct sec_ctx *ctx = crypto_aead_ctx(tfm); +- struct sec_auth_ctx *auth_ctx = &ctx->a_ctx; ++ struct sec_auth_ctx *a_ctx = &ctx->a_ctx; ++ const char *aead_name = alg->base.cra_name; + int ret; + + ret = sec_aead_init(tfm); +@@ -1931,11 +1930,20 @@ static int sec_aead_ctx_init(struct crypto_aead *tfm, const char *hash_name) + return ret; + } + +- auth_ctx->hash_tfm = crypto_alloc_shash(hash_name, 0, 0); +- if (IS_ERR(auth_ctx->hash_tfm)) { ++ a_ctx->hash_tfm = crypto_alloc_shash(hash_name, 0, 0); ++ if (IS_ERR(a_ctx->hash_tfm)) { + dev_err(ctx->dev, "aead alloc shash error!\n"); + sec_aead_exit(tfm); +- return PTR_ERR(auth_ctx->hash_tfm); ++ return PTR_ERR(a_ctx->hash_tfm); ++ } ++ ++ a_ctx->fallback_aead_tfm = crypto_alloc_aead(aead_name, 0, ++ CRYPTO_ALG_NEED_FALLBACK | CRYPTO_ALG_ASYNC); ++ if (IS_ERR(a_ctx->fallback_aead_tfm)) { ++ dev_err(ctx->dev, "aead driver alloc fallback tfm error!\n"); ++ crypto_free_shash(ctx->a_ctx.hash_tfm); ++ sec_aead_exit(tfm); ++ return PTR_ERR(a_ctx->fallback_aead_tfm); + } + + return 0; +@@ -1945,6 +1953,7 @@ static void sec_aead_ctx_exit(struct crypto_aead *tfm) + { + struct sec_ctx *ctx = crypto_aead_ctx(tfm); + ++ crypto_free_aead(ctx->a_ctx.fallback_aead_tfm); + crypto_free_shash(ctx->a_ctx.hash_tfm); + sec_aead_exit(tfm); + } +@@ -1971,7 +1980,6 @@ static int sec_aead_xcm_ctx_init(struct crypto_aead *tfm) + sec_aead_exit(tfm); + return PTR_ERR(a_ctx->fallback_aead_tfm); + } +- a_ctx->fallback = false; + + return 0; + } +@@ -2257,15 +2265,15 @@ static int sec_aead_spec_check(struct sec_ctx *ctx, struct sec_req *sreq) + struct device *dev = ctx->dev; + int ret; + +- if (unlikely(req->cryptlen + req->assoclen > MAX_INPUT_DATA_LEN || +- req->assoclen > SEC_MAX_AAD_LEN)) { +- dev_err(dev, "aead input spec error!\n"); ++ /* Hardware does not handle cases where authsize is less than 4 bytes */ ++ if (unlikely(sz < MIN_MAC_LEN)) { ++ sreq->aead_req.fallback = true; + return -EINVAL; + } + +- if (unlikely((c_mode == SEC_CMODE_GCM && sz < DES_BLOCK_SIZE) || +- (c_mode == SEC_CMODE_CCM && (sz < MIN_MAC_LEN || sz & MAC_LEN_MASK)))) { +- dev_err(dev, "aead input mac length error!\n"); ++ if (unlikely(req->cryptlen + req->assoclen > MAX_INPUT_DATA_LEN || ++ req->assoclen > SEC_MAX_AAD_LEN)) { ++ dev_err(dev, "aead input spec error!\n"); + return -EINVAL; + } + +@@ -2311,7 +2319,7 @@ static int sec_aead_param_check(struct sec_ctx *ctx, struct sec_req *sreq) + if (ctx->sec->qm.ver == QM_HW_V2) { + if (unlikely(!req->cryptlen || (!sreq->c_req.encrypt && + req->cryptlen <= authsize))) { +- ctx->a_ctx.fallback = true; ++ sreq->aead_req.fallback = true; + return -EINVAL; + } + } +@@ -2339,16 +2347,9 @@ static int sec_aead_soft_crypto(struct sec_ctx *ctx, + bool encrypt) + { + struct sec_auth_ctx *a_ctx = &ctx->a_ctx; +- struct device *dev = ctx->dev; + struct aead_request *subreq; + int ret; + +- /* Kunpeng920 aead mode not support input 0 size */ +- if (!a_ctx->fallback_aead_tfm) { +- dev_err(dev, "aead fallback tfm is NULL!\n"); +- return -EINVAL; +- } +- + subreq = aead_request_alloc(a_ctx->fallback_aead_tfm, GFP_KERNEL); + if (!subreq) + return -ENOMEM; +@@ -2380,10 +2381,11 @@ static int sec_aead_crypto(struct aead_request *a_req, bool encrypt) + req->aead_req.aead_req = a_req; + req->c_req.encrypt = encrypt; + req->ctx = ctx; ++ req->aead_req.fallback = false; + + ret = sec_aead_param_check(ctx, req); + if (unlikely(ret)) { +- if (ctx->a_ctx.fallback) ++ if (req->aead_req.fallback) + return sec_aead_soft_crypto(ctx, a_req, encrypt); + return -EINVAL; + } +-- +2.39.5 + diff --git a/queue-6.6/crypto-hisilicon-sec2-optimize-the-error-return-proc.patch b/queue-6.6/crypto-hisilicon-sec2-optimize-the-error-return-proc.patch new file mode 100644 index 0000000000..19e111d8f9 --- /dev/null +++ b/queue-6.6/crypto-hisilicon-sec2-optimize-the-error-return-proc.patch @@ -0,0 +1,62 @@ +From 8d45093736cc8a1fee057e7638ec639f3580569a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 9 Dec 2023 15:01:35 +0800 +Subject: crypto: hisilicon/sec2 - optimize the error return process + +From: Chenghai Huang + +[ Upstream commit 1bed82257b1881b689ee41f14ecb4c20a273cac0 ] + +Add the printf of an error message and optimized the handling +process of ret. + +Signed-off-by: Chenghai Huang +Signed-off-by: Herbert Xu +Stable-dep-of: fd337f852b26 ("crypto: hisilicon/sec2 - fix for aead icv error") +Signed-off-by: Sasha Levin +--- + drivers/crypto/hisilicon/sec2/sec_crypto.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hisilicon/sec2/sec_crypto.c +index 932cc277eb3a5..7b5012cf1ffac 100644 +--- a/drivers/crypto/hisilicon/sec2/sec_crypto.c ++++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c +@@ -849,6 +849,7 @@ static int sec_skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key, + ret = sec_skcipher_aes_sm4_setkey(c_ctx, keylen, c_mode); + break; + default: ++ dev_err(dev, "sec c_alg err!\n"); + return -EINVAL; + } + +@@ -1174,7 +1175,8 @@ static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key, + return 0; + } + +- if (crypto_authenc_extractkeys(&keys, key, keylen)) ++ ret = crypto_authenc_extractkeys(&keys, key, keylen); ++ if (ret) + goto bad_key; + + ret = sec_aead_aes_set_key(c_ctx, &keys); +@@ -1191,6 +1193,7 @@ static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key, + + if ((ctx->a_ctx.mac_len & SEC_SQE_LEN_RATE_MASK) || + (ctx->a_ctx.a_key_len & SEC_SQE_LEN_RATE_MASK)) { ++ ret = -EINVAL; + dev_err(dev, "MAC or AUTH key length error!\n"); + goto bad_key; + } +@@ -1199,7 +1202,7 @@ static int sec_aead_setkey(struct crypto_aead *tfm, const u8 *key, + + bad_key: + memzero_explicit(&keys, sizeof(struct crypto_authenc_keys)); +- return -EINVAL; ++ return ret; + } + + +-- +2.39.5 + diff --git a/queue-6.6/crypto-ixp4xx-fix-of-node-reference-leaks-in-init_ix.patch b/queue-6.6/crypto-ixp4xx-fix-of-node-reference-leaks-in-init_ix.patch new file mode 100644 index 0000000000..74b03a9a5a --- /dev/null +++ b/queue-6.6/crypto-ixp4xx-fix-of-node-reference-leaks-in-init_ix.patch @@ -0,0 +1,55 @@ +From 664c5d992f56fb3db950faef9bb3b4ab6bd8ea7d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 15 Dec 2024 16:27:20 +0900 +Subject: crypto: ixp4xx - fix OF node reference leaks in init_ixp_crypto() + +From: Joe Hattori + +[ Upstream commit 472a989029aac2b78ef2f0b18b27c568bf76d104 ] + +init_ixp_crypto() calls of_parse_phandle_with_fixed_args() multiple +times, but does not release all the obtained refcounts. Fix it by adding +of_node_put() calls. + +This bug was found by an experimental static analysis tool that I am +developing. + +Fixes: 76f24b4f46b8 ("crypto: ixp4xx - Add device tree support") +Signed-off-by: Joe Hattori +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c b/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c +index 4a18095ae5d80..662aac9ea186d 100644 +--- a/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c ++++ b/drivers/crypto/intel/ixp4xx/ixp4xx_crypto.c +@@ -471,6 +471,7 @@ static int init_ixp_crypto(struct device *dev) + return -ENODEV; + } + npe_id = npe_spec.args[0]; ++ of_node_put(npe_spec.np); + + ret = of_parse_phandle_with_fixed_args(np, "queue-rx", 1, 0, + &queue_spec); +@@ -479,6 +480,7 @@ static int init_ixp_crypto(struct device *dev) + return -ENODEV; + } + recv_qid = queue_spec.args[0]; ++ of_node_put(queue_spec.np); + + ret = of_parse_phandle_with_fixed_args(np, "queue-txready", 1, 0, + &queue_spec); +@@ -487,6 +489,7 @@ static int init_ixp_crypto(struct device *dev) + return -ENODEV; + } + send_qid = queue_spec.args[0]; ++ of_node_put(queue_spec.np); + } else { + /* + * Hardcoded engine when using platform data, this goes away +-- +2.39.5 + diff --git a/queue-6.6/dlm-fix-srcu_read_lock-return-type-to-int.patch b/queue-6.6/dlm-fix-srcu_read_lock-return-type-to-int.patch new file mode 100644 index 0000000000..3e54becedf --- /dev/null +++ b/queue-6.6/dlm-fix-srcu_read_lock-return-type-to-int.patch @@ -0,0 +1,38 @@ +From 903bc1d953ab3d63fe71d8aaaad957137d69b32b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Dec 2024 10:26:37 -0500 +Subject: dlm: fix srcu_read_lock() return type to int + +From: Alexander Aring + +[ Upstream commit 57cdd1a1cf1464199678f9338049b63fb5d5b41c ] + +The return type of srcu_read_lock() is int and not bool. Whereas we +using the ret variable only to evaluate a bool type of +dlm_lowcomms_con_has_addr() to check if an address is already being set. + +Fixes: 6f0b0b5d7ae7 ("fs: dlm: remove dlm_node_addrs lookup list") +Signed-off-by: Alexander Aring +Signed-off-by: David Teigland +Signed-off-by: Sasha Levin +--- + fs/dlm/lowcomms.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c +index 32dbd1a828d01..0618af36f5506 100644 +--- a/fs/dlm/lowcomms.c ++++ b/fs/dlm/lowcomms.c +@@ -460,7 +460,8 @@ static bool dlm_lowcomms_con_has_addr(const struct connection *con, + int dlm_lowcomms_addr(int nodeid, struct sockaddr_storage *addr, int len) + { + struct connection *con; +- bool ret, idx; ++ bool ret; ++ int idx; + + idx = srcu_read_lock(&connections_srcu); + con = nodeid2con(nodeid, GFP_NOFS); +-- +2.39.5 + diff --git a/queue-6.6/dmaengine-ti-edma-fix-of-node-reference-leaks-in-edm.patch b/queue-6.6/dmaengine-ti-edma-fix-of-node-reference-leaks-in-edm.patch new file mode 100644 index 0000000000..b1240c592c --- /dev/null +++ b/queue-6.6/dmaengine-ti-edma-fix-of-node-reference-leaks-in-edm.patch @@ -0,0 +1,55 @@ +From 441d9bfaf2f788132886b68ee020e8aab980428d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 19 Dec 2024 11:05:07 +0900 +Subject: dmaengine: ti: edma: fix OF node reference leaks in edma_driver + +From: Joe Hattori + +[ Upstream commit e883c64778e5a9905fce955681f8ee38c7197e0f ] + +The .probe() of edma_driver calls of_parse_phandle_with_fixed_args() but +does not release the obtained OF nodes. Thus add a of_node_put() call. + +This bug was found by an experimental verification tool that I am +developing. + +Fixes: 1be5336bc7ba ("dmaengine: edma: New device tree binding") +Signed-off-by: Joe Hattori +Reviewed-by: Dan Carpenter +Link: https://lore.kernel.org/r/20241219020507.1983124-3-joe@pf.is.s.u-tokyo.ac.jp +Signed-off-by: Vinod Koul +Signed-off-by: Sasha Levin +--- + drivers/dma/ti/edma.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/dma/ti/edma.c b/drivers/dma/ti/edma.c +index 155c409d2b434..c0fa541324675 100644 +--- a/drivers/dma/ti/edma.c ++++ b/drivers/dma/ti/edma.c +@@ -208,7 +208,6 @@ struct edma_desc { + struct edma_cc; + + struct edma_tc { +- struct device_node *node; + u16 id; + }; + +@@ -2466,13 +2465,13 @@ static int edma_probe(struct platform_device *pdev) + if (ret || i == ecc->num_tc) + break; + +- ecc->tc_list[i].node = tc_args.np; + ecc->tc_list[i].id = i; + queue_priority_mapping[i][1] = tc_args.args[0]; + if (queue_priority_mapping[i][1] > lowest_priority) { + lowest_priority = queue_priority_mapping[i][1]; + info->default_queue = i; + } ++ of_node_put(tc_args.np); + } + + /* See if we have optional dma-channel-mask array */ +-- +2.39.5 + diff --git a/queue-6.6/driver-core-class-fix-wild-pointer-dereferences-in-a.patch b/queue-6.6/driver-core-class-fix-wild-pointer-dereferences-in-a.patch new file mode 100644 index 0000000000..29e6afdf3c --- /dev/null +++ b/queue-6.6/driver-core-class-fix-wild-pointer-dereferences-in-a.patch @@ -0,0 +1,76 @@ +From 684903df75bd542596fbda41f51c9cd170c52b3a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 5 Jan 2025 16:34:02 +0800 +Subject: driver core: class: Fix wild pointer dereferences in API + class_dev_iter_next() + +From: Zijun Hu + +[ Upstream commit e128f82f7006991c99a58114f70ef61e937b1ac1 ] + +There are a potential wild pointer dereferences issue regarding APIs +class_dev_iter_(init|next|exit)(), as explained by below typical usage: + +// All members of @iter are wild pointers. +struct class_dev_iter iter; + +// class_dev_iter_init(@iter, @class, ...) checks parameter @class for +// potential class_to_subsys() error, and it returns void type and does +// not initialize its output parameter @iter, so caller can not detect +// the error and continues to invoke class_dev_iter_next(@iter) even if +// @iter still contains wild pointers. +class_dev_iter_init(&iter, ...); + +// Dereference these wild pointers in @iter here once suffer the error. +while (dev = class_dev_iter_next(&iter)) { ... }; + +// Also dereference these wild pointers here. +class_dev_iter_exit(&iter); + +Actually, all callers of these APIs have such usage pattern in kernel tree. +Fix by: +- Initialize output parameter @iter by memset() in class_dev_iter_init() + and give callers prompt by pr_crit() for the error. +- Check if @iter is valid in class_dev_iter_next(). + +Fixes: 7b884b7f24b4 ("driver core: class.c: convert to only use class_to_subsys") +Reviewed-by: Jonathan Cameron +Signed-off-by: Zijun Hu +Link: https://lore.kernel.org/r/20250105-class_fix-v6-1-3a2f1768d4d4@quicinc.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/base/class.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/drivers/base/class.c b/drivers/base/class.c +index 9cd489a577086..695e7fba580b9 100644 +--- a/drivers/base/class.c ++++ b/drivers/base/class.c +@@ -314,8 +314,12 @@ void class_dev_iter_init(struct class_dev_iter *iter, const struct class *class, + struct subsys_private *sp = class_to_subsys(class); + struct klist_node *start_knode = NULL; + +- if (!sp) ++ memset(iter, 0, sizeof(*iter)); ++ if (!sp) { ++ pr_crit("%s: class %p was not registered yet\n", ++ __func__, class); + return; ++ } + + if (start) + start_knode = &start->p->knode_class; +@@ -342,6 +346,9 @@ struct device *class_dev_iter_next(struct class_dev_iter *iter) + struct klist_node *knode; + struct device *dev; + ++ if (!iter->sp) ++ return NULL; ++ + while (1) { + knode = klist_next(&iter->ki); + if (!knode) +-- +2.39.5 + diff --git a/queue-6.6/drm-amd-pm-fix-an-error-handling-path-in-vega10_enab.patch b/queue-6.6/drm-amd-pm-fix-an-error-handling-path-in-vega10_enab.patch new file mode 100644 index 0000000000..4bca81f149 --- /dev/null +++ b/queue-6.6/drm-amd-pm-fix-an-error-handling-path-in-vega10_enab.patch @@ -0,0 +1,47 @@ +From d80db0c16ffb044bf7fa46a054bf65690801862c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 19 Nov 2024 21:23:18 +0100 +Subject: drm/amd/pm: Fix an error handling path in + vega10_enable_se_edc_force_stall_config() + +From: Christophe JAILLET + +[ Upstream commit a3300782d5375e280ba7040f323d01960bfe3396 ] + +In case of error after a amdgpu_gfx_rlc_enter_safe_mode() call, it is not +balanced by a corresponding amdgpu_gfx_rlc_exit_safe_mode() call. + +Add the missing call. + +Fixes: 9b7b8154cdb8 ("drm/amd/powerplay: added didt support for vega10") +Signed-off-by: Christophe JAILLET +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_powertune.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_powertune.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_powertune.c +index 3007b054c873c..776d58ea63ae9 100644 +--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_powertune.c ++++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega10_powertune.c +@@ -1120,13 +1120,14 @@ static int vega10_enable_se_edc_force_stall_config(struct pp_hwmgr *hwmgr) + result = vega10_program_didt_config_registers(hwmgr, SEEDCForceStallPatternConfig_Vega10, VEGA10_CONFIGREG_DIDT); + result |= vega10_program_didt_config_registers(hwmgr, SEEDCCtrlForceStallConfig_Vega10, VEGA10_CONFIGREG_DIDT); + if (0 != result) +- return result; ++ goto exit_safe_mode; + + vega10_didt_set_mask(hwmgr, false); + ++exit_safe_mode: + amdgpu_gfx_rlc_exit_safe_mode(adev, 0); + +- return 0; ++ return result; + } + + static int vega10_disable_se_edc_force_stall_config(struct pp_hwmgr *hwmgr) +-- +2.39.5 + diff --git a/queue-6.6/drm-amdgpu-fix-potential-null-pointer-dereference-in.patch b/queue-6.6/drm-amdgpu-fix-potential-null-pointer-dereference-in.patch new file mode 100644 index 0000000000..c076b5f4a1 --- /dev/null +++ b/queue-6.6/drm-amdgpu-fix-potential-null-pointer-dereference-in.patch @@ -0,0 +1,44 @@ +From f486688dfa2e61055a66e8aee8efa5f2ef335a5d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Dec 2024 11:00:43 +0300 +Subject: drm/amdgpu: Fix potential NULL pointer dereference in + atomctrl_get_smc_sclk_range_table + +From: Ivan Stepchenko + +[ Upstream commit 357445e28ff004d7f10967aa93ddb4bffa5c3688 ] + +The function atomctrl_get_smc_sclk_range_table() does not check the return +value of smu_atom_get_data_table(). If smu_atom_get_data_table() fails to +retrieve SMU_Info table, it returns NULL which is later dereferenced. + +Found by Linux Verification Center (linuxtesting.org) with SVACE. + +In practice this should never happen as this code only gets called +on polaris chips and the vbios data table will always be present on +those chips. + +Fixes: a23eefa2f461 ("drm/amd/powerplay: enable dpm for baffin.") +Signed-off-by: Ivan Stepchenko +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c +index cc3b62f733941..1fbd23922082a 100644 +--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c ++++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/ppatomctrl.c +@@ -1420,6 +1420,8 @@ int atomctrl_get_smc_sclk_range_table(struct pp_hwmgr *hwmgr, struct pp_atom_ctr + GetIndexIntoMasterTable(DATA, SMU_Info), + &size, &frev, &crev); + ++ if (!psmu_info) ++ return -EINVAL; + + for (i = 0; i < psmu_info->ucSclkEntryNum; i++) { + table->entry[i].ucVco_setting = psmu_info->asSclkFcwRangeEntry[i].ucVco_setting; +-- +2.39.5 + diff --git a/queue-6.6/drm-amdgpu-tear-down-ttm-range-manager-for-doorbell-.patch b/queue-6.6/drm-amdgpu-tear-down-ttm-range-manager-for-doorbell-.patch new file mode 100644 index 0000000000..a84a9ce3a8 --- /dev/null +++ b/queue-6.6/drm-amdgpu-tear-down-ttm-range-manager-for-doorbell-.patch @@ -0,0 +1,38 @@ +From 72ed06e9393198047f81409eb6bc9759aaecb78d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Dec 2024 00:27:21 +0800 +Subject: drm/amdgpu: tear down ttm range manager for doorbell in + amdgpu_ttm_fini() + +From: Jiang Liu + +[ Upstream commit 60a2c0c12b644450e420ffc42291d1eb248bacb7 ] + +Tear down ttm range manager for doorbell in function amdgpu_ttm_fini(), +to avoid memory leakage. + +Fixes: 792b84fb9038 ("drm/amdgpu: initialize ttm for doorbells") +Signed-off-by: Jiang Liu +Signed-off-by: Kent Russell +Reviewed-by: Alex Deucher +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +index c89264242bea3..69dfc3da5e15c 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c +@@ -2049,6 +2049,7 @@ void amdgpu_ttm_fini(struct amdgpu_device *adev) + ttm_range_man_fini(&adev->mman.bdev, AMDGPU_PL_GDS); + ttm_range_man_fini(&adev->mman.bdev, AMDGPU_PL_GWS); + ttm_range_man_fini(&adev->mman.bdev, AMDGPU_PL_OA); ++ ttm_range_man_fini(&adev->mman.bdev, AMDGPU_PL_DOORBELL); + ttm_device_fini(&adev->mman.bdev); + adev->mman.initialized = false; + DRM_INFO("amdgpu: ttm finalized\n"); +-- +2.39.5 + diff --git a/queue-6.6/drm-amdgpu-vcn-reset-fw_shared-under-sriov.patch b/queue-6.6/drm-amdgpu-vcn-reset-fw_shared-under-sriov.patch new file mode 100644 index 0000000000..c173ebb9a2 --- /dev/null +++ b/queue-6.6/drm-amdgpu-vcn-reset-fw_shared-under-sriov.patch @@ -0,0 +1,38 @@ +From 2ba70c4a630d6b6a5a8bf9c8dd292548afb2250f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Dec 2024 15:42:56 -0600 +Subject: drm/amdgpu/vcn: reset fw_shared under SRIOV + +From: Bokun Zhang + +[ Upstream commit 3676f37a88432132bcff55a17dc48911239b6d98 ] + +- The previous patch only considered the case for baremetal + and is not applicable for SRIOV code path. We also need to + init fw_share for SRIOV VF + +Fixes: 928cd772e18f ("drm/amdgpu/vcn: reset fw_shared when VCPU buffers corrupted on vcn v4.0.3") +Acked-by: Alex Deucher +Signed-off-by: Bokun Zhang +Signed-off-by: Alex Deucher +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +index e80c4f5b4f402..d1141a9baa916 100644 +--- a/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c ++++ b/drivers/gpu/drm/amd/amdgpu/vcn_v4_0_3.c +@@ -896,6 +896,8 @@ static int vcn_v4_0_3_start_sriov(struct amdgpu_device *adev) + for (i = 0; i < adev->vcn.num_vcn_inst; i++) { + vcn_inst = GET_INST(VCN, i); + ++ vcn_v4_0_3_fw_shared_init(adev, vcn_inst); ++ + memset(&header, 0, sizeof(struct mmsch_v4_0_3_init_header)); + header.version = MMSCH_VERSION; + header.total_size = sizeof(struct mmsch_v4_0_3_init_header) >> 2; +-- +2.39.5 + diff --git a/queue-6.6/drm-bridge-it6505-change-definition-of-aux_fifo_max_.patch b/queue-6.6/drm-bridge-it6505-change-definition-of-aux_fifo_max_.patch new file mode 100644 index 0000000000..50e755f8f3 --- /dev/null +++ b/queue-6.6/drm-bridge-it6505-change-definition-of-aux_fifo_max_.patch @@ -0,0 +1,39 @@ +From 353c4c3e074b781a974eb786954cb0e7259ee7e9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Dec 2024 18:51:19 +0800 +Subject: drm/bridge: it6505: Change definition of AUX_FIFO_MAX_SIZE + +From: Hermes Wu + +[ Upstream commit c14870218c14532b0f0a7805b96a4d3c92d06fb2 ] + +The hardware AUX FIFO is 16 bytes +Change definition of AUX_FIFO_MAX_SIZE to 16 + +Fixes: b5c84a9edcd4 ("drm/bridge: add it6505 driver") +Reviewed-by: Dmitry Baryshkov +Signed-off-by: Hermes Wu +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Dmitry Baryshkov +Link: https://patchwork.freedesktop.org/patch/msgid/20241230-v7-upstream-v7-1-e0fdd4844703@ite.corp-partner.google.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/bridge/ite-it6505.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/bridge/ite-it6505.c b/drivers/gpu/drm/bridge/ite-it6505.c +index 26d3b9b843267..24c5a926af8d1 100644 +--- a/drivers/gpu/drm/bridge/ite-it6505.c ++++ b/drivers/gpu/drm/bridge/ite-it6505.c +@@ -299,7 +299,7 @@ + #define MAX_CR_LEVEL 0x03 + #define MAX_EQ_LEVEL 0x03 + #define AUX_WAIT_TIMEOUT_MS 15 +-#define AUX_FIFO_MAX_SIZE 32 ++#define AUX_FIFO_MAX_SIZE 16 + #define PIXEL_CLK_DELAY 1 + #define PIXEL_CLK_INVERSE 0 + #define ADJUST_PHASE_THRESHOLD 80000 +-- +2.39.5 + diff --git a/queue-6.6/drm-etnaviv-drop-the-len-parameter-of-etnaviv_iommu_.patch b/queue-6.6/drm-etnaviv-drop-the-len-parameter-of-etnaviv_iommu_.patch new file mode 100644 index 0000000000..b11bd26b49 --- /dev/null +++ b/queue-6.6/drm-etnaviv-drop-the-len-parameter-of-etnaviv_iommu_.patch @@ -0,0 +1,45 @@ +From ead2e41a83d07ebd4c5126d73cd10f5425f97b31 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 7 Oct 2023 15:03:12 +0800 +Subject: drm/etnaviv: Drop the 'len' parameter of etnaviv_iommu_map() function + +From: Sui Jingfeng + +[ Upstream commit 9e2e8a5113bf452081cb1f6a13617e36f5298cbf ] + +The 'len' parameter is the 4th argument, because it is not get used, so +drop it. No functional change. + +Signed-off-by: Sui Jingfeng +Signed-off-by: Lucas Stach +Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation") +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c +index 4fa72567183a8..1661d589bf3e7 100644 +--- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c +@@ -70,7 +70,7 @@ static int etnaviv_context_map(struct etnaviv_iommu_context *context, + } + + static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova, +- struct sg_table *sgt, unsigned len, int prot) ++ struct sg_table *sgt, int prot) + { struct scatterlist *sg; + unsigned int da = iova; + unsigned int i; +@@ -314,7 +314,7 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context, + goto unlock; + + mapping->iova = node->start; +- ret = etnaviv_iommu_map(context, node->start, sgt, etnaviv_obj->base.size, ++ ret = etnaviv_iommu_map(context, node->start, sgt, + ETNAVIV_PROT_READ | ETNAVIV_PROT_WRITE); + + if (ret < 0) { +-- +2.39.5 + diff --git a/queue-6.6/drm-etnaviv-drop-the-offset-in-page-manipulation.patch b/queue-6.6/drm-etnaviv-drop-the-offset-in-page-manipulation.patch new file mode 100644 index 0000000000..045297e6c5 --- /dev/null +++ b/queue-6.6/drm-etnaviv-drop-the-offset-in-page-manipulation.patch @@ -0,0 +1,110 @@ +From c04a0d1506f784fcab46db7cf671b00977df0ac0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 15 Nov 2024 20:32:44 +0800 +Subject: drm/etnaviv: Drop the offset in page manipulation + +From: Sui Jingfeng + +[ Upstream commit 9aad03e7f5db7944d5ee96cd5c595c54be2236e6 ] + +The etnaviv driver, both kernel space and user space, assumes that GPU page +size is 4KiB. Its IOMMU map/unmap 4KiB physical address range once a time. +If 'sg->offset != 0' is true, then the current implementation will map the +IOVA to a wrong area, which may lead to coherency problem. Picture 0 and 1 +give the illustration, see below. + + PA start drifted + | + |<--- 'sg_dma_address(sg) - sg->offset' + | .------ sg_dma_address(sg) + | | .---- sg_dma_len(sg) + |<-sg->offset->| | + V |<-->| Another one cpu page + +----+----+----+----+ +----+----+----+----+ + |xxxx| |||||| ||||||||||||||||||||| + +----+----+----+----+ +----+----+----+----+ + ^ ^ ^ ^ + |<--- da_len --->| | | + | | | | + | .--------------' | | + | | .----------------' | + | | | .----------------' + | | | | + | | +----+----+----+----+ + | | ||||||||||||||||||||| + | | +----+----+----+----+ + | | + | '--------------. da_len = sg_dma_len(sg) + sg->offset, using + | | 'sg_dma_len(sg) + sg->offset' will lead to GPUVA + +----+ ~~~~~~~~~~~~~+ collision, but min_t(unsigned int, da_len, va_len) + |xxxx| | will clamp it to correct size. But the IOVA will + +----+ ~~~~~~~~~~~~~+ be redirect to wrong area. + ^ + | Picture 0: Possibly wrong implementation. +GPUVA (IOVA) + +-------------------------------------------------------------------------- + + .------- sg_dma_address(sg) + | .---- sg_dma_len(sg) + |<-sg->offset->| | + | |<-->| another one cpu page + +----+----+----+----+ +----+----+----+----+ + | |||||| ||||||||||||||||||||| + +----+----+----+----+ +----+----+----+----+ + ^ ^ ^ ^ + | | | | + .--------------' | | | + | | | | + | .--------------' | | + | | .----------------' | + | | | .----------------' + | | | | + +----+ +----+----+----+----+ + |||||| ||||||||||||||||||||| The first one is SZ_4K, the second is SZ_16K + +----+ +----+----+----+----+ + ^ + | Picture 1: Perfectly correct implementation. +GPUVA (IOVA) + +If sg->offset != 0 is true, IOVA will be mapped to wrong physical address. +Either because there doesn't contain the data or there contains wrong data. +Strictly speaking, the memory area that before sg_dma_address(sg) doesn't +belong to us, and it's likely that the area is being used by other process. + +Because we don't want to introduce confusions about which part is visible +to the GPU, we assumes that the size of GPUVA is always 4KiB aligned. This +is very relaxed requirement, since we already made the decision that GPU +page size is 4KiB (as a canonical decision). And softpin feature is landed, +Mesa's util_vma_heap_alloc() will certainly report correct length of GPUVA +to kernel with desired alignment ensured. + +With above statements agreed, drop the "offset in page" manipulation will +return us a correct implementation at any case. + +Fixes: a8c21a5451d8 ("drm/etnaviv: add initial etnaviv DRM driver") +Signed-off-by: Sui Jingfeng +Signed-off-by: Lucas Stach +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c +index a382920ae2be0..b7c09fc86a2cc 100644 +--- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c +@@ -82,8 +82,8 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, + return -EINVAL; + + for_each_sgtable_dma_sg(sgt, sg, i) { +- phys_addr_t pa = sg_dma_address(sg) - sg->offset; +- unsigned int da_len = sg_dma_len(sg) + sg->offset; ++ phys_addr_t pa = sg_dma_address(sg); ++ unsigned int da_len = sg_dma_len(sg); + unsigned int bytes = min_t(unsigned int, da_len, va_len); + + VERB("map[%d]: %08x %pap(%x)", i, iova, &pa, bytes); +-- +2.39.5 + diff --git a/queue-6.6/drm-etnaviv-drop-the-second-argument-of-the-etnaviv_.patch b/queue-6.6/drm-etnaviv-drop-the-second-argument-of-the-etnaviv_.patch new file mode 100644 index 0000000000..c8b75d3814 --- /dev/null +++ b/queue-6.6/drm-etnaviv-drop-the-second-argument-of-the-etnaviv_.patch @@ -0,0 +1,55 @@ +From abaf8ebffa6e1c8004e856f6b996a8e3cd6ee1ee Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Oct 2023 19:12:03 +0800 +Subject: drm/etnaviv: Drop the second argument of the etnaviv_gem_new_impl() + +From: Sui Jingfeng + +[ Upstream commit 4c6e6c01d82fc0edd8b47cb1ffbd05289029b005 ] + +The mentioned second parameter is the 'u32 size', but it is not get used by +the etnaviv_gem_new_impl() function, so drop it. No functional change. + +Signed-off-by: Sui Jingfeng +Signed-off-by: Lucas Stach +Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation") +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/etnaviv/etnaviv_gem.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c +index 84b7789454962..814da8188f965 100644 +--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c +@@ -556,7 +556,7 @@ static const struct drm_gem_object_funcs etnaviv_gem_object_funcs = { + .vm_ops = &vm_ops, + }; + +-static int etnaviv_gem_new_impl(struct drm_device *dev, u32 size, u32 flags, ++static int etnaviv_gem_new_impl(struct drm_device *dev, u32 flags, + const struct etnaviv_gem_ops *ops, struct drm_gem_object **obj) + { + struct etnaviv_gem_object *etnaviv_obj; +@@ -605,8 +605,7 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file, + + size = PAGE_ALIGN(size); + +- ret = etnaviv_gem_new_impl(dev, size, flags, +- &etnaviv_gem_shmem_ops, &obj); ++ ret = etnaviv_gem_new_impl(dev, flags, &etnaviv_gem_shmem_ops, &obj); + if (ret) + goto fail; + +@@ -641,7 +640,7 @@ int etnaviv_gem_new_private(struct drm_device *dev, size_t size, u32 flags, + struct drm_gem_object *obj; + int ret; + +- ret = etnaviv_gem_new_impl(dev, size, flags, ops, &obj); ++ ret = etnaviv_gem_new_impl(dev, flags, ops, &obj); + if (ret) + return ret; + +-- +2.39.5 + diff --git a/queue-6.6/drm-etnaviv-fix-page-property-being-used-for-non-wri.patch b/queue-6.6/drm-etnaviv-fix-page-property-being-used-for-non-wri.patch new file mode 100644 index 0000000000..87479b0181 --- /dev/null +++ b/queue-6.6/drm-etnaviv-fix-page-property-being-used-for-non-wri.patch @@ -0,0 +1,60 @@ +From 5c532f768244c26f1ec916dd05e6e57129c17630 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Nov 2024 08:41:56 +0800 +Subject: drm/etnaviv: Fix page property being used for non writecombine + buffers + +From: Sui Jingfeng + +[ Upstream commit 834f304192834d6f0941954f3277ae0ba11a9a86 ] + +In the etnaviv_gem_vmap_impl() function, the driver vmap whatever buffers +with write combine(WC) page property, this is incorrect. Cached buffers +should be mapped with the cached page property and uncached buffers should +be mapped with the uncached page property. + +Fixes: a0a5ab3e99b8 ("drm/etnaviv: call correct function when trying to vmap a DMABUF") +Signed-off-by: Sui Jingfeng +Signed-off-by: Lucas Stach +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/etnaviv/etnaviv_gem.c | 16 ++++++++++++++-- + 1 file changed, 14 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c +index 69fccbcd92c62..84b7789454962 100644 +--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c +@@ -343,6 +343,7 @@ void *etnaviv_gem_vmap(struct drm_gem_object *obj) + static void *etnaviv_gem_vmap_impl(struct etnaviv_gem_object *obj) + { + struct page **pages; ++ pgprot_t prot; + + lockdep_assert_held(&obj->lock); + +@@ -350,8 +351,19 @@ static void *etnaviv_gem_vmap_impl(struct etnaviv_gem_object *obj) + if (IS_ERR(pages)) + return NULL; + +- return vmap(pages, obj->base.size >> PAGE_SHIFT, +- VM_MAP, pgprot_writecombine(PAGE_KERNEL)); ++ switch (obj->flags & ETNA_BO_CACHE_MASK) { ++ case ETNA_BO_CACHED: ++ prot = PAGE_KERNEL; ++ break; ++ case ETNA_BO_UNCACHED: ++ prot = pgprot_noncached(PAGE_KERNEL); ++ break; ++ case ETNA_BO_WC: ++ default: ++ prot = pgprot_writecombine(PAGE_KERNEL); ++ } ++ ++ return vmap(pages, obj->base.size >> PAGE_SHIFT, VM_MAP, prot); + } + + static inline enum dma_data_direction etnaviv_op_to_dma_dir(u32 op) +-- +2.39.5 + diff --git a/queue-6.6/drm-etnaviv-map-and-unmap-gpuva-range-with-respect-t.patch b/queue-6.6/drm-etnaviv-map-and-unmap-gpuva-range-with-respect-t.patch new file mode 100644 index 0000000000..bf9daa2404 --- /dev/null +++ b/queue-6.6/drm-etnaviv-map-and-unmap-gpuva-range-with-respect-t.patch @@ -0,0 +1,119 @@ +From 68b553dc44a9da1ebfbb674feda69c6f4306bdc3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 26 Oct 2024 04:43:55 +0800 +Subject: drm/etnaviv: Map and unmap GPUVA range with respect to the GPUVA size + +From: Sui Jingfeng + +[ Upstream commit 68786b7f49873c69ec332a045a9bf4337d71ec20 ] + +Etnaviv assumes that GPU page size is 4KiB, however, GPUVA ranges collision +when using softpin capable GPUs on a non 4KiB CPU page size configuration. +The root cause is that kernel side BO takes up bigger address space than +userspace expect, the size of backing memory of GEM buffer objects are +required to align to the CPU PAGE_SIZE. Therefore, results in userspace +allocated GPUVA range fails to be inserted to the specified hole exactly. + +To solve this problem, record the GPU visiable size of a BO firstly, then +map and unmap the SG entry strictly with respect to the total GPUVA size. + +Signed-off-by: Sui Jingfeng +Signed-off-by: Lucas Stach +Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation") +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/etnaviv/etnaviv_mmu.c | 38 +++++++++------------------ + 1 file changed, 13 insertions(+), 25 deletions(-) + +diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c +index 1661d589bf3e7..a382920ae2be0 100644 +--- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c +@@ -69,9 +69,11 @@ static int etnaviv_context_map(struct etnaviv_iommu_context *context, + return ret; + } + +-static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova, ++static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, ++ u32 iova, unsigned int va_len, + struct sg_table *sgt, int prot) +-{ struct scatterlist *sg; ++{ ++ struct scatterlist *sg; + unsigned int da = iova; + unsigned int i; + int ret; +@@ -81,14 +83,16 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova, + + for_each_sgtable_dma_sg(sgt, sg, i) { + phys_addr_t pa = sg_dma_address(sg) - sg->offset; +- size_t bytes = sg_dma_len(sg) + sg->offset; ++ unsigned int da_len = sg_dma_len(sg) + sg->offset; ++ unsigned int bytes = min_t(unsigned int, da_len, va_len); + +- VERB("map[%d]: %08x %pap(%zx)", i, iova, &pa, bytes); ++ VERB("map[%d]: %08x %pap(%x)", i, iova, &pa, bytes); + + ret = etnaviv_context_map(context, da, pa, bytes, prot); + if (ret) + goto fail; + ++ va_len -= bytes; + da += bytes; + } + +@@ -104,21 +108,7 @@ static int etnaviv_iommu_map(struct etnaviv_iommu_context *context, u32 iova, + static void etnaviv_iommu_unmap(struct etnaviv_iommu_context *context, u32 iova, + struct sg_table *sgt, unsigned len) + { +- struct scatterlist *sg; +- unsigned int da = iova; +- int i; +- +- for_each_sgtable_dma_sg(sgt, sg, i) { +- size_t bytes = sg_dma_len(sg) + sg->offset; +- +- etnaviv_context_unmap(context, da, bytes); +- +- VERB("unmap[%d]: %08x(%zx)", i, iova, bytes); +- +- BUG_ON(!PAGE_ALIGNED(bytes)); +- +- da += bytes; +- } ++ etnaviv_context_unmap(context, iova, len); + + context->flush_seq++; + } +@@ -131,7 +121,7 @@ static void etnaviv_iommu_remove_mapping(struct etnaviv_iommu_context *context, + lockdep_assert_held(&context->lock); + + etnaviv_iommu_unmap(context, mapping->vram_node.start, +- etnaviv_obj->sgt, etnaviv_obj->base.size); ++ etnaviv_obj->sgt, etnaviv_obj->size); + drm_mm_remove_node(&mapping->vram_node); + } + +@@ -305,16 +295,14 @@ int etnaviv_iommu_map_gem(struct etnaviv_iommu_context *context, + node = &mapping->vram_node; + + if (va) +- ret = etnaviv_iommu_insert_exact(context, node, +- etnaviv_obj->base.size, va); ++ ret = etnaviv_iommu_insert_exact(context, node, etnaviv_obj->size, va); + else +- ret = etnaviv_iommu_find_iova(context, node, +- etnaviv_obj->base.size); ++ ret = etnaviv_iommu_find_iova(context, node, etnaviv_obj->size); + if (ret < 0) + goto unlock; + + mapping->iova = node->start; +- ret = etnaviv_iommu_map(context, node->start, sgt, ++ ret = etnaviv_iommu_map(context, node->start, etnaviv_obj->size, sgt, + ETNAVIV_PROT_READ | ETNAVIV_PROT_WRITE); + + if (ret < 0) { +-- +2.39.5 + diff --git a/queue-6.6/drm-etnaviv-record-gpu-visible-size-of-gem-bo-separa.patch b/queue-6.6/drm-etnaviv-record-gpu-visible-size-of-gem-bo-separa.patch new file mode 100644 index 0000000000..72a1ae6e77 --- /dev/null +++ b/queue-6.6/drm-etnaviv-record-gpu-visible-size-of-gem-bo-separa.patch @@ -0,0 +1,93 @@ +From e3663f9578c6b60c820cd092f9ff91449aae2e91 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 26 Oct 2024 04:43:54 +0800 +Subject: drm/etnaviv: Record GPU visible size of GEM BO separately + +From: Sui Jingfeng + +[ Upstream commit b5f1eed853c6ea6a99149fd97fe179f3ebd96a02 ] + +The GPU visible size of a GEM BO is not necessarily PAGE_SIZE aligned, +which happens when CPU page size is not equal to GPU page size. Extra +precious resources such as GPU page tables and GPU TLBs may being paid +because of this but never get used. + +Track the size of GPU visible part of GEM BO separately, ensure no +GPUVA range wasting by aligning that size to GPU page size. + +Signed-off-by: Sui Jingfeng +Signed-off-by: Lucas Stach +Stable-dep-of: 9aad03e7f5db ("drm/etnaviv: Drop the offset in page manipulation") +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/etnaviv/etnaviv_gem.c | 11 +++++------ + drivers/gpu/drm/etnaviv/etnaviv_gem.h | 5 +++++ + 2 files changed, 10 insertions(+), 6 deletions(-) + +diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c +index 814da8188f965..d9495743ec8bd 100644 +--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c +@@ -556,7 +556,7 @@ static const struct drm_gem_object_funcs etnaviv_gem_object_funcs = { + .vm_ops = &vm_ops, + }; + +-static int etnaviv_gem_new_impl(struct drm_device *dev, u32 flags, ++static int etnaviv_gem_new_impl(struct drm_device *dev, u32 size, u32 flags, + const struct etnaviv_gem_ops *ops, struct drm_gem_object **obj) + { + struct etnaviv_gem_object *etnaviv_obj; +@@ -583,6 +583,7 @@ static int etnaviv_gem_new_impl(struct drm_device *dev, u32 flags, + if (!etnaviv_obj) + return -ENOMEM; + ++ etnaviv_obj->size = ALIGN(size, SZ_4K); + etnaviv_obj->flags = flags; + etnaviv_obj->ops = ops; + +@@ -603,15 +604,13 @@ int etnaviv_gem_new_handle(struct drm_device *dev, struct drm_file *file, + struct drm_gem_object *obj = NULL; + int ret; + +- size = PAGE_ALIGN(size); +- +- ret = etnaviv_gem_new_impl(dev, flags, &etnaviv_gem_shmem_ops, &obj); ++ ret = etnaviv_gem_new_impl(dev, size, flags, &etnaviv_gem_shmem_ops, &obj); + if (ret) + goto fail; + + lockdep_set_class(&to_etnaviv_bo(obj)->lock, &etnaviv_shm_lock_class); + +- ret = drm_gem_object_init(dev, obj, size); ++ ret = drm_gem_object_init(dev, obj, PAGE_ALIGN(size)); + if (ret) + goto fail; + +@@ -640,7 +639,7 @@ int etnaviv_gem_new_private(struct drm_device *dev, size_t size, u32 flags, + struct drm_gem_object *obj; + int ret; + +- ret = etnaviv_gem_new_impl(dev, flags, ops, &obj); ++ ret = etnaviv_gem_new_impl(dev, size, flags, ops, &obj); + if (ret) + return ret; + +diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.h b/drivers/gpu/drm/etnaviv/etnaviv_gem.h +index a42d260cac2cf..687555aae8079 100644 +--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.h ++++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.h +@@ -36,6 +36,11 @@ struct etnaviv_gem_object { + const struct etnaviv_gem_ops *ops; + struct mutex lock; + ++ /* ++ * The actual size that is visible to the GPU, not necessarily ++ * PAGE_SIZE aligned, but should be aligned to GPU page size. ++ */ ++ u32 size; + u32 flags; + + struct list_head gem_node; +-- +2.39.5 + diff --git a/queue-6.6/drm-msm-check-return-value-of-of_dma_configure.patch b/queue-6.6/drm-msm-check-return-value-of-of_dma_configure.patch new file mode 100644 index 0000000000..acc65a4033 --- /dev/null +++ b/queue-6.6/drm-msm-check-return-value-of-of_dma_configure.patch @@ -0,0 +1,57 @@ +From 227d6fa9c068147dfb05445ac0bd87df484475a2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Nov 2024 17:07:38 +0800 +Subject: drm/msm: Check return value of of_dma_configure() + +From: Sui Jingfeng + +[ Upstream commit b34a7401ffaee45354e81b38a4d072794079cfd6 ] + +Because the of_dma_configure() will returns '-EPROBE_DEFER' if the probe +procedure of the specific platform IOMMU driver is not finished yet. It +can also return other error code for various reasons. + +Stop pretending that it will always suceess, quit if it fail. + +Signed-off-by: Sui Jingfeng +Reviewed-by: Konrad Dybcio +Fixes: 29ac8979cdf7 ("drm/msm/a6xx: use msm_gem for GMU memory objects") +Fixes: 5a903a44a984 ("drm/msm/a6xx: Introduce GMU wrapper support") +Reviewed-by: Dmitry Baryshkov +Patchwork: https://patchwork.freedesktop.org/patch/622782/ +Link: https://lore.kernel.org/r/20241104090738.529848-1-sui.jingfeng@linux.dev +Signed-off-by: Dmitry Baryshkov +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +index c9edaa6d76369..9009442b543dd 100644 +--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c ++++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +@@ -1510,7 +1510,9 @@ int a6xx_gmu_wrapper_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) + + gmu->dev = &pdev->dev; + +- of_dma_configure(gmu->dev, node, true); ++ ret = of_dma_configure(gmu->dev, node, true); ++ if (ret) ++ return ret; + + pm_runtime_enable(gmu->dev); + +@@ -1574,7 +1576,9 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node) + + gmu->dev = &pdev->dev; + +- of_dma_configure(gmu->dev, node, true); ++ ret = of_dma_configure(gmu->dev, node, true); ++ if (ret) ++ return ret; + + /* Fow now, don't do anything fancy until we get our feet under us */ + gmu->idle_level = GMU_IDLE_STATE_ACTIVE; +-- +2.39.5 + diff --git a/queue-6.6/drm-msm-dp-set-safe_to_exit_level-before-printing-it.patch b/queue-6.6/drm-msm-dp-set-safe_to_exit_level-before-printing-it.patch new file mode 100644 index 0000000000..1d69f068ea --- /dev/null +++ b/queue-6.6/drm-msm-dp-set-safe_to_exit_level-before-printing-it.patch @@ -0,0 +1,44 @@ +From a6efc2549e5dc21e922ae2da50cf42e9a7d65ae2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Dec 2024 12:06:31 +0200 +Subject: drm/msm/dp: set safe_to_exit_level before printing it + +From: Dmitry Baryshkov + +[ Upstream commit 7dee35d79bb046bfd425aa9e58a82414f67c1cec ] + +Rather than printing random garbage from stack and pretending that it is +the default safe_to_exit_level, set the variable beforehand. + +Fixes: d13e36d7d222 ("drm/msm/dp: add audio support for Display Port on MSM") +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202411081748.0PPL9MIj-lkp@intel.com/ +Signed-off-by: Dmitry Baryshkov +Reviewed-by: Abhinav Kumar +Patchwork: https://patchwork.freedesktop.org/patch/626804/ +Link: https://lore.kernel.org/r/20241202-fd-dp-audio-fixup-v2-1-d9187ea96dad@linaro.org +Signed-off-by: Abhinav Kumar +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/dp/dp_audio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/msm/dp/dp_audio.c b/drivers/gpu/drm/msm/dp/dp_audio.c +index 4a2e479723a85..610cbe23aa839 100644 +--- a/drivers/gpu/drm/msm/dp/dp_audio.c ++++ b/drivers/gpu/drm/msm/dp/dp_audio.c +@@ -410,10 +410,10 @@ static void dp_audio_safe_to_exit_level(struct dp_audio_private *audio) + safe_to_exit_level = 5; + break; + default: ++ safe_to_exit_level = 14; + drm_dbg_dp(audio->drm_dev, + "setting the default safe_to_exit_level = %u\n", + safe_to_exit_level); +- safe_to_exit_level = 14; + break; + } + +-- +2.39.5 + diff --git a/queue-6.6/drm-msm-dpu-link-dspp_2-_3-blocks-on-sc8180x.patch b/queue-6.6/drm-msm-dpu-link-dspp_2-_3-blocks-on-sc8180x.patch new file mode 100644 index 0000000000..6bff68b34f --- /dev/null +++ b/queue-6.6/drm-msm-dpu-link-dspp_2-_3-blocks-on-sc8180x.patch @@ -0,0 +1,46 @@ +From 0b81c794c7122e0181fb2bd3560baf2f95634218 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 Dec 2024 03:28:31 +0200 +Subject: drm/msm/dpu: link DSPP_2/_3 blocks on SC8180X + +From: Dmitry Baryshkov + +[ Upstream commit 0986163245df6bece47113e506143a7e87b0097d ] + +Link DSPP_2 to the LM_2 and DSPP_3 to the LM_3 mixer blocks. This allows +using colour transformation matrix (aka night mode) with more outputs at +the same time. + +Fixes: f5abecfe339e ("drm/msm/dpu: enable DSPP and DSC on sc8180x") +Reviewed-by: Abhinav Kumar +Signed-off-by: Dmitry Baryshkov +Patchwork: https://patchwork.freedesktop.org/patch/629954/ +Link: https://lore.kernel.org/r/20241220-dpu-fix-catalog-v2-3-38fa961ea992@linaro.org +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_5_1_sc8180x.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_5_1_sc8180x.h b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_5_1_sc8180x.h +index 47de71e71e310..427dec0cd1d36 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_5_1_sc8180x.h ++++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_5_1_sc8180x.h +@@ -163,6 +163,7 @@ static const struct dpu_lm_cfg sc8180x_lm[] = { + .sblk = &sdm845_lm_sblk, + .lm_pair = LM_3, + .pingpong = PINGPONG_2, ++ .dspp = DSPP_2, + }, { + .name = "lm_3", .id = LM_3, + .base = 0x47000, .len = 0x320, +@@ -170,6 +171,7 @@ static const struct dpu_lm_cfg sc8180x_lm[] = { + .sblk = &sdm845_lm_sblk, + .lm_pair = LM_2, + .pingpong = PINGPONG_3, ++ .dspp = DSPP_3, + }, { + .name = "lm_4", .id = LM_4, + .base = 0x48000, .len = 0x320, +-- +2.39.5 + diff --git a/queue-6.6/drm-msm-dpu-link-dspp_2-_3-blocks-on-sm8150.patch b/queue-6.6/drm-msm-dpu-link-dspp_2-_3-blocks-on-sm8150.patch new file mode 100644 index 0000000000..aafdefbcf3 --- /dev/null +++ b/queue-6.6/drm-msm-dpu-link-dspp_2-_3-blocks-on-sm8150.patch @@ -0,0 +1,46 @@ +From ada85a915d827c4b7d12bab0be75184b643edf5e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 Dec 2024 03:28:30 +0200 +Subject: drm/msm/dpu: link DSPP_2/_3 blocks on SM8150 + +From: Dmitry Baryshkov + +[ Upstream commit ac440a31e523805939215b24d2f0c451b48d5891 ] + +Link DSPP_2 to the LM_2 and DSPP_3 to the LM_3 mixer blocks. This allows +using colour transformation matrix (aka night mode) with more outputs at +the same time. + +Fixes: 05ae91d960fd ("drm/msm/dpu: enable DSPP support on SM8[12]50") +Reviewed-by: Abhinav Kumar +Signed-off-by: Dmitry Baryshkov +Patchwork: https://patchwork.freedesktop.org/patch/629952/ +Link: https://lore.kernel.org/r/20241220-dpu-fix-catalog-v2-2-38fa961ea992@linaro.org +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_5_0_sm8150.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_5_0_sm8150.h b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_5_0_sm8150.h +index f0c3804f42587..76b668f36477a 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_5_0_sm8150.h ++++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_5_0_sm8150.h +@@ -164,6 +164,7 @@ static const struct dpu_lm_cfg sm8150_lm[] = { + .sblk = &sdm845_lm_sblk, + .lm_pair = LM_3, + .pingpong = PINGPONG_2, ++ .dspp = DSPP_2, + }, { + .name = "lm_3", .id = LM_3, + .base = 0x47000, .len = 0x320, +@@ -171,6 +172,7 @@ static const struct dpu_lm_cfg sm8150_lm[] = { + .sblk = &sdm845_lm_sblk, + .lm_pair = LM_2, + .pingpong = PINGPONG_3, ++ .dspp = DSPP_3, + }, { + .name = "lm_4", .id = LM_4, + .base = 0x48000, .len = 0x320, +-- +2.39.5 + diff --git a/queue-6.6/drm-msm-dpu-link-dspp_2-_3-blocks-on-sm8250.patch b/queue-6.6/drm-msm-dpu-link-dspp_2-_3-blocks-on-sm8250.patch new file mode 100644 index 0000000000..ec63a4a941 --- /dev/null +++ b/queue-6.6/drm-msm-dpu-link-dspp_2-_3-blocks-on-sm8250.patch @@ -0,0 +1,46 @@ +From ded16a6a15fe22a9a5039719267d5e7c990d08f9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 Dec 2024 03:28:32 +0200 +Subject: drm/msm/dpu: link DSPP_2/_3 blocks on SM8250 + +From: Dmitry Baryshkov + +[ Upstream commit 8252028092f86d413b3a83e5e76a9615073a0c7f ] + +Link DSPP_2 to the LM_2 and DSPP_3 to the LM_3 mixer blocks. This allows +using colour transformation matrix (aka night mode) with more outputs at +the same time. + +Fixes: 05ae91d960fd ("drm/msm/dpu: enable DSPP support on SM8[12]50") +Reviewed-by: Abhinav Kumar +Signed-off-by: Dmitry Baryshkov +Patchwork: https://patchwork.freedesktop.org/patch/629956/ +Link: https://lore.kernel.org/r/20241220-dpu-fix-catalog-v2-4-38fa961ea992@linaro.org +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_6_0_sm8250.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_6_0_sm8250.h b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_6_0_sm8250.h +index ee781037ada93..a38fb057ceda6 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_6_0_sm8250.h ++++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_6_0_sm8250.h +@@ -163,6 +163,7 @@ static const struct dpu_lm_cfg sm8250_lm[] = { + .sblk = &sdm845_lm_sblk, + .lm_pair = LM_3, + .pingpong = PINGPONG_2, ++ .dspp = DSPP_2, + }, { + .name = "lm_3", .id = LM_3, + .base = 0x47000, .len = 0x320, +@@ -170,6 +171,7 @@ static const struct dpu_lm_cfg sm8250_lm[] = { + .sblk = &sdm845_lm_sblk, + .lm_pair = LM_2, + .pingpong = PINGPONG_3, ++ .dspp = DSPP_3, + }, { + .name = "lm_4", .id = LM_4, + .base = 0x48000, .len = 0x320, +-- +2.39.5 + diff --git a/queue-6.6/drm-msm-dpu-link-dspp_2-_3-blocks-on-sm8350.patch b/queue-6.6/drm-msm-dpu-link-dspp_2-_3-blocks-on-sm8350.patch new file mode 100644 index 0000000000..3da45c27c3 --- /dev/null +++ b/queue-6.6/drm-msm-dpu-link-dspp_2-_3-blocks-on-sm8350.patch @@ -0,0 +1,46 @@ +From 2be60ee592ef68161e360ae935d6ae43f2897c36 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 Dec 2024 03:28:33 +0200 +Subject: drm/msm/dpu: link DSPP_2/_3 blocks on SM8350 + +From: Dmitry Baryshkov + +[ Upstream commit 42323d3c9e04c725d27606c31663b80a7cc30218 ] + +Link DSPP_2 to the LM_2 and DSPP_3 to the LM_3 mixer blocks. This allows +using colour transformation matrix (aka night mode) with more outputs at +the same time. + +Fixes: 0e91bcbb0016 ("drm/msm/dpu: Add SM8350 to hw catalog") +Reviewed-by: Abhinav Kumar +Signed-off-by: Dmitry Baryshkov +Patchwork: https://patchwork.freedesktop.org/patch/629959/ +Link: https://lore.kernel.org/r/20241220-dpu-fix-catalog-v2-5-38fa961ea992@linaro.org +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_7_0_sm8350.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_7_0_sm8350.h b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_7_0_sm8350.h +index 428bcbcfbf192..e2f181077d11e 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_7_0_sm8350.h ++++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_7_0_sm8350.h +@@ -163,6 +163,7 @@ static const struct dpu_lm_cfg sm8350_lm[] = { + .sblk = &sdm845_lm_sblk, + .lm_pair = LM_3, + .pingpong = PINGPONG_2, ++ .dspp = DSPP_2, + }, { + .name = "lm_3", .id = LM_3, + .base = 0x47000, .len = 0x320, +@@ -170,6 +171,7 @@ static const struct dpu_lm_cfg sm8350_lm[] = { + .sblk = &sdm845_lm_sblk, + .lm_pair = LM_2, + .pingpong = PINGPONG_3, ++ .dspp = DSPP_3, + }, { + .name = "lm_4", .id = LM_4, + .base = 0x48000, .len = 0x320, +-- +2.39.5 + diff --git a/queue-6.6/drm-msm-dpu-link-dspp_2-_3-blocks-on-sm8550.patch b/queue-6.6/drm-msm-dpu-link-dspp_2-_3-blocks-on-sm8550.patch new file mode 100644 index 0000000000..90274401fc --- /dev/null +++ b/queue-6.6/drm-msm-dpu-link-dspp_2-_3-blocks-on-sm8550.patch @@ -0,0 +1,46 @@ +From a80b49fadf1b9a79d48a87f96ccab5b46d54c62d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 Dec 2024 03:28:34 +0200 +Subject: drm/msm/dpu: link DSPP_2/_3 blocks on SM8550 + +From: Dmitry Baryshkov + +[ Upstream commit e21f9d85b05361bc343b11ecf84ac12c9cccbc3e ] + +Link DSPP_2 to the LM_2 and DSPP_3 to the LM_3 mixer blocks. This allows +using colour transformation matrix (aka night mode) with more outputs at +the same time. + +Fixes: efcd0107727c ("drm/msm/dpu: add support for SM8550") +Reviewed-by: Abhinav Kumar +Signed-off-by: Dmitry Baryshkov +Patchwork: https://patchwork.freedesktop.org/patch/629961/ +Link: https://lore.kernel.org/r/20241220-dpu-fix-catalog-v2-6-38fa961ea992@linaro.org +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h +index 7bed819dfc390..69b238ed01b98 100644 +--- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h ++++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h +@@ -181,6 +181,7 @@ static const struct dpu_lm_cfg sm8550_lm[] = { + .sblk = &sdm845_lm_sblk, + .lm_pair = LM_3, + .pingpong = PINGPONG_2, ++ .dspp = DSPP_2, + }, { + .name = "lm_3", .id = LM_3, + .base = 0x47000, .len = 0x320, +@@ -188,6 +189,7 @@ static const struct dpu_lm_cfg sm8550_lm[] = { + .sblk = &sdm845_lm_sblk, + .lm_pair = LM_2, + .pingpong = PINGPONG_3, ++ .dspp = DSPP_3, + }, { + .name = "lm_4", .id = LM_4, + .base = 0x48000, .len = 0x320, +-- +2.39.5 + diff --git a/queue-6.6/drm-rockchip-move-output-interface-related-definitio.patch b/queue-6.6/drm-rockchip-move-output-interface-related-definitio.patch new file mode 100644 index 0000000000..df2e20493f --- /dev/null +++ b/queue-6.6/drm-rockchip-move-output-interface-related-definitio.patch @@ -0,0 +1,220 @@ +From cd1d989df51fdc582bf2f946133714976156e3c0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Dec 2023 19:56:27 +0800 +Subject: drm/rockchip: move output interface related definition to + rockchip_drm_drv.h + +From: Andy Yan + +[ Upstream commit 8c8546546f256f834e9c7cab48e5946df340d1a8 ] + +The output interface related definition can shared between +vop and vop2, move them to rockchip_drm_drv.h can avoid duplicated +definition. + +Signed-off-by: Andy Yan +Reviewed-by: Sascha Hauer +Signed-off-by: Heiko Stuebner +Link: https://patchwork.freedesktop.org/patch/msgid/20231211115627.1784735-1-andyshrk@163.com +Stable-dep-of: 77b1ccb2a27c ("drm/rockchip: vop2: include rockchip_drm_drv.h") +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 1 - + drivers/gpu/drm/rockchip/cdn-dp-core.c | 1 - + drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 1 - + drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 1 - + drivers/gpu/drm/rockchip/inno_hdmi.c | 1 - + drivers/gpu/drm/rockchip/rk3066_hdmi.c | 1 - + drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 17 +++++++++++++++++ + drivers/gpu/drm/rockchip/rockchip_drm_vop.h | 12 ------------ + drivers/gpu/drm/rockchip/rockchip_drm_vop2.h | 16 +--------------- + drivers/gpu/drm/rockchip/rockchip_lvds.c | 1 - + drivers/gpu/drm/rockchip/rockchip_rgb.c | 1 - + 11 files changed, 18 insertions(+), 35 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +index 84aa811ca1e9c..bd08d57486fef 100644 +--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c ++++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +@@ -30,7 +30,6 @@ + #include + + #include "rockchip_drm_drv.h" +-#include "rockchip_drm_vop.h" + + #define RK3288_GRF_SOC_CON6 0x25c + #define RK3288_EDP_LCDC_SEL BIT(5) +diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c +index 3793863c210eb..fca403ccce47e 100644 +--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c ++++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c +@@ -24,7 +24,6 @@ + + #include "cdn-dp-core.h" + #include "cdn-dp-reg.h" +-#include "rockchip_drm_vop.h" + + static inline struct cdn_dp_device *connector_to_dp(struct drm_connector *connector) + { +diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +index 0100162a73b29..002486741aec2 100644 +--- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +@@ -26,7 +26,6 @@ + #include + + #include "rockchip_drm_drv.h" +-#include "rockchip_drm_vop.h" + + #define DSI_PHY_RSTZ 0xa0 + #define PHY_DISFORCEPLL 0 +diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +index 89bc86d620146..aae48e906af11 100644 +--- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c ++++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +@@ -18,7 +18,6 @@ + #include + + #include "rockchip_drm_drv.h" +-#include "rockchip_drm_vop.h" + + #define RK3228_GRF_SOC_CON2 0x0408 + #define RK3228_HDMI_SDAIN_MSK BIT(14) +diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c +index 345253e033c53..50c984ac107d6 100644 +--- a/drivers/gpu/drm/rockchip/inno_hdmi.c ++++ b/drivers/gpu/drm/rockchip/inno_hdmi.c +@@ -23,7 +23,6 @@ + #include + + #include "rockchip_drm_drv.h" +-#include "rockchip_drm_vop.h" + + #include "inno_hdmi.h" + +diff --git a/drivers/gpu/drm/rockchip/rk3066_hdmi.c b/drivers/gpu/drm/rockchip/rk3066_hdmi.c +index fa6e592e0276c..78136d0c5a659 100644 +--- a/drivers/gpu/drm/rockchip/rk3066_hdmi.c ++++ b/drivers/gpu/drm/rockchip/rk3066_hdmi.c +@@ -17,7 +17,6 @@ + #include "rk3066_hdmi.h" + + #include "rockchip_drm_drv.h" +-#include "rockchip_drm_vop.h" + + #define DEFAULT_PLLA_RATE 30000000 + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +index 9ef98968a83aa..bbb9e0bf68048 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +@@ -20,6 +20,23 @@ + #define ROCKCHIP_MAX_CONNECTOR 2 + #define ROCKCHIP_MAX_CRTC 4 + ++/* ++ * display output interface supported by rockchip lcdc ++ */ ++#define ROCKCHIP_OUT_MODE_P888 0 ++#define ROCKCHIP_OUT_MODE_BT1120 0 ++#define ROCKCHIP_OUT_MODE_P666 1 ++#define ROCKCHIP_OUT_MODE_P565 2 ++#define ROCKCHIP_OUT_MODE_BT656 5 ++#define ROCKCHIP_OUT_MODE_S888 8 ++#define ROCKCHIP_OUT_MODE_S888_DUMMY 12 ++#define ROCKCHIP_OUT_MODE_YUV420 14 ++/* for use special outface */ ++#define ROCKCHIP_OUT_MODE_AAAA 15 ++ ++/* output flags */ ++#define ROCKCHIP_OUTPUT_DSI_DUAL BIT(0) ++ + struct drm_device; + struct drm_connector; + struct iommu_domain; +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +index c5c716a69171a..4ea369e004a91 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.h ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.h +@@ -277,18 +277,6 @@ struct vop_data { + /* dst alpha ctrl define */ + #define DST_FACTOR_M0(x) (((x) & 0x7) << 6) + +-/* +- * display output interface supported by rockchip lcdc +- */ +-#define ROCKCHIP_OUT_MODE_P888 0 +-#define ROCKCHIP_OUT_MODE_P666 1 +-#define ROCKCHIP_OUT_MODE_P565 2 +-/* for use special outface */ +-#define ROCKCHIP_OUT_MODE_AAAA 15 +- +-/* output flags */ +-#define ROCKCHIP_OUTPUT_DSI_DUAL BIT(0) +- + enum alpha_mode { + ALPHA_STRAIGHT, + ALPHA_INVERSE, +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h +index 18f0573b20002..5672df5de90be 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h +@@ -7,10 +7,9 @@ + #ifndef _ROCKCHIP_DRM_VOP2_H + #define _ROCKCHIP_DRM_VOP2_H + +-#include "rockchip_drm_vop.h" +- + #include + #include ++#include "rockchip_drm_vop.h" + + #define VOP_FEATURE_OUTPUT_10BIT BIT(0) + +@@ -169,19 +168,6 @@ struct vop2_data { + #define WB_YRGB_FIFO_FULL_INTR BIT(18) + #define WB_COMPLETE_INTR BIT(19) + +-/* +- * display output interface supported by rockchip lcdc +- */ +-#define ROCKCHIP_OUT_MODE_P888 0 +-#define ROCKCHIP_OUT_MODE_BT1120 0 +-#define ROCKCHIP_OUT_MODE_P666 1 +-#define ROCKCHIP_OUT_MODE_P565 2 +-#define ROCKCHIP_OUT_MODE_BT656 5 +-#define ROCKCHIP_OUT_MODE_S888 8 +-#define ROCKCHIP_OUT_MODE_S888_DUMMY 12 +-#define ROCKCHIP_OUT_MODE_YUV420 14 +-/* for use special outface */ +-#define ROCKCHIP_OUT_MODE_AAAA 15 + + enum vop_csc_format { + CSC_BT601L, +diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/rockchip/rockchip_lvds.c +index 1b6e0b210aa53..107959530c220 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_lvds.c ++++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c +@@ -27,7 +27,6 @@ + #include + + #include "rockchip_drm_drv.h" +-#include "rockchip_drm_vop.h" + #include "rockchip_lvds.h" + + #define DISPLAY_OUTPUT_RGB 0 +diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c +index c677b71ae516b..dbfbde24698ef 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_rgb.c ++++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c +@@ -19,7 +19,6 @@ + #include + + #include "rockchip_drm_drv.h" +-#include "rockchip_drm_vop.h" + #include "rockchip_rgb.h" + + struct rockchip_rgb { +-- +2.39.5 + diff --git a/queue-6.6/drm-rockchip-vop2-check-linear-format-for-cluster-wi.patch b/queue-6.6/drm-rockchip-vop2-check-linear-format-for-cluster-wi.patch new file mode 100644 index 0000000000..860ccff978 --- /dev/null +++ b/queue-6.6/drm-rockchip-vop2-check-linear-format-for-cluster-wi.patch @@ -0,0 +1,45 @@ +From c6bb49b908278834cb91722824b4966544b1cd8b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 14 Dec 2024 16:17:04 +0800 +Subject: drm/rockchip: vop2: Check linear format for Cluster windows on + rk3566/8 + +From: Andy Yan + +[ Upstream commit df063c0b8ffbdca486ab2f802e716973985d8f86 ] + +The Cluster windows on rk3566/8 only support afbc mode. + +Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver") +Signed-off-by: Andy Yan +Signed-off-by: Heiko Stuebner +Link: https://patchwork.freedesktop.org/patch/msgid/20241214081719.3330518-6-andyshrk@163.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +index 724b75cfb6b5b..abd88d2d7cabb 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +@@ -465,6 +465,16 @@ static bool rockchip_vop2_mod_supported(struct drm_plane *plane, u32 format, + if (modifier == DRM_FORMAT_MOD_INVALID) + return false; + ++ if (vop2->data->soc_id == 3568 || vop2->data->soc_id == 3566) { ++ if (vop2_cluster_window(win)) { ++ if (modifier == DRM_FORMAT_MOD_LINEAR) { ++ drm_dbg_kms(vop2->drm, ++ "Cluster window only supports format with afbc\n"); ++ return false; ++ } ++ } ++ } ++ + if (modifier == DRM_FORMAT_MOD_LINEAR) + return true; + +-- +2.39.5 + diff --git a/queue-6.6/drm-rockchip-vop2-fix-cluster-windows-alpha-ctrl-reg.patch b/queue-6.6/drm-rockchip-vop2-fix-cluster-windows-alpha-ctrl-reg.patch new file mode 100644 index 0000000000..4035169864 --- /dev/null +++ b/queue-6.6/drm-rockchip-vop2-fix-cluster-windows-alpha-ctrl-reg.patch @@ -0,0 +1,67 @@ +From 2c229a13ec8833e2a5b1c4946928513f929f32fd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Dec 2024 20:29:15 +0800 +Subject: drm/rockchip: vop2: Fix cluster windows alpha ctrl regsiters offset + +From: Andy Yan + +[ Upstream commit 17b4b10a0df1a1421d5fbdc03bad0bd3799bc966 ] + +The phy_id of cluster windws are not increase one for each window. + +Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver") +Tested-by: Derek Foreman +Signed-off-by: Andy Yan +Signed-off-by: Heiko Stuebner +Link: https://patchwork.freedesktop.org/patch/msgid/20241209122943.2781431-6-andyshrk@163.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 18 +++++++++++++++++- + 1 file changed, 17 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +index d1de12e850e74..f8fdbdf52e907 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +@@ -1741,7 +1741,6 @@ static int vop2_find_start_mixer_id_for_vp(struct vop2 *vop2, u8 port_id) + + static void vop2_setup_cluster_alpha(struct vop2 *vop2, struct vop2_win *main_win) + { +- u32 offset = (main_win->data->phys_id * 0x10); + struct vop2_alpha_config alpha_config; + struct vop2_alpha alpha; + struct drm_plane_state *bottom_win_pstate; +@@ -1749,6 +1748,7 @@ static void vop2_setup_cluster_alpha(struct vop2 *vop2, struct vop2_win *main_wi + u16 src_glb_alpha_val, dst_glb_alpha_val; + bool premulti_en = false; + bool swap = false; ++ u32 offset = 0; + + /* At one win mode, win0 is dst/bottom win, and win1 is a all zero src/top win */ + bottom_win_pstate = main_win->base.state; +@@ -1767,6 +1767,22 @@ static void vop2_setup_cluster_alpha(struct vop2 *vop2, struct vop2_win *main_wi + vop2_parse_alpha(&alpha_config, &alpha); + + alpha.src_color_ctrl.bits.src_dst_swap = swap; ++ ++ switch (main_win->data->phys_id) { ++ case ROCKCHIP_VOP2_CLUSTER0: ++ offset = 0x0; ++ break; ++ case ROCKCHIP_VOP2_CLUSTER1: ++ offset = 0x10; ++ break; ++ case ROCKCHIP_VOP2_CLUSTER2: ++ offset = 0x20; ++ break; ++ case ROCKCHIP_VOP2_CLUSTER3: ++ offset = 0x30; ++ break; ++ } ++ + vop2_writel(vop2, RK3568_CLUSTER0_MIX_SRC_COLOR_CTRL + offset, + alpha.src_color_ctrl.val); + vop2_writel(vop2, RK3568_CLUSTER0_MIX_DST_COLOR_CTRL + offset, +-- +2.39.5 + diff --git a/queue-6.6/drm-rockchip-vop2-fix-the-mixer-alpha-setup-for-laye.patch b/queue-6.6/drm-rockchip-vop2-fix-the-mixer-alpha-setup-for-laye.patch new file mode 100644 index 0000000000..25f811a337 --- /dev/null +++ b/queue-6.6/drm-rockchip-vop2-fix-the-mixer-alpha-setup-for-laye.patch @@ -0,0 +1,45 @@ +From 4db32de20216a654bfd804a6383f11c63936f474 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Dec 2024 20:29:16 +0800 +Subject: drm/rockchip: vop2: Fix the mixer alpha setup for layer 0 + +From: Andy Yan + +[ Upstream commit 6b4dfdcde3573a12b72d2869dabd4ca37ad7e9c7 ] + +The alpha setup should start from the second layer, the current calculation +starts incorrectly from the first layer, a negative offset will be obtained +in the following formula: + +offset = (mixer_id + zpos - 1) * 0x10 + +Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver") +Tested-by: Derek Foreman +Signed-off-by: Andy Yan +Signed-off-by: Heiko Stuebner +Link: https://patchwork.freedesktop.org/patch/msgid/20241209122943.2781431-7-andyshrk@163.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +index f8fdbdf52e907..f7a3b05701e9a 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +@@ -1830,6 +1830,12 @@ static void vop2_setup_alpha(struct vop2_video_port *vp) + struct vop2_win *win = to_vop2_win(plane); + int zpos = plane->state->normalized_zpos; + ++ /* ++ * Need to configure alpha from second layer. ++ */ ++ if (zpos == 0) ++ continue; ++ + if (plane->state->pixel_blend_mode == DRM_MODE_BLEND_PREMULTI) + premulti_en = 1; + else +-- +2.39.5 + diff --git a/queue-6.6/drm-rockchip-vop2-fix-the-windows-switch-between-dif.patch b/queue-6.6/drm-rockchip-vop2-fix-the-windows-switch-between-dif.patch new file mode 100644 index 0000000000..5160bcd5cc --- /dev/null +++ b/queue-6.6/drm-rockchip-vop2-fix-the-windows-switch-between-dif.patch @@ -0,0 +1,106 @@ +From c81edd9a34b43a98b8e0b529399d4481a9c2114f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 14 Dec 2024 16:17:01 +0800 +Subject: drm/rockchip: vop2: Fix the windows switch between different layers + +From: Andy Yan + +[ Upstream commit 0ca953ac226eaffbe1a795f5e517095a8d494921 ] + +Every layer of vop2 should bind a window, and we also need to make +sure that this window is not used by other layer. + +0x5 is a reserved layer sel value on rk3568, but it will select +Cluster3 on rk3588, configure unused layers to 0x5 will lead +alpha blending error on rk3588. + +When we bind a window from layerM to layerN, we move the old window +on layerN to layerM. + +Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver") +Tested-by: Derek Foreman +Signed-off-by: Andy Yan +Signed-off-by: Heiko Stuebner +Link: https://patchwork.freedesktop.org/patch/msgid/20241214081719.3330518-3-andyshrk@163.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 47 ++++++++++++++------ + 1 file changed, 34 insertions(+), 13 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +index 1295aaffe868a..724b75cfb6b5b 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +@@ -1924,7 +1924,10 @@ static void vop2_setup_layer_mixer(struct vop2_video_port *vp) + struct drm_plane *plane; + u32 layer_sel = 0; + u32 port_sel; +- unsigned int nlayer, ofs; ++ u8 layer_id; ++ u8 old_layer_id; ++ u8 layer_sel_id; ++ unsigned int ofs; + u32 ovl_ctrl; + int i; + struct vop2_video_port *vp0 = &vop2->vps[0]; +@@ -1968,9 +1971,30 @@ static void vop2_setup_layer_mixer(struct vop2_video_port *vp) + for (i = 0; i < vp->id; i++) + ofs += vop2->vps[i].nlayers; + +- nlayer = 0; + drm_atomic_crtc_for_each_plane(plane, &vp->crtc) { + struct vop2_win *win = to_vop2_win(plane); ++ struct vop2_win *old_win; ++ ++ layer_id = (u8)(plane->state->normalized_zpos + ofs); ++ ++ /* ++ * Find the layer this win bind in old state. ++ */ ++ for (old_layer_id = 0; old_layer_id < vop2->data->win_size; old_layer_id++) { ++ layer_sel_id = (layer_sel >> (4 * old_layer_id)) & 0xf; ++ if (layer_sel_id == win->data->layer_sel_id) ++ break; ++ } ++ ++ /* ++ * Find the win bind to this layer in old state ++ */ ++ for (i = 0; i < vop2->data->win_size; i++) { ++ old_win = &vop2->win[i]; ++ layer_sel_id = (layer_sel >> (4 * layer_id)) & 0xf; ++ if (layer_sel_id == old_win->data->layer_sel_id) ++ break; ++ } + + switch (win->data->phys_id) { + case ROCKCHIP_VOP2_CLUSTER0: +@@ -1999,17 +2023,14 @@ static void vop2_setup_layer_mixer(struct vop2_video_port *vp) + break; + } + +- layer_sel &= ~RK3568_OVL_LAYER_SEL__LAYER(plane->state->normalized_zpos + ofs, +- 0x7); +- layer_sel |= RK3568_OVL_LAYER_SEL__LAYER(plane->state->normalized_zpos + ofs, +- win->data->layer_sel_id); +- nlayer++; +- } +- +- /* configure unused layers to 0x5 (reserved) */ +- for (; nlayer < vp->nlayers; nlayer++) { +- layer_sel &= ~RK3568_OVL_LAYER_SEL__LAYER(nlayer + ofs, 0x7); +- layer_sel |= RK3568_OVL_LAYER_SEL__LAYER(nlayer + ofs, 5); ++ layer_sel &= ~RK3568_OVL_LAYER_SEL__LAYER(layer_id, 0x7); ++ layer_sel |= RK3568_OVL_LAYER_SEL__LAYER(layer_id, win->data->layer_sel_id); ++ /* ++ * When we bind a window from layerM to layerN, we also need to move the old ++ * window on layerN to layerM to avoid one window selected by two or more layers. ++ */ ++ layer_sel &= ~RK3568_OVL_LAYER_SEL__LAYER(old_layer_id, 0x7); ++ layer_sel |= RK3568_OVL_LAYER_SEL__LAYER(old_layer_id, old_win->data->layer_sel_id); + } + + vop2_writel(vop2, RK3568_OVL_LAYER_SEL, layer_sel); +-- +2.39.5 + diff --git a/queue-6.6/drm-rockchip-vop2-include-rockchip_drm_drv.h.patch b/queue-6.6/drm-rockchip-vop2-include-rockchip_drm_drv.h.patch new file mode 100644 index 0000000000..22ee346d2d --- /dev/null +++ b/queue-6.6/drm-rockchip-vop2-include-rockchip_drm_drv.h.patch @@ -0,0 +1,62 @@ +From 9dadd4966331bfe9eaebfd20eae6baddeca3e8c6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 14 Dec 2024 16:17:06 +0800 +Subject: drm/rockchip: vop2: include rockchip_drm_drv.h + +From: Min-Hua Chen + +[ Upstream commit 77b1ccb2a27c7b3b118a03bf1730def92070d31b ] + +Move rockchip_drm_drv.h in rockchip_drm_vop2.h to fix the follow +sparse warning: + +ARCH=arm64 LLVM=1 make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' +mrproper defconfig all -j12 + +drivers/gpu/drm/rockchip/rockchip_vop2_reg.c:502:24: sparse: +warning: symbol 'vop2_platform_driver' was not declared. Should it +be static? + +It is also beneficial for the upcoming support for rk3576. + +Fixes: 604be85547ce ("drm/rockchip: Add VOP2 driver") +Signed-off-by: Min-Hua Chen +Signed-off-by: Andy Yan +Reviewed-by: Min-Hua Chen +Tested-by: Detlev Casanova +Tested-by: Michael Riesch # on RK3568 +Signed-off-by: Heiko Stuebner +Link: https://patchwork.freedesktop.org/patch/msgid/20241214081719.3330518-8-andyshrk@163.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 1 - + drivers/gpu/drm/rockchip/rockchip_drm_vop2.h | 1 + + 2 files changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +index abd88d2d7cabb..d8f8c37c326c4 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +@@ -33,7 +33,6 @@ + #include + #include + +-#include "rockchip_drm_drv.h" + #include "rockchip_drm_gem.h" + #include "rockchip_drm_fb.h" + #include "rockchip_drm_vop2.h" +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h +index 5672df5de90be..eec06ab1d7371 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h +@@ -9,6 +9,7 @@ + + #include + #include ++#include "rockchip_drm_drv.h" + #include "rockchip_drm_vop.h" + + #define VOP_FEATURE_OUTPUT_10BIT BIT(0) +-- +2.39.5 + diff --git a/queue-6.6/drm-rockchip-vop2-set-bg-dly-and-prescan-dly-at-vop2.patch b/queue-6.6/drm-rockchip-vop2-set-bg-dly-and-prescan-dly-at-vop2.patch new file mode 100644 index 0000000000..e12fb79efc --- /dev/null +++ b/queue-6.6/drm-rockchip-vop2-set-bg-dly-and-prescan-dly-at-vop2.patch @@ -0,0 +1,80 @@ +From 397839506870e7a8d159092b8ad3965b8b72c8ed Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Dec 2023 19:58:15 +0800 +Subject: drm/rockchip: vop2: set bg dly and prescan dly at vop2_post_config + +From: Andy Yan + +[ Upstream commit 075a5b3969becb1ebc2f1d4fa1a1fe9163679273 ] + +We need to setup background delay cycle and prescan +delay cycle when a mode is enable to avoid trigger +POST_BUF_EMPTY irq on rk3588. + +Note: RK356x has no such requirement. + +Signed-off-by: Andy Yan +Signed-off-by: Heiko Stuebner +Link: https://patchwork.freedesktop.org/patch/msgid/20231211115815.1785131-1-andyshrk@163.com +Stable-dep-of: 0ca953ac226e ("drm/rockchip: vop2: Fix the windows switch between different layers") +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 26 ++++++++------------ + 1 file changed, 10 insertions(+), 16 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +index 2504e2f762358..1295aaffe868a 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +@@ -1397,8 +1397,18 @@ static void vop2_post_config(struct drm_crtc *crtc) + u32 top_margin = 100, bottom_margin = 100; + u16 hsize = hdisplay * (left_margin + right_margin) / 200; + u16 vsize = vdisplay * (top_margin + bottom_margin) / 200; ++ u16 hsync_len = mode->crtc_hsync_end - mode->crtc_hsync_start; + u16 hact_end, vact_end; + u32 val; ++ u32 bg_dly; ++ u32 pre_scan_dly; ++ ++ bg_dly = vp->data->pre_scan_max_dly[3]; ++ vop2_writel(vp->vop2, RK3568_VP_BG_MIX_CTRL(vp->id), ++ FIELD_PREP(RK3568_VP_BG_MIX_CTRL__BG_DLY, bg_dly)); ++ ++ pre_scan_dly = ((bg_dly + (hdisplay >> 1) - 1) << 16) | hsync_len; ++ vop2_vp_write(vp, RK3568_VP_PRE_SCAN_HTIMING, pre_scan_dly); + + vsize = rounddown(vsize, 2); + hsize = rounddown(hsize, 2); +@@ -1915,11 +1925,6 @@ static void vop2_setup_layer_mixer(struct vop2_video_port *vp) + u32 layer_sel = 0; + u32 port_sel; + unsigned int nlayer, ofs; +- struct drm_display_mode *adjusted_mode; +- u16 hsync_len; +- u16 hdisplay; +- u32 bg_dly; +- u32 pre_scan_dly; + u32 ovl_ctrl; + int i; + struct vop2_video_port *vp0 = &vop2->vps[0]; +@@ -1927,17 +1932,6 @@ static void vop2_setup_layer_mixer(struct vop2_video_port *vp) + struct vop2_video_port *vp2 = &vop2->vps[2]; + struct rockchip_crtc_state *vcstate = to_rockchip_crtc_state(vp->crtc.state); + +- adjusted_mode = &vp->crtc.state->adjusted_mode; +- hsync_len = adjusted_mode->crtc_hsync_end - adjusted_mode->crtc_hsync_start; +- hdisplay = adjusted_mode->crtc_hdisplay; +- +- bg_dly = vp->data->pre_scan_max_dly[3]; +- vop2_writel(vop2, RK3568_VP_BG_MIX_CTRL(vp->id), +- FIELD_PREP(RK3568_VP_BG_MIX_CTRL__BG_DLY, bg_dly)); +- +- pre_scan_dly = ((bg_dly + (hdisplay >> 1) - 1) << 16) | hsync_len; +- vop2_vp_write(vp, RK3568_VP_PRE_SCAN_HTIMING, pre_scan_dly); +- + ovl_ctrl = vop2_readl(vop2, RK3568_OVL_CTRL); + ovl_ctrl |= RK3568_OVL_CTRL__LAYERSEL_REGDONE_IMD; + if (vcstate->yuv_overlay) +-- +2.39.5 + diff --git a/queue-6.6/drm-rockchip-vop2-set-yuv-rgb-overlay-mode.patch b/queue-6.6/drm-rockchip-vop2-set-yuv-rgb-overlay-mode.patch new file mode 100644 index 0000000000..3228c956a6 --- /dev/null +++ b/queue-6.6/drm-rockchip-vop2-set-yuv-rgb-overlay-mode.patch @@ -0,0 +1,110 @@ +From e895dd39a08d0058a51560ff8c47bb972cc855bc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 11 Dec 2023 19:58:05 +0800 +Subject: drm/rockchip: vop2: Set YUV/RGB overlay mode + +From: Andy Yan + +[ Upstream commit dd49ee4614cfb0b1f627c4353b60cecfe998a374 ] + +Set overlay mode register according to the +output mode is yuv or rgb. + +Signed-off-by: Andy Yan +Signed-off-by: Heiko Stuebner +Link: https://patchwork.freedesktop.org/patch/msgid/20231211115805.1785073-1-andyshrk@163.com +Stable-dep-of: 0ca953ac226e ("drm/rockchip: vop2: Fix the windows switch between different layers") +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 1 + + drivers/gpu/drm/rockchip/rockchip_drm_vop2.c | 17 ++++++++++++++--- + drivers/gpu/drm/rockchip/rockchip_drm_vop2.h | 1 + + 3 files changed, 16 insertions(+), 3 deletions(-) + +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +index aeb03a57240fd..9ef98968a83aa 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h +@@ -31,6 +31,7 @@ struct rockchip_crtc_state { + int output_bpc; + int output_flags; + bool enable_afbc; ++ bool yuv_overlay; + u32 bus_format; + u32 bus_flags; + int color_space; +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +index f7a3b05701e9a..2504e2f762358 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.c +@@ -1560,6 +1560,8 @@ static void vop2_crtc_atomic_enable(struct drm_crtc *crtc, + + vop2->enable_count++; + ++ vcstate->yuv_overlay = is_yuv_output(vcstate->bus_format); ++ + vop2_crtc_enable_irq(vp, VP_INT_POST_BUF_EMPTY); + + polflags = 0; +@@ -1587,7 +1589,7 @@ static void vop2_crtc_atomic_enable(struct drm_crtc *crtc, + if (vop2_output_uv_swap(vcstate->bus_format, vcstate->output_mode)) + dsp_ctrl |= RK3568_VP_DSP_CTRL__DSP_RB_SWAP; + +- if (is_yuv_output(vcstate->bus_format)) ++ if (vcstate->yuv_overlay) + dsp_ctrl |= RK3568_VP_DSP_CTRL__POST_DSP_OUT_R2Y; + + vop2_dither_setup(crtc, &dsp_ctrl); +@@ -1918,10 +1920,12 @@ static void vop2_setup_layer_mixer(struct vop2_video_port *vp) + u16 hdisplay; + u32 bg_dly; + u32 pre_scan_dly; ++ u32 ovl_ctrl; + int i; + struct vop2_video_port *vp0 = &vop2->vps[0]; + struct vop2_video_port *vp1 = &vop2->vps[1]; + struct vop2_video_port *vp2 = &vop2->vps[2]; ++ struct rockchip_crtc_state *vcstate = to_rockchip_crtc_state(vp->crtc.state); + + adjusted_mode = &vp->crtc.state->adjusted_mode; + hsync_len = adjusted_mode->crtc_hsync_end - adjusted_mode->crtc_hsync_start; +@@ -1934,7 +1938,15 @@ static void vop2_setup_layer_mixer(struct vop2_video_port *vp) + pre_scan_dly = ((bg_dly + (hdisplay >> 1) - 1) << 16) | hsync_len; + vop2_vp_write(vp, RK3568_VP_PRE_SCAN_HTIMING, pre_scan_dly); + +- vop2_writel(vop2, RK3568_OVL_CTRL, 0); ++ ovl_ctrl = vop2_readl(vop2, RK3568_OVL_CTRL); ++ ovl_ctrl |= RK3568_OVL_CTRL__LAYERSEL_REGDONE_IMD; ++ if (vcstate->yuv_overlay) ++ ovl_ctrl |= RK3568_OVL_CTRL__YUV_MODE(vp->id); ++ else ++ ovl_ctrl &= ~RK3568_OVL_CTRL__YUV_MODE(vp->id); ++ ++ vop2_writel(vop2, RK3568_OVL_CTRL, ovl_ctrl); ++ + port_sel = vop2_readl(vop2, RK3568_OVL_PORT_SEL); + port_sel &= RK3568_OVL_PORT_SEL__SEL_PORT; + +@@ -2008,7 +2020,6 @@ static void vop2_setup_layer_mixer(struct vop2_video_port *vp) + + vop2_writel(vop2, RK3568_OVL_LAYER_SEL, layer_sel); + vop2_writel(vop2, RK3568_OVL_PORT_SEL, port_sel); +- vop2_writel(vop2, RK3568_OVL_CTRL, RK3568_OVL_CTRL__LAYERSEL_REGDONE_IMD); + } + + static void vop2_setup_dly_for_windows(struct vop2 *vop2) +diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h +index f1234a151130f..18f0573b20002 100644 +--- a/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h ++++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop2.h +@@ -418,6 +418,7 @@ enum dst_factor_mode { + #define VOP2_COLOR_KEY_MASK BIT(31) + + #define RK3568_OVL_CTRL__LAYERSEL_REGDONE_IMD BIT(28) ++#define RK3568_OVL_CTRL__YUV_MODE(vp) BIT(vp) + + #define RK3568_VP_BG_MIX_CTRL__BG_DLY GENMASK(31, 24) + +-- +2.39.5 + diff --git a/queue-6.6/dt-bindings-clock-sunxi-export-pll_video_2x-and-pll_.patch b/queue-6.6/dt-bindings-clock-sunxi-export-pll_video_2x-and-pll_.patch new file mode 100644 index 0000000000..80e2d0f537 --- /dev/null +++ b/queue-6.6/dt-bindings-clock-sunxi-export-pll_video_2x-and-pll_.patch @@ -0,0 +1,44 @@ +From cafe962b7873990a1521ab4334d2916733c6344a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Jan 2025 23:36:57 -0800 +Subject: dt-bindings: clock: sunxi: Export PLL_VIDEO_2X and PLL_MIPI + +From: Vasily Khoruzhick + +[ Upstream commit 9897831de614f1d8d5184547f0e7bf7665eed436 ] + +Export PLL_VIDEO_2X and PLL_MIPI, these will be used to explicitly +select TCON0 clock parent in dts + +Fixes: ca1170b69968 ("clk: sunxi-ng: a64: force select PLL_MIPI in TCON0 mux") +Reviewed-by: Dragan Simic +Reviewed-by: Chen-Yu Tsai +Tested-by: Frank Oltmanns # on PinePhone +Tested-by: Stuart Gathman # on OG Pinebook +Signed-off-by: Vasily Khoruzhick +Acked-by: Krzysztof Kozlowski +Link: https://patch.msgid.link/20250104074035.1611136-2-anarsoul@gmail.com +Signed-off-by: Chen-Yu Tsai +Stable-dep-of: 0f368cb7ef10 ("clk: sunxi-ng: a64: drop redundant CLK_PLL_VIDEO0_2X and CLK_PLL_MIPI") +Signed-off-by: Sasha Levin +--- + include/dt-bindings/clock/sun50i-a64-ccu.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/include/dt-bindings/clock/sun50i-a64-ccu.h b/include/dt-bindings/clock/sun50i-a64-ccu.h +index 175892189e9dc..4f220ea7a23cc 100644 +--- a/include/dt-bindings/clock/sun50i-a64-ccu.h ++++ b/include/dt-bindings/clock/sun50i-a64-ccu.h +@@ -44,7 +44,9 @@ + #define _DT_BINDINGS_CLK_SUN50I_A64_H_ + + #define CLK_PLL_VIDEO0 7 ++#define CLK_PLL_VIDEO0_2X 8 + #define CLK_PLL_PERIPH0 11 ++#define CLK_PLL_MIPI 17 + + #define CLK_CPUX 21 + #define CLK_BUS_MIPI_DSI 28 +-- +2.39.5 + diff --git a/queue-6.6/dt-bindings-leds-class-multicolor-fix-path-to-color-.patch b/queue-6.6/dt-bindings-leds-class-multicolor-fix-path-to-color-.patch new file mode 100644 index 0000000000..895e131aff --- /dev/null +++ b/queue-6.6/dt-bindings-leds-class-multicolor-fix-path-to-color-.patch @@ -0,0 +1,38 @@ +From da52a9d75343e4c7d8d318cfd62b765ccf94ee4d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 14 Nov 2024 13:44:29 +0100 +Subject: dt-bindings: leds: class-multicolor: Fix path to color definitions + +From: Geert Uytterhoeven + +[ Upstream commit 609bc99a4452ffbce82d10f024a85d911c42e6cd ] + +The LED color definitions have always been in +include/dt-bindings/leds/common.h in upstream. + +Fixes: 5c7f8ffe741daae7 ("dt: bindings: Add multicolor class dt bindings documention") +Signed-off-by: Geert Uytterhoeven +Acked-by: Conor Dooley +Link: https://lore.kernel.org/r/a3c7ea92e90b77032f2e480d46418b087709286d.1731588129.git.geert+renesas@glider.be +Signed-off-by: Lee Jones +Signed-off-by: Sasha Levin +--- + .../devicetree/bindings/leds/leds-class-multicolor.yaml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml b/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml +index e850a8894758d..bb40bb9e036ee 100644 +--- a/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml ++++ b/Documentation/devicetree/bindings/leds/leds-class-multicolor.yaml +@@ -27,7 +27,7 @@ properties: + description: | + For multicolor LED support this property should be defined as either + LED_COLOR_ID_RGB or LED_COLOR_ID_MULTI which can be found in +- include/linux/leds/common.h. ++ include/dt-bindings/leds/common.h. + enum: [ 8, 9 ] + + required: +-- +2.39.5 + diff --git a/queue-6.6/dt-bindings-mfd-bd71815-fix-rsense-and-typos.patch b/queue-6.6/dt-bindings-mfd-bd71815-fix-rsense-and-typos.patch new file mode 100644 index 0000000000..4261bf117d --- /dev/null +++ b/queue-6.6/dt-bindings-mfd-bd71815-fix-rsense-and-typos.patch @@ -0,0 +1,77 @@ +From b7ebe84932215801ef43273fa3e5844bf07004a4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Nov 2024 19:01:06 +0200 +Subject: dt-bindings: mfd: bd71815: Fix rsense and typos + +From: Matti Vaittinen + +[ Upstream commit 6856edf7ead8c54803216a38a7b227bcb3dadff7 ] + +The sense resistor used for measuring currents is typically some tens of +milli Ohms. It has accidentally been documented to be tens of mega Ohms. +Fix the size of this resistor and a few copy-paste errors while at it. + +Drop the unsuitable 'rohm,charger-sense-resistor-ohms' property (which +can't represent resistors smaller than one Ohm), and introduce a new +'rohm,charger-sense-resistor-micro-ohms' property with appropriate +minimum, maximum and default values instead. + +Fixes: 4238dc1e6490 ("dt_bindings: mfd: Add ROHM BD71815 PMIC") +Signed-off-by: Matti Vaittinen +Acked-by: Conor Dooley +Link: https://lore.kernel.org/r/0efd8e9de0ae8d62ee4c6b78cc565b04007a245d.1731430700.git.mazziesaccount@gmail.com +Signed-off-by: Lee Jones +Signed-off-by: Sasha Levin +--- + .../bindings/mfd/rohm,bd71815-pmic.yaml | 20 +++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/Documentation/devicetree/bindings/mfd/rohm,bd71815-pmic.yaml b/Documentation/devicetree/bindings/mfd/rohm,bd71815-pmic.yaml +index 05747e012516e..ab26b1bd567fd 100644 +--- a/Documentation/devicetree/bindings/mfd/rohm,bd71815-pmic.yaml ++++ b/Documentation/devicetree/bindings/mfd/rohm,bd71815-pmic.yaml +@@ -50,15 +50,15 @@ properties: + minimum: 0 + maximum: 1 + +- rohm,charger-sense-resistor-ohms: +- minimum: 10000000 +- maximum: 50000000 ++ rohm,charger-sense-resistor-micro-ohms: ++ minimum: 10000 ++ maximum: 50000 + description: | +- BD71827 and BD71828 have SAR ADC for measuring charging currents. +- External sense resistor (RSENSE in data sheet) should be used. If +- something other but 30MOhm resistor is used the resistance value +- should be given here in Ohms. +- default: 30000000 ++ BD71815 has SAR ADC for measuring charging currents. External sense ++ resistor (RSENSE in data sheet) should be used. If something other ++ but a 30 mOhm resistor is used the resistance value should be given ++ here in micro Ohms. ++ default: 30000 + + regulators: + $ref: ../regulator/rohm,bd71815-regulator.yaml +@@ -67,7 +67,7 @@ properties: + + gpio-reserved-ranges: + description: | +- Usage of BD71828 GPIO pins can be changed via OTP. This property can be ++ Usage of BD71815 GPIO pins can be changed via OTP. This property can be + used to mark the pins which should not be configured for GPIO. Please see + the ../gpio/gpio.txt for more information. + +@@ -113,7 +113,7 @@ examples: + gpio-controller; + #gpio-cells = <2>; + +- rohm,charger-sense-resistor-ohms = <10000000>; ++ rohm,charger-sense-resistor-micro-ohms = <10000>; + + regulators { + buck1: buck1 { +-- +2.39.5 + diff --git a/queue-6.6/dt-bindings-mmc-controller-clarify-the-address-cells.patch b/queue-6.6/dt-bindings-mmc-controller-clarify-the-address-cells.patch new file mode 100644 index 0000000000..8dfd5229e2 --- /dev/null +++ b/queue-6.6/dt-bindings-mmc-controller-clarify-the-address-cells.patch @@ -0,0 +1,39 @@ +From 0daca4cfbd47494a8984414d5005a47ff99338dd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 28 Nov 2024 16:16:41 +0100 +Subject: dt-bindings: mmc: controller: clarify the address-cells description + +From: Neil Armstrong + +[ Upstream commit b2b8e93ec00b8110cb37cbde5400d5abfdaed6a7 ] + +The term "slot ID" has nothing to do with the SDIO function number +which is specified in the reg property of the subnodes, rephrase +the description to be more accurate. + +Fixes: f9b7989859dd ("dt-bindings: mmc: Add YAML schemas for the generic MMC options") +Signed-off-by: Neil Armstrong +Acked-by: Rob Herring (Arm) +Message-ID: <20241128-topic-amlogic-arm32-upstream-bindings-fixes-convert-meson-mx-sdio-v4-1-11d9f9200a59@linaro.org> +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +--- + Documentation/devicetree/bindings/mmc/mmc-controller.yaml | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Documentation/devicetree/bindings/mmc/mmc-controller.yaml b/Documentation/devicetree/bindings/mmc/mmc-controller.yaml +index 58ae298cd2fcf..23884b8184a9d 100644 +--- a/Documentation/devicetree/bindings/mmc/mmc-controller.yaml ++++ b/Documentation/devicetree/bindings/mmc/mmc-controller.yaml +@@ -25,7 +25,7 @@ properties: + "#address-cells": + const: 1 + description: | +- The cell is the slot ID if a function subnode is used. ++ The cell is the SDIO function number if a function subnode is used. + + "#size-cells": + const: 0 +-- +2.39.5 + diff --git a/queue-6.6/dts-arm64-mediatek-mt8195-remove-mt8183-compatible-f.patch b/queue-6.6/dts-arm64-mediatek-mt8195-remove-mt8183-compatible-f.patch new file mode 100644 index 0000000000..ad71201072 --- /dev/null +++ b/queue-6.6/dts-arm64-mediatek-mt8195-remove-mt8183-compatible-f.patch @@ -0,0 +1,39 @@ +From b18e85df145e364b664b4ac0eb48998986e99777 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 Dec 2024 02:15:31 +0800 +Subject: dts: arm64: mediatek: mt8195: Remove MT8183 compatible for OVL + +From: Jason-JH.Lin + +[ Upstream commit ce3dbc46d7e30a84b8e99c730e3172dd5efbf094 ] + +The OVL hardware capabilities have changed starting from MT8195, +making the MT8183 compatible no longer applicable. +Therefore, it is necessary to remove the MT8183 compatible for OVL. + +Reviewed-by: AngeloGioacchino Del Regno +Signed-off-by: Jason-JH.Lin +Fixes: b852ee68fd72 ("arm64: dts: mt8195: Add display node for vdosys0") +Link: https://lore.kernel.org/r/20241219181531.4282-5-jason-jh.lin@mediatek.com +Signed-off-by: AngeloGioacchino Del Regno +Signed-off-by: Sasha Levin +--- + arch/arm64/boot/dts/mediatek/mt8195.dtsi | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm64/boot/dts/mediatek/mt8195.dtsi b/arch/arm64/boot/dts/mediatek/mt8195.dtsi +index 1cb22257adb36..7ba30209ba9a9 100644 +--- a/arch/arm64/boot/dts/mediatek/mt8195.dtsi ++++ b/arch/arm64/boot/dts/mediatek/mt8195.dtsi +@@ -2677,7 +2677,7 @@ + }; + + ovl0: ovl@1c000000 { +- compatible = "mediatek,mt8195-disp-ovl", "mediatek,mt8183-disp-ovl"; ++ compatible = "mediatek,mt8195-disp-ovl"; + reg = <0 0x1c000000 0 0x1000>; + interrupts = ; + power-domains = <&spm MT8195_POWER_DOMAIN_VDOSYS0>; +-- +2.39.5 + diff --git a/queue-6.6/efi-sysfb_efi-fix-w-1-warnings-when-efi-is-not-set.patch b/queue-6.6/efi-sysfb_efi-fix-w-1-warnings-when-efi-is-not-set.patch new file mode 100644 index 0000000000..5fe7e66ce2 --- /dev/null +++ b/queue-6.6/efi-sysfb_efi-fix-w-1-warnings-when-efi-is-not-set.patch @@ -0,0 +1,70 @@ +From 3fa81db02da771813b1241fd5817b8ddae8c15c3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Jan 2025 15:53:09 -0800 +Subject: efi: sysfb_efi: fix W=1 warnings when EFI is not set +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Randy Dunlap + +[ Upstream commit 19fdc68aa7b90b1d3d600e873a3e050a39e7663d ] + +A build with W=1 fails because there are code and data that are not +needed or used when CONFIG_EFI is not set. Move the "#ifdef CONFIG_EFI" +block to earlier in the source file so that the unused code/data are +not built. + +drivers/firmware/efi/sysfb_efi.c:345:39: warning: ‘efifb_fwnode_ops’ defined but not used [-Wunused-const-variable=] + 345 | static const struct fwnode_operations efifb_fwnode_ops = { + | ^~~~~~~~~~~~~~~~ +drivers/firmware/efi/sysfb_efi.c:238:35: warning: ‘efifb_dmi_swap_width_height’ defined but not used [-Wunused-const-variable=] + 238 | static const struct dmi_system_id efifb_dmi_swap_width_height[] __initconst = { + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~ +drivers/firmware/efi/sysfb_efi.c:188:35: warning: ‘efifb_dmi_system_table’ defined but not used [-Wunused-const-variable=] + 188 | static const struct dmi_system_id efifb_dmi_system_table[] __initconst = { + | ^~~~~~~~~~~~~~~~~~~~~~ + +Fixes: 15d27b15de96 ("efi: sysfb_efi: fix build when EFI is not set") +Signed-off-by: Randy Dunlap +Reported-by: kernel test robot +Closes: https://lore.kernel.org/oe-kbuild-all/202501071933.20nlmJJt-lkp@intel.com/ +Cc: David Rheinsberg +Cc: Hans de Goede +Cc: Javier Martinez Canillas +Cc: Peter Jones +Cc: Simona Vetter +Cc: linux-fbdev@vger.kernel.org +Cc: Ard Biesheuvel +Cc: linux-efi@vger.kernel.org +Reviewed-by: Thomas Zimmermann +Reviewed-by: Javier Martinez Canillas +Signed-off-by: Ard Biesheuvel +Signed-off-by: Sasha Levin +--- + drivers/firmware/efi/sysfb_efi.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/firmware/efi/sysfb_efi.c b/drivers/firmware/efi/sysfb_efi.c +index 456d0e5eaf78b..f479680299838 100644 +--- a/drivers/firmware/efi/sysfb_efi.c ++++ b/drivers/firmware/efi/sysfb_efi.c +@@ -91,6 +91,7 @@ void efifb_setup_from_dmi(struct screen_info *si, const char *opt) + _ret_; \ + }) + ++#ifdef CONFIG_EFI + static int __init efifb_set_system(const struct dmi_system_id *id) + { + struct efifb_dmi_info *info = id->driver_data; +@@ -346,7 +347,6 @@ static const struct fwnode_operations efifb_fwnode_ops = { + .add_links = efifb_add_links, + }; + +-#ifdef CONFIG_EFI + static struct fwnode_handle efifb_fwnode; + + __init void sysfb_apply_efi_quirks(void) +-- +2.39.5 + diff --git a/queue-6.6/fbdev-omapfb-fix-an-of-node-leak-in-dss_of_port_get_.patch b/queue-6.6/fbdev-omapfb-fix-an-of-node-leak-in-dss_of_port_get_.patch new file mode 100644 index 0000000000..ab49b17caf --- /dev/null +++ b/queue-6.6/fbdev-omapfb-fix-an-of-node-leak-in-dss_of_port_get_.patch @@ -0,0 +1,42 @@ +From 22b828b9d650f7568751f085c147aa546fecbd81 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 Jan 2025 10:15:37 +0900 +Subject: fbdev: omapfb: Fix an OF node leak in dss_of_port_get_parent_device() + +From: Joe Hattori + +[ Upstream commit de124b61e179e690277116e6be512e4f422b5dd8 ] + +dss_of_port_get_parent_device() leaks an OF node reference when i >= 2 +and struct device_node *np is present. Since of_get_next_parent() +obtains a reference of the returned OF node, call of_node_put() before +returning NULL. + +This was found by an experimental verifier that I am developing, and no +runtime test was able to be performed due to that lack of actual +devices. + +Fixes: f76ee892a99e ("omapfb: copy omapdss & displays for omapfb") +Signed-off-by: Joe Hattori +Reviewed-by: Laurent Pinchart +Signed-off-by: Helge Deller +Signed-off-by: Sasha Levin +--- + drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c +index 0282d4eef139d..3b16c3342cb77 100644 +--- a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c ++++ b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c +@@ -102,6 +102,7 @@ struct device_node *dss_of_port_get_parent_device(struct device_node *port) + np = of_get_next_parent(np); + } + ++ of_node_put(np); + return NULL; + } + +-- +2.39.5 + diff --git a/queue-6.6/fs-fix-proc_handler-for-sysctl_nr_open.patch b/queue-6.6/fs-fix-proc_handler-for-sysctl_nr_open.patch new file mode 100644 index 0000000000..94bc6f0c99 --- /dev/null +++ b/queue-6.6/fs-fix-proc_handler-for-sysctl_nr_open.patch @@ -0,0 +1,37 @@ +From 6581d693a57285728bb5be7c3cac3a4b96b2ed4a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 24 Nov 2024 11:46:36 +0800 +Subject: fs: fix proc_handler for sysctl_nr_open + +From: Jinliang Zheng + +[ Upstream commit d727935cad9f6f52c8d184968f9720fdc966c669 ] + +Use proc_douintvec_minmax() instead of proc_dointvec_minmax() to handle +sysctl_nr_open, because its data type is unsigned int, not int. + +Fixes: 9b80a184eaad ("fs/file: more unsigned file descriptors") +Signed-off-by: Jinliang Zheng +Link: https://lore.kernel.org/r/20241124034636.325337-1-alexjlzheng@tencent.com +Signed-off-by: Christian Brauner +Signed-off-by: Sasha Levin +--- + fs/file_table.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/file_table.c b/fs/file_table.c +index ee21b3da9d081..234284ef72a9a 100644 +--- a/fs/file_table.c ++++ b/fs/file_table.c +@@ -133,7 +133,7 @@ static struct ctl_table fs_stat_sysctls[] = { + .data = &sysctl_nr_open, + .maxlen = sizeof(unsigned int), + .mode = 0644, +- .proc_handler = proc_dointvec_minmax, ++ .proc_handler = proc_douintvec_minmax, + .extra1 = &sysctl_nr_open_min, + .extra2 = &sysctl_nr_open_max, + }, +-- +2.39.5 + diff --git a/queue-6.6/genirq-make-handle_enforce_irqctx-unconditionally-av.patch b/queue-6.6/genirq-make-handle_enforce_irqctx-unconditionally-av.patch new file mode 100644 index 0000000000..ddd92a9249 --- /dev/null +++ b/queue-6.6/genirq-make-handle_enforce_irqctx-unconditionally-av.patch @@ -0,0 +1,60 @@ +From 953365f034c312c1fe9bf91c7cdcde9ae01b7cde Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Dec 2024 11:20:43 +0100 +Subject: genirq: Make handle_enforce_irqctx() unconditionally available + +From: Thomas Gleixner + +[ Upstream commit 8d187a77f04c14fb459a5301d69f733a5a1396bc ] + +Commit 1b57d91b969c ("irqchip/gic-v2, v3: Prevent SW resends entirely") +sett the flag which enforces interrupt handling in interrupt context and +prevents software base resends for ARM GIC v2/v3. + +But it missed that the helper function which checks the flag was hidden +behind CONFIG_GENERIC_PENDING_IRQ, which is not set by ARM[64]. + +Make the helper unconditionally available so that the enforcement actually +works. + +Fixes: 1b57d91b969c ("irqchip/gic-v2, v3: Prevent SW resends entirely") +Signed-off-by: Thomas Gleixner +Link: https://lore.kernel.org/all/20241210101811.497716609@linutronix.de +Signed-off-by: Sasha Levin +--- + kernel/irq/internals.h | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/kernel/irq/internals.h b/kernel/irq/internals.h +index bcc7f21db9eeb..fbeecc608f54c 100644 +--- a/kernel/irq/internals.h ++++ b/kernel/irq/internals.h +@@ -434,10 +434,6 @@ static inline struct cpumask *irq_desc_get_pending_mask(struct irq_desc *desc) + { + return desc->pending_mask; + } +-static inline bool handle_enforce_irqctx(struct irq_data *data) +-{ +- return irqd_is_handle_enforce_irqctx(data); +-} + bool irq_fixup_move_pending(struct irq_desc *desc, bool force_clear); + #else /* CONFIG_GENERIC_PENDING_IRQ */ + static inline bool irq_can_move_pcntxt(struct irq_data *data) +@@ -464,11 +460,12 @@ static inline bool irq_fixup_move_pending(struct irq_desc *desc, bool fclear) + { + return false; + } ++#endif /* !CONFIG_GENERIC_PENDING_IRQ */ ++ + static inline bool handle_enforce_irqctx(struct irq_data *data) + { +- return false; ++ return irqd_is_handle_enforce_irqctx(data); + } +-#endif /* !CONFIG_GENERIC_PENDING_IRQ */ + + #if !defined(CONFIG_IRQ_DOMAIN) || !defined(CONFIG_IRQ_DOMAIN_HIERARCHY) + static inline int irq_domain_activate_irq(struct irq_data *data, bool reserve) +-- +2.39.5 + diff --git a/queue-6.6/gpio-mxc-remove-dead-code-after-switch-to-dt-only.patch b/queue-6.6/gpio-mxc-remove-dead-code-after-switch-to-dt-only.patch new file mode 100644 index 0000000000..02d300a0b9 --- /dev/null +++ b/queue-6.6/gpio-mxc-remove-dead-code-after-switch-to-dt-only.patch @@ -0,0 +1,44 @@ +From cf6c655a135c9749236bd1d83a05fb6e4d0b400d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Jan 2025 23:19:11 +0100 +Subject: gpio: mxc: remove dead code after switch to DT-only + +From: Ahmad Fatoum + +[ Upstream commit b049e7abe9001a780d58e78e3833dcceee22f396 ] + +struct platform_device::id was only set by board code, but since i.MX +became a devicetree-only platform, this will always be -1 +(PLATFORM_DEVID_NONE). + +Note: of_alias_get_id() returns a negative number on error and base +treats all negative errors the same, so we need not add any additional +error handling. + +Fixes: 0f2c7af45d7e ("gpio: mxc: Convert the driver to DT-only") +Signed-off-by: Ahmad Fatoum +Reviewed-by: Andy Shevchenko +Link: https://lore.kernel.org/r/20250113-b4-imx-gpio-base-warning-v1-3-0a28731a5cf6@pengutronix.de +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpio-mxc.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c +index 4cb455b2bdee7..619b6fb9d833a 100644 +--- a/drivers/gpio/gpio-mxc.c ++++ b/drivers/gpio/gpio-mxc.c +@@ -490,8 +490,7 @@ static int mxc_gpio_probe(struct platform_device *pdev) + port->gc.request = mxc_gpio_request; + port->gc.free = mxc_gpio_free; + port->gc.to_irq = mxc_gpio_to_irq; +- port->gc.base = (pdev->id < 0) ? of_alias_get_id(np, "gpio") * 32 : +- pdev->id * 32; ++ port->gc.base = of_alias_get_id(np, "gpio") * 32; + + err = devm_gpiochip_add_data(&pdev->dev, &port->gc, port); + if (err) +-- +2.39.5 + diff --git a/queue-6.6/gpio-pca953x-drop-unused-fields-in-struct-pca953x_pl.patch b/queue-6.6/gpio-pca953x-drop-unused-fields-in-struct-pca953x_pl.patch new file mode 100644 index 0000000000..d64b8cd776 --- /dev/null +++ b/queue-6.6/gpio-pca953x-drop-unused-fields-in-struct-pca953x_pl.patch @@ -0,0 +1,170 @@ +From 8591306880255bfcfca2635a9684bac9af431099 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 1 Sep 2023 16:40:32 +0300 +Subject: gpio: pca953x: Drop unused fields in struct pca953x_platform_data + +From: Andy Shevchenko + +[ Upstream commit 2f4d3e293392571e02b106c8b431b638bd029276 ] + +New code should solely use firmware nodes for the specifics and +not any callbacks. + +Signed-off-by: Andy Shevchenko +Signed-off-by: Bartosz Golaszewski +Stable-dep-of: 7cef813a91c4 ("gpio: pca953x: log an error when failing to get the reset GPIO") +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpio-pca953x.c | 37 ++++++--------------------- + include/linux/platform_data/pca953x.h | 13 ---------- + 2 files changed, 8 insertions(+), 42 deletions(-) + +diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c +index ce9a94e332801..b52548822ecc3 100644 +--- a/drivers/gpio/gpio-pca953x.c ++++ b/drivers/gpio/gpio-pca953x.c +@@ -211,7 +211,6 @@ struct pca953x_chip { + + struct i2c_client *client; + struct gpio_chip gpio_chip; +- const char *const *names; + unsigned long driver_data; + struct regulator *regulator; + +@@ -712,7 +711,6 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios) + gc->label = dev_name(&chip->client->dev); + gc->parent = &chip->client->dev; + gc->owner = THIS_MODULE; +- gc->names = chip->names; + } + + #ifdef CONFIG_GPIO_PCA953X_IRQ +@@ -1000,7 +998,7 @@ static int pca953x_irq_setup(struct pca953x_chip *chip, + } + #endif + +-static int device_pca95xx_init(struct pca953x_chip *chip, u32 invert) ++static int device_pca95xx_init(struct pca953x_chip *chip) + { + DECLARE_BITMAP(val, MAX_LINE); + u8 regaddr; +@@ -1018,24 +1016,21 @@ static int device_pca95xx_init(struct pca953x_chip *chip, u32 invert) + if (ret) + goto out; + +- /* set platform specific polarity inversion */ +- if (invert) +- bitmap_fill(val, MAX_LINE); +- else +- bitmap_zero(val, MAX_LINE); ++ /* clear polarity inversion */ ++ bitmap_zero(val, MAX_LINE); + + ret = pca953x_write_regs(chip, chip->regs->invert, val); + out: + return ret; + } + +-static int device_pca957x_init(struct pca953x_chip *chip, u32 invert) ++static int device_pca957x_init(struct pca953x_chip *chip) + { + DECLARE_BITMAP(val, MAX_LINE); + unsigned int i; + int ret; + +- ret = device_pca95xx_init(chip, invert); ++ ret = device_pca95xx_init(chip); + if (ret) + goto out; + +@@ -1056,9 +1051,8 @@ static int pca953x_probe(struct i2c_client *client) + { + struct pca953x_platform_data *pdata; + struct pca953x_chip *chip; +- int irq_base = 0; ++ int irq_base; + int ret; +- u32 invert = 0; + struct regulator *reg; + const struct regmap_config *regmap_config; + +@@ -1070,8 +1064,6 @@ static int pca953x_probe(struct i2c_client *client) + if (pdata) { + irq_base = pdata->irq_base; + chip->gpio_start = pdata->gpio_base; +- invert = pdata->invert; +- chip->names = pdata->names; + } else { + struct gpio_desc *reset_gpio; + +@@ -1160,10 +1152,10 @@ static int pca953x_probe(struct i2c_client *client) + */ + if (PCA_CHIP_TYPE(chip->driver_data) == PCA957X_TYPE) { + chip->regs = &pca957x_regs; +- ret = device_pca957x_init(chip, invert); ++ ret = device_pca957x_init(chip); + } else { + chip->regs = &pca953x_regs; +- ret = device_pca95xx_init(chip, invert); ++ ret = device_pca95xx_init(chip); + } + if (ret) + goto err_exit; +@@ -1176,13 +1168,6 @@ static int pca953x_probe(struct i2c_client *client) + if (ret) + goto err_exit; + +- if (pdata && pdata->setup) { +- ret = pdata->setup(client, chip->gpio_chip.base, +- chip->gpio_chip.ngpio, pdata->context); +- if (ret < 0) +- dev_warn(&client->dev, "setup failed, %d\n", ret); +- } +- + return 0; + + err_exit: +@@ -1192,14 +1177,8 @@ static int pca953x_probe(struct i2c_client *client) + + static void pca953x_remove(struct i2c_client *client) + { +- struct pca953x_platform_data *pdata = dev_get_platdata(&client->dev); + struct pca953x_chip *chip = i2c_get_clientdata(client); + +- if (pdata && pdata->teardown) { +- pdata->teardown(client, chip->gpio_chip.base, +- chip->gpio_chip.ngpio, pdata->context); +- } +- + regulator_disable(chip->regulator); + } + +diff --git a/include/linux/platform_data/pca953x.h b/include/linux/platform_data/pca953x.h +index 96c1a14ab3657..3c3787c4d96ca 100644 +--- a/include/linux/platform_data/pca953x.h ++++ b/include/linux/platform_data/pca953x.h +@@ -11,21 +11,8 @@ struct pca953x_platform_data { + /* number of the first GPIO */ + unsigned gpio_base; + +- /* initial polarity inversion setting */ +- u32 invert; +- + /* interrupt base */ + int irq_base; +- +- void *context; /* param to setup/teardown */ +- +- int (*setup)(struct i2c_client *client, +- unsigned gpio, unsigned ngpio, +- void *context); +- void (*teardown)(struct i2c_client *client, +- unsigned gpio, unsigned ngpio, +- void *context); +- const char *const *names; + }; + + #endif /* _LINUX_PCA953X_H */ +-- +2.39.5 + diff --git a/queue-6.6/gpio-pca953x-fully-convert-to-device-managed-resourc.patch b/queue-6.6/gpio-pca953x-fully-convert-to-device-managed-resourc.patch new file mode 100644 index 0000000000..557e6d5bf7 --- /dev/null +++ b/queue-6.6/gpio-pca953x-fully-convert-to-device-managed-resourc.patch @@ -0,0 +1,143 @@ +From 4972f80d9a5f91363258da91d31c514ee53bc375 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 1 Sep 2023 16:40:33 +0300 +Subject: gpio: pca953x: Fully convert to device managed resources + +From: Andy Shevchenko + +[ Upstream commit 53c59d66c44c5eb98b34da9967f937e5387f8624 ] + +Curtrently the error path is unsynchronised with removal due to +regulator being disabled before other device managed resources +are handled. Correct that by wrapping regulator enablement in +the respective call. + +Signed-off-by: Andy Shevchenko +Signed-off-by: Bartosz Golaszewski +Stable-dep-of: 7cef813a91c4 ("gpio: pca953x: log an error when failing to get the reset GPIO") +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpio-pca953x.c | 68 +++++++++++++++++++------------------ + 1 file changed, 35 insertions(+), 33 deletions(-) + +diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c +index b52548822ecc3..cf5d85c6c8925 100644 +--- a/drivers/gpio/gpio-pca953x.c ++++ b/drivers/gpio/gpio-pca953x.c +@@ -1047,13 +1047,40 @@ static int device_pca957x_init(struct pca953x_chip *chip) + return ret; + } + ++static void pca953x_disable_regulator(void *reg) ++{ ++ regulator_disable(reg); ++} ++ ++static int pca953x_get_and_enable_regulator(struct pca953x_chip *chip) ++{ ++ struct device *dev = &chip->client->dev; ++ struct regulator *reg = chip->regulator; ++ int ret; ++ ++ reg = devm_regulator_get(dev, "vcc"); ++ if (IS_ERR(reg)) ++ return dev_err_probe(dev, PTR_ERR(reg), "reg get err\n"); ++ ++ ret = regulator_enable(reg); ++ if (ret) ++ return dev_err_probe(dev, ret, "reg en err\n"); ++ ++ ret = devm_add_action_or_reset(dev, pca953x_disable_regulator, reg); ++ if (ret) ++ return ret; ++ ++ chip->regulator = reg; ++ return 0; ++} ++ + static int pca953x_probe(struct i2c_client *client) + { ++ struct device *dev = &client->dev; + struct pca953x_platform_data *pdata; + struct pca953x_chip *chip; + int irq_base; + int ret; +- struct regulator *reg; + const struct regmap_config *regmap_config; + + chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL); +@@ -1088,16 +1115,9 @@ static int pca953x_probe(struct i2c_client *client) + if (!chip->driver_data) + return -ENODEV; + +- reg = devm_regulator_get(&client->dev, "vcc"); +- if (IS_ERR(reg)) +- return dev_err_probe(&client->dev, PTR_ERR(reg), "reg get err\n"); +- +- ret = regulator_enable(reg); +- if (ret) { +- dev_err(&client->dev, "reg en err: %d\n", ret); ++ ret = pca953x_get_and_enable_regulator(chip); ++ if (ret) + return ret; +- } +- chip->regulator = reg; + + i2c_set_clientdata(client, chip); + +@@ -1120,10 +1140,8 @@ static int pca953x_probe(struct i2c_client *client) + } + + chip->regmap = devm_regmap_init_i2c(client, regmap_config); +- if (IS_ERR(chip->regmap)) { +- ret = PTR_ERR(chip->regmap); +- goto err_exit; +- } ++ if (IS_ERR(chip->regmap)) ++ return PTR_ERR(chip->regmap); + + regcache_mark_dirty(chip->regmap); + +@@ -1158,28 +1176,13 @@ static int pca953x_probe(struct i2c_client *client) + ret = device_pca95xx_init(chip); + } + if (ret) +- goto err_exit; ++ return ret; + + ret = pca953x_irq_setup(chip, irq_base); + if (ret) +- goto err_exit; +- +- ret = devm_gpiochip_add_data(&client->dev, &chip->gpio_chip, chip); +- if (ret) +- goto err_exit; +- +- return 0; +- +-err_exit: +- regulator_disable(chip->regulator); +- return ret; +-} +- +-static void pca953x_remove(struct i2c_client *client) +-{ +- struct pca953x_chip *chip = i2c_get_clientdata(client); ++ return ret; + +- regulator_disable(chip->regulator); ++ return devm_gpiochip_add_data(dev, &chip->gpio_chip, chip); + } + + #ifdef CONFIG_PM_SLEEP +@@ -1347,7 +1350,6 @@ static struct i2c_driver pca953x_driver = { + .acpi_match_table = pca953x_acpi_ids, + }, + .probe = pca953x_probe, +- .remove = pca953x_remove, + .id_table = pca953x_id, + }; + +-- +2.39.5 + diff --git a/queue-6.6/gpio-pca953x-log-an-error-when-failing-to-get-the-re.patch b/queue-6.6/gpio-pca953x-log-an-error-when-failing-to-get-the-re.patch new file mode 100644 index 0000000000..91a3f67897 --- /dev/null +++ b/queue-6.6/gpio-pca953x-log-an-error-when-failing-to-get-the-re.patch @@ -0,0 +1,38 @@ +From 42b94a222eb01d431ceb1f84a5c83c9d3ff68dbb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 19 Dec 2024 10:39:46 +0100 +Subject: gpio: pca953x: log an error when failing to get the reset GPIO + +From: Luca Ceresoli + +[ Upstream commit 7cef813a91c468253c80633891393478b9f2c966 ] + +When the dirver fails getting this GPIO, it fails silently. Log an error +message to make debugging a lot easier by just reading dmesg. + +Signed-off-by: Luca Ceresoli +Fixes: 054ccdef8b28 ("gpio: pca953x: Add optional reset gpio control") +Link: https://lore.kernel.org/r/20241219-pca953x-log-no-reset-gpio-v1-1-9aa7bcc45ead@bootlin.com +Signed-off-by: Bartosz Golaszewski +Signed-off-by: Sasha Levin +--- + drivers/gpio/gpio-pca953x.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c +index cf5d85c6c8925..9c33f9da724cf 100644 +--- a/drivers/gpio/gpio-pca953x.c ++++ b/drivers/gpio/gpio-pca953x.c +@@ -1107,7 +1107,8 @@ static int pca953x_probe(struct i2c_client *client) + reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", + GPIOD_OUT_LOW); + if (IS_ERR(reset_gpio)) +- return PTR_ERR(reset_gpio); ++ return dev_err_probe(dev, PTR_ERR(reset_gpio), ++ "Failed to get reset gpio\n"); + } + + chip->client = client; +-- +2.39.5 + diff --git a/queue-6.6/hid-fix-generic-desktop-d-pad-controls.patch b/queue-6.6/hid-fix-generic-desktop-d-pad-controls.patch new file mode 100644 index 0000000000..febb7d956a --- /dev/null +++ b/queue-6.6/hid-fix-generic-desktop-d-pad-controls.patch @@ -0,0 +1,94 @@ +From fa907c9eb611f9d47a33d402bcc8f17bf0c80b98 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 Dec 2024 19:23:18 +0000 +Subject: HID: fix generic desktop D-Pad controls + +From: Terry Tritton + +[ Upstream commit 80818fdc068eaab729bb793d790ae9fd053f7053 ] + +The addition of the "System Do Not Disturb" event code caused the Generic +Desktop D-Pad configuration to be skipped. This commit allows both to be +configured without conflicting with each other. + +Fixes: 22d6d060ac77 ("input: Add support for "Do Not Disturb"") +Signed-off-by: Terry Tritton +Reviewed-by: Aseda Aboagye +Reviewed-by: Carlos Llamas +Signed-off-by: Jiri Kosina +Signed-off-by: Sasha Levin +--- + drivers/hid/hid-input.c | 37 +++++++++++++++++-------------------- + include/linux/hid.h | 1 + + 2 files changed, 18 insertions(+), 20 deletions(-) + +diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c +index fda9dce3da998..9d80635a91ebd 100644 +--- a/drivers/hid/hid-input.c ++++ b/drivers/hid/hid-input.c +@@ -810,10 +810,23 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel + break; + } + +- if ((usage->hid & 0xf0) == 0x90) { /* SystemControl*/ +- switch (usage->hid & 0xf) { +- case 0xb: map_key_clear(KEY_DO_NOT_DISTURB); break; +- default: goto ignore; ++ if ((usage->hid & 0xf0) == 0x90) { /* SystemControl & D-pad */ ++ switch (usage->hid) { ++ case HID_GD_UP: usage->hat_dir = 1; break; ++ case HID_GD_DOWN: usage->hat_dir = 5; break; ++ case HID_GD_RIGHT: usage->hat_dir = 3; break; ++ case HID_GD_LEFT: usage->hat_dir = 7; break; ++ case HID_GD_DO_NOT_DISTURB: ++ map_key_clear(KEY_DO_NOT_DISTURB); break; ++ default: goto unknown; ++ } ++ ++ if (usage->hid <= HID_GD_LEFT) { ++ if (field->dpad) { ++ map_abs(field->dpad); ++ goto ignore; ++ } ++ map_abs(ABS_HAT0X); + } + break; + } +@@ -844,22 +857,6 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel + if (field->application == HID_GD_SYSTEM_CONTROL) + goto ignore; + +- if ((usage->hid & 0xf0) == 0x90) { /* D-pad */ +- switch (usage->hid) { +- case HID_GD_UP: usage->hat_dir = 1; break; +- case HID_GD_DOWN: usage->hat_dir = 5; break; +- case HID_GD_RIGHT: usage->hat_dir = 3; break; +- case HID_GD_LEFT: usage->hat_dir = 7; break; +- default: goto unknown; +- } +- if (field->dpad) { +- map_abs(field->dpad); +- goto ignore; +- } +- map_abs(ABS_HAT0X); +- break; +- } +- + switch (usage->hid) { + /* These usage IDs map directly to the usage codes. */ + case HID_GD_X: case HID_GD_Y: case HID_GD_Z: +diff --git a/include/linux/hid.h b/include/linux/hid.h +index af55a25db91b0..774cb25dec34c 100644 +--- a/include/linux/hid.h ++++ b/include/linux/hid.h +@@ -218,6 +218,7 @@ struct hid_item { + #define HID_GD_DOWN 0x00010091 + #define HID_GD_RIGHT 0x00010092 + #define HID_GD_LEFT 0x00010093 ++#define HID_GD_DO_NOT_DISTURB 0x0001009b + /* Microsoft Win8 Wireless Radio Controls CA usage codes */ + #define HID_GD_RFKILL_BTN 0x000100c6 + #define HID_GD_RFKILL_LED 0x000100c7 +-- +2.39.5 + diff --git a/queue-6.6/hid-hid-thrustmaster-fix-warning-in-thrustmaster_pro.patch b/queue-6.6/hid-hid-thrustmaster-fix-warning-in-thrustmaster_pro.patch new file mode 100644 index 0000000000..aef13ff5e2 --- /dev/null +++ b/queue-6.6/hid-hid-thrustmaster-fix-warning-in-thrustmaster_pro.patch @@ -0,0 +1,50 @@ +From fc5cbb46cb48e2bb949df77a1a03eb226b993140 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 5 Dec 2024 23:22:21 +0100 +Subject: HID: hid-thrustmaster: Fix warning in thrustmaster_probe by adding + endpoint check + +From: Karol Przybylski + +[ Upstream commit 50420d7c79c37a3efe4010ff9b1bb14bc61ebccf ] + +syzbot has found a type mismatch between a USB pipe and the transfer +endpoint, which is triggered by the hid-thrustmaster driver[1]. +There is a number of similar, already fixed issues [2]. +In this case as in others, implementing check for endpoint type fixes the issue. + +[1] https://syzkaller.appspot.com/bug?extid=040e8b3db6a96908d470 +[2] https://syzkaller.appspot.com/bug?extid=348331f63b034f89b622 + +Fixes: c49c33637802 ("HID: support for initialization of some Thrustmaster wheels") +Reported-by: syzbot+040e8b3db6a96908d470@syzkaller.appspotmail.com +Tested-by: syzbot+040e8b3db6a96908d470@syzkaller.appspotmail.com +Signed-off-by: Karol Przybylski +Signed-off-by: Jiri Kosina +Signed-off-by: Sasha Levin +--- + drivers/hid/hid-thrustmaster.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/hid/hid-thrustmaster.c b/drivers/hid/hid-thrustmaster.c +index cf1679b0d4fbb..6c3e758bbb09e 100644 +--- a/drivers/hid/hid-thrustmaster.c ++++ b/drivers/hid/hid-thrustmaster.c +@@ -170,6 +170,14 @@ static void thrustmaster_interrupts(struct hid_device *hdev) + ep = &usbif->cur_altsetting->endpoint[1]; + b_ep = ep->desc.bEndpointAddress; + ++ /* Are the expected endpoints present? */ ++ u8 ep_addr[1] = {b_ep}; ++ ++ if (!usb_check_int_endpoints(usbif, ep_addr)) { ++ hid_err(hdev, "Unexpected non-int endpoint\n"); ++ return; ++ } ++ + for (i = 0; i < ARRAY_SIZE(setup_arr); ++i) { + memcpy(send_buf, setup_arr[i], setup_arr_sizes[i]); + +-- +2.39.5 + diff --git a/queue-6.6/hid-multitouch-fix-support-for-goodix-pid-0x01e9.patch b/queue-6.6/hid-multitouch-fix-support-for-goodix-pid-0x01e9.patch new file mode 100644 index 0000000000..902f83ede5 --- /dev/null +++ b/queue-6.6/hid-multitouch-fix-support-for-goodix-pid-0x01e9.patch @@ -0,0 +1,42 @@ +From 741785230e0e11b7ee35a5e8678e74b40cf92a8f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Dec 2024 10:19:32 +0100 +Subject: HID: multitouch: fix support for Goodix PID 0x01e9 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jiri Kosina + +[ Upstream commit 8ade5e05bd094485ce370fad66a6a3fb6f50bfbc ] + +Commit c8000deb68365b ("HID: multitouch: Add support for GT7868Q") added +support for 0x01e8 and 0x01e9, but the mt_device[] entries were added +twice for 0x01e8 and there was none added for 0x01e9. Fix that. + +Fixes: c8000deb68365b ("HID: multitouch: Add support for GT7868Q") +Reported-by: He Lugang +Reported-by: WangYuli +Reported-by: Ulrich Müller +Signed-off-by: Jiri Kosina +Signed-off-by: Sasha Levin +--- + drivers/hid/hid-multitouch.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c +index e62104e1a6038..5ad871a7d1a44 100644 +--- a/drivers/hid/hid-multitouch.c ++++ b/drivers/hid/hid-multitouch.c +@@ -2072,7 +2072,7 @@ static const struct hid_device_id mt_devices[] = { + I2C_DEVICE_ID_GOODIX_01E8) }, + { .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT_NSMU, + HID_DEVICE(BUS_I2C, HID_GROUP_ANY, I2C_VENDOR_ID_GOODIX, +- I2C_DEVICE_ID_GOODIX_01E8) }, ++ I2C_DEVICE_ID_GOODIX_01E9) }, + + /* GoodTouch panels */ + { .driver_data = MT_CLS_NSMU, +-- +2.39.5 + diff --git a/queue-6.6/i3c-dw-add-hot-join-support.patch b/queue-6.6/i3c-dw-add-hot-join-support.patch new file mode 100644 index 0000000000..b67dc9aca8 --- /dev/null +++ b/queue-6.6/i3c-dw-add-hot-join-support.patch @@ -0,0 +1,157 @@ +From 17f65c38f105a6976c7ac97b8c835ba725f6882c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 29 Apr 2024 15:36:24 +0800 +Subject: i3c: dw: Add hot-join support. + +From: Billy Tsai + +[ Upstream commit 1d08326020fba690cbb7b8f1b38ab4eab6745969 ] + +Add hot-join support for dw i3c master controller. +By default, the hot-join acknowledgment is disabled, and the hardware will +automatically send the DISEC CCC when it receives the hot-join request. +Users can use the sys entry to enable it. + +Signed-off-by: Billy Tsai +Link: https://lore.kernel.org/r/20240429073624.256830-1-billy_tsai@aspeedtech.com +Signed-off-by: Alexandre Belloni +Stable-dep-of: b75439c945b9 ("i3c: dw: Fix use-after-free in dw_i3c_master driver due to race condition") +Signed-off-by: Sasha Levin +--- + drivers/i3c/master/dw-i3c-master.c | 67 ++++++++++++++++++++++++------ + drivers/i3c/master/dw-i3c-master.h | 2 + + 2 files changed, 56 insertions(+), 13 deletions(-) + +diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c +index 235235613c1b9..93e9d307e40ef 100644 +--- a/drivers/i3c/master/dw-i3c-master.c ++++ b/drivers/i3c/master/dw-i3c-master.c +@@ -1136,6 +1136,23 @@ static void dw_i3c_master_free_ibi(struct i3c_dev_desc *dev) + data->ibi_pool = NULL; + } + ++static void dw_i3c_master_enable_sir_signal(struct dw_i3c_master *master, bool enable) ++{ ++ u32 reg; ++ ++ reg = readl(master->regs + INTR_STATUS_EN); ++ reg &= ~INTR_IBI_THLD_STAT; ++ if (enable) ++ reg |= INTR_IBI_THLD_STAT; ++ writel(reg, master->regs + INTR_STATUS_EN); ++ ++ reg = readl(master->regs + INTR_SIGNAL_EN); ++ reg &= ~INTR_IBI_THLD_STAT; ++ if (enable) ++ reg |= INTR_IBI_THLD_STAT; ++ writel(reg, master->regs + INTR_SIGNAL_EN); ++} ++ + static void dw_i3c_master_set_sir_enabled(struct dw_i3c_master *master, + struct i3c_dev_desc *dev, + u8 idx, bool enable) +@@ -1170,23 +1187,34 @@ static void dw_i3c_master_set_sir_enabled(struct dw_i3c_master *master, + } + writel(reg, master->regs + IBI_SIR_REQ_REJECT); + +- if (global) { +- reg = readl(master->regs + INTR_STATUS_EN); +- reg &= ~INTR_IBI_THLD_STAT; +- if (enable) +- reg |= INTR_IBI_THLD_STAT; +- writel(reg, master->regs + INTR_STATUS_EN); +- +- reg = readl(master->regs + INTR_SIGNAL_EN); +- reg &= ~INTR_IBI_THLD_STAT; +- if (enable) +- reg |= INTR_IBI_THLD_STAT; +- writel(reg, master->regs + INTR_SIGNAL_EN); +- } ++ if (global) ++ dw_i3c_master_enable_sir_signal(master, enable); ++ + + spin_unlock_irqrestore(&master->devs_lock, flags); + } + ++static int dw_i3c_master_enable_hotjoin(struct i3c_master_controller *m) ++{ ++ struct dw_i3c_master *master = to_dw_i3c_master(m); ++ ++ dw_i3c_master_enable_sir_signal(master, true); ++ writel(readl(master->regs + DEVICE_CTRL) & ~DEV_CTRL_HOT_JOIN_NACK, ++ master->regs + DEVICE_CTRL); ++ ++ return 0; ++} ++ ++static int dw_i3c_master_disable_hotjoin(struct i3c_master_controller *m) ++{ ++ struct dw_i3c_master *master = to_dw_i3c_master(m); ++ ++ writel(readl(master->regs + DEVICE_CTRL) | DEV_CTRL_HOT_JOIN_NACK, ++ master->regs + DEVICE_CTRL); ++ ++ return 0; ++} ++ + static int dw_i3c_master_enable_ibi(struct i3c_dev_desc *dev) + { + struct dw_i3c_i2c_dev_data *data = i3c_dev_get_master_data(dev); +@@ -1326,6 +1354,8 @@ static void dw_i3c_master_irq_handle_ibis(struct dw_i3c_master *master) + + if (IBI_TYPE_SIRQ(reg)) { + dw_i3c_master_handle_ibi_sir(master, reg); ++ } else if (IBI_TYPE_HJ(reg)) { ++ queue_work(master->base.wq, &master->hj_work); + } else { + len = IBI_QUEUE_STATUS_DATA_LEN(reg); + dev_info(&master->base.dev, +@@ -1393,6 +1423,8 @@ static const struct i3c_master_controller_ops dw_mipi_i3c_ibi_ops = { + .enable_ibi = dw_i3c_master_enable_ibi, + .disable_ibi = dw_i3c_master_disable_ibi, + .recycle_ibi_slot = dw_i3c_master_recycle_ibi_slot, ++ .enable_hotjoin = dw_i3c_master_enable_hotjoin, ++ .disable_hotjoin = dw_i3c_master_disable_hotjoin, + }; + + /* default platform ops implementations */ +@@ -1412,6 +1444,14 @@ static const struct dw_i3c_platform_ops dw_i3c_platform_ops_default = { + .set_dat_ibi = dw_i3c_platform_set_dat_ibi_nop, + }; + ++static void dw_i3c_hj_work(struct work_struct *work) ++{ ++ struct dw_i3c_master *master = ++ container_of(work, typeof(*master), hj_work); ++ ++ i3c_master_do_daa(&master->base); ++} ++ + int dw_i3c_common_probe(struct dw_i3c_master *master, + struct platform_device *pdev) + { +@@ -1469,6 +1509,7 @@ int dw_i3c_common_probe(struct dw_i3c_master *master, + if (master->ibi_capable) + ops = &dw_mipi_i3c_ibi_ops; + ++ INIT_WORK(&master->hj_work, dw_i3c_hj_work); + ret = i3c_master_register(&master->base, &pdev->dev, ops, false); + if (ret) + goto err_assert_rst; +diff --git a/drivers/i3c/master/dw-i3c-master.h b/drivers/i3c/master/dw-i3c-master.h +index ab862c5d15fe7..4ab94aa72252e 100644 +--- a/drivers/i3c/master/dw-i3c-master.h ++++ b/drivers/i3c/master/dw-i3c-master.h +@@ -57,6 +57,8 @@ struct dw_i3c_master { + + /* platform-specific data */ + const struct dw_i3c_platform_ops *platform_ops; ++ ++ struct work_struct hj_work; + }; + + struct dw_i3c_platform_ops { +-- +2.39.5 + diff --git a/queue-6.6/i3c-dw-fix-use-after-free-in-dw_i3c_master-driver-du.patch b/queue-6.6/i3c-dw-fix-use-after-free-in-dw_i3c_master-driver-du.patch new file mode 100644 index 0000000000..72a69c28f3 --- /dev/null +++ b/queue-6.6/i3c-dw-fix-use-after-free-in-dw_i3c_master-driver-du.patch @@ -0,0 +1,58 @@ +From 75b228eae75dddbef8aa4609806d2bbe3c3f3566 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 27 Nov 2024 18:35:11 +0800 +Subject: i3c: dw: Fix use-after-free in dw_i3c_master driver due to race + condition + +From: Pei Xiao + +[ Upstream commit b75439c945b94dd8a2b645355bdb56f948052601 ] + +In dw_i3c_common_probe, &master->hj_work is bound with +dw_i3c_hj_work. And dw_i3c_master_irq_handler can call +dw_i3c_master_irq_handle_ibis function to start the work. + +If we remove the module which will call dw_i3c_common_remove to +make cleanup, it will free master->base through i3c_master_unregister +while the work mentioned above will be used. The sequence of operations +that may lead to a UAF bug is as follows: + +CPU0 CPU1 + + | dw_i3c_hj_work +dw_i3c_common_remove | +i3c_master_unregister(&master->base) | +device_unregister(&master->dev) | +device_release | +//free master->base | + | i3c_master_do_daa(&master->base) + | //use master->base + +Fix it by ensuring that the work is canceled before proceeding with +the cleanup in dw_i3c_common_remove. + +Fixes: 1dd728f5d4d4 ("i3c: master: Add driver for Synopsys DesignWare IP") +Signed-off-by: Pei Xiao +Acked-by: Mukesh Kumar Savaliya +Link: https://lore.kernel.org/r/bfc49c9527be5b513e7ceafeba314ca40a5be4bc.1732703537.git.xiaopei01@kylinos.cn +Signed-off-by: Alexandre Belloni +Signed-off-by: Sasha Levin +--- + drivers/i3c/master/dw-i3c-master.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/i3c/master/dw-i3c-master.c b/drivers/i3c/master/dw-i3c-master.c +index 93e9d307e40ef..030127525672e 100644 +--- a/drivers/i3c/master/dw-i3c-master.c ++++ b/drivers/i3c/master/dw-i3c-master.c +@@ -1528,6 +1528,7 @@ EXPORT_SYMBOL_GPL(dw_i3c_common_probe); + + void dw_i3c_common_remove(struct dw_i3c_master *master) + { ++ cancel_work_sync(&master->hj_work); + i3c_master_unregister(&master->base); + + reset_control_assert(master->core_rst); +-- +2.39.5 + diff --git a/queue-6.6/iavf-allow-changing-vlan-state-without-calling-pf.patch b/queue-6.6/iavf-allow-changing-vlan-state-without-calling-pf.patch new file mode 100644 index 0000000000..f17a21acf0 --- /dev/null +++ b/queue-6.6/iavf-allow-changing-vlan-state-without-calling-pf.patch @@ -0,0 +1,111 @@ +From 4e8fbedf0e6ad62da777163d866459f5424519c5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 5 Sep 2024 11:14:10 +0200 +Subject: iavf: allow changing VLAN state without calling PF + +From: Michal Swiatkowski + +[ Upstream commit ee7d79433d783346430ee32f28c9df44a88b3bb6 ] + +First case: +> ip l a l $VF name vlanx type vlan id 100 +> ip l d vlanx +> ip l a l $VF name vlanx type vlan id 100 + +As workqueue can be execute after sometime, there is a window to have +call trace like that: +- iavf_del_vlan +- iavf_add_vlan +- iavf_del_vlans (wq) + +It means that our VLAN 100 will change the state from IAVF_VLAN_ACTIVE +to IAVF_VLAN_REMOVE (iavf_del_vlan). After that in iavf_add_vlan state +won't be changed because VLAN 100 is on the filter list. The final +result is that the VLAN 100 filter isn't added in hardware (no +iavf_add_vlans call). + +To fix that change the state if the filter wasn't removed yet directly +to active. It is save as IAVF_VLAN_REMOVE means that virtchnl message +wasn't sent yet. + +Second case: +> ip l a l $VF name vlanx type vlan id 100 +Any type of VF reset ex. change trust +> ip l s $PF vf $VF_NUM trust on +> ip l d vlanx +> ip l a l $VF name vlanx type vlan id 100 + +In case of reset iavf driver is responsible for readding all filters +that are being used. To do that all VLAN filters state are changed to +IAVF_VLAN_ADD. Here is even longer window for changing VLAN state from +kernel side, as workqueue isn't called immediately. We can have call +trace like that: + +- changing to IAVF_VLAN_ADD (after reset) +- iavf_del_vlan (called from kernel ops) +- iavf_del_vlans (wq) + +Not exsisitng VLAN filters will be removed from hardware. It isn't a +bug, ice driver will handle it fine. However, we can have call trace +like that: + +- changing to IAVF_VLAN_ADD (after reset) +- iavf_del_vlan (called from kernel ops) +- iavf_add_vlan (called from kernel ops) +- iavf_del_vlans (wq) + +With fix for previous case we end up with no VLAN filters in hardware. +We have to remove VLAN filters if the state is IAVF_VLAN_ADD and delete +VLAN was called. It is save as IAVF_VLAN_ADD means that virtchnl message +wasn't sent yet. + +Fixes: 0c0da0e95105 ("iavf: refactor VLAN filter states") +Signed-off-by: Michal Swiatkowski +Reviewed-by: Przemek Kitszel +Tested-by: Rafal Romanowski +Signed-off-by: Tony Nguyen +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/intel/iavf/iavf_main.c | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c +index ce0b919995264..fde8d7b80ca66 100644 +--- a/drivers/net/ethernet/intel/iavf/iavf_main.c ++++ b/drivers/net/ethernet/intel/iavf/iavf_main.c +@@ -801,6 +801,11 @@ iavf_vlan_filter *iavf_add_vlan(struct iavf_adapter *adapter, + f->state = IAVF_VLAN_ADD; + adapter->num_vlan_filters++; + iavf_schedule_aq_request(adapter, IAVF_FLAG_AQ_ADD_VLAN_FILTER); ++ } else if (f->state == IAVF_VLAN_REMOVE) { ++ /* IAVF_VLAN_REMOVE means that VLAN wasn't yet removed. ++ * We can safely only change the state here. ++ */ ++ f->state = IAVF_VLAN_ACTIVE; + } + + clearout: +@@ -821,8 +826,18 @@ static void iavf_del_vlan(struct iavf_adapter *adapter, struct iavf_vlan vlan) + + f = iavf_find_vlan(adapter, vlan); + if (f) { +- f->state = IAVF_VLAN_REMOVE; +- iavf_schedule_aq_request(adapter, IAVF_FLAG_AQ_DEL_VLAN_FILTER); ++ /* IAVF_ADD_VLAN means that VLAN wasn't even added yet. ++ * Remove it from the list. ++ */ ++ if (f->state == IAVF_VLAN_ADD) { ++ list_del(&f->list); ++ kfree(f); ++ adapter->num_vlan_filters--; ++ } else { ++ f->state = IAVF_VLAN_REMOVE; ++ iavf_schedule_aq_request(adapter, ++ IAVF_FLAG_AQ_DEL_VLAN_FILTER); ++ } + } + + spin_unlock_bh(&adapter->mac_vlan_list_lock); +-- +2.39.5 + diff --git a/queue-6.6/inet-ipmr-fix-data-races.patch b/queue-6.6/inet-ipmr-fix-data-races.patch new file mode 100644 index 0000000000..8c676e4f0b --- /dev/null +++ b/queue-6.6/inet-ipmr-fix-data-races.patch @@ -0,0 +1,241 @@ +From aa8458b948a2cea932a85dbd9bc452f985b8dcb5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Jan 2025 22:10:49 +0000 +Subject: inet: ipmr: fix data-races + +From: Eric Dumazet + +[ Upstream commit 3440fa34ad99d471f1085bc2f4dedeaebc310261 ] + +Following fields of 'struct mr_mfc' can be updated +concurrently (no lock protection) from ip_mr_forward() +and ip6_mr_forward() + +- bytes +- pkt +- wrong_if +- lastuse + +They also can be read from other functions. + +Convert bytes, pkt and wrong_if to atomic_long_t, +and use READ_ONCE()/WRITE_ONCE() for lastuse. + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Signed-off-by: Eric Dumazet +Reviewed-by: David Ahern +Link: https://patch.msgid.link/20250114221049.1190631-1-edumazet@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + .../net/ethernet/mellanox/mlxsw/spectrum_mr.c | 8 +++--- + include/linux/mroute_base.h | 6 ++-- + net/ipv4/ipmr.c | 28 +++++++++---------- + net/ipv4/ipmr_base.c | 6 ++-- + net/ipv6/ip6mr.c | 28 +++++++++---------- + 5 files changed, 38 insertions(+), 38 deletions(-) + +diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c +index 69cd689dbc83e..5afe6b155ef0d 100644 +--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c ++++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_mr.c +@@ -1003,10 +1003,10 @@ static void mlxsw_sp_mr_route_stats_update(struct mlxsw_sp *mlxsw_sp, + mr->mr_ops->route_stats(mlxsw_sp, mr_route->route_priv, &packets, + &bytes); + +- if (mr_route->mfc->mfc_un.res.pkt != packets) +- mr_route->mfc->mfc_un.res.lastuse = jiffies; +- mr_route->mfc->mfc_un.res.pkt = packets; +- mr_route->mfc->mfc_un.res.bytes = bytes; ++ if (atomic_long_read(&mr_route->mfc->mfc_un.res.pkt) != packets) ++ WRITE_ONCE(mr_route->mfc->mfc_un.res.lastuse, jiffies); ++ atomic_long_set(&mr_route->mfc->mfc_un.res.pkt, packets); ++ atomic_long_set(&mr_route->mfc->mfc_un.res.bytes, bytes); + } + + static void mlxsw_sp_mr_stats_update(struct work_struct *work) +diff --git a/include/linux/mroute_base.h b/include/linux/mroute_base.h +index 9dd4bf1572553..58a2401e4b551 100644 +--- a/include/linux/mroute_base.h ++++ b/include/linux/mroute_base.h +@@ -146,9 +146,9 @@ struct mr_mfc { + unsigned long last_assert; + int minvif; + int maxvif; +- unsigned long bytes; +- unsigned long pkt; +- unsigned long wrong_if; ++ atomic_long_t bytes; ++ atomic_long_t pkt; ++ atomic_long_t wrong_if; + unsigned long lastuse; + unsigned char ttls[MAXVIFS]; + refcount_t refcount; +diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c +index dc0ad979a894a..af9412a507cf3 100644 +--- a/net/ipv4/ipmr.c ++++ b/net/ipv4/ipmr.c +@@ -816,7 +816,7 @@ static void ipmr_update_thresholds(struct mr_table *mrt, struct mr_mfc *cache, + cache->mfc_un.res.maxvif = vifi + 1; + } + } +- cache->mfc_un.res.lastuse = jiffies; ++ WRITE_ONCE(cache->mfc_un.res.lastuse, jiffies); + } + + static int vif_add(struct net *net, struct mr_table *mrt, +@@ -1666,9 +1666,9 @@ int ipmr_ioctl(struct sock *sk, int cmd, void *arg) + rcu_read_lock(); + c = ipmr_cache_find(mrt, sr->src.s_addr, sr->grp.s_addr); + if (c) { +- sr->pktcnt = c->_c.mfc_un.res.pkt; +- sr->bytecnt = c->_c.mfc_un.res.bytes; +- sr->wrong_if = c->_c.mfc_un.res.wrong_if; ++ sr->pktcnt = atomic_long_read(&c->_c.mfc_un.res.pkt); ++ sr->bytecnt = atomic_long_read(&c->_c.mfc_un.res.bytes); ++ sr->wrong_if = atomic_long_read(&c->_c.mfc_un.res.wrong_if); + rcu_read_unlock(); + return 0; + } +@@ -1738,9 +1738,9 @@ int ipmr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg) + rcu_read_lock(); + c = ipmr_cache_find(mrt, sr.src.s_addr, sr.grp.s_addr); + if (c) { +- sr.pktcnt = c->_c.mfc_un.res.pkt; +- sr.bytecnt = c->_c.mfc_un.res.bytes; +- sr.wrong_if = c->_c.mfc_un.res.wrong_if; ++ sr.pktcnt = atomic_long_read(&c->_c.mfc_un.res.pkt); ++ sr.bytecnt = atomic_long_read(&c->_c.mfc_un.res.bytes); ++ sr.wrong_if = atomic_long_read(&c->_c.mfc_un.res.wrong_if); + rcu_read_unlock(); + + if (copy_to_user(arg, &sr, sizeof(sr))) +@@ -1973,9 +1973,9 @@ static void ip_mr_forward(struct net *net, struct mr_table *mrt, + int vif, ct; + + vif = c->_c.mfc_parent; +- c->_c.mfc_un.res.pkt++; +- c->_c.mfc_un.res.bytes += skb->len; +- c->_c.mfc_un.res.lastuse = jiffies; ++ atomic_long_inc(&c->_c.mfc_un.res.pkt); ++ atomic_long_add(skb->len, &c->_c.mfc_un.res.bytes); ++ WRITE_ONCE(c->_c.mfc_un.res.lastuse, jiffies); + + if (c->mfc_origin == htonl(INADDR_ANY) && true_vifi >= 0) { + struct mfc_cache *cache_proxy; +@@ -2006,7 +2006,7 @@ static void ip_mr_forward(struct net *net, struct mr_table *mrt, + goto dont_forward; + } + +- c->_c.mfc_un.res.wrong_if++; ++ atomic_long_inc(&c->_c.mfc_un.res.wrong_if); + + if (true_vifi >= 0 && mrt->mroute_do_assert && + /* pimsm uses asserts, when switching from RPT to SPT, +@@ -3013,9 +3013,9 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v) + + if (it->cache != &mrt->mfc_unres_queue) { + seq_printf(seq, " %8lu %8lu %8lu", +- mfc->_c.mfc_un.res.pkt, +- mfc->_c.mfc_un.res.bytes, +- mfc->_c.mfc_un.res.wrong_if); ++ atomic_long_read(&mfc->_c.mfc_un.res.pkt), ++ atomic_long_read(&mfc->_c.mfc_un.res.bytes), ++ atomic_long_read(&mfc->_c.mfc_un.res.wrong_if)); + for (n = mfc->_c.mfc_un.res.minvif; + n < mfc->_c.mfc_un.res.maxvif; n++) { + if (VIF_EXISTS(mrt, n) && +diff --git a/net/ipv4/ipmr_base.c b/net/ipv4/ipmr_base.c +index f0af12a2f70bc..03b6eee407a24 100644 +--- a/net/ipv4/ipmr_base.c ++++ b/net/ipv4/ipmr_base.c +@@ -263,9 +263,9 @@ int mr_fill_mroute(struct mr_table *mrt, struct sk_buff *skb, + lastuse = READ_ONCE(c->mfc_un.res.lastuse); + lastuse = time_after_eq(jiffies, lastuse) ? jiffies - lastuse : 0; + +- mfcs.mfcs_packets = c->mfc_un.res.pkt; +- mfcs.mfcs_bytes = c->mfc_un.res.bytes; +- mfcs.mfcs_wrong_if = c->mfc_un.res.wrong_if; ++ mfcs.mfcs_packets = atomic_long_read(&c->mfc_un.res.pkt); ++ mfcs.mfcs_bytes = atomic_long_read(&c->mfc_un.res.bytes); ++ mfcs.mfcs_wrong_if = atomic_long_read(&c->mfc_un.res.wrong_if); + if (nla_put_64bit(skb, RTA_MFC_STATS, sizeof(mfcs), &mfcs, RTA_PAD) || + nla_put_u64_64bit(skb, RTA_EXPIRES, jiffies_to_clock_t(lastuse), + RTA_PAD)) +diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c +index 1571e85a3531e..7f19868d7d6c6 100644 +--- a/net/ipv6/ip6mr.c ++++ b/net/ipv6/ip6mr.c +@@ -506,9 +506,9 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v) + + if (it->cache != &mrt->mfc_unres_queue) { + seq_printf(seq, " %8lu %8lu %8lu", +- mfc->_c.mfc_un.res.pkt, +- mfc->_c.mfc_un.res.bytes, +- mfc->_c.mfc_un.res.wrong_if); ++ atomic_long_read(&mfc->_c.mfc_un.res.pkt), ++ atomic_long_read(&mfc->_c.mfc_un.res.bytes), ++ atomic_long_read(&mfc->_c.mfc_un.res.wrong_if)); + for (n = mfc->_c.mfc_un.res.minvif; + n < mfc->_c.mfc_un.res.maxvif; n++) { + if (VIF_EXISTS(mrt, n) && +@@ -870,7 +870,7 @@ static void ip6mr_update_thresholds(struct mr_table *mrt, + cache->mfc_un.res.maxvif = vifi + 1; + } + } +- cache->mfc_un.res.lastuse = jiffies; ++ WRITE_ONCE(cache->mfc_un.res.lastuse, jiffies); + } + + static int mif6_add(struct net *net, struct mr_table *mrt, +@@ -1931,9 +1931,9 @@ int ip6mr_ioctl(struct sock *sk, int cmd, void *arg) + c = ip6mr_cache_find(mrt, &sr->src.sin6_addr, + &sr->grp.sin6_addr); + if (c) { +- sr->pktcnt = c->_c.mfc_un.res.pkt; +- sr->bytecnt = c->_c.mfc_un.res.bytes; +- sr->wrong_if = c->_c.mfc_un.res.wrong_if; ++ sr->pktcnt = atomic_long_read(&c->_c.mfc_un.res.pkt); ++ sr->bytecnt = atomic_long_read(&c->_c.mfc_un.res.bytes); ++ sr->wrong_if = atomic_long_read(&c->_c.mfc_un.res.wrong_if); + rcu_read_unlock(); + return 0; + } +@@ -2003,9 +2003,9 @@ int ip6mr_compat_ioctl(struct sock *sk, unsigned int cmd, void __user *arg) + rcu_read_lock(); + c = ip6mr_cache_find(mrt, &sr.src.sin6_addr, &sr.grp.sin6_addr); + if (c) { +- sr.pktcnt = c->_c.mfc_un.res.pkt; +- sr.bytecnt = c->_c.mfc_un.res.bytes; +- sr.wrong_if = c->_c.mfc_un.res.wrong_if; ++ sr.pktcnt = atomic_long_read(&c->_c.mfc_un.res.pkt); ++ sr.bytecnt = atomic_long_read(&c->_c.mfc_un.res.bytes); ++ sr.wrong_if = atomic_long_read(&c->_c.mfc_un.res.wrong_if); + rcu_read_unlock(); + + if (copy_to_user(arg, &sr, sizeof(sr))) +@@ -2128,9 +2128,9 @@ static void ip6_mr_forward(struct net *net, struct mr_table *mrt, + int true_vifi = ip6mr_find_vif(mrt, dev); + + vif = c->_c.mfc_parent; +- c->_c.mfc_un.res.pkt++; +- c->_c.mfc_un.res.bytes += skb->len; +- c->_c.mfc_un.res.lastuse = jiffies; ++ atomic_long_inc(&c->_c.mfc_un.res.pkt); ++ atomic_long_add(skb->len, &c->_c.mfc_un.res.bytes); ++ WRITE_ONCE(c->_c.mfc_un.res.lastuse, jiffies); + + if (ipv6_addr_any(&c->mf6c_origin) && true_vifi >= 0) { + struct mfc6_cache *cache_proxy; +@@ -2148,7 +2148,7 @@ static void ip6_mr_forward(struct net *net, struct mr_table *mrt, + * Wrong interface: drop packet and (maybe) send PIM assert. + */ + if (rcu_access_pointer(mrt->vif_table[vif].dev) != dev) { +- c->_c.mfc_un.res.wrong_if++; ++ atomic_long_inc(&c->_c.mfc_un.res.wrong_if); + + if (true_vifi >= 0 && mrt->mroute_do_assert && + /* pimsm uses asserts, when switching from RPT to SPT, +-- +2.39.5 + diff --git a/queue-6.6/inetpeer-do-not-get-a-refcount-in-inet_getpeer.patch b/queue-6.6/inetpeer-do-not-get-a-refcount-in-inet_getpeer.patch new file mode 100644 index 0000000000..476a8acb67 --- /dev/null +++ b/queue-6.6/inetpeer-do-not-get-a-refcount-in-inet_getpeer.patch @@ -0,0 +1,272 @@ +From a3403ac21a70c5708fd4c29aba0d3a2cea4228c3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 15 Dec 2024 17:56:29 +0000 +Subject: inetpeer: do not get a refcount in inet_getpeer() + +From: Eric Dumazet + +[ Upstream commit a853c609504e2d1d83e71285e3622fda1f1451d8 ] + +All inet_getpeer() callers except ip4_frag_init() don't need +to acquire a permanent refcount on the inetpeer. + +They can switch to full RCU protection. + +Move the refcount_inc_not_zero() into ip4_frag_init(), +so that all the other callers no longer have to +perform a pair of expensive atomic operations on +a possibly contended cache line. + +inet_putpeer() no longer needs to be exported. + +After this patch, my DUT can receive 8,400,000 UDP packets +per second targeting closed ports, using 50% less cpu cycles +than before. + +Also change two calls to l3mdev_master_ifindex() by +l3mdev_master_ifindex_rcu() (Ido ideas) + +Fixes: 8c2bd38b95f7 ("icmp: change the order of rate limits") +Signed-off-by: Eric Dumazet +Link: https://patch.msgid.link/20241215175629.1248773-5-edumazet@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/ipv4/icmp.c | 9 ++++----- + net/ipv4/inetpeer.c | 8 ++------ + net/ipv4/ip_fragment.c | 15 ++++++++++----- + net/ipv4/route.c | 15 ++++++++------- + net/ipv6/icmp.c | 4 ++-- + net/ipv6/ip6_output.c | 4 ++-- + net/ipv6/ndisc.c | 6 ++++-- + 7 files changed, 32 insertions(+), 29 deletions(-) + +diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c +index 203734e29d462..a6adf6a2ec4b5 100644 +--- a/net/ipv4/icmp.c ++++ b/net/ipv4/icmp.c +@@ -316,7 +316,6 @@ static bool icmpv4_xrlim_allow(struct net *net, struct rtable *rt, + struct dst_entry *dst = &rt->dst; + struct inet_peer *peer; + bool rc = true; +- int vif; + + if (!apply_ratelimit) + return true; +@@ -325,12 +324,12 @@ static bool icmpv4_xrlim_allow(struct net *net, struct rtable *rt, + if (dst->dev && (dst->dev->flags&IFF_LOOPBACK)) + goto out; + +- vif = l3mdev_master_ifindex(dst->dev); +- peer = inet_getpeer_v4(net->ipv4.peers, fl4->daddr, vif); ++ rcu_read_lock(); ++ peer = inet_getpeer_v4(net->ipv4.peers, fl4->daddr, ++ l3mdev_master_ifindex_rcu(dst->dev)); + rc = inet_peer_xrlim_allow(peer, + READ_ONCE(net->ipv4.sysctl_icmp_ratelimit)); +- if (peer) +- inet_putpeer(peer); ++ rcu_read_unlock(); + out: + if (!rc) + __ICMP_INC_STATS(net, ICMP_MIB_RATELIMITHOST); +diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c +index 596e2c3a8551f..23896b6b8417d 100644 +--- a/net/ipv4/inetpeer.c ++++ b/net/ipv4/inetpeer.c +@@ -112,8 +112,6 @@ static struct inet_peer *lookup(const struct inetpeer_addr *daddr, + p = rb_entry(parent, struct inet_peer, rb_node); + cmp = inetpeer_addr_cmp(daddr, &p->daddr); + if (cmp == 0) { +- if (!refcount_inc_not_zero(&p->refcnt)) +- break; + now = jiffies; + if (READ_ONCE(p->dtime) != now) + WRITE_ONCE(p->dtime, now); +@@ -177,6 +175,7 @@ static void inet_peer_gc(struct inet_peer_base *base, + } + } + ++/* Must be called under RCU : No refcount change is done here. */ + struct inet_peer *inet_getpeer(struct inet_peer_base *base, + const struct inetpeer_addr *daddr) + { +@@ -187,10 +186,8 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base, + /* Attempt a lockless lookup first. + * Because of a concurrent writer, we might not find an existing entry. + */ +- rcu_read_lock(); + seq = read_seqbegin(&base->lock); + p = lookup(daddr, base, seq, NULL, &gc_cnt, &parent, &pp); +- rcu_read_unlock(); + + if (p) + return p; +@@ -208,7 +205,7 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base, + if (p) { + p->daddr = *daddr; + p->dtime = (__u32)jiffies; +- refcount_set(&p->refcnt, 2); ++ refcount_set(&p->refcnt, 1); + atomic_set(&p->rid, 0); + p->metrics[RTAX_LOCK-1] = INETPEER_METRICS_NEW; + p->rate_tokens = 0; +@@ -236,7 +233,6 @@ void inet_putpeer(struct inet_peer *p) + if (refcount_dec_and_test(&p->refcnt)) + call_rcu(&p->rcu, inetpeer_free_rcu); + } +-EXPORT_SYMBOL_GPL(inet_putpeer); + + /* + * Check transmit rate limitation for given message. +diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c +index e8cc225fcf250..877d1e03150c7 100644 +--- a/net/ipv4/ip_fragment.c ++++ b/net/ipv4/ip_fragment.c +@@ -82,15 +82,20 @@ static int ip_frag_reasm(struct ipq *qp, struct sk_buff *skb, + static void ip4_frag_init(struct inet_frag_queue *q, const void *a) + { + struct ipq *qp = container_of(q, struct ipq, q); +- struct net *net = q->fqdir->net; +- + const struct frag_v4_compare_key *key = a; ++ struct net *net = q->fqdir->net; ++ struct inet_peer *p = NULL; + + q->key.v4 = *key; + qp->ecn = 0; +- qp->peer = q->fqdir->max_dist ? +- inet_getpeer_v4(net->ipv4.peers, key->saddr, key->vif) : +- NULL; ++ if (q->fqdir->max_dist) { ++ rcu_read_lock(); ++ p = inet_getpeer_v4(net->ipv4.peers, key->saddr, key->vif); ++ if (p && !refcount_inc_not_zero(&p->refcnt)) ++ p = NULL; ++ rcu_read_unlock(); ++ } ++ qp->peer = p; + } + + static void ip4_frag_free(struct inet_frag_queue *q) +diff --git a/net/ipv4/route.c b/net/ipv4/route.c +index fb1ac5976d4c1..61fc2166a870e 100644 +--- a/net/ipv4/route.c ++++ b/net/ipv4/route.c +@@ -882,11 +882,11 @@ void ip_rt_send_redirect(struct sk_buff *skb) + } + log_martians = IN_DEV_LOG_MARTIANS(in_dev); + vif = l3mdev_master_ifindex_rcu(rt->dst.dev); +- rcu_read_unlock(); + + net = dev_net(rt->dst.dev); + peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, vif); + if (!peer) { ++ rcu_read_unlock(); + icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, + rt_nexthop(rt, ip_hdr(skb)->daddr)); + return; +@@ -905,7 +905,7 @@ void ip_rt_send_redirect(struct sk_buff *skb) + */ + if (peer->n_redirects >= ip_rt_redirect_number) { + peer->rate_last = jiffies; +- goto out_put_peer; ++ goto out_unlock; + } + + /* Check for load limit; set rate_last to the latest sent +@@ -926,8 +926,8 @@ void ip_rt_send_redirect(struct sk_buff *skb) + &ip_hdr(skb)->saddr, inet_iif(skb), + &ip_hdr(skb)->daddr, &gw); + } +-out_put_peer: +- inet_putpeer(peer); ++out_unlock: ++ rcu_read_unlock(); + } + + static int ip_error(struct sk_buff *skb) +@@ -987,9 +987,9 @@ static int ip_error(struct sk_buff *skb) + break; + } + ++ rcu_read_lock(); + peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, +- l3mdev_master_ifindex(skb->dev)); +- ++ l3mdev_master_ifindex_rcu(skb->dev)); + send = true; + if (peer) { + now = jiffies; +@@ -1001,8 +1001,9 @@ static int ip_error(struct sk_buff *skb) + peer->rate_tokens -= ip_rt_error_cost; + else + send = false; +- inet_putpeer(peer); + } ++ rcu_read_unlock(); ++ + if (send) + icmp_send(skb, ICMP_DEST_UNREACH, code, 0); + +diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c +index 74b4050c746af..35df405ce1f75 100644 +--- a/net/ipv6/icmp.c ++++ b/net/ipv6/icmp.c +@@ -222,10 +222,10 @@ static bool icmpv6_xrlim_allow(struct sock *sk, u8 type, + if (rt->rt6i_dst.plen < 128) + tmo >>= ((128 - rt->rt6i_dst.plen)>>5); + ++ rcu_read_lock(); + peer = inet_getpeer_v6(net->ipv6.peers, &fl6->daddr); + res = inet_peer_xrlim_allow(peer, tmo); +- if (peer) +- inet_putpeer(peer); ++ rcu_read_unlock(); + } + if (!res) + __ICMP6_INC_STATS(net, ip6_dst_idev(dst), +diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c +index ea1839fe47012..cd89a2b35dfb5 100644 +--- a/net/ipv6/ip6_output.c ++++ b/net/ipv6/ip6_output.c +@@ -612,6 +612,7 @@ int ip6_forward(struct sk_buff *skb) + else + target = &hdr->daddr; + ++ rcu_read_lock(); + peer = inet_getpeer_v6(net->ipv6.peers, &hdr->daddr); + + /* Limit redirects both by destination (here) +@@ -619,8 +620,7 @@ int ip6_forward(struct sk_buff *skb) + */ + if (inet_peer_xrlim_allow(peer, 1*HZ)) + ndisc_send_redirect(skb, target); +- if (peer) +- inet_putpeer(peer); ++ rcu_read_unlock(); + } else { + int addrtype = ipv6_addr_type(&hdr->saddr); + +diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c +index a5989a18ccd73..2ad0ef47b07c2 100644 +--- a/net/ipv6/ndisc.c ++++ b/net/ipv6/ndisc.c +@@ -1717,10 +1717,12 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target) + "Redirect: destination is not a neighbour\n"); + goto release; + } ++ ++ rcu_read_lock(); + peer = inet_getpeer_v6(net->ipv6.peers, &ipv6_hdr(skb)->saddr); + ret = inet_peer_xrlim_allow(peer, 1*HZ); +- if (peer) +- inet_putpeer(peer); ++ rcu_read_unlock(); ++ + if (!ret) + goto release; + +-- +2.39.5 + diff --git a/queue-6.6/inetpeer-remove-create-argument-of-inet_getpeer.patch b/queue-6.6/inetpeer-remove-create-argument-of-inet_getpeer.patch new file mode 100644 index 0000000000..693f364b95 --- /dev/null +++ b/queue-6.6/inetpeer-remove-create-argument-of-inet_getpeer.patch @@ -0,0 +1,101 @@ +From fda3562482fdc5f9815079e35701138cff59c7d6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 15 Dec 2024 17:56:27 +0000 +Subject: inetpeer: remove create argument of inet_getpeer() + +From: Eric Dumazet + +[ Upstream commit 7a596a50c4a4eab946aec149171c72321b4934aa ] + +All callers of inet_getpeer() want to create an inetpeer. + +Signed-off-by: Eric Dumazet +Link: https://patch.msgid.link/20241215175629.1248773-3-edumazet@google.com +Signed-off-by: Jakub Kicinski +Stable-dep-of: a853c609504e ("inetpeer: do not get a refcount in inet_getpeer()") +Signed-off-by: Sasha Levin +--- + include/net/inetpeer.h | 7 +++---- + net/ipv4/inetpeer.c | 11 ++--------- + 2 files changed, 5 insertions(+), 13 deletions(-) + +diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h +index 6f51f81d6cb19..f475757daafba 100644 +--- a/include/net/inetpeer.h ++++ b/include/net/inetpeer.h +@@ -96,8 +96,7 @@ static inline struct in6_addr *inetpeer_get_addr_v6(struct inetpeer_addr *iaddr) + + /* can be called with or without local BH being disabled */ + struct inet_peer *inet_getpeer(struct inet_peer_base *base, +- const struct inetpeer_addr *daddr, +- int create); ++ const struct inetpeer_addr *daddr); + + static inline struct inet_peer *inet_getpeer_v4(struct inet_peer_base *base, + __be32 v4daddr, +@@ -108,7 +107,7 @@ static inline struct inet_peer *inet_getpeer_v4(struct inet_peer_base *base, + daddr.a4.addr = v4daddr; + daddr.a4.vif = vif; + daddr.family = AF_INET; +- return inet_getpeer(base, &daddr, 1); ++ return inet_getpeer(base, &daddr); + } + + static inline struct inet_peer *inet_getpeer_v6(struct inet_peer_base *base, +@@ -118,7 +117,7 @@ static inline struct inet_peer *inet_getpeer_v6(struct inet_peer_base *base, + + daddr.a6 = *v6daddr; + daddr.family = AF_INET6; +- return inet_getpeer(base, &daddr, 1); ++ return inet_getpeer(base, &daddr); + } + + static inline int inetpeer_addr_cmp(const struct inetpeer_addr *a, +diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c +index e9fed83e9b3cc..5670571ee5fbe 100644 +--- a/net/ipv4/inetpeer.c ++++ b/net/ipv4/inetpeer.c +@@ -177,13 +177,11 @@ static void inet_peer_gc(struct inet_peer_base *base, + } + + struct inet_peer *inet_getpeer(struct inet_peer_base *base, +- const struct inetpeer_addr *daddr, +- int create) ++ const struct inetpeer_addr *daddr) + { + struct inet_peer *p, *gc_stack[PEER_MAX_GC]; + struct rb_node **pp, *parent; + unsigned int gc_cnt, seq; +- int invalidated; + + /* Attempt a lockless lookup first. + * Because of a concurrent writer, we might not find an existing entry. +@@ -191,16 +189,11 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base, + rcu_read_lock(); + seq = read_seqbegin(&base->lock); + p = lookup(daddr, base, seq, NULL, &gc_cnt, &parent, &pp); +- invalidated = read_seqretry(&base->lock, seq); + rcu_read_unlock(); + + if (p) + return p; + +- /* If no writer did a change during our lookup, we can return early. */ +- if (!create && !invalidated) +- return NULL; +- + /* retry an exact lookup, taking the lock before. + * At least, nodes should be hot in our cache. + */ +@@ -209,7 +202,7 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base, + + gc_cnt = 0; + p = lookup(daddr, base, seq, gc_stack, &gc_cnt, &parent, &pp); +- if (!p && create) { ++ if (!p) { + p = kmem_cache_alloc(peer_cachep, GFP_ATOMIC); + if (p) { + p->daddr = *daddr; +-- +2.39.5 + diff --git a/queue-6.6/inetpeer-remove-create-argument-of-inet_getpeer_v-46.patch b/queue-6.6/inetpeer-remove-create-argument-of-inet_getpeer_v-46.patch new file mode 100644 index 0000000000..f4f96bdcb3 --- /dev/null +++ b/queue-6.6/inetpeer-remove-create-argument-of-inet_getpeer_v-46.patch @@ -0,0 +1,151 @@ +From 67cc4123505730f8a0f1c2f4491ceff34a8df75b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 15 Dec 2024 17:56:26 +0000 +Subject: inetpeer: remove create argument of inet_getpeer_v[46]() + +From: Eric Dumazet + +[ Upstream commit 661cd8fc8e9039819ca0c22e0add52b632240a9e ] + +All callers of inet_getpeer_v4() and inet_getpeer_v6() +want to create an inetpeer. + +Signed-off-by: Eric Dumazet +Link: https://patch.msgid.link/20241215175629.1248773-2-edumazet@google.com +Signed-off-by: Jakub Kicinski +Stable-dep-of: a853c609504e ("inetpeer: do not get a refcount in inet_getpeer()") +Signed-off-by: Sasha Levin +--- + include/net/inetpeer.h | 9 ++++----- + net/ipv4/icmp.c | 2 +- + net/ipv4/ip_fragment.c | 2 +- + net/ipv4/route.c | 4 ++-- + net/ipv6/icmp.c | 2 +- + net/ipv6/ip6_output.c | 2 +- + net/ipv6/ndisc.c | 2 +- + 7 files changed, 11 insertions(+), 12 deletions(-) + +diff --git a/include/net/inetpeer.h b/include/net/inetpeer.h +index 74ff688568a0c..6f51f81d6cb19 100644 +--- a/include/net/inetpeer.h ++++ b/include/net/inetpeer.h +@@ -101,25 +101,24 @@ struct inet_peer *inet_getpeer(struct inet_peer_base *base, + + static inline struct inet_peer *inet_getpeer_v4(struct inet_peer_base *base, + __be32 v4daddr, +- int vif, int create) ++ int vif) + { + struct inetpeer_addr daddr; + + daddr.a4.addr = v4daddr; + daddr.a4.vif = vif; + daddr.family = AF_INET; +- return inet_getpeer(base, &daddr, create); ++ return inet_getpeer(base, &daddr, 1); + } + + static inline struct inet_peer *inet_getpeer_v6(struct inet_peer_base *base, +- const struct in6_addr *v6daddr, +- int create) ++ const struct in6_addr *v6daddr) + { + struct inetpeer_addr daddr; + + daddr.a6 = *v6daddr; + daddr.family = AF_INET6; +- return inet_getpeer(base, &daddr, create); ++ return inet_getpeer(base, &daddr, 1); + } + + static inline int inetpeer_addr_cmp(const struct inetpeer_addr *a, +diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c +index 9dffdd876fef5..203734e29d462 100644 +--- a/net/ipv4/icmp.c ++++ b/net/ipv4/icmp.c +@@ -326,7 +326,7 @@ static bool icmpv4_xrlim_allow(struct net *net, struct rtable *rt, + goto out; + + vif = l3mdev_master_ifindex(dst->dev); +- peer = inet_getpeer_v4(net->ipv4.peers, fl4->daddr, vif, 1); ++ peer = inet_getpeer_v4(net->ipv4.peers, fl4->daddr, vif); + rc = inet_peer_xrlim_allow(peer, + READ_ONCE(net->ipv4.sysctl_icmp_ratelimit)); + if (peer) +diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c +index fb947d1613fe2..e8cc225fcf250 100644 +--- a/net/ipv4/ip_fragment.c ++++ b/net/ipv4/ip_fragment.c +@@ -89,7 +89,7 @@ static void ip4_frag_init(struct inet_frag_queue *q, const void *a) + q->key.v4 = *key; + qp->ecn = 0; + qp->peer = q->fqdir->max_dist ? +- inet_getpeer_v4(net->ipv4.peers, key->saddr, key->vif, 1) : ++ inet_getpeer_v4(net->ipv4.peers, key->saddr, key->vif) : + NULL; + } + +diff --git a/net/ipv4/route.c b/net/ipv4/route.c +index 285482060082f..fb1ac5976d4c1 100644 +--- a/net/ipv4/route.c ++++ b/net/ipv4/route.c +@@ -885,7 +885,7 @@ void ip_rt_send_redirect(struct sk_buff *skb) + rcu_read_unlock(); + + net = dev_net(rt->dst.dev); +- peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, vif, 1); ++ peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, vif); + if (!peer) { + icmp_send(skb, ICMP_REDIRECT, ICMP_REDIR_HOST, + rt_nexthop(rt, ip_hdr(skb)->daddr)); +@@ -988,7 +988,7 @@ static int ip_error(struct sk_buff *skb) + } + + peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, +- l3mdev_master_ifindex(skb->dev), 1); ++ l3mdev_master_ifindex(skb->dev)); + + send = true; + if (peer) { +diff --git a/net/ipv6/icmp.c b/net/ipv6/icmp.c +index 25a3a726fa117..74b4050c746af 100644 +--- a/net/ipv6/icmp.c ++++ b/net/ipv6/icmp.c +@@ -222,7 +222,7 @@ static bool icmpv6_xrlim_allow(struct sock *sk, u8 type, + if (rt->rt6i_dst.plen < 128) + tmo >>= ((128 - rt->rt6i_dst.plen)>>5); + +- peer = inet_getpeer_v6(net->ipv6.peers, &fl6->daddr, 1); ++ peer = inet_getpeer_v6(net->ipv6.peers, &fl6->daddr); + res = inet_peer_xrlim_allow(peer, tmo); + if (peer) + inet_putpeer(peer); +diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c +index 2341a4373bb94..ea1839fe47012 100644 +--- a/net/ipv6/ip6_output.c ++++ b/net/ipv6/ip6_output.c +@@ -612,7 +612,7 @@ int ip6_forward(struct sk_buff *skb) + else + target = &hdr->daddr; + +- peer = inet_getpeer_v6(net->ipv6.peers, &hdr->daddr, 1); ++ peer = inet_getpeer_v6(net->ipv6.peers, &hdr->daddr); + + /* Limit redirects both by destination (here) + and by source (inside ndisc_send_redirect) +diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c +index 23b46b5705c53..a5989a18ccd73 100644 +--- a/net/ipv6/ndisc.c ++++ b/net/ipv6/ndisc.c +@@ -1717,7 +1717,7 @@ void ndisc_send_redirect(struct sk_buff *skb, const struct in6_addr *target) + "Redirect: destination is not a neighbour\n"); + goto release; + } +- peer = inet_getpeer_v6(net->ipv6.peers, &ipv6_hdr(skb)->saddr, 1); ++ peer = inet_getpeer_v6(net->ipv6.peers, &ipv6_hdr(skb)->saddr); + ret = inet_peer_xrlim_allow(peer, 1*HZ); + if (peer) + inet_putpeer(peer); +-- +2.39.5 + diff --git a/queue-6.6/inetpeer-update-inetpeer-timestamp-in-inet_getpeer.patch b/queue-6.6/inetpeer-update-inetpeer-timestamp-in-inet_getpeer.patch new file mode 100644 index 0000000000..b8b9d58d54 --- /dev/null +++ b/queue-6.6/inetpeer-update-inetpeer-timestamp-in-inet_getpeer.patch @@ -0,0 +1,70 @@ +From 79e00a4f5f2204584d994129b3f75d981ea2b2ae Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 15 Dec 2024 17:56:28 +0000 +Subject: inetpeer: update inetpeer timestamp in inet_getpeer() + +From: Eric Dumazet + +[ Upstream commit 50b362f21d6c10b0f7939c1482c6a1b43da82f1a ] + +inet_putpeer() will be removed in the following patch, +because we will no longer use refcounts. + +Update inetpeer timestamp (p->dtime) at lookup time. + +Signed-off-by: Eric Dumazet +Link: https://patch.msgid.link/20241215175629.1248773-4-edumazet@google.com +Signed-off-by: Jakub Kicinski +Stable-dep-of: a853c609504e ("inetpeer: do not get a refcount in inet_getpeer()") +Signed-off-by: Sasha Levin +--- + net/ipv4/inetpeer.c | 12 ++++-------- + 1 file changed, 4 insertions(+), 8 deletions(-) + +diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c +index 5670571ee5fbe..596e2c3a8551f 100644 +--- a/net/ipv4/inetpeer.c ++++ b/net/ipv4/inetpeer.c +@@ -98,6 +98,7 @@ static struct inet_peer *lookup(const struct inetpeer_addr *daddr, + { + struct rb_node **pp, *parent, *next; + struct inet_peer *p; ++ u32 now; + + pp = &base->rb_root.rb_node; + parent = NULL; +@@ -113,6 +114,9 @@ static struct inet_peer *lookup(const struct inetpeer_addr *daddr, + if (cmp == 0) { + if (!refcount_inc_not_zero(&p->refcnt)) + break; ++ now = jiffies; ++ if (READ_ONCE(p->dtime) != now) ++ WRITE_ONCE(p->dtime, now); + return p; + } + if (gc_stack) { +@@ -158,9 +162,6 @@ static void inet_peer_gc(struct inet_peer_base *base, + for (i = 0; i < gc_cnt; i++) { + p = gc_stack[i]; + +- /* The READ_ONCE() pairs with the WRITE_ONCE() +- * in inet_putpeer() +- */ + delta = (__u32)jiffies - READ_ONCE(p->dtime); + + if (delta < ttl || !refcount_dec_if_one(&p->refcnt)) +@@ -232,11 +233,6 @@ EXPORT_SYMBOL_GPL(inet_getpeer); + + void inet_putpeer(struct inet_peer *p) + { +- /* The WRITE_ONCE() pairs with itself (we run lockless) +- * and the READ_ONCE() in inet_peer_gc() +- */ +- WRITE_ONCE(p->dtime, (__u32)jiffies); +- + if (refcount_dec_and_test(&p->refcnt)) + call_rcu(&p->rcu, inetpeer_free_rcu); + } +-- +2.39.5 + diff --git a/queue-6.6/iommufd-iova_bitmap-fix-shift-out-of-bounds-in-iova_.patch b/queue-6.6/iommufd-iova_bitmap-fix-shift-out-of-bounds-in-iova_.patch new file mode 100644 index 0000000000..540ca0b42c --- /dev/null +++ b/queue-6.6/iommufd-iova_bitmap-fix-shift-out-of-bounds-in-iova_.patch @@ -0,0 +1,49 @@ +From 89a7c100d6044f972a7a345a4281e67073d4bc65 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Jan 2025 22:38:20 +0000 +Subject: iommufd/iova_bitmap: Fix shift-out-of-bounds in + iova_bitmap_offset_to_index() + +From: Qasim Ijaz + +[ Upstream commit e24c1551059268b37f6f40639883eafb281b8b9c ] + +Resolve a UBSAN shift-out-of-bounds issue in iova_bitmap_offset_to_index() +where shifting the constant "1" (of type int) by bitmap->mapped.pgshift +(an unsigned long value) could result in undefined behavior. + +The constant "1" defaults to a 32-bit "int", and when "pgshift" exceeds +31 (e.g., pgshift = 63) the shift operation overflows, as the result +cannot be represented in a 32-bit type. + +To resolve this, the constant is updated to "1UL", promoting it to an +unsigned long type to match the operand's type. + +Fixes: 58ccf0190d19 ("vfio: Add an IOVA bitmap support") +Link: https://patch.msgid.link/r/20250113223820.10713-1-qasdev00@gmail.com +Reported-by: syzbot +Closes: https://syzkaller.appspot.com/bug?extid=85992ace37d5b7b51635 +Signed-off-by: Qasim Ijaz +Reviewed-by: Joao Martins +Signed-off-by: Jason Gunthorpe +Signed-off-by: Sasha Levin +--- + drivers/vfio/iova_bitmap.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/vfio/iova_bitmap.c b/drivers/vfio/iova_bitmap.c +index 7af5b204990bb..38b51613ecca9 100644 +--- a/drivers/vfio/iova_bitmap.c ++++ b/drivers/vfio/iova_bitmap.c +@@ -127,7 +127,7 @@ struct iova_bitmap { + static unsigned long iova_bitmap_offset_to_index(struct iova_bitmap *bitmap, + unsigned long iova) + { +- unsigned long pgsize = 1 << bitmap->mapped.pgshift; ++ unsigned long pgsize = 1UL << bitmap->mapped.pgshift; + + return iova / (BITS_PER_TYPE(*bitmap->bitmap) * pgsize); + } +-- +2.39.5 + diff --git a/queue-6.6/ipmi-ipmb-add-check-devm_kasprintf-returned-value.patch b/queue-6.6/ipmi-ipmb-add-check-devm_kasprintf-returned-value.patch new file mode 100644 index 0000000000..00a5ddc4e7 --- /dev/null +++ b/queue-6.6/ipmi-ipmb-add-check-devm_kasprintf-returned-value.patch @@ -0,0 +1,38 @@ +From df9a02bae0cf511deade2155e05d0bfe599a7ed4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 26 Sep 2024 17:44:19 +0800 +Subject: ipmi: ipmb: Add check devm_kasprintf() returned value + +From: Charles Han + +[ Upstream commit 2378bd0b264ad3a1f76bd957caf33ee0c7945351 ] + +devm_kasprintf() can return a NULL pointer on failure but this +returned value is not checked. + +Fixes: 51bd6f291583 ("Add support for IPMB driver") +Signed-off-by: Charles Han +Message-ID: <20240926094419.25900-1-hanchunchao@inspur.com> +Signed-off-by: Corey Minyard +Signed-off-by: Sasha Levin +--- + drivers/char/ipmi/ipmb_dev_int.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/char/ipmi/ipmb_dev_int.c b/drivers/char/ipmi/ipmb_dev_int.c +index 49100845fcb7b..9371891915129 100644 +--- a/drivers/char/ipmi/ipmb_dev_int.c ++++ b/drivers/char/ipmi/ipmb_dev_int.c +@@ -321,6 +321,9 @@ static int ipmb_probe(struct i2c_client *client) + ipmb_dev->miscdev.name = devm_kasprintf(&client->dev, GFP_KERNEL, + "%s%d", "ipmb-", + client->adapter->nr); ++ if (!ipmb_dev->miscdev.name) ++ return -ENOMEM; ++ + ipmb_dev->miscdev.fops = &ipmb_fops; + ipmb_dev->miscdev.parent = &client->dev; + ret = misc_register(&ipmb_dev->miscdev); +-- +2.39.5 + diff --git a/queue-6.6/ipmi-ssif_bmc-fix-new-request-loss-when-bmc-ready-fo.patch b/queue-6.6/ipmi-ssif_bmc-fix-new-request-loss-when-bmc-ready-fo.patch new file mode 100644 index 0000000000..81b0239b33 --- /dev/null +++ b/queue-6.6/ipmi-ssif_bmc-fix-new-request-loss-when-bmc-ready-fo.patch @@ -0,0 +1,55 @@ +From 26b0eca8207e13757c4ff51701bd1103ee52ef8c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Jan 2025 10:47:34 +0700 +Subject: ipmi: ssif_bmc: Fix new request loss when bmc ready for a response + +From: Quan Nguyen + +[ Upstream commit 83d8c79aa958e37724ed9c14dc7d0f66a48ad864 ] + +Cosmo found that when there is a new request comes in while BMC is +ready for a response, the complete_response(), which is called to +complete the pending response, would accidentally clear out that new +request and force ssif_bmc to move back to abort state again. + +This commit is to address that issue. + +Fixes: dd2bc5cc9e25 ("ipmi: ssif_bmc: Add SSIF BMC driver") +Reported-by: Cosmo Chou +Closes: https://lore.kernel.org/lkml/20250101165431.2113407-1-chou.cosmo@gmail.com/ +Signed-off-by: Quan Nguyen +Message-ID: <20250107034734.1842247-1-quan@os.amperecomputing.com> +Signed-off-by: Corey Minyard +Signed-off-by: Sasha Levin +--- + drivers/char/ipmi/ssif_bmc.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/char/ipmi/ssif_bmc.c b/drivers/char/ipmi/ssif_bmc.c +index ab4e87a99f087..e8460e966b83e 100644 +--- a/drivers/char/ipmi/ssif_bmc.c ++++ b/drivers/char/ipmi/ssif_bmc.c +@@ -292,7 +292,6 @@ static void complete_response(struct ssif_bmc_ctx *ssif_bmc) + ssif_bmc->nbytes_processed = 0; + ssif_bmc->remain_len = 0; + ssif_bmc->busy = false; +- memset(&ssif_bmc->part_buf, 0, sizeof(struct ssif_part_buffer)); + wake_up_all(&ssif_bmc->wait_queue); + } + +@@ -744,9 +743,11 @@ static void on_stop_event(struct ssif_bmc_ctx *ssif_bmc, u8 *val) + ssif_bmc->aborting = true; + } + } else if (ssif_bmc->state == SSIF_RES_SENDING) { +- if (ssif_bmc->is_singlepart_read || ssif_bmc->block_num == 0xFF) ++ if (ssif_bmc->is_singlepart_read || ssif_bmc->block_num == 0xFF) { ++ memset(&ssif_bmc->part_buf, 0, sizeof(struct ssif_part_buffer)); + /* Invalidate response buffer to denote it is sent */ + complete_response(ssif_bmc); ++ } + ssif_bmc->state = SSIF_READY; + } + +-- +2.39.5 + diff --git a/queue-6.6/ipmr-do-not-call-mr_mfc_uses_dev-for-unres-entries.patch b/queue-6.6/ipmr-do-not-call-mr_mfc_uses_dev-for-unres-entries.patch new file mode 100644 index 0000000000..8973e117a0 --- /dev/null +++ b/queue-6.6/ipmr-do-not-call-mr_mfc_uses_dev-for-unres-entries.patch @@ -0,0 +1,71 @@ +From ed33ae396886895387a9a501180a68a264a0905d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Jan 2025 18:12:41 +0000 +Subject: ipmr: do not call mr_mfc_uses_dev() for unres entries + +From: Eric Dumazet + +[ Upstream commit 15a901361ec3fb1c393f91880e1cbf24ec0a88bd ] + +syzbot found that calling mr_mfc_uses_dev() for unres entries +would crash [1], because c->mfc_un.res.minvif / c->mfc_un.res.maxvif +alias to "struct sk_buff_head unresolved", which contain two pointers. + +This code never worked, lets remove it. + +[1] +Unable to handle kernel paging request at virtual address ffff5fff2d536613 +KASAN: maybe wild-memory-access in range [0xfffefff96a9b3098-0xfffefff96a9b309f] +Modules linked in: +CPU: 1 UID: 0 PID: 7321 Comm: syz.0.16 Not tainted 6.13.0-rc7-syzkaller-g1950a0af2d55 #0 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 +pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) + pc : mr_mfc_uses_dev net/ipv4/ipmr_base.c:290 [inline] + pc : mr_table_dump+0x5a4/0x8b0 net/ipv4/ipmr_base.c:334 + lr : mr_mfc_uses_dev net/ipv4/ipmr_base.c:289 [inline] + lr : mr_table_dump+0x694/0x8b0 net/ipv4/ipmr_base.c:334 +Call trace: + mr_mfc_uses_dev net/ipv4/ipmr_base.c:290 [inline] (P) + mr_table_dump+0x5a4/0x8b0 net/ipv4/ipmr_base.c:334 (P) + mr_rtm_dumproute+0x254/0x454 net/ipv4/ipmr_base.c:382 + ipmr_rtm_dumproute+0x248/0x4b4 net/ipv4/ipmr.c:2648 + rtnl_dump_all+0x2e4/0x4e8 net/core/rtnetlink.c:4327 + rtnl_dumpit+0x98/0x1d0 net/core/rtnetlink.c:6791 + netlink_dump+0x4f0/0xbc0 net/netlink/af_netlink.c:2317 + netlink_recvmsg+0x56c/0xe64 net/netlink/af_netlink.c:1973 + sock_recvmsg_nosec net/socket.c:1033 [inline] + sock_recvmsg net/socket.c:1055 [inline] + sock_read_iter+0x2d8/0x40c net/socket.c:1125 + new_sync_read fs/read_write.c:484 [inline] + vfs_read+0x740/0x970 fs/read_write.c:565 + ksys_read+0x15c/0x26c fs/read_write.c:708 + +Fixes: cb167893f41e ("net: Plumb support for filtering ipv4 and ipv6 multicast route dumps") +Reported-by: syzbot+5cfae50c0e5f2c500013@syzkaller.appspotmail.com +Closes: https://lore.kernel.org/netdev/678fe2d1.050a0220.15cac.00b3.GAE@google.com/T/#u +Signed-off-by: Eric Dumazet +Reviewed-by: David Ahern +Link: https://patch.msgid.link/20250121181241.841212-1-edumazet@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/ipv4/ipmr_base.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/net/ipv4/ipmr_base.c b/net/ipv4/ipmr_base.c +index 03b6eee407a24..28d77d454d442 100644 +--- a/net/ipv4/ipmr_base.c ++++ b/net/ipv4/ipmr_base.c +@@ -330,9 +330,6 @@ int mr_table_dump(struct mr_table *mrt, struct sk_buff *skb, + list_for_each_entry(mfc, &mrt->mfc_unres_queue, list) { + if (e < s_e) + goto next_entry2; +- if (filter->dev && +- !mr_mfc_uses_dev(mrt, mfc, filter->dev)) +- goto next_entry2; + + err = fill(mrt, skb, NETLINK_CB(cb->skb).portid, + cb->nlh->nlmsg_seq, mfc, RTM_NEWROUTE, flags); +-- +2.39.5 + diff --git a/queue-6.6/ktest.pl-remove-unused-declarations-in-run_bisect_te.patch b/queue-6.6/ktest.pl-remove-unused-declarations-in-run_bisect_te.patch new file mode 100644 index 0000000000..7325cbe73e --- /dev/null +++ b/queue-6.6/ktest.pl-remove-unused-declarations-in-run_bisect_te.patch @@ -0,0 +1,37 @@ +From b7c0b7c8ab1b86a0681006bdf5f592d82c5b3cb6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Sep 2024 21:07:35 +0800 +Subject: ktest.pl: Remove unused declarations in run_bisect_test function + +From: Ba Jing + +[ Upstream commit 776735b954f49f85fd19e1198efa421fae2ad77c ] + +Since $output and $ret are not used in the subsequent code, the declarations +should be removed. + +Fixes: a75fececff3c ("ktest: Added sample.conf, new %default option format") +Link: https://lore.kernel.org/20240902130735.6034-1-bajing@cmss.chinamobile.com +Signed-off-by: Ba Jing +Signed-off-by: Steven Rostedt +Signed-off-by: Sasha Levin +--- + tools/testing/ktest/ktest.pl | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl +index 045090085ac5b..e84464d80e183 100755 +--- a/tools/testing/ktest/ktest.pl ++++ b/tools/testing/ktest/ktest.pl +@@ -2946,8 +2946,6 @@ sub run_bisect_test { + + my $failed = 0; + my $result; +- my $output; +- my $ret; + + $in_bisect = 1; + +-- +2.39.5 + diff --git a/queue-6.6/landlock-handle-weird-files.patch b/queue-6.6/landlock-handle-weird-files.patch new file mode 100644 index 0000000000..5e5d7297af --- /dev/null +++ b/queue-6.6/landlock-handle-weird-files.patch @@ -0,0 +1,67 @@ +From 9bca1de7ad65c9a9c298538ae1727b675ee05ef4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Jan 2025 16:39:13 +0100 +Subject: landlock: Handle weird files +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Mickaël Salaün + +[ Upstream commit 49440290a0935f428a1e43a5ac8dc275a647ff80 ] + +A corrupted filesystem (e.g. bcachefs) might return weird files. +Instead of throwing a warning and allowing access to such file, treat +them as regular files. + +Cc: Dave Chinner +Cc: Kent Overstreet +Cc: Paul Moore +Reported-by: syzbot+34b68f850391452207df@syzkaller.appspotmail.com +Closes: https://lore.kernel.org/r/000000000000a65b35061cffca61@google.com +Reported-by: syzbot+360866a59e3c80510a62@syzkaller.appspotmail.com +Closes: https://lore.kernel.org/r/67379b3f.050a0220.85a0.0001.GAE@google.com +Reported-by: Ubisectech Sirius +Closes: https://lore.kernel.org/r/c426821d-8380-46c4-a494-7008bbd7dd13.bugreport@ubisectech.com +Fixes: cb2c7d1a1776 ("landlock: Support filesystem access-control") +Reviewed-by: Günther Noack +Link: https://lore.kernel.org/r/20250110153918.241810-1-mic@digikod.net +Signed-off-by: Mickaël Salaün +Signed-off-by: Sasha Levin +--- + security/landlock/fs.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/security/landlock/fs.c b/security/landlock/fs.c +index 1bdd049e3d636..fe4622d88eb15 100644 +--- a/security/landlock/fs.c ++++ b/security/landlock/fs.c +@@ -664,10 +664,6 @@ static inline access_mask_t get_mode_access(const umode_t mode) + switch (mode & S_IFMT) { + case S_IFLNK: + return LANDLOCK_ACCESS_FS_MAKE_SYM; +- case 0: +- /* A zero mode translates to S_IFREG. */ +- case S_IFREG: +- return LANDLOCK_ACCESS_FS_MAKE_REG; + case S_IFDIR: + return LANDLOCK_ACCESS_FS_MAKE_DIR; + case S_IFCHR: +@@ -678,9 +674,12 @@ static inline access_mask_t get_mode_access(const umode_t mode) + return LANDLOCK_ACCESS_FS_MAKE_FIFO; + case S_IFSOCK: + return LANDLOCK_ACCESS_FS_MAKE_SOCK; ++ case S_IFREG: ++ case 0: ++ /* A zero mode translates to S_IFREG. */ + default: +- WARN_ON_ONCE(1); +- return 0; ++ /* Treats weird files as regular files. */ ++ return LANDLOCK_ACCESS_FS_MAKE_REG; + } + } + +-- +2.39.5 + diff --git a/queue-6.6/leds-cht-wcove-use-devm_led_classdev_register-to-avo.patch b/queue-6.6/leds-cht-wcove-use-devm_led_classdev_register-to-avo.patch new file mode 100644 index 0000000000..67bbe73dce --- /dev/null +++ b/queue-6.6/leds-cht-wcove-use-devm_led_classdev_register-to-avo.patch @@ -0,0 +1,51 @@ +From 5811d68143e24d8aa2fbf63089d631375d5f1990 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 Dec 2024 17:53:46 +0900 +Subject: leds: cht-wcove: Use devm_led_classdev_register() to avoid memory + leak + +From: Joe Hattori + +[ Upstream commit 417cad5dc782096350e6a967ee5dd3417a19a24e ] + +cht_wc_leds_probe() leaks memory when the second led_classdev_register() +call in the for-loop fails as it does not call the cleanup function +led_classdev_unregister() on the first device. Avoid this leak by +calling devm_led_classdev_register(). + +Fixes: 047da762b9a9 ("leds: Add Intel Cherry Trail Whiskey Cove PMIC LED driver") +Signed-off-by: Joe Hattori +Link: https://lore.kernel.org/r/20241220085346.533675-1-joe@pf.is.s.u-tokyo.ac.jp +Signed-off-by: Lee Jones +Signed-off-by: Sasha Levin +--- + drivers/leds/leds-cht-wcove.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/drivers/leds/leds-cht-wcove.c b/drivers/leds/leds-cht-wcove.c +index b4998402b8c6f..711ac4bd60580 100644 +--- a/drivers/leds/leds-cht-wcove.c ++++ b/drivers/leds/leds-cht-wcove.c +@@ -394,7 +394,7 @@ static int cht_wc_leds_probe(struct platform_device *pdev) + led->cdev.pattern_clear = cht_wc_leds_pattern_clear; + led->cdev.max_brightness = 255; + +- ret = led_classdev_register(&pdev->dev, &led->cdev); ++ ret = devm_led_classdev_register(&pdev->dev, &led->cdev); + if (ret < 0) + return ret; + } +@@ -406,10 +406,6 @@ static int cht_wc_leds_probe(struct platform_device *pdev) + static void cht_wc_leds_remove(struct platform_device *pdev) + { + struct cht_wc_leds *leds = platform_get_drvdata(pdev); +- int i; +- +- for (i = 0; i < CHT_WC_LED_COUNT; i++) +- led_classdev_unregister(&leds->leds[i].cdev); + + /* Restore LED1 regs if hw-control was active else leave LED1 off */ + if (!(leds->led1_initial_regs.ctrl & CHT_WC_LED1_SWCTL)) +-- +2.39.5 + diff --git a/queue-6.6/leds-netxbig-fix-an-of-node-reference-leak-in-netxbi.patch b/queue-6.6/leds-netxbig-fix-an-of-node-reference-leak-in-netxbi.patch new file mode 100644 index 0000000000..017b6c9dbe --- /dev/null +++ b/queue-6.6/leds-netxbig-fix-an-of-node-reference-leak-in-netxbi.patch @@ -0,0 +1,41 @@ +From 0571ea8335d71264d98e92c03f1d3cf1d9a08e20 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Dec 2024 16:49:23 +0900 +Subject: leds: netxbig: Fix an OF node reference leak in + netxbig_leds_get_of_pdata() + +From: Joe Hattori + +[ Upstream commit 0508316be63bb735f59bdc8fe4527cadb62210ca ] + +netxbig_leds_get_of_pdata() does not release the OF node obtained by +of_parse_phandle() when of_find_device_by_node() fails. Add an +of_node_put() call to fix the leak. + +This bug was found by an experimental static analysis tool that I am +developing. + +Fixes: 9af512e81964 ("leds: netxbig: Convert to use GPIO descriptors") +Signed-off-by: Joe Hattori +Link: https://lore.kernel.org/r/20241216074923.628509-1-joe@pf.is.s.u-tokyo.ac.jp +Signed-off-by: Lee Jones +Signed-off-by: Sasha Levin +--- + drivers/leds/leds-netxbig.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c +index 77213b79f84d9..6692de0af68f1 100644 +--- a/drivers/leds/leds-netxbig.c ++++ b/drivers/leds/leds-netxbig.c +@@ -440,6 +440,7 @@ static int netxbig_leds_get_of_pdata(struct device *dev, + } + gpio_ext_pdev = of_find_device_by_node(gpio_ext_np); + if (!gpio_ext_pdev) { ++ of_node_put(gpio_ext_np); + dev_err(dev, "Failed to find platform device for gpio-ext\n"); + return -ENODEV; + } +-- +2.39.5 + diff --git a/queue-6.6/libbpf-don-t-adjust-usdt-semaphore-address-if-.staps.patch b/queue-6.6/libbpf-don-t-adjust-usdt-semaphore-address-if-.staps.patch new file mode 100644 index 0000000000..c8ba8d7709 --- /dev/null +++ b/queue-6.6/libbpf-don-t-adjust-usdt-semaphore-address-if-.staps.patch @@ -0,0 +1,47 @@ +From fd0ca2440416a1c846a1138ba2332bf1a61d410b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 21 Nov 2024 14:45:58 -0800 +Subject: libbpf: don't adjust USDT semaphore address if .stapsdt.base addr is + missing + +From: Andrii Nakryiko + +[ Upstream commit 98ebe5ef6f5c4517ba92fb3e56f95827ebea83fd ] + +USDT ELF note optionally can record an offset of .stapsdt.base, which is +used to make adjustments to USDT target attach address. Currently, +libbpf will do this address adjustment unconditionally if it finds +.stapsdt.base ELF section in target binary. But there is a corner case +where .stapsdt.base ELF section is present, but specific USDT note +doesn't reference it. In such case, libbpf will basically just add base +address and end up with absolutely incorrect USDT target address. + +This adjustment has to be done only if both .stapsdt.sema section is +present and USDT note is recording a reference to it. + +Fixes: 74cc6311cec9 ("libbpf: Add USDT notes parsing and resolution logic") +Signed-off-by: Andrii Nakryiko +Acked-by: Jiri Olsa +Link: https://lore.kernel.org/r/20241121224558.796110-1-andrii@kernel.org +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + tools/lib/bpf/usdt.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/lib/bpf/usdt.c b/tools/lib/bpf/usdt.c +index 93794f01bb67c..6ff28e7bf5e3d 100644 +--- a/tools/lib/bpf/usdt.c ++++ b/tools/lib/bpf/usdt.c +@@ -659,7 +659,7 @@ static int collect_usdt_targets(struct usdt_manager *man, Elf *elf, const char * + * [0] https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation + */ + usdt_abs_ip = note.loc_addr; +- if (base_addr) ++ if (base_addr && note.base_addr) + usdt_abs_ip += base_addr - note.base_addr; + + /* When attaching uprobes (which is what USDTs basically are) +-- +2.39.5 + diff --git a/queue-6.6/libbpf-fix-segfault-due-to-libelf-functions-not-sett.patch b/queue-6.6/libbpf-fix-segfault-due-to-libelf-functions-not-sett.patch new file mode 100644 index 0000000000..74a8edfb9d --- /dev/null +++ b/queue-6.6/libbpf-fix-segfault-due-to-libelf-functions-not-sett.patch @@ -0,0 +1,140 @@ +From 5bafdd06e00108916a59ff27e7336fce2a4fab44 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 5 Dec 2024 13:59:42 +0000 +Subject: libbpf: Fix segfault due to libelf functions not setting errno + +From: Quentin Monnet + +[ Upstream commit e10500b69c3f3378f3dcfc8c2fe4cdb74fc844f5 ] + +Libelf functions do not set errno on failure. Instead, it relies on its +internal _elf_errno value, that can be retrieved via elf_errno (or the +corresponding message via elf_errmsg()). From "man libelf": + + If a libelf function encounters an error it will set an internal + error code that can be retrieved with elf_errno. Each thread + maintains its own separate error code. The meaning of each error + code can be determined with elf_errmsg, which returns a string + describing the error. + +As a consequence, libbpf should not return -errno when a function from +libelf fails, because an empty value will not be interpreted as an error +and won't prevent the program to stop. This is visible in +bpf_linker__add_file(), for example, where we call a succession of +functions that rely on libelf: + + err = err ?: linker_load_obj_file(linker, filename, opts, &obj); + err = err ?: linker_append_sec_data(linker, &obj); + err = err ?: linker_append_elf_syms(linker, &obj); + err = err ?: linker_append_elf_relos(linker, &obj); + err = err ?: linker_append_btf(linker, &obj); + err = err ?: linker_append_btf_ext(linker, &obj); + +If the object file that we try to process is not, in fact, a correct +object file, linker_load_obj_file() may fail with errno not being set, +and return 0. In this case we attempt to run linker_append_elf_sysms() +and may segfault. + +This can happen (and was discovered) with bpftool: + + $ bpftool gen object output.o sample_ret0.bpf.c + libbpf: failed to get ELF header for sample_ret0.bpf.c: invalid `Elf' handle + zsh: segmentation fault (core dumped) bpftool gen object output.o sample_ret0.bpf.c + +Fix the issue by returning a non-null error code (-EINVAL) when libelf +functions fail. + +Fixes: faf6ed321cf6 ("libbpf: Add BPF static linker APIs") +Signed-off-by: Quentin Monnet +Signed-off-by: Andrii Nakryiko +Link: https://lore.kernel.org/bpf/20241205135942.65262-1-qmo@kernel.org +Signed-off-by: Sasha Levin +--- + tools/lib/bpf/linker.c | 22 ++++++++-------------- + 1 file changed, 8 insertions(+), 14 deletions(-) + +diff --git a/tools/lib/bpf/linker.c b/tools/lib/bpf/linker.c +index 88cc7236f1220..736ebceea233f 100644 +--- a/tools/lib/bpf/linker.c ++++ b/tools/lib/bpf/linker.c +@@ -567,17 +567,15 @@ static int linker_load_obj_file(struct bpf_linker *linker, const char *filename, + } + obj->elf = elf_begin(obj->fd, ELF_C_READ_MMAP, NULL); + if (!obj->elf) { +- err = -errno; + pr_warn_elf("failed to parse ELF file '%s'", filename); +- return err; ++ return -EINVAL; + } + + /* Sanity check ELF file high-level properties */ + ehdr = elf64_getehdr(obj->elf); + if (!ehdr) { +- err = -errno; + pr_warn_elf("failed to get ELF header for %s", filename); +- return err; ++ return -EINVAL; + } + if (ehdr->e_ident[EI_DATA] != host_endianness) { + err = -EOPNOTSUPP; +@@ -593,9 +591,8 @@ static int linker_load_obj_file(struct bpf_linker *linker, const char *filename, + } + + if (elf_getshdrstrndx(obj->elf, &obj->shstrs_sec_idx)) { +- err = -errno; + pr_warn_elf("failed to get SHSTRTAB section index for %s", filename); +- return err; ++ return -EINVAL; + } + + scn = NULL; +@@ -605,26 +602,23 @@ static int linker_load_obj_file(struct bpf_linker *linker, const char *filename, + + shdr = elf64_getshdr(scn); + if (!shdr) { +- err = -errno; + pr_warn_elf("failed to get section #%zu header for %s", + sec_idx, filename); +- return err; ++ return -EINVAL; + } + + sec_name = elf_strptr(obj->elf, obj->shstrs_sec_idx, shdr->sh_name); + if (!sec_name) { +- err = -errno; + pr_warn_elf("failed to get section #%zu name for %s", + sec_idx, filename); +- return err; ++ return -EINVAL; + } + + data = elf_getdata(scn, 0); + if (!data) { +- err = -errno; + pr_warn_elf("failed to get section #%zu (%s) data from %s", + sec_idx, sec_name, filename); +- return err; ++ return -EINVAL; + } + + sec = add_src_sec(obj, sec_name); +@@ -2602,14 +2596,14 @@ int bpf_linker__finalize(struct bpf_linker *linker) + + /* Finalize ELF layout */ + if (elf_update(linker->elf, ELF_C_NULL) < 0) { +- err = -errno; ++ err = -EINVAL; + pr_warn_elf("failed to finalize ELF layout"); + return libbpf_err(err); + } + + /* Write out final ELF contents */ + if (elf_update(linker->elf, ELF_C_WRITE) < 0) { +- err = -errno; ++ err = -EINVAL; + pr_warn_elf("failed to write ELF contents"); + return libbpf_err(err); + } +-- +2.39.5 + diff --git a/queue-6.6/loongarch-fix-warnings-during-s3-suspend.patch b/queue-6.6/loongarch-fix-warnings-during-s3-suspend.patch new file mode 100644 index 0000000000..1c6bac0e32 --- /dev/null +++ b/queue-6.6/loongarch-fix-warnings-during-s3-suspend.patch @@ -0,0 +1,105 @@ +From 8a3587ac1b58ca09681bef1bd4a7549c30fe1fcd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 26 Jan 2025 21:49:59 +0800 +Subject: LoongArch: Fix warnings during S3 suspend + +From: Huacai Chen + +[ Upstream commit 26c0a2d93af55d30a46d5f45d3e9c42cde730168 ] + +The enable_gpe_wakeup() function calls acpi_enable_all_wakeup_gpes(), +and the later one may call the preempt_schedule_common() function, +resulting in a thread switch and causing the CPU to be in an interrupt +enabled state after the enable_gpe_wakeup() function returns, leading +to the warnings as follow. + +[ C0] WARNING: ... at kernel/time/timekeeping.c:845 ktime_get+0xbc/0xc8 +[ C0] ... +[ C0] Call Trace: +[ C0] [<90000000002243b4>] show_stack+0x64/0x188 +[ C0] [<900000000164673c>] dump_stack_lvl+0x60/0x88 +[ C0] [<90000000002687e4>] __warn+0x8c/0x148 +[ C0] [<90000000015e9978>] report_bug+0x1c0/0x2b0 +[ C0] [<90000000016478e4>] do_bp+0x204/0x3b8 +[ C0] [<90000000025b1924>] exception_handlers+0x1924/0x10000 +[ C0] [<9000000000343bbc>] ktime_get+0xbc/0xc8 +[ C0] [<9000000000354c08>] tick_sched_timer+0x30/0xb0 +[ C0] [<90000000003408e0>] __hrtimer_run_queues+0x160/0x378 +[ C0] [<9000000000341f14>] hrtimer_interrupt+0x144/0x388 +[ C0] [<9000000000228348>] constant_timer_interrupt+0x38/0x48 +[ C0] [<90000000002feba4>] __handle_irq_event_percpu+0x64/0x1e8 +[ C0] [<90000000002fed48>] handle_irq_event_percpu+0x20/0x80 +[ C0] [<9000000000306b9c>] handle_percpu_irq+0x5c/0x98 +[ C0] [<90000000002fd4a0>] generic_handle_domain_irq+0x30/0x48 +[ C0] [<9000000000d0c7b0>] handle_cpu_irq+0x70/0xa8 +[ C0] [<9000000001646b30>] handle_loongarch_irq+0x30/0x48 +[ C0] [<9000000001646bc8>] do_vint+0x80/0xe0 +[ C0] [<90000000002aea1c>] finish_task_switch.isra.0+0x8c/0x2a8 +[ C0] [<900000000164e34c>] __schedule+0x314/0xa48 +[ C0] [<900000000164ead8>] schedule+0x58/0xf0 +[ C0] [<9000000000294a2c>] worker_thread+0x224/0x498 +[ C0] [<900000000029d2f0>] kthread+0xf8/0x108 +[ C0] [<9000000000221f28>] ret_from_kernel_thread+0xc/0xa4 +[ C0] +[ C0] ---[ end trace 0000000000000000 ]--- + +The root cause is acpi_enable_all_wakeup_gpes() uses a mutex to protect +acpi_hw_enable_all_wakeup_gpes(), and acpi_ut_acquire_mutex() may cause +a thread switch. Since there is no longer concurrent execution during +loongarch_acpi_suspend(), we can call acpi_hw_enable_all_wakeup_gpes() +directly in enable_gpe_wakeup(). + +The solution is similar to commit 22db06337f590d01 ("ACPI: sleep: Avoid +breaking S3 wakeup due to might_sleep()"). + +Fixes: 366bb35a8e48 ("LoongArch: Add suspend (ACPI S3) support") +Signed-off-by: Qunqin Zhao +Signed-off-by: Huacai Chen +Signed-off-by: Sasha Levin +--- + arch/loongarch/power/platform.c | 2 +- + drivers/acpi/acpica/achware.h | 2 -- + include/acpi/acpixf.h | 1 + + 3 files changed, 2 insertions(+), 3 deletions(-) + +diff --git a/arch/loongarch/power/platform.c b/arch/loongarch/power/platform.c +index 3ea8e07aa225f..6c7735cda4d83 100644 +--- a/arch/loongarch/power/platform.c ++++ b/arch/loongarch/power/platform.c +@@ -17,7 +17,7 @@ void enable_gpe_wakeup(void) + if (acpi_gbl_reduced_hardware) + return; + +- acpi_enable_all_wakeup_gpes(); ++ acpi_hw_enable_all_wakeup_gpes(); + } + + void enable_pci_wakeup(void) +diff --git a/drivers/acpi/acpica/achware.h b/drivers/acpi/acpica/achware.h +index 79bbfe00d241f..b8543a34caead 100644 +--- a/drivers/acpi/acpica/achware.h ++++ b/drivers/acpi/acpica/achware.h +@@ -103,8 +103,6 @@ acpi_hw_get_gpe_status(struct acpi_gpe_event_info *gpe_event_info, + + acpi_status acpi_hw_enable_all_runtime_gpes(void); + +-acpi_status acpi_hw_enable_all_wakeup_gpes(void); +- + u8 acpi_hw_check_all_gpes(acpi_handle gpe_skip_device, u32 gpe_skip_number); + + acpi_status +diff --git a/include/acpi/acpixf.h b/include/acpi/acpixf.h +index a3c9dd4a1ac33..7e9e7e7690436 100644 +--- a/include/acpi/acpixf.h ++++ b/include/acpi/acpixf.h +@@ -763,6 +763,7 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status + *event_status)) + ACPI_HW_DEPENDENT_RETURN_UINT32(u32 acpi_dispatch_gpe(acpi_handle gpe_device, u32 gpe_number)) + ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_hw_disable_all_gpes(void)) ++ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_hw_enable_all_wakeup_gpes(void)) + ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable_all_gpes(void)) + ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_runtime_gpes(void)) + ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable_all_wakeup_gpes(void)) +-- +2.39.5 + diff --git a/queue-6.6/media-camif-core-add-check-for-clk_enable.patch b/queue-6.6/media-camif-core-add-check-for-clk_enable.patch new file mode 100644 index 0000000000..389f2f9ecf --- /dev/null +++ b/queue-6.6/media-camif-core-add-check-for-clk_enable.patch @@ -0,0 +1,50 @@ +From 6d364acd869bf8d2c8c1941cd78230c0195e05af Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 25 Nov 2024 19:18:17 +0000 +Subject: media: camif-core: Add check for clk_enable() + +From: Jiasheng Jiang + +[ Upstream commit 77ed2470ac09c2b0a33cf3f98cc51d18ba9ed976 ] + +Add check for the return value of clk_enable() to gurantee the success. + +Fixes: babde1c243b2 ("[media] V4L: Add driver for S3C24XX/S3C64XX SoC series camera interface") +Signed-off-by: Jiasheng Jiang +Reviewed-by: Krzysztof Kozlowski +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + .../media/platform/samsung/s3c-camif/camif-core.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/drivers/media/platform/samsung/s3c-camif/camif-core.c b/drivers/media/platform/samsung/s3c-camif/camif-core.c +index e4529f666e206..8c597dd01713a 100644 +--- a/drivers/media/platform/samsung/s3c-camif/camif-core.c ++++ b/drivers/media/platform/samsung/s3c-camif/camif-core.c +@@ -527,10 +527,19 @@ static void s3c_camif_remove(struct platform_device *pdev) + static int s3c_camif_runtime_resume(struct device *dev) + { + struct camif_dev *camif = dev_get_drvdata(dev); ++ int ret; ++ ++ ret = clk_enable(camif->clock[CLK_GATE]); ++ if (ret) ++ return ret; + +- clk_enable(camif->clock[CLK_GATE]); + /* null op on s3c244x */ +- clk_enable(camif->clock[CLK_CAM]); ++ ret = clk_enable(camif->clock[CLK_CAM]); ++ if (ret) { ++ clk_disable(camif->clock[CLK_GATE]); ++ return ret; ++ } ++ + return 0; + } + +-- +2.39.5 + diff --git a/queue-6.6/media-dvb-usb-v2-af9035-fix-iso-c90-compilation-erro.patch b/queue-6.6/media-dvb-usb-v2-af9035-fix-iso-c90-compilation-erro.patch new file mode 100644 index 0000000000..8bd8492d81 --- /dev/null +++ b/queue-6.6/media-dvb-usb-v2-af9035-fix-iso-c90-compilation-erro.patch @@ -0,0 +1,70 @@ +From e1152b8895efa60a49c255ca7bd00fea5d1f7710 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 19 Sep 2024 14:27:55 -0300 +Subject: media: dvb-usb-v2: af9035: fix ISO C90 compilation error on + af9035_i2c_master_xfer + +From: Desnes Nunes + +[ Upstream commit c36b9ad1a8add3c114e25fe167efa217a813b0c7 ] + +This fixes a 'ISO C90 forbids mixed declarations and code' compilation +error on af9035_i2c_master_xfer, which is caused by the sanity check added +on user controlled msg[i], before declaring the demodulator register. + +Fixes: 7bf744f2de0a ("media: dvb-usb-v2: af9035: Fix null-ptr-deref in af9035_i2c_master_xfer") +Signed-off-by: Desnes Nunes +Link: https://lore.kernel.org/r/20240919172755.196907-1-desnesn@redhat.com +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/usb/dvb-usb-v2/af9035.c | 18 ++++++++++++------ + 1 file changed, 12 insertions(+), 6 deletions(-) + +diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c +index 4eb7dd4599b7e..7caf5e90721a4 100644 +--- a/drivers/media/usb/dvb-usb-v2/af9035.c ++++ b/drivers/media/usb/dvb-usb-v2/af9035.c +@@ -322,13 +322,16 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, + ret = -EOPNOTSUPP; + } else if ((msg[0].addr == state->af9033_i2c_addr[0]) || + (msg[0].addr == state->af9033_i2c_addr[1])) { ++ /* demod access via firmware interface */ ++ u32 reg; ++ + if (msg[0].len < 3 || msg[1].len < 1) { + ret = -EOPNOTSUPP; + goto unlock; + } +- /* demod access via firmware interface */ +- u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | +- msg[0].buf[2]; ++ ++ reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | ++ msg[0].buf[2]; + + if (msg[0].addr == state->af9033_i2c_addr[1]) + reg |= 0x100000; +@@ -385,13 +388,16 @@ static int af9035_i2c_master_xfer(struct i2c_adapter *adap, + ret = -EOPNOTSUPP; + } else if ((msg[0].addr == state->af9033_i2c_addr[0]) || + (msg[0].addr == state->af9033_i2c_addr[1])) { ++ /* demod access via firmware interface */ ++ u32 reg; ++ + if (msg[0].len < 3) { + ret = -EOPNOTSUPP; + goto unlock; + } +- /* demod access via firmware interface */ +- u32 reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | +- msg[0].buf[2]; ++ ++ reg = msg[0].buf[0] << 16 | msg[0].buf[1] << 8 | ++ msg[0].buf[2]; + + if (msg[0].addr == state->af9033_i2c_addr[1]) + reg |= 0x100000; +-- +2.39.5 + diff --git a/queue-6.6/media-i2c-imx290-register-0x3011-varies-between-imx3.patch b/queue-6.6/media-i2c-imx290-register-0x3011-varies-between-imx3.patch new file mode 100644 index 0000000000..aaab7c7cd0 --- /dev/null +++ b/queue-6.6/media-i2c-imx290-register-0x3011-varies-between-imx3.patch @@ -0,0 +1,57 @@ +From 7fd53fafcb0a8b5bb79b5d926b8bbe349375bac8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 20 Nov 2024 19:17:04 +0000 +Subject: media: i2c: imx290: Register 0x3011 varies between imx327 and imx290 + +From: Dave Stevenson + +[ Upstream commit f2055c1d62d6dfd25a31d1d1923883f21305aea5 ] + +Reviewing the datasheets, register 0x3011 is meant to be 0x02 on imx327 +and 0x00 on imx290. + +Move it out of the common registers, and set it appropriately in the +sensor specific sections. (Included for imx290 to be explicit, rather +than relying on the default value). + +Fixes: 2d41947ec2c0 ("media: i2c: imx290: Add support for imx327 variant") +Signed-off-by: Dave Stevenson +Reviewed-by: Laurent Pinchart +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/i2c/imx290.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/media/i2c/imx290.c b/drivers/media/i2c/imx290.c +index 6dacd38ae947a..f8ada6c1ef65b 100644 +--- a/drivers/media/i2c/imx290.c ++++ b/drivers/media/i2c/imx290.c +@@ -269,7 +269,6 @@ static const struct cci_reg_sequence imx290_global_init_settings[] = { + { IMX290_WINWV, 1097 }, + { IMX290_XSOUTSEL, IMX290_XSOUTSEL_XVSOUTSEL_VSYNC | + IMX290_XSOUTSEL_XHSOUTSEL_HSYNC }, +- { CCI_REG8(0x3011), 0x02 }, + { CCI_REG8(0x3012), 0x64 }, + { CCI_REG8(0x3013), 0x00 }, + }; +@@ -277,6 +276,7 @@ static const struct cci_reg_sequence imx290_global_init_settings[] = { + static const struct cci_reg_sequence imx290_global_init_settings_290[] = { + { CCI_REG8(0x300f), 0x00 }, + { CCI_REG8(0x3010), 0x21 }, ++ { CCI_REG8(0x3011), 0x00 }, + { CCI_REG8(0x3016), 0x09 }, + { CCI_REG8(0x3070), 0x02 }, + { CCI_REG8(0x3071), 0x11 }, +@@ -330,6 +330,7 @@ static const struct cci_reg_sequence xclk_regs[][IMX290_NUM_CLK_REGS] = { + }; + + static const struct cci_reg_sequence imx290_global_init_settings_327[] = { ++ { CCI_REG8(0x3011), 0x02 }, + { CCI_REG8(0x309e), 0x4A }, + { CCI_REG8(0x309f), 0x4A }, + { CCI_REG8(0x313b), 0x61 }, +-- +2.39.5 + diff --git a/queue-6.6/media-i2c-imx412-add-missing-newline-to-prints.patch b/queue-6.6/media-i2c-imx412-add-missing-newline-to-prints.patch new file mode 100644 index 0000000000..99e53be100 --- /dev/null +++ b/queue-6.6/media-i2c-imx412-add-missing-newline-to-prints.patch @@ -0,0 +1,210 @@ +From 31972076701f6e77b535840f3acfe77b6aa7cc1d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 18 Nov 2024 22:45:46 +0100 +Subject: media: i2c: imx412: Add missing newline to prints + +From: Luca Weiss + +[ Upstream commit 33f4a7fba7229232e294f4794503283e44cd03f2 ] + +Add trailing \n to dev_dbg and dev_err prints where missing. + +Signed-off-by: Luca Weiss +Fixes: 9214e86c0cc1 ("media: i2c: Add imx412 camera sensor driver") +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/i2c/imx412.c | 42 +++++++++++++++++++------------------- + 1 file changed, 21 insertions(+), 21 deletions(-) + +diff --git a/drivers/media/i2c/imx412.c b/drivers/media/i2c/imx412.c +index 8597f98a8dcf8..90fc8eea171f4 100644 +--- a/drivers/media/i2c/imx412.c ++++ b/drivers/media/i2c/imx412.c +@@ -549,7 +549,7 @@ static int imx412_update_exp_gain(struct imx412 *imx412, u32 exposure, u32 gain) + + lpfr = imx412->vblank + imx412->cur_mode->height; + +- dev_dbg(imx412->dev, "Set exp %u, analog gain %u, lpfr %u", ++ dev_dbg(imx412->dev, "Set exp %u, analog gain %u, lpfr %u\n", + exposure, gain, lpfr); + + ret = imx412_write_reg(imx412, IMX412_REG_HOLD, 1, 1); +@@ -596,7 +596,7 @@ static int imx412_set_ctrl(struct v4l2_ctrl *ctrl) + case V4L2_CID_VBLANK: + imx412->vblank = imx412->vblank_ctrl->val; + +- dev_dbg(imx412->dev, "Received vblank %u, new lpfr %u", ++ dev_dbg(imx412->dev, "Received vblank %u, new lpfr %u\n", + imx412->vblank, + imx412->vblank + imx412->cur_mode->height); + +@@ -615,7 +615,7 @@ static int imx412_set_ctrl(struct v4l2_ctrl *ctrl) + exposure = ctrl->val; + analog_gain = imx412->again_ctrl->val; + +- dev_dbg(imx412->dev, "Received exp %u, analog gain %u", ++ dev_dbg(imx412->dev, "Received exp %u, analog gain %u\n", + exposure, analog_gain); + + ret = imx412_update_exp_gain(imx412, exposure, analog_gain); +@@ -624,7 +624,7 @@ static int imx412_set_ctrl(struct v4l2_ctrl *ctrl) + + break; + default: +- dev_err(imx412->dev, "Invalid control %d", ctrl->id); ++ dev_err(imx412->dev, "Invalid control %d\n", ctrl->id); + ret = -EINVAL; + } + +@@ -805,14 +805,14 @@ static int imx412_start_streaming(struct imx412 *imx412) + ret = imx412_write_regs(imx412, reg_list->regs, + reg_list->num_of_regs); + if (ret) { +- dev_err(imx412->dev, "fail to write initial registers"); ++ dev_err(imx412->dev, "fail to write initial registers\n"); + return ret; + } + + /* Setup handler will write actual exposure and gain */ + ret = __v4l2_ctrl_handler_setup(imx412->sd.ctrl_handler); + if (ret) { +- dev_err(imx412->dev, "fail to setup handler"); ++ dev_err(imx412->dev, "fail to setup handler\n"); + return ret; + } + +@@ -823,7 +823,7 @@ static int imx412_start_streaming(struct imx412 *imx412) + ret = imx412_write_reg(imx412, IMX412_REG_MODE_SELECT, + 1, IMX412_MODE_STREAMING); + if (ret) { +- dev_err(imx412->dev, "fail to start streaming"); ++ dev_err(imx412->dev, "fail to start streaming\n"); + return ret; + } + +@@ -904,7 +904,7 @@ static int imx412_detect(struct imx412 *imx412) + return ret; + + if (val != IMX412_ID) { +- dev_err(imx412->dev, "chip id mismatch: %x!=%x", ++ dev_err(imx412->dev, "chip id mismatch: %x!=%x\n", + IMX412_ID, val); + return -ENXIO; + } +@@ -936,7 +936,7 @@ static int imx412_parse_hw_config(struct imx412 *imx412) + imx412->reset_gpio = devm_gpiod_get_optional(imx412->dev, "reset", + GPIOD_OUT_LOW); + if (IS_ERR(imx412->reset_gpio)) { +- dev_err(imx412->dev, "failed to get reset gpio %ld", ++ dev_err(imx412->dev, "failed to get reset gpio %ld\n", + PTR_ERR(imx412->reset_gpio)); + return PTR_ERR(imx412->reset_gpio); + } +@@ -944,13 +944,13 @@ static int imx412_parse_hw_config(struct imx412 *imx412) + /* Get sensor input clock */ + imx412->inclk = devm_clk_get(imx412->dev, NULL); + if (IS_ERR(imx412->inclk)) { +- dev_err(imx412->dev, "could not get inclk"); ++ dev_err(imx412->dev, "could not get inclk\n"); + return PTR_ERR(imx412->inclk); + } + + rate = clk_get_rate(imx412->inclk); + if (rate != IMX412_INCLK_RATE) { +- dev_err(imx412->dev, "inclk frequency mismatch"); ++ dev_err(imx412->dev, "inclk frequency mismatch\n"); + return -EINVAL; + } + +@@ -975,14 +975,14 @@ static int imx412_parse_hw_config(struct imx412 *imx412) + + if (bus_cfg.bus.mipi_csi2.num_data_lanes != IMX412_NUM_DATA_LANES) { + dev_err(imx412->dev, +- "number of CSI2 data lanes %d is not supported", ++ "number of CSI2 data lanes %d is not supported\n", + bus_cfg.bus.mipi_csi2.num_data_lanes); + ret = -EINVAL; + goto done_endpoint_free; + } + + if (!bus_cfg.nr_of_link_frequencies) { +- dev_err(imx412->dev, "no link frequencies defined"); ++ dev_err(imx412->dev, "no link frequencies defined\n"); + ret = -EINVAL; + goto done_endpoint_free; + } +@@ -1040,7 +1040,7 @@ static int imx412_power_on(struct device *dev) + + ret = clk_prepare_enable(imx412->inclk); + if (ret) { +- dev_err(imx412->dev, "fail to enable inclk"); ++ dev_err(imx412->dev, "fail to enable inclk\n"); + goto error_reset; + } + +@@ -1151,7 +1151,7 @@ static int imx412_init_controls(struct imx412 *imx412) + imx412->hblank_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY; + + if (ctrl_hdlr->error) { +- dev_err(imx412->dev, "control init failed: %d", ++ dev_err(imx412->dev, "control init failed: %d\n", + ctrl_hdlr->error); + v4l2_ctrl_handler_free(ctrl_hdlr); + return ctrl_hdlr->error; +@@ -1188,7 +1188,7 @@ static int imx412_probe(struct i2c_client *client) + + ret = imx412_parse_hw_config(imx412); + if (ret) { +- dev_err(imx412->dev, "HW configuration is not supported"); ++ dev_err(imx412->dev, "HW configuration is not supported\n"); + return ret; + } + +@@ -1196,14 +1196,14 @@ static int imx412_probe(struct i2c_client *client) + + ret = imx412_power_on(imx412->dev); + if (ret) { +- dev_err(imx412->dev, "failed to power-on the sensor"); ++ dev_err(imx412->dev, "failed to power-on the sensor\n"); + goto error_mutex_destroy; + } + + /* Check module identity */ + ret = imx412_detect(imx412); + if (ret) { +- dev_err(imx412->dev, "failed to find sensor: %d", ret); ++ dev_err(imx412->dev, "failed to find sensor: %d\n", ret); + goto error_power_off; + } + +@@ -1213,7 +1213,7 @@ static int imx412_probe(struct i2c_client *client) + + ret = imx412_init_controls(imx412); + if (ret) { +- dev_err(imx412->dev, "failed to init controls: %d", ret); ++ dev_err(imx412->dev, "failed to init controls: %d\n", ret); + goto error_power_off; + } + +@@ -1227,14 +1227,14 @@ static int imx412_probe(struct i2c_client *client) + imx412->pad.flags = MEDIA_PAD_FL_SOURCE; + ret = media_entity_pads_init(&imx412->sd.entity, 1, &imx412->pad); + if (ret) { +- dev_err(imx412->dev, "failed to init entity pads: %d", ret); ++ dev_err(imx412->dev, "failed to init entity pads: %d\n", ret); + goto error_handler_free; + } + + ret = v4l2_async_register_subdev_sensor(&imx412->sd); + if (ret < 0) { + dev_err(imx412->dev, +- "failed to register async subdev: %d", ret); ++ "failed to register async subdev: %d\n", ret); + goto error_media_entity; + } + +-- +2.39.5 + diff --git a/queue-6.6/media-i2c-ov9282-correct-the-exposure-offset.patch b/queue-6.6/media-i2c-ov9282-correct-the-exposure-offset.patch new file mode 100644 index 0000000000..92822019df --- /dev/null +++ b/queue-6.6/media-i2c-ov9282-correct-the-exposure-offset.patch @@ -0,0 +1,44 @@ +From 3e68ba7284a8ccaf9fe5e24bd5d03517b5021137 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Dec 2024 14:55:45 +0000 +Subject: media: i2c: ov9282: Correct the exposure offset + +From: Dave Stevenson + +[ Upstream commit feaf4154d69657af2bf96e6e66cca794f88b1a61 ] + +The datasheet lists that "Maximum exposure time is frame +length -25 row periods, where frame length is set by +registers {0x380E, 0x380F}". +However this driver had OV9282_EXPOSURE_OFFSET set to 12 +which allowed that restriction to be violated, and would +result in very under-exposed images. + +Correct the offset. + +Fixes: 14ea315bbeb7 ("media: i2c: Add ov9282 camera sensor driver") +Signed-off-by: Dave Stevenson +Reviewed-by: Kieran Bingham +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/i2c/ov9282.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c +index 068c7449f50ed..7498f55b3ef2b 100644 +--- a/drivers/media/i2c/ov9282.c ++++ b/drivers/media/i2c/ov9282.c +@@ -40,7 +40,7 @@ + /* Exposure control */ + #define OV9282_REG_EXPOSURE 0x3500 + #define OV9282_EXPOSURE_MIN 1 +-#define OV9282_EXPOSURE_OFFSET 12 ++#define OV9282_EXPOSURE_OFFSET 25 + #define OV9282_EXPOSURE_STEP 1 + #define OV9282_EXPOSURE_DEFAULT 0x0282 + +-- +2.39.5 + diff --git a/queue-6.6/media-lmedm04-handle-errors-for-lme2510_int_read.patch b/queue-6.6/media-lmedm04-handle-errors-for-lme2510_int_read.patch new file mode 100644 index 0000000000..b5fe2eadae --- /dev/null +++ b/queue-6.6/media-lmedm04-handle-errors-for-lme2510_int_read.patch @@ -0,0 +1,58 @@ +From 39bedac7661ad3fe94fc946abb5c5ec36c598354 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 May 2024 17:10:42 +0800 +Subject: media: lmedm04: Handle errors for lme2510_int_read + +From: Chen Ni + +[ Upstream commit a2836d3fe220220ff8c495ca9722f89cea8a67e7 ] + +Add check for the return value of usb_pipe_endpoint() and +usb_submit_urb() in order to catch the errors. + +Fixes: 15e1ce33182d ("[media] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb") +Signed-off-by: Chen Ni +Link: https://lore.kernel.org/r/20240521091042.1769684-1-nichen@iscas.ac.cn +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/usb/dvb-usb-v2/lmedm04.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c +index 8a34e6c0d6a6d..f0537b741d135 100644 +--- a/drivers/media/usb/dvb-usb-v2/lmedm04.c ++++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c +@@ -373,6 +373,7 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) + struct dvb_usb_device *d = adap_to_d(adap); + struct lme2510_state *lme_int = adap_to_priv(adap); + struct usb_host_endpoint *ep; ++ int ret; + + lme_int->lme_urb = usb_alloc_urb(0, GFP_KERNEL); + +@@ -390,11 +391,20 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) + + /* Quirk of pipe reporting PIPE_BULK but behaves as interrupt */ + ep = usb_pipe_endpoint(d->udev, lme_int->lme_urb->pipe); ++ if (!ep) { ++ usb_free_urb(lme_int->lme_urb); ++ return -ENODEV; ++ } + + if (usb_endpoint_type(&ep->desc) == USB_ENDPOINT_XFER_BULK) + lme_int->lme_urb->pipe = usb_rcvbulkpipe(d->udev, 0xa); + +- usb_submit_urb(lme_int->lme_urb, GFP_KERNEL); ++ ret = usb_submit_urb(lme_int->lme_urb, GFP_KERNEL); ++ if (ret) { ++ usb_free_urb(lme_int->lme_urb); ++ return ret; ++ } ++ + info("INT Interrupt Service Started"); + + return 0; +-- +2.39.5 + diff --git a/queue-6.6/media-marvell-add-check-for-clk_enable.patch b/queue-6.6/media-marvell-add-check-for-clk_enable.patch new file mode 100644 index 0000000000..c1fdd6da12 --- /dev/null +++ b/queue-6.6/media-marvell-add-check-for-clk_enable.patch @@ -0,0 +1,42 @@ +From 932ce1e529602d5d5540151dacdcb6cc9c8d9ca8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 3 Dec 2024 21:29:02 +0000 +Subject: media: marvell: Add check for clk_enable() + +From: Jiasheng Jiang + +[ Upstream commit 11f68d2ba2e1521a608af773bf788e8cfa260f68 ] + +Add check for the return value of clk_enable() to guarantee the success. + +Fixes: 81a409bfd551 ("media: marvell-ccic: provide a clock for the sensor") +Signed-off-by: Jiasheng Jiang +[Sakari Ailus: Fix spelling in commit message.] +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/platform/marvell/mcam-core.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/media/platform/marvell/mcam-core.c b/drivers/media/platform/marvell/mcam-core.c +index 66688b4aece5d..555f560238c9a 100644 +--- a/drivers/media/platform/marvell/mcam-core.c ++++ b/drivers/media/platform/marvell/mcam-core.c +@@ -935,7 +935,12 @@ static int mclk_enable(struct clk_hw *hw) + ret = pm_runtime_resume_and_get(cam->dev); + if (ret < 0) + return ret; +- clk_enable(cam->clk[0]); ++ ret = clk_enable(cam->clk[0]); ++ if (ret) { ++ pm_runtime_put(cam->dev); ++ return ret; ++ } ++ + mcam_reg_write(cam, REG_CLKCTRL, (mclk_src << 29) | mclk_div); + mcam_ctlr_power_up(cam); + +-- +2.39.5 + diff --git a/queue-6.6/media-mipi-csis-add-check-for-clk_enable.patch b/queue-6.6/media-mipi-csis-add-check-for-clk_enable.patch new file mode 100644 index 0000000000..bc28ee1acb --- /dev/null +++ b/queue-6.6/media-mipi-csis-add-check-for-clk_enable.patch @@ -0,0 +1,50 @@ +From b48d33427c66b5259640d98d362e44d936a6183c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 25 Nov 2024 19:18:18 +0000 +Subject: media: mipi-csis: Add check for clk_enable() + +From: Jiasheng Jiang + +[ Upstream commit 125ad1aeec77eb55273b420be6894b284a01e4b6 ] + +Add check for the return value of clk_enable() to gurantee the success. + +Fixes: b5f1220d587d ("[media] v4l: Add v4l2 subdev driver for S5P/EXYNOS4 MIPI-CSI receivers") +Signed-off-by: Jiasheng Jiang +Reviewed-by: Krzysztof Kozlowski +Signed-off-by: Sakari Ailus +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/platform/samsung/exynos4-is/mipi-csis.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/drivers/media/platform/samsung/exynos4-is/mipi-csis.c b/drivers/media/platform/samsung/exynos4-is/mipi-csis.c +index 686ca8753ba22..87c6fb88ab920 100644 +--- a/drivers/media/platform/samsung/exynos4-is/mipi-csis.c ++++ b/drivers/media/platform/samsung/exynos4-is/mipi-csis.c +@@ -940,13 +940,19 @@ static int s5pcsis_pm_resume(struct device *dev, bool runtime) + state->supplies); + goto unlock; + } +- clk_enable(state->clock[CSIS_CLK_GATE]); ++ ret = clk_enable(state->clock[CSIS_CLK_GATE]); ++ if (ret) { ++ phy_power_off(state->phy); ++ regulator_bulk_disable(CSIS_NUM_SUPPLIES, ++ state->supplies); ++ goto unlock; ++ } + } + if (state->flags & ST_STREAMING) + s5pcsis_start_stream(state); + + state->flags &= ~ST_SUSPENDED; +- unlock: ++unlock: + mutex_unlock(&state->lock); + return ret ? -EAGAIN : 0; + } +-- +2.39.5 + diff --git a/queue-6.6/media-nxp-imx8-isi-fix-v4l2-compliance-test-errors.patch b/queue-6.6/media-nxp-imx8-isi-fix-v4l2-compliance-test-errors.patch new file mode 100644 index 0000000000..b5fe8cceb6 --- /dev/null +++ b/queue-6.6/media-nxp-imx8-isi-fix-v4l2-compliance-test-errors.patch @@ -0,0 +1,54 @@ +From 05a614a20dcf4fcd2cbbe12dca520bcb5ba8334b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Sep 2024 13:33:04 +0300 +Subject: media: nxp: imx8-isi: fix v4l2-compliance test errors + +From: Laurentiu Palcu + +[ Upstream commit 7b12ab055edef2f51733d155617a401a05237bcc ] + +Running the v4l2-compliance (1.27.0-5208, SHA: af114250d48d) on the m2m +device fails on the MMAP streaming tests, with the following messages: + +fail: v4l2-test-buffers.cpp(240): g_field() == V4L2_FIELD_ANY +fail: v4l2-test-buffers.cpp(1508): buf.qbuf(node) + +Apparently, the driver does not properly set the field member of +vb2_v4l2_buffer struct, returning the default V4L2_FIELD_ANY value which +is against the guidelines. + +Fixes: cf21f328fcaf ("media: nxp: Add i.MX8 ISI driver") +Signed-off-by: Laurentiu Palcu +Reviewed-by: Laurent Pinchart +Link: https://lore.kernel.org/r/20240924103304.124085-1-laurentiu.palcu@oss.nxp.com +Signed-off-by: Laurent Pinchart +Signed-off-by: Hans Verkuil +Signed-off-by: Sasha Levin +--- + drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c +index 10840c9a0912b..111be77eca1ca 100644 +--- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c ++++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-video.c +@@ -861,6 +861,7 @@ int mxc_isi_video_buffer_prepare(struct mxc_isi_dev *isi, struct vb2_buffer *vb2 + const struct mxc_isi_format_info *info, + const struct v4l2_pix_format_mplane *pix) + { ++ struct vb2_v4l2_buffer *v4l2_buf = to_vb2_v4l2_buffer(vb2); + unsigned int i; + + for (i = 0; i < info->mem_planes; i++) { +@@ -875,6 +876,8 @@ int mxc_isi_video_buffer_prepare(struct mxc_isi_dev *isi, struct vb2_buffer *vb2 + vb2_set_plane_payload(vb2, i, size); + } + ++ v4l2_buf->field = pix->field; ++ + return 0; + } + +-- +2.39.5 + diff --git a/queue-6.6/media-rc-iguanair-handle-timeouts.patch b/queue-6.6/media-rc-iguanair-handle-timeouts.patch new file mode 100644 index 0000000000..116d00c855 --- /dev/null +++ b/queue-6.6/media-rc-iguanair-handle-timeouts.patch @@ -0,0 +1,48 @@ +From 787f22d2a87e1f1bbaa1f31686ecde7d1964019c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 26 Nov 2024 14:17:22 +0100 +Subject: media: rc: iguanair: handle timeouts + +From: Oliver Neukum + +[ Upstream commit b98d5000c50544f14bacb248c34e5219fbe81287 ] + +In case of a timeout the IO must be cancelled or +the next IO using the URB will fail and/or overwrite +an operational URB. + +The automatic bisection fails because it arrives +at a commit that correctly lets the test case run +without an error. + +Signed-off-by: Oliver Neukum +Fixes: e99a7cfe93fd ("[media] iguanair: reuse existing urb callback for command responses") +Reported-by: syzbot+ffba8e636870dac0e0c0@syzkaller.appspotmail.com +Closes: https://lore.kernel.org/all/66f5cc9a.050a0220.46d20.0004.GAE@google.com/ +Tested-by: syzbot+ffba8e636870dac0e0c0@syzkaller.appspotmail.com +Signed-off-by: Sean Young +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/rc/iguanair.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c +index 276bf3c8a8cb4..8af94246e5916 100644 +--- a/drivers/media/rc/iguanair.c ++++ b/drivers/media/rc/iguanair.c +@@ -194,8 +194,10 @@ static int iguanair_send(struct iguanair *ir, unsigned size) + if (rc) + return rc; + +- if (wait_for_completion_timeout(&ir->completion, TIMEOUT) == 0) ++ if (wait_for_completion_timeout(&ir->completion, TIMEOUT) == 0) { ++ usb_kill_urb(ir->urb_out); + return -ETIMEDOUT; ++ } + + return rc; + } +-- +2.39.5 + diff --git a/queue-6.6/media-uvcvideo-propagate-buf-error-to-userspace.patch b/queue-6.6/media-uvcvideo-propagate-buf-error-to-userspace.patch new file mode 100644 index 0000000000..bbf5d0629a --- /dev/null +++ b/queue-6.6/media-uvcvideo-propagate-buf-error-to-userspace.patch @@ -0,0 +1,44 @@ +From 3445b2e1e6be28be3427f6e1ed8b08aa98a01d32 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 18 Dec 2024 21:39:08 +0000 +Subject: media: uvcvideo: Propagate buf->error to userspace + +From: Ricardo Ribalda + +[ Upstream commit 87ce177654e388451850905a1d376658aebe8699 ] + +Now we return VB2_BUF_STATE_DONE for valid and invalid frames. Propagate +the correct value, so the user can know if the frame is valid or not via +struct v4l2_buffer->flags. + +Reported-by: Hans de Goede +Closes: https://lore.kernel.org/linux-media/84b0f212-cd88-46bb-8e6f-b94ec3eccba6@redhat.com +Fixes: 6998b6fb4b1c ("[media] uvcvideo: Use videobuf2-vmalloc") +Signed-off-by: Ricardo Ribalda +Reviewed-by: Laurent Pinchart +Reviewed-by: Hans de Goede +Link: https://lore.kernel.org/r/20241218-uvc-deprecate-v2-1-ab814139e983@chromium.org +Signed-off-by: Laurent Pinchart +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/usb/uvc/uvc_queue.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/media/usb/uvc/uvc_queue.c b/drivers/media/usb/uvc/uvc_queue.c +index 16fa17bbd15ea..83ed7821fa2a7 100644 +--- a/drivers/media/usb/uvc/uvc_queue.c ++++ b/drivers/media/usb/uvc/uvc_queue.c +@@ -483,7 +483,8 @@ static void uvc_queue_buffer_complete(struct kref *ref) + + buf->state = buf->error ? UVC_BUF_STATE_ERROR : UVC_BUF_STATE_DONE; + vb2_set_plane_payload(&buf->buf.vb2_buf, 0, buf->bytesused); +- vb2_buffer_done(&buf->buf.vb2_buf, VB2_BUF_STATE_DONE); ++ vb2_buffer_done(&buf->buf.vb2_buf, buf->error ? VB2_BUF_STATE_ERROR : ++ VB2_BUF_STATE_DONE); + } + + /* +-- +2.39.5 + diff --git a/queue-6.6/memory-tegra20-emc-fix-an-of-node-reference-bug-in-t.patch b/queue-6.6/memory-tegra20-emc-fix-an-of-node-reference-bug-in-t.patch new file mode 100644 index 0000000000..f2a4ea343f --- /dev/null +++ b/queue-6.6/memory-tegra20-emc-fix-an-of-node-reference-bug-in-t.patch @@ -0,0 +1,67 @@ +From 00e9f0d6cabecf3b0bf6cbdd27ff1461653f45ff Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 17 Dec 2024 18:14:34 +0900 +Subject: memory: tegra20-emc: fix an OF node reference bug in + tegra_emc_find_node_by_ram_code() + +From: Joe Hattori + +[ Upstream commit b9784e5cde1f9fb83661a70e580e381ae1264d12 ] + +As of_find_node_by_name() release the reference of the argument device +node, tegra_emc_find_node_by_ram_code() releases some device nodes while +still in use, resulting in possible UAFs. According to the bindings and +the in-tree DTS files, the "emc-tables" node is always device's child +node with the property "nvidia,use-ram-code", and the "lpddr2" node is a +child of the "emc-tables" node. Thus utilize the +for_each_child_of_node() macro and of_get_child_by_name() instead of +of_find_node_by_name() to simplify the code. + +This bug was found by an experimental verification tool that I am +developing. + +Fixes: 96e5da7c8424 ("memory: tegra: Introduce Tegra20 EMC driver") +Signed-off-by: Joe Hattori +Link: https://lore.kernel.org/r/20241217091434.1993597-1-joe@pf.is.s.u-tokyo.ac.jp +Link: https://lore.kernel.org/r/20241218024415.2494267-3-joe@pf.is.s.u-tokyo.ac.jp +[krzysztof: applied v1, adjust the commit msg to incorporate v2 parts] +Signed-off-by: Krzysztof Kozlowski +Signed-off-by: Sasha Levin +--- + drivers/memory/tegra/tegra20-emc.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/memory/tegra/tegra20-emc.c b/drivers/memory/tegra/tegra20-emc.c +index fd595c851a278..eb2813b51d770 100644 +--- a/drivers/memory/tegra/tegra20-emc.c ++++ b/drivers/memory/tegra/tegra20-emc.c +@@ -477,14 +477,15 @@ tegra_emc_find_node_by_ram_code(struct tegra_emc *emc) + + ram_code = tegra_read_ram_code(); + +- for (np = of_find_node_by_name(dev->of_node, "emc-tables"); np; +- np = of_find_node_by_name(np, "emc-tables")) { ++ for_each_child_of_node(dev->of_node, np) { ++ if (!of_node_name_eq(np, "emc-tables")) ++ continue; + err = of_property_read_u32(np, "nvidia,ram-code", &value); + if (err || value != ram_code) { + struct device_node *lpddr2_np; + bool cfg_mismatches = false; + +- lpddr2_np = of_find_node_by_name(np, "lpddr2"); ++ lpddr2_np = of_get_child_by_name(np, "lpddr2"); + if (lpddr2_np) { + const struct lpddr2_info *info; + +@@ -521,7 +522,6 @@ tegra_emc_find_node_by_ram_code(struct tegra_emc *emc) + } + + if (cfg_mismatches) { +- of_node_put(np); + continue; + } + } +-- +2.39.5 + diff --git a/queue-6.6/mfd-syscon-add-of_syscon_register_regmap-api.patch b/queue-6.6/mfd-syscon-add-of_syscon_register_regmap-api.patch new file mode 100644 index 0000000000..c34e6c98b0 --- /dev/null +++ b/queue-6.6/mfd-syscon-add-of_syscon_register_regmap-api.patch @@ -0,0 +1,124 @@ +From 441e05cd5625f7d1dc8cdcf18374f8f27d80c1b1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 21 Jun 2024 12:55:43 +0100 +Subject: mfd: syscon: Add of_syscon_register_regmap() API + +From: Peter Griffin + +[ Upstream commit 769cb63166d90f1fadafa4352f180cbd96b6cb77 ] + +The of_syscon_register_regmap() API allows an externally created regmap +to be registered with syscon. This regmap can then be returned to client +drivers using the syscon_regmap_lookup_by_phandle() APIs. + +The API is used by platforms where mmio access to the syscon registers is +not possible, and a underlying soc driver like exynos-pmu provides a SoC +specific regmap that can issue a SMC or hypervisor call to write the +register. + +This approach keeps the SoC complexities out of syscon, but allows common +drivers such as syscon-poweroff, syscon-reboot and friends that are used +by many SoCs already to be re-used. + +Signed-off-by: Peter Griffin +Reviewed-by: Arnd Bergmann +Reviewed-by: Sam Protsenko +Tested-by: Will McVicker +Reviewed-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20240621115544.1655458-2-peter.griffin@linaro.org +Signed-off-by: Lee Jones +Stable-dep-of: 805f7aaf7fee ("mfd: syscon: Fix race in device_node_get_regmap()") +Signed-off-by: Sasha Levin +--- + drivers/mfd/syscon.c | 48 ++++++++++++++++++++++++++++++++++++++ + include/linux/mfd/syscon.h | 8 +++++++ + 2 files changed, 56 insertions(+) + +diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c +index 7d0e91164cbaa..33f1e07ab24dc 100644 +--- a/drivers/mfd/syscon.c ++++ b/drivers/mfd/syscon.c +@@ -192,6 +192,54 @@ static struct regmap *device_node_get_regmap(struct device_node *np, + return syscon->regmap; + } + ++/** ++ * of_syscon_register_regmap() - Register regmap for specified device node ++ * @np: Device tree node ++ * @regmap: Pointer to regmap object ++ * ++ * Register an externally created regmap object with syscon for the specified ++ * device tree node. This regmap will then be returned to client drivers using ++ * the syscon_regmap_lookup_by_phandle() API. ++ * ++ * Return: 0 on success, negative error code on failure. ++ */ ++int of_syscon_register_regmap(struct device_node *np, struct regmap *regmap) ++{ ++ struct syscon *entry, *syscon = NULL; ++ int ret; ++ ++ if (!np || !regmap) ++ return -EINVAL; ++ ++ syscon = kzalloc(sizeof(*syscon), GFP_KERNEL); ++ if (!syscon) ++ return -ENOMEM; ++ ++ /* check if syscon entry already exists */ ++ spin_lock(&syscon_list_slock); ++ ++ list_for_each_entry(entry, &syscon_list, list) ++ if (entry->np == np) { ++ ret = -EEXIST; ++ goto err_unlock; ++ } ++ ++ syscon->regmap = regmap; ++ syscon->np = np; ++ ++ /* register the regmap in syscon list */ ++ list_add_tail(&syscon->list, &syscon_list); ++ spin_unlock(&syscon_list_slock); ++ ++ return 0; ++ ++err_unlock: ++ spin_unlock(&syscon_list_slock); ++ kfree(syscon); ++ return ret; ++} ++EXPORT_SYMBOL_GPL(of_syscon_register_regmap); ++ + struct regmap *device_node_to_regmap(struct device_node *np) + { + return device_node_get_regmap(np, false); +diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h +index c315903f6dab3..aad9c6b504636 100644 +--- a/include/linux/mfd/syscon.h ++++ b/include/linux/mfd/syscon.h +@@ -28,6 +28,8 @@ struct regmap *syscon_regmap_lookup_by_phandle_args(struct device_node *np, + unsigned int *out_args); + struct regmap *syscon_regmap_lookup_by_phandle_optional(struct device_node *np, + const char *property); ++int of_syscon_register_regmap(struct device_node *np, ++ struct regmap *regmap); + #else + static inline struct regmap *device_node_to_regmap(struct device_node *np) + { +@@ -67,6 +69,12 @@ static inline struct regmap *syscon_regmap_lookup_by_phandle_optional( + return NULL; + } + ++static inline int of_syscon_register_regmap(struct device_node *np, ++ struct regmap *regmap) ++{ ++ return -EOPNOTSUPP; ++} ++ + #endif + + #endif /* __LINUX_MFD_SYSCON_H__ */ +-- +2.39.5 + diff --git a/queue-6.6/mfd-syscon-fix-race-in-device_node_get_regmap.patch b/queue-6.6/mfd-syscon-fix-race-in-device_node_get_regmap.patch new file mode 100644 index 0000000000..5407be2dfe --- /dev/null +++ b/queue-6.6/mfd-syscon-fix-race-in-device_node_get_regmap.patch @@ -0,0 +1,125 @@ +From 1096264009b3cf9990d996191cda51394bc9b4cd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 17 Dec 2024 12:11:40 -0600 +Subject: mfd: syscon: Fix race in device_node_get_regmap() + +From: Rob Herring (Arm) + +[ Upstream commit 805f7aaf7fee14a57b56af01d270edf6c10765e8 ] + +It is possible for multiple, simultaneous callers calling +device_node_get_regmap() with the same node to fail to find an entry in +the syscon_list. There is a period of time while the first caller is +calling of_syscon_register() that subsequent callers also fail to find +an entry in the syscon_list and then call of_syscon_register() a second +time. + +Fix this by keeping the lock held until after of_syscon_register() +completes and adds the node to syscon_list. Convert the spinlock to a +mutex as many of the functions called in of_syscon_register() such as +kzalloc() and of_clk_get() may sleep. + +Fixes: bdb0066df96e ("mfd: syscon: Decouple syscon interface from platform devices") +Signed-off-by: Rob Herring (Arm) +Reviewed-by: Krzysztof Kozlowski +Tested-by: Krzysztof Kozlowski +Tested-by: Will McVicker +Tested-by: Pankaj Dubey +Reviewed-by: Pankaj Dubey +Link: https://lore.kernel.org/r/20241217-syscon-fixes-v2-1-4f56d750541d@kernel.org +Signed-off-by: Lee Jones +Signed-off-by: Sasha Levin +--- + drivers/mfd/syscon.c | 19 ++++++++++--------- + 1 file changed, 10 insertions(+), 9 deletions(-) + +diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c +index 2ce15f60eb107..729e79e1be49f 100644 +--- a/drivers/mfd/syscon.c ++++ b/drivers/mfd/syscon.c +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -27,7 +28,7 @@ + + static struct platform_driver syscon_driver; + +-static DEFINE_SPINLOCK(syscon_list_slock); ++static DEFINE_MUTEX(syscon_list_lock); + static LIST_HEAD(syscon_list); + + struct syscon { +@@ -54,6 +55,8 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res) + struct resource res; + struct reset_control *reset; + ++ WARN_ON(!mutex_is_locked(&syscon_list_lock)); ++ + struct syscon *syscon __free(kfree) = kzalloc(sizeof(*syscon), GFP_KERNEL); + if (!syscon) + return ERR_PTR(-ENOMEM); +@@ -144,9 +147,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res) + syscon->regmap = regmap; + syscon->np = np; + +- spin_lock(&syscon_list_slock); + list_add_tail(&syscon->list, &syscon_list); +- spin_unlock(&syscon_list_slock); + + return_ptr(syscon); + +@@ -167,7 +168,7 @@ static struct regmap *device_node_get_regmap(struct device_node *np, + { + struct syscon *entry, *syscon = NULL; + +- spin_lock(&syscon_list_slock); ++ mutex_lock(&syscon_list_lock); + + list_for_each_entry(entry, &syscon_list, list) + if (entry->np == np) { +@@ -175,11 +176,11 @@ static struct regmap *device_node_get_regmap(struct device_node *np, + break; + } + +- spin_unlock(&syscon_list_slock); +- + if (!syscon) + syscon = of_syscon_register(np, check_res); + ++ mutex_unlock(&syscon_list_lock); ++ + if (IS_ERR(syscon)) + return ERR_CAST(syscon); + +@@ -210,7 +211,7 @@ int of_syscon_register_regmap(struct device_node *np, struct regmap *regmap) + return -ENOMEM; + + /* check if syscon entry already exists */ +- spin_lock(&syscon_list_slock); ++ mutex_lock(&syscon_list_lock); + + list_for_each_entry(entry, &syscon_list, list) + if (entry->np == np) { +@@ -223,12 +224,12 @@ int of_syscon_register_regmap(struct device_node *np, struct regmap *regmap) + + /* register the regmap in syscon list */ + list_add_tail(&syscon->list, &syscon_list); +- spin_unlock(&syscon_list_slock); ++ mutex_unlock(&syscon_list_lock); + + return 0; + + err_unlock: +- spin_unlock(&syscon_list_slock); ++ mutex_unlock(&syscon_list_lock); + kfree(syscon); + return ret; + } +-- +2.39.5 + diff --git a/queue-6.6/mfd-syscon-remove-extern-from-function-prototypes.patch b/queue-6.6/mfd-syscon-remove-extern-from-function-prototypes.patch new file mode 100644 index 0000000000..68d491fb4f --- /dev/null +++ b/queue-6.6/mfd-syscon-remove-extern-from-function-prototypes.patch @@ -0,0 +1,66 @@ +From a6a9c8ec86d10619dc0035c460063d2f7fc511e3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 20 Feb 2024 11:50:11 +0000 +Subject: mfd: syscon: Remove extern from function prototypes + +From: Peter Griffin + +[ Upstream commit 0db017f8edd9b9af818bc1d68ba578df1b4c4628 ] + +The kernel coding style does not require 'extern' in function prototypes +in .h files, so remove them as they are not needed. + +To avoid checkpatch warnings such as +CHECK: Lines should not end with a '(' ++struct regmap *syscon_regmap_lookup_by_phandle( + +The indentation is also updated. No functional changes in this patch. + +Signed-off-by: Peter Griffin +Link: https://lore.kernel.org/r/20240220115012.471689-3-peter.griffin@linaro.org +Signed-off-by: Lee Jones +Stable-dep-of: 805f7aaf7fee ("mfd: syscon: Fix race in device_node_get_regmap()") +Signed-off-by: Sasha Levin +--- + include/linux/mfd/syscon.h | 25 +++++++++++-------------- + 1 file changed, 11 insertions(+), 14 deletions(-) + +diff --git a/include/linux/mfd/syscon.h b/include/linux/mfd/syscon.h +index fecc2fa2a3647..c315903f6dab3 100644 +--- a/include/linux/mfd/syscon.h ++++ b/include/linux/mfd/syscon.h +@@ -17,20 +17,17 @@ + struct device_node; + + #ifdef CONFIG_MFD_SYSCON +-extern struct regmap *device_node_to_regmap(struct device_node *np); +-extern struct regmap *syscon_node_to_regmap(struct device_node *np); +-extern struct regmap *syscon_regmap_lookup_by_compatible(const char *s); +-extern struct regmap *syscon_regmap_lookup_by_phandle( +- struct device_node *np, +- const char *property); +-extern struct regmap *syscon_regmap_lookup_by_phandle_args( +- struct device_node *np, +- const char *property, +- int arg_count, +- unsigned int *out_args); +-extern struct regmap *syscon_regmap_lookup_by_phandle_optional( +- struct device_node *np, +- const char *property); ++struct regmap *device_node_to_regmap(struct device_node *np); ++struct regmap *syscon_node_to_regmap(struct device_node *np); ++struct regmap *syscon_regmap_lookup_by_compatible(const char *s); ++struct regmap *syscon_regmap_lookup_by_phandle(struct device_node *np, ++ const char *property); ++struct regmap *syscon_regmap_lookup_by_phandle_args(struct device_node *np, ++ const char *property, ++ int arg_count, ++ unsigned int *out_args); ++struct regmap *syscon_regmap_lookup_by_phandle_optional(struct device_node *np, ++ const char *property); + #else + static inline struct regmap *device_node_to_regmap(struct device_node *np) + { +-- +2.39.5 + diff --git a/queue-6.6/mfd-syscon-use-scoped-variables-with-memory-allocato.patch b/queue-6.6/mfd-syscon-use-scoped-variables-with-memory-allocato.patch new file mode 100644 index 0000000000..63d81acb8e --- /dev/null +++ b/queue-6.6/mfd-syscon-use-scoped-variables-with-memory-allocato.patch @@ -0,0 +1,89 @@ +From 449853e05fb17fec7ffa516f9036fc274a9c61de Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 7 Jul 2024 13:48:23 +0200 +Subject: mfd: syscon: Use scoped variables with memory allocators to simplify + error paths + +From: Krzysztof Kozlowski + +[ Upstream commit 82f898f47112bc7b787cb9ce8803c4e2f9f60c89 ] + +Allocate the memory with scoped/cleanup.h to reduce error handling and +make the code a bit simpler. + +Signed-off-by: Krzysztof Kozlowski +Link: https://lore.kernel.org/r/20240707114823.9175-2-krzysztof.kozlowski@linaro.org +Signed-off-by: Lee Jones +Stable-dep-of: 805f7aaf7fee ("mfd: syscon: Fix race in device_node_get_regmap()") +Signed-off-by: Sasha Levin +--- + drivers/mfd/syscon.c | 20 +++++++------------- + 1 file changed, 7 insertions(+), 13 deletions(-) + +diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c +index 33f1e07ab24dc..2ce15f60eb107 100644 +--- a/drivers/mfd/syscon.c ++++ b/drivers/mfd/syscon.c +@@ -8,6 +8,7 @@ + * Author: Dong Aisheng + */ + ++#include + #include + #include + #include +@@ -45,7 +46,6 @@ static const struct regmap_config syscon_regmap_config = { + static struct syscon *of_syscon_register(struct device_node *np, bool check_res) + { + struct clk *clk; +- struct syscon *syscon; + struct regmap *regmap; + void __iomem *base; + u32 reg_io_width; +@@ -54,20 +54,16 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res) + struct resource res; + struct reset_control *reset; + +- syscon = kzalloc(sizeof(*syscon), GFP_KERNEL); ++ struct syscon *syscon __free(kfree) = kzalloc(sizeof(*syscon), GFP_KERNEL); + if (!syscon) + return ERR_PTR(-ENOMEM); + +- if (of_address_to_resource(np, 0, &res)) { +- ret = -ENOMEM; +- goto err_map; +- } ++ if (of_address_to_resource(np, 0, &res)) ++ return ERR_PTR(-ENOMEM); + + base = of_iomap(np, 0); +- if (!base) { +- ret = -ENOMEM; +- goto err_map; +- } ++ if (!base) ++ return ERR_PTR(-ENOMEM); + + /* Parse the device's DT node for an endianness specification */ + if (of_property_read_bool(np, "big-endian")) +@@ -152,7 +148,7 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res) + list_add_tail(&syscon->list, &syscon_list); + spin_unlock(&syscon_list_slock); + +- return syscon; ++ return_ptr(syscon); + + err_reset: + reset_control_put(reset); +@@ -163,8 +159,6 @@ static struct syscon *of_syscon_register(struct device_node *np, bool check_res) + regmap_exit(regmap); + err_regmap: + iounmap(base); +-err_map: +- kfree(syscon); + return ERR_PTR(ret); + } + +-- +2.39.5 + diff --git a/queue-6.6/module-extend-the-preempt-disabled-section-in-derefe.patch b/queue-6.6/module-extend-the-preempt-disabled-section-in-derefe.patch new file mode 100644 index 0000000000..e1666d01a6 --- /dev/null +++ b/queue-6.6/module-extend-the-preempt-disabled-section-in-derefe.patch @@ -0,0 +1,59 @@ +From cb7e5494e311fcdbed0dd048511edd1452f64a5d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 Jan 2025 10:04:30 +0100 +Subject: module: Extend the preempt disabled section in + dereference_symbol_descriptor(). + +From: Sebastian Andrzej Siewior + +[ Upstream commit a145c848d69f9c6f32008d8319edaa133360dd74 ] + +dereference_symbol_descriptor() needs to obtain the module pointer +belonging to pointer in order to resolve that pointer. +The returned mod pointer is obtained under RCU-sched/ preempt_disable() +guarantees and needs to be used within this section to ensure that the +module is not removed in the meantime. + +Extend the preempt_disable() section to also cover +dereference_module_function_descriptor(). + +Fixes: 04b8eb7a4ccd9 ("symbol lookup: introduce dereference_symbol_descriptor()") +Cc: James E.J. Bottomley +Cc: Christophe Leroy +Cc: Helge Deller +Cc: Madhavan Srinivasan +Cc: Michael Ellerman +Cc: Naveen N Rao +Cc: Nicholas Piggin +Cc: Sergey Senozhatsky +Cc: linux-parisc@vger.kernel.org +Cc: linuxppc-dev@lists.ozlabs.org +Reviewed-by: Sergey Senozhatsky +Acked-by: Peter Zijlstra (Intel) +Signed-off-by: Sebastian Andrzej Siewior +Link: https://lore.kernel.org/r/20250108090457.512198-2-bigeasy@linutronix.de +Signed-off-by: Petr Pavlu +Signed-off-by: Sasha Levin +--- + include/linux/kallsyms.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/linux/kallsyms.h b/include/linux/kallsyms.h +index c3f075e8f60cb..1c6a6c1704d8d 100644 +--- a/include/linux/kallsyms.h ++++ b/include/linux/kallsyms.h +@@ -57,10 +57,10 @@ static inline void *dereference_symbol_descriptor(void *ptr) + + preempt_disable(); + mod = __module_address((unsigned long)ptr); +- preempt_enable(); + + if (mod) + ptr = dereference_module_function_descriptor(mod, ptr); ++ preempt_enable(); + #endif + return ptr; + } +-- +2.39.5 + diff --git a/queue-6.6/mtd-hyperbus-hbmc-am654-convert-to-platform-remove-c.patch b/queue-6.6/mtd-hyperbus-hbmc-am654-convert-to-platform-remove-c.patch new file mode 100644 index 0000000000..ec7bfab86d --- /dev/null +++ b/queue-6.6/mtd-hyperbus-hbmc-am654-convert-to-platform-remove-c.patch @@ -0,0 +1,70 @@ +From c497918727826a38865b19f8773f12a6a7df20d7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 8 Oct 2023 22:01:32 +0200 +Subject: mtd: hyperbus: hbmc-am654: Convert to platform remove callback + returning void +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Uwe Kleine-König + +[ Upstream commit 59bd56760df17506bc2f828f19b40a2243edd0d0 ] + +The .remove() callback for a platform driver returns an int which makes +many driver authors wrongly assume it's possible to do error handling by +returning an error code. However the value returned is ignored (apart +from emitting a warning) and this typically results in resource leaks. + +To improve here there is a quest to make the remove callback return +void. In the first step of this quest all drivers are converted to +.remove_new(), which already returns void. Eventually after all drivers +are converted, .remove_new() will be renamed to .remove(). + +Trivially convert this driver from always returning zero in the remove +callback to the void returning variant. + +Signed-off-by: Uwe Kleine-König +Signed-off-by: Miquel Raynal +Acked-by: Tudor Ambarus +Link: https://lore.kernel.org/linux-mtd/20231008200143.196369-10-u.kleine-koenig@pengutronix.de +Stable-dep-of: bf5821909eb9 ("mtd: hyperbus: hbmc-am654: fix an OF node reference leak") +Signed-off-by: Sasha Levin +--- + drivers/mtd/hyperbus/hbmc-am654.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/drivers/mtd/hyperbus/hbmc-am654.c b/drivers/mtd/hyperbus/hbmc-am654.c +index a6161ce340d4e..dbe3eb361cca2 100644 +--- a/drivers/mtd/hyperbus/hbmc-am654.c ++++ b/drivers/mtd/hyperbus/hbmc-am654.c +@@ -229,7 +229,7 @@ static int am654_hbmc_probe(struct platform_device *pdev) + return ret; + } + +-static int am654_hbmc_remove(struct platform_device *pdev) ++static void am654_hbmc_remove(struct platform_device *pdev) + { + struct am654_hbmc_priv *priv = platform_get_drvdata(pdev); + struct am654_hbmc_device_priv *dev_priv = priv->hbdev.priv; +@@ -241,8 +241,6 @@ static int am654_hbmc_remove(struct platform_device *pdev) + + if (dev_priv->rx_chan) + dma_release_channel(dev_priv->rx_chan); +- +- return 0; + } + + static const struct of_device_id am654_hbmc_dt_ids[] = { +@@ -256,7 +254,7 @@ MODULE_DEVICE_TABLE(of, am654_hbmc_dt_ids); + + static struct platform_driver am654_hbmc_platform_driver = { + .probe = am654_hbmc_probe, +- .remove = am654_hbmc_remove, ++ .remove_new = am654_hbmc_remove, + .driver = { + .name = "hbmc-am654", + .of_match_table = am654_hbmc_dt_ids, +-- +2.39.5 + diff --git a/queue-6.6/mtd-hyperbus-hbmc-am654-fix-an-of-node-reference-lea.patch b/queue-6.6/mtd-hyperbus-hbmc-am654-fix-an-of-node-reference-lea.patch new file mode 100644 index 0000000000..f2ac2fb400 --- /dev/null +++ b/queue-6.6/mtd-hyperbus-hbmc-am654-fix-an-of-node-reference-lea.patch @@ -0,0 +1,82 @@ +From eb7b89f208685580bd3a81c06559a2c63448f61d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Dec 2024 22:38:09 +0900 +Subject: mtd: hyperbus: hbmc-am654: fix an OF node reference leak + +From: Joe Hattori + +[ Upstream commit bf5821909eb9c7f5d07d5c6e852ead2c373c94a0 ] + +In am654_hbmc_platform_driver, .remove() and the error path of .probe() +do not decrement the refcount of an OF node obtained by + of_get_next_child(). Fix this by adding of_node_put() calls. + +Fixes: aca31ce96814 ("mtd: hyperbus: hbmc-am654: Fix direct mapping setup flash access") +Signed-off-by: Joe Hattori +Signed-off-by: Miquel Raynal +Signed-off-by: Sasha Levin +--- + drivers/mtd/hyperbus/hbmc-am654.c | 19 +++++++++++++------ + 1 file changed, 13 insertions(+), 6 deletions(-) + +diff --git a/drivers/mtd/hyperbus/hbmc-am654.c b/drivers/mtd/hyperbus/hbmc-am654.c +index dbe3eb361cca2..4b6cbee23fe89 100644 +--- a/drivers/mtd/hyperbus/hbmc-am654.c ++++ b/drivers/mtd/hyperbus/hbmc-am654.c +@@ -174,26 +174,30 @@ static int am654_hbmc_probe(struct platform_device *pdev) + priv->hbdev.np = of_get_next_child(np, NULL); + ret = of_address_to_resource(priv->hbdev.np, 0, &res); + if (ret) +- return ret; ++ goto put_node; + + if (of_property_read_bool(dev->of_node, "mux-controls")) { + struct mux_control *control = devm_mux_control_get(dev, NULL); + +- if (IS_ERR(control)) +- return PTR_ERR(control); ++ if (IS_ERR(control)) { ++ ret = PTR_ERR(control); ++ goto put_node; ++ } + + ret = mux_control_select(control, 1); + if (ret) { + dev_err(dev, "Failed to select HBMC mux\n"); +- return ret; ++ goto put_node; + } + priv->mux_ctrl = control; + } + + priv->hbdev.map.size = resource_size(&res); + priv->hbdev.map.virt = devm_ioremap_resource(dev, &res); +- if (IS_ERR(priv->hbdev.map.virt)) +- return PTR_ERR(priv->hbdev.map.virt); ++ if (IS_ERR(priv->hbdev.map.virt)) { ++ ret = PTR_ERR(priv->hbdev.map.virt); ++ goto disable_mux; ++ } + + priv->ctlr.dev = dev; + priv->ctlr.ops = &am654_hbmc_ops; +@@ -226,6 +230,8 @@ static int am654_hbmc_probe(struct platform_device *pdev) + disable_mux: + if (priv->mux_ctrl) + mux_control_deselect(priv->mux_ctrl); ++put_node: ++ of_node_put(priv->hbdev.np); + return ret; + } + +@@ -241,6 +247,7 @@ static void am654_hbmc_remove(struct platform_device *pdev) + + if (dev_priv->rx_chan) + dma_release_channel(dev_priv->rx_chan); ++ of_node_put(priv->hbdev.np); + } + + static const struct of_device_id am654_hbmc_dt_ids[] = { +-- +2.39.5 + diff --git a/queue-6.6/mtd-rawnand-brcmnand-fix-status-read-of-brcmnand_wai.patch b/queue-6.6/mtd-rawnand-brcmnand-fix-status-read-of-brcmnand_wai.patch new file mode 100644 index 0000000000..1788ff8b99 --- /dev/null +++ b/queue-6.6/mtd-rawnand-brcmnand-fix-status-read-of-brcmnand_wai.patch @@ -0,0 +1,40 @@ +From 000286fbb68426686ef1f9ef2e5a15e166643e94 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 25 Nov 2024 18:39:16 -0800 +Subject: mtd: rawnand: brcmnand: fix status read of brcmnand_waitfunc + +From: david regan + +[ Upstream commit 03271ea36ea7a58d30a4bde182eb2a0d46220467 ] + +This change fixes an issue where an error return value may be mistakenly +used as NAND status. + +Fixes: f504551b7f15 ("mtd: rawnand: Propagate error and simplify ternary operators for brcmstb_nand_wait_for_completion()") +Signed-off-by: david regan +Reviewed-by: William Zhang +Signed-off-by: Miquel Raynal +Signed-off-by: Sasha Levin +--- + drivers/mtd/nand/raw/brcmnand/brcmnand.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c +index 440bef477930c..085a16148a68d 100644 +--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c ++++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c +@@ -2450,6 +2450,11 @@ static int brcmnand_write(struct mtd_info *mtd, struct nand_chip *chip, + brcmnand_send_cmd(host, CMD_PROGRAM_PAGE); + status = brcmnand_waitfunc(chip); + ++ if (status < 0) { ++ ret = status; ++ goto out; ++ } ++ + if (status & NAND_STATUS_FAIL) { + dev_info(ctrl->dev, "program failed at %llx\n", + (unsigned long long)addr); +-- +2.39.5 + diff --git a/queue-6.6/nbd-don-t-allow-reconnect-after-disconnect.patch b/queue-6.6/nbd-don-t-allow-reconnect-after-disconnect.patch new file mode 100644 index 0000000000..2f12174e1f --- /dev/null +++ b/queue-6.6/nbd-don-t-allow-reconnect-after-disconnect.patch @@ -0,0 +1,75 @@ +From 245b70321a6e1da9c16e4f62496bb5d351d353b7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 3 Jan 2025 17:28:59 +0800 +Subject: nbd: don't allow reconnect after disconnect + +From: Yu Kuai + +[ Upstream commit 844b8cdc681612ff24df62cdefddeab5772fadf1 ] + +Following process can cause nbd_config UAF: + +1) grab nbd_config temporarily; + +2) nbd_genl_disconnect() flush all recv_work() and release the +initial reference: + + nbd_genl_disconnect + nbd_disconnect_and_put + nbd_disconnect + flush_workqueue(nbd->recv_workq) + if (test_and_clear_bit(NBD_RT_HAS_CONFIG_REF, ...)) + nbd_config_put + -> due to step 1), reference is still not zero + +3) nbd_genl_reconfigure() queue recv_work() again; + + nbd_genl_reconfigure + config = nbd_get_config_unlocked(nbd) + if (!config) + -> succeed + if (!test_bit(NBD_RT_BOUND, ...)) + -> succeed + nbd_reconnect_socket + queue_work(nbd->recv_workq, &args->work) + +4) step 1) release the reference; + +5) Finially, recv_work() will trigger UAF: + + recv_work + nbd_config_put(nbd) + -> nbd_config is freed + atomic_dec(&config->recv_threads) + -> UAF + +Fix the problem by clearing NBD_RT_BOUND in nbd_genl_disconnect(), so +that nbd_genl_reconfigure() will fail. + +Fixes: b7aa3d39385d ("nbd: add a reconfigure netlink command") +Reported-by: syzbot+6b0df248918b92c33e6a@syzkaller.appspotmail.com +Closes: https://lore.kernel.org/all/675bfb65.050a0220.1a2d0d.0006.GAE@google.com/ +Signed-off-by: Yu Kuai +Reviewed-by: Christoph Hellwig +Link: https://lore.kernel.org/r/20250103092859.3574648-1-yukuai1@huaweicloud.com +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/block/nbd.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c +index 96b349148e578..2203686156bfe 100644 +--- a/drivers/block/nbd.c ++++ b/drivers/block/nbd.c +@@ -2164,6 +2164,7 @@ static void nbd_disconnect_and_put(struct nbd_device *nbd) + flush_workqueue(nbd->recv_workq); + nbd_clear_que(nbd); + nbd->task_setup = NULL; ++ clear_bit(NBD_RT_BOUND, &nbd->config->runtime_flags); + mutex_unlock(&nbd->config_lock); + + if (test_and_clear_bit(NBD_RT_HAS_CONFIG_REF, +-- +2.39.5 + diff --git a/queue-6.6/net-avoid-race-between-device-unregistration-and-eth.patch b/queue-6.6/net-avoid-race-between-device-unregistration-and-eth.patch new file mode 100644 index 0000000000..229237fb95 --- /dev/null +++ b/queue-6.6/net-avoid-race-between-device-unregistration-and-eth.patch @@ -0,0 +1,73 @@ +From 3e1104aedb2e912765123c99c50628704c7cdf8a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 16 Jan 2025 10:21:57 +0100 +Subject: net: avoid race between device unregistration and ethnl ops + +From: Antoine Tenart + +[ Upstream commit 12e070eb6964b341b41677fd260af5a305316a1f ] + +The following trace can be seen if a device is being unregistered while +its number of channels are being modified. + + DEBUG_LOCKS_WARN_ON(lock->magic != lock) + WARNING: CPU: 3 PID: 3754 at kernel/locking/mutex.c:564 __mutex_lock+0xc8a/0x1120 + CPU: 3 UID: 0 PID: 3754 Comm: ethtool Not tainted 6.13.0-rc6+ #771 + RIP: 0010:__mutex_lock+0xc8a/0x1120 + Call Trace: + + ethtool_check_max_channel+0x1ea/0x880 + ethnl_set_channels+0x3c3/0xb10 + ethnl_default_set_doit+0x306/0x650 + genl_family_rcv_msg_doit+0x1e3/0x2c0 + genl_rcv_msg+0x432/0x6f0 + netlink_rcv_skb+0x13d/0x3b0 + genl_rcv+0x28/0x40 + netlink_unicast+0x42e/0x720 + netlink_sendmsg+0x765/0xc20 + __sys_sendto+0x3ac/0x420 + __x64_sys_sendto+0xe0/0x1c0 + do_syscall_64+0x95/0x180 + entry_SYSCALL_64_after_hwframe+0x76/0x7e + +This is because unregister_netdevice_many_notify might run before the +rtnl lock section of ethnl operations, eg. set_channels in the above +example. In this example the rss lock would be destroyed by the device +unregistration path before being used again, but in general running +ethnl operations while dismantle has started is not a good idea. + +Fix this by denying any operation on devices being unregistered. A check +was already there in ethnl_ops_begin, but not wide enough. + +Note that the same issue cannot be seen on the ioctl version +(__dev_ethtool) because the device reference is retrieved from within +the rtnl lock section there. Once dismantle started, the net device is +unlisted and no reference will be found. + +Fixes: dde91ccfa25f ("ethtool: do not perform operations on net devices being unregistered") +Signed-off-by: Antoine Tenart +Reviewed-by: Przemek Kitszel +Reviewed-by: Edward Cree +Link: https://patch.msgid.link/20250116092159.50890-1-atenart@kernel.org +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/ethtool/netlink.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/ethtool/netlink.c b/net/ethtool/netlink.c +index fe3553f60bf39..c1ad63bee8ead 100644 +--- a/net/ethtool/netlink.c ++++ b/net/ethtool/netlink.c +@@ -41,7 +41,7 @@ int ethnl_ops_begin(struct net_device *dev) + pm_runtime_get_sync(dev->dev.parent); + + if (!netif_device_present(dev) || +- dev->reg_state == NETREG_UNREGISTERING) { ++ dev->reg_state >= NETREG_UNREGISTERING) { + ret = -ENODEV; + goto err; + } +-- +2.39.5 + diff --git a/queue-6.6/net-davicom-fix-uaf-in-dm9000_drv_remove.patch b/queue-6.6/net-davicom-fix-uaf-in-dm9000_drv_remove.patch new file mode 100644 index 0000000000..e7e7b309fd --- /dev/null +++ b/queue-6.6/net-davicom-fix-uaf-in-dm9000_drv_remove.patch @@ -0,0 +1,52 @@ +From 11ea4bfa9c22402912527ff47ad912f96435d752 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jan 2025 15:42:13 -0600 +Subject: net: davicom: fix UAF in dm9000_drv_remove +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Chenyuan Yang + +[ Upstream commit 19e65c45a1507a1a2926649d2db3583ed9d55fd9 ] + +dm is netdev private data and it cannot be +used after free_netdev() call. Using dm after free_netdev() +can cause UAF bug. Fix it by moving free_netdev() at the end of the +function. + +This is similar to the issue fixed in commit +ad297cd2db89 ("net: qcom/emac: fix UAF in emac_remove"). + +This bug is detected by our static analysis tool. + +Fixes: cf9e60aa69ae ("net: davicom: Fix regulator not turned off on driver removal") +Signed-off-by: Chenyuan Yang +CC: Uwe Kleine-König +Link: https://patch.msgid.link/20250123214213.623518-1-chenyuan0y@gmail.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/davicom/dm9000.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c +index 05a89ab6766c4..bd38f2f57c8ab 100644 +--- a/drivers/net/ethernet/davicom/dm9000.c ++++ b/drivers/net/ethernet/davicom/dm9000.c +@@ -1778,10 +1778,11 @@ dm9000_drv_remove(struct platform_device *pdev) + + unregister_netdev(ndev); + dm9000_release_board(pdev, dm); +- free_netdev(ndev); /* free device structure */ + if (dm->power_supply) + regulator_disable(dm->power_supply); + ++ free_netdev(ndev); /* free device structure */ ++ + dev_dbg(&pdev->dev, "released and freed device\n"); + return 0; + } +-- +2.39.5 + diff --git a/queue-6.6/net-ethernet-ti-am65-cpsw-fix-freeing-irq-in-am65_cp.patch b/queue-6.6/net-ethernet-ti-am65-cpsw-fix-freeing-irq-in-am65_cp.patch new file mode 100644 index 0000000000..3601647417 --- /dev/null +++ b/queue-6.6/net-ethernet-ti-am65-cpsw-fix-freeing-irq-in-am65_cp.patch @@ -0,0 +1,61 @@ +From 5452e58e07de150fadf00a92a8811e1f92a0ee52 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 16 Jan 2025 15:54:49 +0200 +Subject: net: ethernet: ti: am65-cpsw: fix freeing IRQ in + am65_cpsw_nuss_remove_tx_chns() + +From: Roger Quadros + +[ Upstream commit 4395a44acb15850e492dd1de9ec4b6479d96bc80 ] + +When getting the IRQ we use k3_udma_glue_tx_get_irq() which returns +negative error value on error. So not NULL check is not sufficient +to deteremine if IRQ is valid. Check that IRQ is greater then zero +to ensure it is valid. + +There is no issue at probe time but at runtime user can invoke +.set_channels which results in the following call chain. +am65_cpsw_set_channels() + am65_cpsw_nuss_update_tx_rx_chns() + am65_cpsw_nuss_remove_tx_chns() + am65_cpsw_nuss_init_tx_chns() + +At this point if am65_cpsw_nuss_init_tx_chns() fails due to +k3_udma_glue_tx_get_irq() then tx_chn->irq will be set to a +negative value. + +Then, at subsequent .set_channels with higher channel count we +will attempt to free an invalid IRQ in am65_cpsw_nuss_remove_tx_chns() +leading to a kernel warning. + +The issue is present in the original commit that introduced this driver, +although there, am65_cpsw_nuss_update_tx_rx_chns() existed as +am65_cpsw_nuss_update_tx_chns(). + +Fixes: 93a76530316a ("net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver") +Signed-off-by: Roger Quadros +Reviewed-by: Simon Horman +Reviewed-by: Siddharth Vadapalli +Reviewed-by: Jacob Keller +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c +index d556e705ec000..8ffc1fbb036f9 100644 +--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c ++++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c +@@ -1651,7 +1651,7 @@ void am65_cpsw_nuss_remove_tx_chns(struct am65_cpsw_common *common) + for (i = 0; i < common->tx_ch_num; i++) { + struct am65_cpsw_tx_chn *tx_chn = &common->tx_chns[i]; + +- if (tx_chn->irq) ++ if (tx_chn->irq > 0) + devm_free_irq(dev, tx_chn->irq, tx_chn); + + netif_napi_del(&tx_chn->napi_tx); +-- +2.39.5 + diff --git a/queue-6.6/net-fec-implement-tso-descriptor-cleanup.patch b/queue-6.6/net-fec-implement-tso-descriptor-cleanup.patch new file mode 100644 index 0000000000..5d7fc0e0fe --- /dev/null +++ b/queue-6.6/net-fec-implement-tso-descriptor-cleanup.patch @@ -0,0 +1,78 @@ +From 235dcf224711e34e74e0a57705f9072c5f7c4be5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 20 Jan 2025 14:24:30 +0530 +Subject: net: fec: implement TSO descriptor cleanup + +From: Dheeraj Reddy Jonnalagadda + +[ Upstream commit 61dc1fd9205bc9d9918aa933a847b08e80b4dc20 ] + +Implement cleanup of descriptors in the TSO error path of +fec_enet_txq_submit_tso(). The cleanup + +- Unmaps DMA buffers for data descriptors skipping TSO header +- Clears all buffer descriptors +- Handles extended descriptors by clearing cbd_esc when enabled + +Fixes: 79f339125ea3 ("net: fec: Add software TSO support") +Signed-off-by: Dheeraj Reddy Jonnalagadda +Reviewed-by: Wei Fang +Link: https://patch.msgid.link/20250120085430.99318-1-dheeraj.linuxdev@gmail.com +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/freescale/fec_main.c | 31 ++++++++++++++++++++++- + 1 file changed, 30 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c +index 8f5cc1f233188..2d6b50903c923 100644 +--- a/drivers/net/ethernet/freescale/fec_main.c ++++ b/drivers/net/ethernet/freescale/fec_main.c +@@ -821,6 +821,8 @@ static int fec_enet_txq_submit_tso(struct fec_enet_priv_tx_q *txq, + struct fec_enet_private *fep = netdev_priv(ndev); + int hdr_len, total_len, data_left; + struct bufdesc *bdp = txq->bd.cur; ++ struct bufdesc *tmp_bdp; ++ struct bufdesc_ex *ebdp; + struct tso_t tso; + unsigned int index = 0; + int ret; +@@ -894,7 +896,34 @@ static int fec_enet_txq_submit_tso(struct fec_enet_priv_tx_q *txq, + return 0; + + err_release: +- /* TODO: Release all used data descriptors for TSO */ ++ /* Release all used data descriptors for TSO */ ++ tmp_bdp = txq->bd.cur; ++ ++ while (tmp_bdp != bdp) { ++ /* Unmap data buffers */ ++ if (tmp_bdp->cbd_bufaddr && ++ !IS_TSO_HEADER(txq, fec32_to_cpu(tmp_bdp->cbd_bufaddr))) ++ dma_unmap_single(&fep->pdev->dev, ++ fec32_to_cpu(tmp_bdp->cbd_bufaddr), ++ fec16_to_cpu(tmp_bdp->cbd_datlen), ++ DMA_TO_DEVICE); ++ ++ /* Clear standard buffer descriptor fields */ ++ tmp_bdp->cbd_sc = 0; ++ tmp_bdp->cbd_datlen = 0; ++ tmp_bdp->cbd_bufaddr = 0; ++ ++ /* Handle extended descriptor if enabled */ ++ if (fep->bufdesc_ex) { ++ ebdp = (struct bufdesc_ex *)tmp_bdp; ++ ebdp->cbd_esc = 0; ++ } ++ ++ tmp_bdp = fec_enet_get_nextdesc(tmp_bdp, &txq->bd); ++ } ++ ++ dev_kfree_skb_any(skb); ++ + return ret; + } + +-- +2.39.5 + diff --git a/queue-6.6/net-hns3-fix-oops-when-unload-drivers-paralleling.patch b/queue-6.6/net-hns3-fix-oops-when-unload-drivers-paralleling.patch new file mode 100644 index 0000000000..5f7622a836 --- /dev/null +++ b/queue-6.6/net-hns3-fix-oops-when-unload-drivers-paralleling.patch @@ -0,0 +1,121 @@ +From e040fe0915f0d01cb61b82aca840264f9907ac37 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 18 Jan 2025 17:47:41 +0800 +Subject: net: hns3: fix oops when unload drivers paralleling + +From: Jian Shen + +[ Upstream commit 92e5995773774a3e70257e9c95ea03518268bea5 ] + +When unload hclge driver, it tries to disable sriov first for each +ae_dev node from hnae3_ae_dev_list. If user unloads hns3 driver at +the time, because it removes all the ae_dev nodes, and it may cause +oops. + +But we can't simply use hnae3_common_lock for this. Because in the +process flow of pci_disable_sriov(), it will trigger the remove flow +of VF, which will also take hnae3_common_lock. + +To fixes it, introduce a new mutex to protect the unload process. + +Fixes: 0dd8a25f355b ("net: hns3: disable sriov before unload hclge layer") +Signed-off-by: Jian Shen +Signed-off-by: Jijie Shao +Link: https://patch.msgid.link/20250118094741.3046663-1-shaojijie@huawei.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/hisilicon/hns3/hnae3.c | 15 +++++++++++++++ + drivers/net/ethernet/hisilicon/hns3/hnae3.h | 2 ++ + drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 2 ++ + .../ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 2 ++ + .../ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 2 ++ + 5 files changed, 23 insertions(+) + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.c b/drivers/net/ethernet/hisilicon/hns3/hnae3.c +index 9a63fbc694083..b25fb400f4767 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.c +@@ -40,6 +40,21 @@ EXPORT_SYMBOL(hnae3_unregister_ae_algo_prepare); + */ + static DEFINE_MUTEX(hnae3_common_lock); + ++/* ensure the drivers being unloaded one by one */ ++static DEFINE_MUTEX(hnae3_unload_lock); ++ ++void hnae3_acquire_unload_lock(void) ++{ ++ mutex_lock(&hnae3_unload_lock); ++} ++EXPORT_SYMBOL(hnae3_acquire_unload_lock); ++ ++void hnae3_release_unload_lock(void) ++{ ++ mutex_unlock(&hnae3_unload_lock); ++} ++EXPORT_SYMBOL(hnae3_release_unload_lock); ++ + static bool hnae3_client_match(enum hnae3_client_type client_type) + { + if (client_type == HNAE3_CLIENT_KNIC || +diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h +index 57787c380fa07..7eb22b8ea3e70 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h ++++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h +@@ -946,4 +946,6 @@ int hnae3_register_client(struct hnae3_client *client); + void hnae3_set_client_init_flag(struct hnae3_client *client, + struct hnae3_ae_dev *ae_dev, + unsigned int inited); ++void hnae3_acquire_unload_lock(void); ++void hnae3_release_unload_lock(void); + #endif +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +index 14d086b535a2d..801801e8803e9 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +@@ -6008,9 +6008,11 @@ module_init(hns3_init_module); + */ + static void __exit hns3_exit_module(void) + { ++ hnae3_acquire_unload_lock(); + pci_unregister_driver(&hns3_driver); + hnae3_unregister_client(&client); + hns3_dbg_unregister_debugfs(); ++ hnae3_release_unload_lock(); + } + module_exit(hns3_exit_module); + +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +index 9650ce594e2fd..4d318af748a0b 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +@@ -12814,9 +12814,11 @@ static int __init hclge_init(void) + + static void __exit hclge_exit(void) + { ++ hnae3_acquire_unload_lock(); + hnae3_unregister_ae_algo_prepare(&ae_algo); + hnae3_unregister_ae_algo(&ae_algo); + destroy_workqueue(hclge_wq); ++ hnae3_release_unload_lock(); + } + module_init(hclge_init); + module_exit(hclge_exit); +diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +index affdd9d70549a..69bfcfb148def 100644 +--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c ++++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c +@@ -3345,8 +3345,10 @@ static int __init hclgevf_init(void) + + static void __exit hclgevf_exit(void) + { ++ hnae3_acquire_unload_lock(); + hnae3_unregister_ae_algo(&ae_algovf); + destroy_workqueue(hclgevf_wq); ++ hnae3_release_unload_lock(); + } + module_init(hclgevf_init); + module_exit(hclgevf_exit); +-- +2.39.5 + diff --git a/queue-6.6/net-hsr-fix-fill_frame_info-regression-vs-vlan-packe.patch b/queue-6.6/net-hsr-fix-fill_frame_info-regression-vs-vlan-packe.patch new file mode 100644 index 0000000000..280e63482b --- /dev/null +++ b/queue-6.6/net-hsr-fix-fill_frame_info-regression-vs-vlan-packe.patch @@ -0,0 +1,79 @@ +From 1563d7b3a5a3ba86e8ae67bfca8fc2b2c0fc89ed Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 29 Jan 2025 13:00:07 +0000 +Subject: net: hsr: fix fill_frame_info() regression vs VLAN packets + +From: Eric Dumazet + +[ Upstream commit 0f5697f1a3f99bc2b674b8aa3c5da822c5673c11 ] + +Stephan Wurm reported that my recent patch broke VLAN support. + +Apparently skb->mac_len is not correct for VLAN traffic as +shown by debug traces [1]. + +Use instead pskb_may_pull() to make sure the expected header +is present in skb->head. + +Many thanks to Stephan for his help. + +[1] +kernel: skb len=170 headroom=2 headlen=170 tailroom=20 + mac=(2,14) mac_len=14 net=(16,-1) trans=-1 + shinfo(txflags=0 nr_frags=0 gso(size=0 type=0 segs=0)) + csum(0x0 start=0 offset=0 ip_summed=0 complete_sw=0 valid=0 level=0) + hash(0x0 sw=0 l4=0) proto=0x0000 pkttype=0 iif=0 + priority=0x0 mark=0x0 alloc_cpu=0 vlan_all=0x0 + encapsulation=0 inner(proto=0x0000, mac=0, net=0, trans=0) +kernel: dev name=prp0 feat=0x0000000000007000 +kernel: sk family=17 type=3 proto=0 +kernel: skb headroom: 00000000: 74 00 +kernel: skb linear: 00000000: 01 0c cd 01 00 01 00 d0 93 53 9c cb 81 00 80 00 +kernel: skb linear: 00000010: 88 b8 00 01 00 98 00 00 00 00 61 81 8d 80 16 52 +kernel: skb linear: 00000020: 45 47 44 4e 43 54 52 4c 2f 4c 4c 4e 30 24 47 4f +kernel: skb linear: 00000030: 24 47 6f 43 62 81 01 14 82 16 52 45 47 44 4e 43 +kernel: skb linear: 00000040: 54 52 4c 2f 4c 4c 4e 30 24 44 73 47 6f 6f 73 65 +kernel: skb linear: 00000050: 83 07 47 6f 49 64 65 6e 74 84 08 67 8d f5 93 7e +kernel: skb linear: 00000060: 76 c8 00 85 01 01 86 01 00 87 01 00 88 01 01 89 +kernel: skb linear: 00000070: 01 00 8a 01 02 ab 33 a2 15 83 01 00 84 03 03 00 +kernel: skb linear: 00000080: 00 91 08 67 8d f5 92 77 4b c6 1f 83 01 00 a2 1a +kernel: skb linear: 00000090: a2 06 85 01 00 83 01 00 84 03 03 00 00 91 08 67 +kernel: skb linear: 000000a0: 8d f5 92 77 4b c6 1f 83 01 00 +kernel: skb tailroom: 00000000: 80 18 02 00 fe 4e 00 00 01 01 08 0a 4f fd 5e d1 +kernel: skb tailroom: 00000010: 4f fd 5e cd + +Fixes: b9653d19e556 ("net: hsr: avoid potential out-of-bound access in fill_frame_info()") +Reported-by: Stephan Wurm +Tested-by: Stephan Wurm +Closes: https://lore.kernel.org/netdev/Z4o_UC0HweBHJ_cw@PC-LX-SteWu/ +Signed-off-by: Eric Dumazet +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/20250129130007.644084-1-edumazet@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/hsr/hsr_forward.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/net/hsr/hsr_forward.c b/net/hsr/hsr_forward.c +index 2790f3964d6bd..9317f96127c1b 100644 +--- a/net/hsr/hsr_forward.c ++++ b/net/hsr/hsr_forward.c +@@ -588,9 +588,12 @@ static int fill_frame_info(struct hsr_frame_info *frame, + frame->is_vlan = true; + + if (frame->is_vlan) { +- if (skb->mac_len < offsetofend(struct hsr_vlan_ethhdr, vlanhdr)) ++ /* Note: skb->mac_len might be wrong here. */ ++ if (!pskb_may_pull(skb, ++ skb_mac_offset(skb) + ++ offsetofend(struct hsr_vlan_ethhdr, vlanhdr))) + return -EINVAL; +- vlan_hdr = (struct hsr_vlan_ethhdr *)ethhdr; ++ vlan_hdr = (struct hsr_vlan_ethhdr *)skb_mac_header(skb); + proto = vlan_hdr->vlanhdr.h_vlan_encapsulated_proto; + /* FIXME: */ + netdev_warn_once(skb->dev, "VLAN not yet supported"); +-- +2.39.5 + diff --git a/queue-6.6/net-let-net.core.dev_weight-always-be-non-zero.patch b/queue-6.6/net-let-net.core.dev_weight-always-be-non-zero.patch new file mode 100644 index 0000000000..776c833af8 --- /dev/null +++ b/queue-6.6/net-let-net.core.dev_weight-always-be-non-zero.patch @@ -0,0 +1,103 @@ +From 6e6f86b8de031d9664104794143c28f71fb6a561 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 16 Jan 2025 22:30:53 +0800 +Subject: net: let net.core.dev_weight always be non-zero + +From: Liu Jian + +[ Upstream commit d1f9f79fa2af8e3b45cffdeef66e05833480148a ] + +The following problem was encountered during stability test: + +(NULL net_device): NAPI poll function process_backlog+0x0/0x530 \ + returned 1, exceeding its budget of 0. +------------[ cut here ]------------ +list_add double add: new=ffff88905f746f48, prev=ffff88905f746f48, \ + next=ffff88905f746e40. +WARNING: CPU: 18 PID: 5462 at lib/list_debug.c:35 \ + __list_add_valid_or_report+0xf3/0x130 +CPU: 18 UID: 0 PID: 5462 Comm: ping Kdump: loaded Not tainted 6.13.0-rc7+ +RIP: 0010:__list_add_valid_or_report+0xf3/0x130 +Call Trace: +? __warn+0xcd/0x250 +? __list_add_valid_or_report+0xf3/0x130 +enqueue_to_backlog+0x923/0x1070 +netif_rx_internal+0x92/0x2b0 +__netif_rx+0x15/0x170 +loopback_xmit+0x2ef/0x450 +dev_hard_start_xmit+0x103/0x490 +__dev_queue_xmit+0xeac/0x1950 +ip_finish_output2+0x6cc/0x1620 +ip_output+0x161/0x270 +ip_push_pending_frames+0x155/0x1a0 +raw_sendmsg+0xe13/0x1550 +__sys_sendto+0x3bf/0x4e0 +__x64_sys_sendto+0xdc/0x1b0 +do_syscall_64+0x5b/0x170 +entry_SYSCALL_64_after_hwframe+0x76/0x7e + +The reproduction command is as follows: + sysctl -w net.core.dev_weight=0 + ping 127.0.0.1 + +This is because when the napi's weight is set to 0, process_backlog() may +return 0 and clear the NAPI_STATE_SCHED bit of napi->state, causing this +napi to be re-polled in net_rx_action() until __do_softirq() times out. +Since the NAPI_STATE_SCHED bit has been cleared, napi_schedule_rps() can +be retriggered in enqueue_to_backlog(), causing this issue. + +Making the napi's weight always non-zero solves this problem. + +Triggering this issue requires system-wide admin (setting is +not namespaced). + +Fixes: e38766054509 ("[NET]: Fix sysctl net.core.dev_weight") +Fixes: 3d48b53fb2ae ("net: dev_weight: TX/RX orthogonality") +Signed-off-by: Liu Jian +Link: https://patch.msgid.link/20250116143053.4146855-1-liujian56@huawei.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/core/sysctl_net_core.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c +index 373b5b2231c49..0b15272dd2d35 100644 +--- a/net/core/sysctl_net_core.c ++++ b/net/core/sysctl_net_core.c +@@ -297,7 +297,7 @@ static int proc_do_dev_weight(struct ctl_table *table, int write, + int ret, weight; + + mutex_lock(&dev_weight_mutex); +- ret = proc_dointvec(table, write, buffer, lenp, ppos); ++ ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos); + if (!ret && write) { + weight = READ_ONCE(weight_p); + WRITE_ONCE(dev_rx_weight, weight * dev_weight_rx_bias); +@@ -422,6 +422,7 @@ static struct ctl_table net_core_table[] = { + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_do_dev_weight, ++ .extra1 = SYSCTL_ONE, + }, + { + .procname = "dev_weight_rx_bias", +@@ -429,6 +430,7 @@ static struct ctl_table net_core_table[] = { + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_do_dev_weight, ++ .extra1 = SYSCTL_ONE, + }, + { + .procname = "dev_weight_tx_bias", +@@ -436,6 +438,7 @@ static struct ctl_table net_core_table[] = { + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_do_dev_weight, ++ .extra1 = SYSCTL_ONE, + }, + { + .procname = "netdev_max_backlog", +-- +2.39.5 + diff --git a/queue-6.6/net-mlxfw-drop-hard-coded-max-fw-flash-image-size.patch b/queue-6.6/net-mlxfw-drop-hard-coded-max-fw-flash-image-size.patch new file mode 100644 index 0000000000..7ff2a67a4c --- /dev/null +++ b/queue-6.6/net-mlxfw-drop-hard-coded-max-fw-flash-image-size.patch @@ -0,0 +1,53 @@ +From 49ef2b0ffa286fb35ad0e6dbe9c26bdf02cefb3c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 16 Jan 2025 14:33:16 +0200 +Subject: net/mlxfw: Drop hard coded max FW flash image size + +From: Maher Sanalla + +[ Upstream commit 70d81f25cc92cc4e914516c9935ae752f27d78ad ] + +Currently, mlxfw kernel module limits FW flash image size to be +10MB at most, preventing the ability to burn recent BlueField-3 +FW that exceeds the said size limit. + +Thus, drop the hard coded limit. Instead, rely on FW's +max_component_size threshold that is reported in MCQI register +as the size limit for FW image. + +Fixes: 410ed13cae39 ("Add the mlxfw module for Mellanox firmware flash process") +Signed-off-by: Maher Sanalla +Signed-off-by: Moshe Shemesh +Reviewed-by: Ido Schimmel +Tested-by: Ido Schimmel +Reviewed-by: Michal Swiatkowski +Link: https://patch.msgid.link/1737030796-1441634-1-git-send-email-moshe@nvidia.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c b/drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c +index 46245e0b24623..43c84900369a3 100644 +--- a/drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c ++++ b/drivers/net/ethernet/mellanox/mlxfw/mlxfw_fsm.c +@@ -14,7 +14,6 @@ + #define MLXFW_FSM_STATE_WAIT_TIMEOUT_MS 30000 + #define MLXFW_FSM_STATE_WAIT_ROUNDS \ + (MLXFW_FSM_STATE_WAIT_TIMEOUT_MS / MLXFW_FSM_STATE_WAIT_CYCLE_MS) +-#define MLXFW_FSM_MAX_COMPONENT_SIZE (10 * (1 << 20)) + + static const int mlxfw_fsm_state_errno[] = { + [MLXFW_FSM_STATE_ERR_ERROR] = -EIO, +@@ -229,7 +228,6 @@ static int mlxfw_flash_component(struct mlxfw_dev *mlxfw_dev, + return err; + } + +- comp_max_size = min_t(u32, comp_max_size, MLXFW_FSM_MAX_COMPONENT_SIZE); + if (comp->data_size > comp_max_size) { + MLXFW_ERR_MSG(mlxfw_dev, extack, + "Component size is bigger than limit", -EINVAL); +-- +2.39.5 + diff --git a/queue-6.6/net-netdevsim-try-to-close-udp-port-harness-races.patch b/queue-6.6/net-netdevsim-try-to-close-udp-port-harness-races.patch new file mode 100644 index 0000000000..78e1865bfd --- /dev/null +++ b/queue-6.6/net-netdevsim-try-to-close-udp-port-harness-races.patch @@ -0,0 +1,175 @@ +From 8249925e497373564309c3ae7541168cad3408d8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Jan 2025 14:45:03 -0800 +Subject: net: netdevsim: try to close UDP port harness races + +From: Jakub Kicinski + +[ Upstream commit 50bf398e1ceacb9a7f85bd3bdca065ebe5cb6159 ] + +syzbot discovered that we remove the debugfs files after we free +the netdev. Try to clean up the relevant dir while the device +is still around. + +Reported-by: syzbot+2e5de9e3ab986b71d2bf@syzkaller.appspotmail.com +Fixes: 424be63ad831 ("netdevsim: add UDP tunnel port offload support") +Reviewed-by: Michal Swiatkowski +Link: https://patch.msgid.link/20250122224503.762705-1-kuba@kernel.org +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/netdevsim/netdevsim.h | 1 + + drivers/net/netdevsim/udp_tunnels.c | 23 +++++++++++-------- + .../drivers/net/netdevsim/udp_tunnel_nic.sh | 16 ++++++------- + 3 files changed, 23 insertions(+), 17 deletions(-) + +diff --git a/drivers/net/netdevsim/netdevsim.h b/drivers/net/netdevsim/netdevsim.h +index 028c825b86db1..dfc6e00b718e3 100644 +--- a/drivers/net/netdevsim/netdevsim.h ++++ b/drivers/net/netdevsim/netdevsim.h +@@ -121,6 +121,7 @@ struct netdevsim { + u32 sleep; + u32 __ports[2][NSIM_UDP_TUNNEL_N_PORTS]; + u32 (*ports)[NSIM_UDP_TUNNEL_N_PORTS]; ++ struct dentry *ddir; + struct debugfs_u32_array dfs_ports[2]; + } udp_ports; + +diff --git a/drivers/net/netdevsim/udp_tunnels.c b/drivers/net/netdevsim/udp_tunnels.c +index 02dc3123eb6c1..640b4983a9a0d 100644 +--- a/drivers/net/netdevsim/udp_tunnels.c ++++ b/drivers/net/netdevsim/udp_tunnels.c +@@ -112,9 +112,11 @@ nsim_udp_tunnels_info_reset_write(struct file *file, const char __user *data, + struct net_device *dev = file->private_data; + struct netdevsim *ns = netdev_priv(dev); + +- memset(ns->udp_ports.ports, 0, sizeof(ns->udp_ports.__ports)); + rtnl_lock(); +- udp_tunnel_nic_reset_ntf(dev); ++ if (dev->reg_state == NETREG_REGISTERED) { ++ memset(ns->udp_ports.ports, 0, sizeof(ns->udp_ports.__ports)); ++ udp_tunnel_nic_reset_ntf(dev); ++ } + rtnl_unlock(); + + return count; +@@ -144,23 +146,23 @@ int nsim_udp_tunnels_info_create(struct nsim_dev *nsim_dev, + else + ns->udp_ports.ports = nsim_dev->udp_ports.__ports; + +- debugfs_create_u32("udp_ports_inject_error", 0600, +- ns->nsim_dev_port->ddir, ++ ns->udp_ports.ddir = debugfs_create_dir("udp_ports", ++ ns->nsim_dev_port->ddir); ++ ++ debugfs_create_u32("inject_error", 0600, ns->udp_ports.ddir, + &ns->udp_ports.inject_error); + + ns->udp_ports.dfs_ports[0].array = ns->udp_ports.ports[0]; + ns->udp_ports.dfs_ports[0].n_elements = NSIM_UDP_TUNNEL_N_PORTS; +- debugfs_create_u32_array("udp_ports_table0", 0400, +- ns->nsim_dev_port->ddir, ++ debugfs_create_u32_array("table0", 0400, ns->udp_ports.ddir, + &ns->udp_ports.dfs_ports[0]); + + ns->udp_ports.dfs_ports[1].array = ns->udp_ports.ports[1]; + ns->udp_ports.dfs_ports[1].n_elements = NSIM_UDP_TUNNEL_N_PORTS; +- debugfs_create_u32_array("udp_ports_table1", 0400, +- ns->nsim_dev_port->ddir, ++ debugfs_create_u32_array("table1", 0400, ns->udp_ports.ddir, + &ns->udp_ports.dfs_ports[1]); + +- debugfs_create_file("udp_ports_reset", 0200, ns->nsim_dev_port->ddir, ++ debugfs_create_file("reset", 0200, ns->udp_ports.ddir, + dev, &nsim_udp_tunnels_info_reset_fops); + + /* Note: it's not normal to allocate the info struct like this! +@@ -196,6 +198,9 @@ int nsim_udp_tunnels_info_create(struct nsim_dev *nsim_dev, + + void nsim_udp_tunnels_info_destroy(struct net_device *dev) + { ++ struct netdevsim *ns = netdev_priv(dev); ++ ++ debugfs_remove_recursive(ns->udp_ports.ddir); + kfree(dev->udp_tunnel_nic_info); + dev->udp_tunnel_nic_info = NULL; + } +diff --git a/tools/testing/selftests/drivers/net/netdevsim/udp_tunnel_nic.sh b/tools/testing/selftests/drivers/net/netdevsim/udp_tunnel_nic.sh +index 185b02d2d4cd1..7af78990b5bb6 100755 +--- a/tools/testing/selftests/drivers/net/netdevsim/udp_tunnel_nic.sh ++++ b/tools/testing/selftests/drivers/net/netdevsim/udp_tunnel_nic.sh +@@ -142,7 +142,7 @@ function pre_ethtool { + } + + function check_table { +- local path=$NSIM_DEV_DFS/ports/$port/udp_ports_table$1 ++ local path=$NSIM_DEV_DFS/ports/$port/udp_ports/table$1 + local -n expected=$2 + local last=$3 + +@@ -212,7 +212,7 @@ function check_tables { + } + + function print_table { +- local path=$NSIM_DEV_DFS/ports/$port/udp_ports_table$1 ++ local path=$NSIM_DEV_DFS/ports/$port/udp_ports/table$1 + read -a have < $path + + tree $NSIM_DEV_DFS/ +@@ -640,7 +640,7 @@ for port in 0 1; do + NSIM_NETDEV=`get_netdev_name old_netdevs` + ifconfig $NSIM_NETDEV up + +- echo 110 > $NSIM_DEV_DFS/ports/$port/udp_ports_inject_error ++ echo 110 > $NSIM_DEV_DFS/ports/$port/udp_ports/inject_error + + msg="1 - create VxLANs v6" + exp0=( 0 0 0 0 ) +@@ -662,7 +662,7 @@ for port in 0 1; do + new_geneve gnv0 20000 + + msg="2 - destroy GENEVE" +- echo 2 > $NSIM_DEV_DFS/ports/$port/udp_ports_inject_error ++ echo 2 > $NSIM_DEV_DFS/ports/$port/udp_ports/inject_error + exp1=( `mke 20000 2` 0 0 0 ) + del_dev gnv0 + +@@ -763,7 +763,7 @@ for port in 0 1; do + msg="create VxLANs v4" + new_vxlan vxlan0 10000 $NSIM_NETDEV + +- echo 1 > $NSIM_DEV_DFS/ports/$port/udp_ports_reset ++ echo 1 > $NSIM_DEV_DFS/ports/$port/udp_ports/reset + check_tables + + msg="NIC device goes down" +@@ -774,7 +774,7 @@ for port in 0 1; do + fi + check_tables + +- echo 1 > $NSIM_DEV_DFS/ports/$port/udp_ports_reset ++ echo 1 > $NSIM_DEV_DFS/ports/$port/udp_ports/reset + check_tables + + msg="NIC device goes up again" +@@ -788,7 +788,7 @@ for port in 0 1; do + del_dev vxlan0 + check_tables + +- echo 1 > $NSIM_DEV_DFS/ports/$port/udp_ports_reset ++ echo 1 > $NSIM_DEV_DFS/ports/$port/udp_ports/reset + check_tables + + msg="destroy NIC" +@@ -895,7 +895,7 @@ msg="vacate VxLAN in overflow table" + exp0=( `mke 10000 1` `mke 10004 1` 0 `mke 10003 1` ) + del_dev vxlan2 + +-echo 1 > $NSIM_DEV_DFS/ports/$port/udp_ports_reset ++echo 1 > $NSIM_DEV_DFS/ports/$port/udp_ports/reset + check_tables + + msg="tunnels destroyed 2" +-- +2.39.5 + diff --git a/queue-6.6/net-rose-fix-timer-races-against-user-threads.patch b/queue-6.6/net-rose-fix-timer-races-against-user-threads.patch new file mode 100644 index 0000000000..e73545bffe --- /dev/null +++ b/queue-6.6/net-rose-fix-timer-races-against-user-threads.patch @@ -0,0 +1,116 @@ +From 7e8e3467bc89366a4e1d750204f5e59dbfb56f0d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Jan 2025 18:02:44 +0000 +Subject: net: rose: fix timer races against user threads + +From: Eric Dumazet + +[ Upstream commit 5de7665e0a0746b5ad7943554b34db8f8614a196 ] + +Rose timers only acquire the socket spinlock, without +checking if the socket is owned by one user thread. + +Add a check and rearm the timers if needed. + +BUG: KASAN: slab-use-after-free in rose_timer_expiry+0x31d/0x360 net/rose/rose_timer.c:174 +Read of size 2 at addr ffff88802f09b82a by task swapper/0/0 + +CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.13.0-rc5-syzkaller-00172-gd1bf27c4e176 #0 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 +Call Trace: + + __dump_stack lib/dump_stack.c:94 [inline] + dump_stack_lvl+0x241/0x360 lib/dump_stack.c:120 + print_address_description mm/kasan/report.c:378 [inline] + print_report+0x169/0x550 mm/kasan/report.c:489 + kasan_report+0x143/0x180 mm/kasan/report.c:602 + rose_timer_expiry+0x31d/0x360 net/rose/rose_timer.c:174 + call_timer_fn+0x187/0x650 kernel/time/timer.c:1793 + expire_timers kernel/time/timer.c:1844 [inline] + __run_timers kernel/time/timer.c:2418 [inline] + __run_timer_base+0x66a/0x8e0 kernel/time/timer.c:2430 + run_timer_base kernel/time/timer.c:2439 [inline] + run_timer_softirq+0xb7/0x170 kernel/time/timer.c:2449 + handle_softirqs+0x2d4/0x9b0 kernel/softirq.c:561 + __do_softirq kernel/softirq.c:595 [inline] + invoke_softirq kernel/softirq.c:435 [inline] + __irq_exit_rcu+0xf7/0x220 kernel/softirq.c:662 + irq_exit_rcu+0x9/0x30 kernel/softirq.c:678 + instr_sysvec_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1049 [inline] + sysvec_apic_timer_interrupt+0xa6/0xc0 arch/x86/kernel/apic/apic.c:1049 + + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Reported-by: syzbot +Signed-off-by: Eric Dumazet +Link: https://patch.msgid.link/20250122180244.1861468-1-edumazet@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/rose/rose_timer.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/net/rose/rose_timer.c b/net/rose/rose_timer.c +index f06ddbed3fed6..1525773e94aa1 100644 +--- a/net/rose/rose_timer.c ++++ b/net/rose/rose_timer.c +@@ -122,6 +122,10 @@ static void rose_heartbeat_expiry(struct timer_list *t) + struct rose_sock *rose = rose_sk(sk); + + bh_lock_sock(sk); ++ if (sock_owned_by_user(sk)) { ++ sk_reset_timer(sk, &sk->sk_timer, jiffies + HZ/20); ++ goto out; ++ } + switch (rose->state) { + case ROSE_STATE_0: + /* Magic here: If we listen() and a new link dies before it +@@ -152,6 +156,7 @@ static void rose_heartbeat_expiry(struct timer_list *t) + } + + rose_start_heartbeat(sk); ++out: + bh_unlock_sock(sk); + sock_put(sk); + } +@@ -162,6 +167,10 @@ static void rose_timer_expiry(struct timer_list *t) + struct sock *sk = &rose->sock; + + bh_lock_sock(sk); ++ if (sock_owned_by_user(sk)) { ++ sk_reset_timer(sk, &rose->timer, jiffies + HZ/20); ++ goto out; ++ } + switch (rose->state) { + case ROSE_STATE_1: /* T1 */ + case ROSE_STATE_4: /* T2 */ +@@ -182,6 +191,7 @@ static void rose_timer_expiry(struct timer_list *t) + } + break; + } ++out: + bh_unlock_sock(sk); + sock_put(sk); + } +@@ -192,6 +202,10 @@ static void rose_idletimer_expiry(struct timer_list *t) + struct sock *sk = &rose->sock; + + bh_lock_sock(sk); ++ if (sock_owned_by_user(sk)) { ++ sk_reset_timer(sk, &rose->idletimer, jiffies + HZ/20); ++ goto out; ++ } + rose_clear_queues(sk); + + rose_write_internal(sk, ROSE_CLEAR_REQUEST); +@@ -207,6 +221,7 @@ static void rose_idletimer_expiry(struct timer_list *t) + sk->sk_state_change(sk); + sock_set_flag(sk, SOCK_DEAD); + } ++out: + bh_unlock_sock(sk); + sock_put(sk); + } +-- +2.39.5 + diff --git a/queue-6.6/net-rose-prevent-integer-overflows-in-rose_setsockop.patch b/queue-6.6/net-rose-prevent-integer-overflows-in-rose_setsockop.patch new file mode 100644 index 0000000000..ff25990fbe --- /dev/null +++ b/queue-6.6/net-rose-prevent-integer-overflows-in-rose_setsockop.patch @@ -0,0 +1,90 @@ +From f55bcd92c6d66f5961c17baf6742edb4844c3183 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Jan 2025 08:42:20 -0800 +Subject: net/rose: prevent integer overflows in rose_setsockopt() + +From: Nikita Zhandarovich + +[ Upstream commit d640627663bfe7d8963c7615316d7d4ef60f3b0b ] + +In case of possible unpredictably large arguments passed to +rose_setsockopt() and multiplied by extra values on top of that, +integer overflows may occur. + +Do the safest minimum and fix these issues by checking the +contents of 'opt' and returning -EINVAL if they are too large. Also, +switch to unsigned int and remove useless check for negative 'opt' +in ROSE_IDLE case. + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Signed-off-by: Nikita Zhandarovich +Link: https://patch.msgid.link/20250115164220.19954-1-n.zhandarovich@fintech.ru +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/rose/af_rose.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c +index 42e8b9e37516b..342823b918e7c 100644 +--- a/net/rose/af_rose.c ++++ b/net/rose/af_rose.c +@@ -397,15 +397,15 @@ static int rose_setsockopt(struct socket *sock, int level, int optname, + { + struct sock *sk = sock->sk; + struct rose_sock *rose = rose_sk(sk); +- int opt; ++ unsigned int opt; + + if (level != SOL_ROSE) + return -ENOPROTOOPT; + +- if (optlen < sizeof(int)) ++ if (optlen < sizeof(unsigned int)) + return -EINVAL; + +- if (copy_from_sockptr(&opt, optval, sizeof(int))) ++ if (copy_from_sockptr(&opt, optval, sizeof(unsigned int))) + return -EFAULT; + + switch (optname) { +@@ -414,31 +414,31 @@ static int rose_setsockopt(struct socket *sock, int level, int optname, + return 0; + + case ROSE_T1: +- if (opt < 1) ++ if (opt < 1 || opt > UINT_MAX / HZ) + return -EINVAL; + rose->t1 = opt * HZ; + return 0; + + case ROSE_T2: +- if (opt < 1) ++ if (opt < 1 || opt > UINT_MAX / HZ) + return -EINVAL; + rose->t2 = opt * HZ; + return 0; + + case ROSE_T3: +- if (opt < 1) ++ if (opt < 1 || opt > UINT_MAX / HZ) + return -EINVAL; + rose->t3 = opt * HZ; + return 0; + + case ROSE_HOLDBACK: +- if (opt < 1) ++ if (opt < 1 || opt > UINT_MAX / HZ) + return -EINVAL; + rose->hb = opt * HZ; + return 0; + + case ROSE_IDLE: +- if (opt < 0) ++ if (opt > UINT_MAX / (60 * HZ)) + return -EINVAL; + rose->idle = opt * 60 * HZ; + return 0; +-- +2.39.5 + diff --git a/queue-6.6/net-sched-disallow-replacing-of-child-qdisc-from-one.patch b/queue-6.6/net-sched-disallow-replacing-of-child-qdisc-from-one.patch new file mode 100644 index 0000000000..ab9770d93a --- /dev/null +++ b/queue-6.6/net-sched-disallow-replacing-of-child-qdisc-from-one.patch @@ -0,0 +1,115 @@ +From f06849ed27d7ad4072e2de524bde8e46c774faa0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 Jan 2025 17:37:13 -0800 +Subject: net: sched: Disallow replacing of child qdisc from one parent to + another + +From: Jamal Hadi Salim + +[ Upstream commit bc50835e83f60f56e9bec2b392fb5544f250fb6f ] + +Lion Ackermann was able to create a UAF which can be abused for privilege +escalation with the following script + +Step 1. create root qdisc +tc qdisc add dev lo root handle 1:0 drr + +step2. a class for packet aggregation do demonstrate uaf +tc class add dev lo classid 1:1 drr + +step3. a class for nesting +tc class add dev lo classid 1:2 drr + +step4. a class to graft qdisc to +tc class add dev lo classid 1:3 drr + +step5. +tc qdisc add dev lo parent 1:1 handle 2:0 plug limit 1024 + +step6. +tc qdisc add dev lo parent 1:2 handle 3:0 drr + +step7. +tc class add dev lo classid 3:1 drr + +step 8. +tc qdisc add dev lo parent 3:1 handle 4:0 pfifo + +step 9. Display the class/qdisc layout + +tc class ls dev lo + class drr 1:1 root leaf 2: quantum 64Kb + class drr 1:2 root leaf 3: quantum 64Kb + class drr 3:1 root leaf 4: quantum 64Kb + +tc qdisc ls + qdisc drr 1: dev lo root refcnt 2 + qdisc plug 2: dev lo parent 1:1 + qdisc pfifo 4: dev lo parent 3:1 limit 1000p + qdisc drr 3: dev lo parent 1:2 + +step10. trigger the bug <=== prevented by this patch +tc qdisc replace dev lo parent 1:3 handle 4:0 + +step 11. Redisplay again the qdiscs/classes + +tc class ls dev lo + class drr 1:1 root leaf 2: quantum 64Kb + class drr 1:2 root leaf 3: quantum 64Kb + class drr 1:3 root leaf 4: quantum 64Kb + class drr 3:1 root leaf 4: quantum 64Kb + +tc qdisc ls + qdisc drr 1: dev lo root refcnt 2 + qdisc plug 2: dev lo parent 1:1 + qdisc pfifo 4: dev lo parent 3:1 refcnt 2 limit 1000p + qdisc drr 3: dev lo parent 1:2 + +Observe that a) parent for 4:0 does not change despite the replace request. +There can only be one parent. b) refcount has gone up by two for 4:0 and +c) both class 1:3 and 3:1 are pointing to it. + +Step 12. send one packet to plug +echo "" | socat -u STDIN UDP4-DATAGRAM:127.0.0.1:8888,priority=$((0x10001)) +step13. send one packet to the grafted fifo +echo "" | socat -u STDIN UDP4-DATAGRAM:127.0.0.1:8888,priority=$((0x10003)) + +step14. lets trigger the uaf +tc class delete dev lo classid 1:3 +tc class delete dev lo classid 1:1 + +The semantics of "replace" is for a del/add _on the same node_ and not +a delete from one node(3:1) and add to another node (1:3) as in step10. +While we could "fix" with a more complex approach there could be +consequences to expectations so the patch takes the preventive approach of +"disallow such config". + +Joint work with Lion Ackermann +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Signed-off-by: Jamal Hadi Salim +Reviewed-by: Simon Horman +Link: https://patch.msgid.link/20250116013713.900000-1-kuba@kernel.org +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/sched/sch_api.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c +index 00f95e7d1b911..7cddaa6321c7c 100644 +--- a/net/sched/sch_api.c ++++ b/net/sched/sch_api.c +@@ -1635,6 +1635,10 @@ static int tc_modify_qdisc(struct sk_buff *skb, struct nlmsghdr *n, + q = qdisc_lookup(dev, tcm->tcm_handle); + if (!q) + goto create_n_graft; ++ if (q->parent != tcm->tcm_parent) { ++ NL_SET_ERR_MSG(extack, "Cannot move an existing qdisc to a different parent"); ++ return -EINVAL; ++ } + if (n->nlmsg_flags & NLM_F_EXCL) { + NL_SET_ERR_MSG(extack, "Exclusivity flag on, cannot override"); + return -EEXIST; +-- +2.39.5 + diff --git a/queue-6.6/net-sh_eth-fix-missing-rtnl-lock-in-suspend-resume-p.patch b/queue-6.6/net-sh_eth-fix-missing-rtnl-lock-in-suspend-resume-p.patch new file mode 100644 index 0000000000..a801b43542 --- /dev/null +++ b/queue-6.6/net-sh_eth-fix-missing-rtnl-lock-in-suspend-resume-p.patch @@ -0,0 +1,60 @@ +From 58f315ad95721b16f48cb84c57d2f046d3cac4e4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 29 Jan 2025 10:50:47 +0100 +Subject: net: sh_eth: Fix missing rtnl lock in suspend/resume path +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Kory Maincent + +[ Upstream commit b95102215a8d0987789715ce11c0d4ec031cbfbe ] + +Fix the suspend/resume path by ensuring the rtnl lock is held where +required. Calls to sh_eth_close, sh_eth_open and wol operations must be +performed under the rtnl lock to prevent conflicts with ongoing ndo +operations. + +Fixes: b71af04676e9 ("sh_eth: add more PM methods") +Tested-by: Niklas Söderlund +Reviewed-by: Sergey Shtylyov +Signed-off-by: Kory Maincent +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/renesas/sh_eth.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c +index 274ea16c0a1f7..0c0fd68ded423 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -3496,10 +3496,12 @@ static int sh_eth_suspend(struct device *dev) + + netif_device_detach(ndev); + ++ rtnl_lock(); + if (mdp->wol_enabled) + ret = sh_eth_wol_setup(ndev); + else + ret = sh_eth_close(ndev); ++ rtnl_unlock(); + + return ret; + } +@@ -3513,10 +3515,12 @@ static int sh_eth_resume(struct device *dev) + if (!netif_running(ndev)) + return 0; + ++ rtnl_lock(); + if (mdp->wol_enabled) + ret = sh_eth_wol_restore(ndev); + else + ret = sh_eth_open(ndev); ++ rtnl_unlock(); + + if (ret < 0) + return ret; +-- +2.39.5 + diff --git a/queue-6.6/net-smc-fix-data-error-when-recvmsg-with-msg_peek-fl.patch b/queue-6.6/net-smc-fix-data-error-when-recvmsg-with-msg_peek-fl.patch new file mode 100644 index 0000000000..4dc8bc5853 --- /dev/null +++ b/queue-6.6/net-smc-fix-data-error-when-recvmsg-with-msg_peek-fl.patch @@ -0,0 +1,244 @@ +From 313e06cb0e802b1df26d48b0daabbf37b1ba18fa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 4 Jan 2025 22:32:01 +0800 +Subject: net/smc: fix data error when recvmsg with MSG_PEEK flag + +From: Guangguan Wang + +[ Upstream commit a4b6539038c1aa1ae871aacf6e41b566c3613993 ] + +When recvmsg with MSG_PEEK flag, the data will be copied to +user's buffer without advancing consume cursor and without +reducing the length of rx available data. Once the expected +peek length is larger than the value of bytes_to_rcv, in the +loop of do while in smc_rx_recvmsg, the first loop will copy +bytes_to_rcv bytes of data from the position local_tx_ctrl.cons, +the second loop will copy the min(bytes_to_rcv, read_remaining) +bytes from the position local_tx_ctrl.cons again because of the +lacking of process with advancing consume cursor and reducing +the length of available data. So do the subsequent loops. The +data copied in the second loop and the subsequent loops will +result in data error, as it should not be copied if no more data +arrives and it should be copied from the position advancing +bytes_to_rcv bytes from the local_tx_ctrl.cons if more data arrives. + +This issue can be reproduce by the following python script: +server.py: +import socket +import time +server_ip = '0.0.0.0' +server_port = 12346 +server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +server_socket.bind((server_ip, server_port)) +server_socket.listen(1) +print('Server is running and listening for connections...') +conn, addr = server_socket.accept() +print('Connected by', addr) +while True: + data = conn.recv(1024) + if not data: + break + print('Received request:', data.decode()) + conn.sendall(b'Hello, client!\n') + time.sleep(5) + conn.sendall(b'Hello, again!\n') +conn.close() + +client.py: +import socket +server_ip = '' +server_port = 12346 +resp=b'Hello, client!\nHello, again!\n' +client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +client_socket.connect((server_ip, server_port)) +request = 'Hello, server!' +client_socket.sendall(request.encode()) +peek_data = client_socket.recv(len(resp), + socket.MSG_PEEK | socket.MSG_WAITALL) +print('Peeked data:', peek_data.decode()) +client_socket.close() + +Fixes: 952310ccf2d8 ("smc: receive data from RMBE") +Reported-by: D. Wythe +Signed-off-by: Guangguan Wang +Link: https://patch.msgid.link/20250104143201.35529-1-guangguan.wang@linux.alibaba.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/smc/af_smc.c | 2 +- + net/smc/smc_rx.c | 37 +++++++++++++++++++++---------------- + net/smc/smc_rx.h | 8 ++++---- + 3 files changed, 26 insertions(+), 21 deletions(-) + +diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c +index 0acf07538840c..45efbbfff94ae 100644 +--- a/net/smc/af_smc.c ++++ b/net/smc/af_smc.c +@@ -2745,7 +2745,7 @@ static int smc_accept(struct socket *sock, struct socket *new_sock, + release_sock(clcsk); + } else if (!atomic_read(&smc_sk(nsk)->conn.bytes_to_rcv)) { + lock_sock(nsk); +- smc_rx_wait(smc_sk(nsk), &timeo, smc_rx_data_available); ++ smc_rx_wait(smc_sk(nsk), &timeo, 0, smc_rx_data_available); + release_sock(nsk); + } + } +diff --git a/net/smc/smc_rx.c b/net/smc/smc_rx.c +index 9a2f3638d161d..acb14e28cad41 100644 +--- a/net/smc/smc_rx.c ++++ b/net/smc/smc_rx.c +@@ -238,22 +238,23 @@ static int smc_rx_splice(struct pipe_inode_info *pipe, char *src, size_t len, + return -ENOMEM; + } + +-static int smc_rx_data_available_and_no_splice_pend(struct smc_connection *conn) ++static int smc_rx_data_available_and_no_splice_pend(struct smc_connection *conn, size_t peeked) + { +- return atomic_read(&conn->bytes_to_rcv) && ++ return smc_rx_data_available(conn, peeked) && + !atomic_read(&conn->splice_pending); + } + + /* blocks rcvbuf consumer until >=len bytes available or timeout or interrupted + * @smc smc socket + * @timeo pointer to max seconds to wait, pointer to value 0 for no timeout ++ * @peeked number of bytes already peeked + * @fcrit add'l criterion to evaluate as function pointer + * Returns: + * 1 if at least 1 byte available in rcvbuf or if socket error/shutdown. + * 0 otherwise (nothing in rcvbuf nor timeout, e.g. interrupted). + */ +-int smc_rx_wait(struct smc_sock *smc, long *timeo, +- int (*fcrit)(struct smc_connection *conn)) ++int smc_rx_wait(struct smc_sock *smc, long *timeo, size_t peeked, ++ int (*fcrit)(struct smc_connection *conn, size_t baseline)) + { + DEFINE_WAIT_FUNC(wait, woken_wake_function); + struct smc_connection *conn = &smc->conn; +@@ -262,7 +263,7 @@ int smc_rx_wait(struct smc_sock *smc, long *timeo, + struct sock *sk = &smc->sk; + int rc; + +- if (fcrit(conn)) ++ if (fcrit(conn, peeked)) + return 1; + sk_set_bit(SOCKWQ_ASYNC_WAITDATA, sk); + add_wait_queue(sk_sleep(sk), &wait); +@@ -271,7 +272,7 @@ int smc_rx_wait(struct smc_sock *smc, long *timeo, + cflags->peer_conn_abort || + READ_ONCE(sk->sk_shutdown) & RCV_SHUTDOWN || + conn->killed || +- fcrit(conn), ++ fcrit(conn, peeked), + &wait); + remove_wait_queue(sk_sleep(sk), &wait); + sk_clear_bit(SOCKWQ_ASYNC_WAITDATA, sk); +@@ -322,11 +323,11 @@ static int smc_rx_recv_urg(struct smc_sock *smc, struct msghdr *msg, int len, + return -EAGAIN; + } + +-static bool smc_rx_recvmsg_data_available(struct smc_sock *smc) ++static bool smc_rx_recvmsg_data_available(struct smc_sock *smc, size_t peeked) + { + struct smc_connection *conn = &smc->conn; + +- if (smc_rx_data_available(conn)) ++ if (smc_rx_data_available(conn, peeked)) + return true; + else if (conn->urg_state == SMC_URG_VALID) + /* we received a single urgent Byte - skip */ +@@ -344,10 +345,10 @@ static bool smc_rx_recvmsg_data_available(struct smc_sock *smc) + int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg, + struct pipe_inode_info *pipe, size_t len, int flags) + { +- size_t copylen, read_done = 0, read_remaining = len; ++ size_t copylen, read_done = 0, read_remaining = len, peeked_bytes = 0; + size_t chunk_len, chunk_off, chunk_len_sum; + struct smc_connection *conn = &smc->conn; +- int (*func)(struct smc_connection *conn); ++ int (*func)(struct smc_connection *conn, size_t baseline); + union smc_host_cursor cons; + int readable, chunk; + char *rcvbuf_base; +@@ -384,14 +385,14 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg, + if (conn->killed) + break; + +- if (smc_rx_recvmsg_data_available(smc)) ++ if (smc_rx_recvmsg_data_available(smc, peeked_bytes)) + goto copy; + + if (sk->sk_shutdown & RCV_SHUTDOWN) { + /* smc_cdc_msg_recv_action() could have run after + * above smc_rx_recvmsg_data_available() + */ +- if (smc_rx_recvmsg_data_available(smc)) ++ if (smc_rx_recvmsg_data_available(smc, peeked_bytes)) + goto copy; + break; + } +@@ -425,26 +426,28 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg, + } + } + +- if (!smc_rx_data_available(conn)) { +- smc_rx_wait(smc, &timeo, smc_rx_data_available); ++ if (!smc_rx_data_available(conn, peeked_bytes)) { ++ smc_rx_wait(smc, &timeo, peeked_bytes, smc_rx_data_available); + continue; + } + + copy: + /* initialize variables for 1st iteration of subsequent loop */ + /* could be just 1 byte, even after waiting on data above */ +- readable = atomic_read(&conn->bytes_to_rcv); ++ readable = smc_rx_data_available(conn, peeked_bytes); + splbytes = atomic_read(&conn->splice_pending); + if (!readable || (msg && splbytes)) { + if (splbytes) + func = smc_rx_data_available_and_no_splice_pend; + else + func = smc_rx_data_available; +- smc_rx_wait(smc, &timeo, func); ++ smc_rx_wait(smc, &timeo, peeked_bytes, func); + continue; + } + + smc_curs_copy(&cons, &conn->local_tx_ctrl.cons, conn); ++ if ((flags & MSG_PEEK) && peeked_bytes) ++ smc_curs_add(conn->rmb_desc->len, &cons, peeked_bytes); + /* subsequent splice() calls pick up where previous left */ + if (splbytes) + smc_curs_add(conn->rmb_desc->len, &cons, splbytes); +@@ -480,6 +483,8 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg, + } + read_remaining -= chunk_len; + read_done += chunk_len; ++ if (flags & MSG_PEEK) ++ peeked_bytes += chunk_len; + + if (chunk_len_sum == copylen) + break; /* either on 1st or 2nd iteration */ +diff --git a/net/smc/smc_rx.h b/net/smc/smc_rx.h +index db823c97d824e..994f5e42d1ba2 100644 +--- a/net/smc/smc_rx.h ++++ b/net/smc/smc_rx.h +@@ -21,11 +21,11 @@ void smc_rx_init(struct smc_sock *smc); + + int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg, + struct pipe_inode_info *pipe, size_t len, int flags); +-int smc_rx_wait(struct smc_sock *smc, long *timeo, +- int (*fcrit)(struct smc_connection *conn)); +-static inline int smc_rx_data_available(struct smc_connection *conn) ++int smc_rx_wait(struct smc_sock *smc, long *timeo, size_t peeked, ++ int (*fcrit)(struct smc_connection *conn, size_t baseline)); ++static inline int smc_rx_data_available(struct smc_connection *conn, size_t peeked) + { +- return atomic_read(&conn->bytes_to_rcv); ++ return atomic_read(&conn->bytes_to_rcv) - peeked; + } + + #endif /* SMC_RX_H */ +-- +2.39.5 + diff --git a/queue-6.6/net-stmmac-limit-fifo-size-by-hardware-capability.patch b/queue-6.6/net-stmmac-limit-fifo-size-by-hardware-capability.patch new file mode 100644 index 0000000000..4b1b102d45 --- /dev/null +++ b/queue-6.6/net-stmmac-limit-fifo-size-by-hardware-capability.patch @@ -0,0 +1,57 @@ +From 04d2588fd5d49e58a02aa8d5cc4a1f0fd1ae81b7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Jan 2025 10:38:19 +0900 +Subject: net: stmmac: Limit FIFO size by hardware capability + +From: Kunihiko Hayashi + +[ Upstream commit 044f2fbaa2725696ecbf1f02ba7ab0a8ccb7e1ae ] + +Tx/Rx FIFO size is specified by the parameter "{tx,rx}-fifo-depth" from +stmmac_platform layer. + +However, these values are constrained by upper limits determined by the +capabilities of each hardware feature. There is a risk that the upper +bits will be truncated due to the calculation, so it's appropriate to +limit them to the upper limit values and display a warning message. + +This only works if the hardware capability has the upper limit values. + +Fixes: e7877f52fd4a ("stmmac: Read tx-fifo-depth and rx-fifo-depth from the devicetree") +Signed-off-by: Kunihiko Hayashi +Reviewed-by: Yanteng Si +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +index 48ad12bca9566..d3d5c01f6dcba 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -7118,6 +7118,21 @@ static int stmmac_hw_init(struct stmmac_priv *priv) + priv->plat->tx_queues_to_use = priv->dma_cap.number_tx_queues; + } + ++ if (priv->dma_cap.rx_fifo_size && ++ priv->plat->rx_fifo_size > priv->dma_cap.rx_fifo_size) { ++ dev_warn(priv->device, ++ "Rx FIFO size (%u) exceeds dma capability\n", ++ priv->plat->rx_fifo_size); ++ priv->plat->rx_fifo_size = priv->dma_cap.rx_fifo_size; ++ } ++ if (priv->dma_cap.tx_fifo_size && ++ priv->plat->tx_fifo_size > priv->dma_cap.tx_fifo_size) { ++ dev_warn(priv->device, ++ "Tx FIFO size (%u) exceeds dma capability\n", ++ priv->plat->tx_fifo_size); ++ priv->plat->tx_fifo_size = priv->dma_cap.tx_fifo_size; ++ } ++ + priv->hw->vlan_fail_q_en = + (priv->plat->flags & STMMAC_FLAG_VLAN_FAIL_Q_EN); + priv->hw->vlan_fail_q = priv->plat->vlan_fail_q; +-- +2.39.5 + diff --git a/queue-6.6/net-stmmac-limit-the-number-of-mtl-queues-to-hardwar.patch b/queue-6.6/net-stmmac-limit-the-number-of-mtl-queues-to-hardwar.patch new file mode 100644 index 0000000000..25aa847199 --- /dev/null +++ b/queue-6.6/net-stmmac-limit-the-number-of-mtl-queues-to-hardwar.patch @@ -0,0 +1,57 @@ +From 76399ff82c82383be660b14d7425bc86166de7e5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Jan 2025 10:38:18 +0900 +Subject: net: stmmac: Limit the number of MTL queues to hardware capability + +From: Kunihiko Hayashi + +[ Upstream commit f5fb35a3d6b36d378b2e2ecbfb9caa337d5428e6 ] + +The number of MTL queues to use is specified by the parameter +"snps,{tx,rx}-queues-to-use" from stmmac_platform layer. + +However, the maximum numbers of queues are constrained by upper limits +determined by the capability of each hardware feature. It's appropriate +to limit the values not to exceed the upper limit values and display +a warning message. + +This only works if the hardware capability has the upper limit values. + +Fixes: d976a525c371 ("net: stmmac: multiple queues dt configuration") +Signed-off-by: Kunihiko Hayashi +Reviewed-by: Yanteng Si +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +index d6ee90fef2eca..48ad12bca9566 100644 +--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c ++++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +@@ -7103,6 +7103,21 @@ static int stmmac_hw_init(struct stmmac_priv *priv) + if (priv->dma_cap.tsoen) + dev_info(priv->device, "TSO supported\n"); + ++ if (priv->dma_cap.number_rx_queues && ++ priv->plat->rx_queues_to_use > priv->dma_cap.number_rx_queues) { ++ dev_warn(priv->device, ++ "Number of Rx queues (%u) exceeds dma capability\n", ++ priv->plat->rx_queues_to_use); ++ priv->plat->rx_queues_to_use = priv->dma_cap.number_rx_queues; ++ } ++ if (priv->dma_cap.number_tx_queues && ++ priv->plat->tx_queues_to_use > priv->dma_cap.number_tx_queues) { ++ dev_warn(priv->device, ++ "Number of Tx queues (%u) exceeds dma capability\n", ++ priv->plat->tx_queues_to_use); ++ priv->plat->tx_queues_to_use = priv->dma_cap.number_tx_queues; ++ } ++ + priv->hw->vlan_fail_q_en = + (priv->plat->flags & STMMAC_FLAG_VLAN_FAIL_Q_EN); + priv->hw->vlan_fail_q = priv->plat->vlan_fail_q; +-- +2.39.5 + diff --git a/queue-6.6/net-xdp-disallow-attaching-device-bound-programs-in-.patch b/queue-6.6/net-xdp-disallow-attaching-device-bound-programs-in-.patch new file mode 100644 index 0000000000..236dcfa3f9 --- /dev/null +++ b/queue-6.6/net-xdp-disallow-attaching-device-bound-programs-in-.patch @@ -0,0 +1,55 @@ +From 0970bad2ce9968deb0773d366eed8b8e6e0ed7ab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Jan 2025 14:13:42 +0100 +Subject: net: xdp: Disallow attaching device-bound programs in generic mode +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Toke Høiland-Jørgensen + +[ Upstream commit 3595599fa8360bb3c7afa7ee50c810b4a64106ea ] + +Device-bound programs are used to support RX metadata kfuncs. These +kfuncs are driver-specific and rely on the driver context to read the +metadata. This means they can't work in generic XDP mode. However, there +is no check to disallow such programs from being attached in generic +mode, in which case the metadata kfuncs will be called in an invalid +context, leading to crashes. + +Fix this by adding a check to disallow attaching device-bound programs +in generic mode. + +Fixes: 2b3486bc2d23 ("bpf: Introduce device-bound XDP programs") +Reported-by: Marcus Wichelmann +Closes: https://lore.kernel.org/r/dae862ec-43b5-41a0-8edf-46c59071cdda@hetzner-cloud.de +Tested-by: Marcus Wichelmann +Acked-by: Stanislav Fomichev +Signed-off-by: Toke Høiland-Jørgensen +Acked-by: Daniel Borkmann +Acked-by: Martin KaFai Lau +Link: https://patch.msgid.link/20250127131344.238147-1-toke@redhat.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/core/dev.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/net/core/dev.c b/net/core/dev.c +index 69da7b009f8b9..479a3892f98c3 100644 +--- a/net/core/dev.c ++++ b/net/core/dev.c +@@ -9346,6 +9346,10 @@ static int dev_xdp_attach(struct net_device *dev, struct netlink_ext_ack *extack + NL_SET_ERR_MSG(extack, "Program bound to different device"); + return -EINVAL; + } ++ if (bpf_prog_is_dev_bound(new_prog->aux) && mode == XDP_MODE_SKB) { ++ NL_SET_ERR_MSG(extack, "Can't attach device-bound programs in generic mode"); ++ return -EINVAL; ++ } + if (new_prog->expected_attach_type == BPF_XDP_DEVMAP) { + NL_SET_ERR_MSG(extack, "BPF_XDP_DEVMAP programs can not be attached to a device"); + return -EINVAL; +-- +2.39.5 + diff --git a/queue-6.6/net_sched-sch_sfq-annotate-data-races-around-q-pertu.patch b/queue-6.6/net_sched-sch_sfq-annotate-data-races-around-q-pertu.patch new file mode 100644 index 0000000000..2c6d70c765 --- /dev/null +++ b/queue-6.6/net_sched-sch_sfq-annotate-data-races-around-q-pertu.patch @@ -0,0 +1,70 @@ +From 1f252f635e0dbf3848f75ed712a1ecd5e99e8075 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 30 Apr 2024 18:00:15 +0000 +Subject: net_sched: sch_sfq: annotate data-races around q->perturb_period + +From: Eric Dumazet + +[ Upstream commit a17ef9e6c2c1cf0fc6cd6ca6a9ce525c67d1da7f ] + +sfq_perturbation() reads q->perturb_period locklessly. +Add annotations to fix potential issues. + +Signed-off-by: Eric Dumazet +Reviewed-by: Simon Horman +Link: https://lore.kernel.org/r/20240430180015.3111398-1-edumazet@google.com +Signed-off-by: Jakub Kicinski +Stable-dep-of: 10685681bafc ("net_sched: sch_sfq: don't allow 1 packet limit") +Signed-off-by: Sasha Levin +--- + net/sched/sch_sfq.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c +index 66dcb18638fea..ed362eefeea9a 100644 +--- a/net/sched/sch_sfq.c ++++ b/net/sched/sch_sfq.c +@@ -608,6 +608,7 @@ static void sfq_perturbation(struct timer_list *t) + struct Qdisc *sch = q->sch; + spinlock_t *root_lock; + siphash_key_t nkey; ++ int period; + + get_random_bytes(&nkey, sizeof(nkey)); + rcu_read_lock(); +@@ -618,8 +619,12 @@ static void sfq_perturbation(struct timer_list *t) + sfq_rehash(sch); + spin_unlock(root_lock); + +- if (q->perturb_period) +- mod_timer(&q->perturb_timer, jiffies + q->perturb_period); ++ /* q->perturb_period can change under us from ++ * sfq_change() and sfq_destroy(). ++ */ ++ period = READ_ONCE(q->perturb_period); ++ if (period) ++ mod_timer(&q->perturb_timer, jiffies + period); + rcu_read_unlock(); + } + +@@ -662,7 +667,7 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt) + q->quantum = ctl->quantum; + q->scaled_quantum = SFQ_ALLOT_SIZE(q->quantum); + } +- q->perturb_period = ctl->perturb_period * HZ; ++ WRITE_ONCE(q->perturb_period, ctl->perturb_period * HZ); + if (ctl->flows) + q->maxflows = min_t(u32, ctl->flows, SFQ_MAX_FLOWS); + if (ctl->divisor) { +@@ -724,7 +729,7 @@ static void sfq_destroy(struct Qdisc *sch) + struct sfq_sched_data *q = qdisc_priv(sch); + + tcf_block_put(q->block); +- q->perturb_period = 0; ++ WRITE_ONCE(q->perturb_period, 0); + del_timer_sync(&q->perturb_timer); + sfq_free(q->ht); + sfq_free(q->slots); +-- +2.39.5 + diff --git a/queue-6.6/net_sched-sch_sfq-don-t-allow-1-packet-limit.patch b/queue-6.6/net_sched-sch_sfq-don-t-allow-1-packet-limit.patch new file mode 100644 index 0000000000..a3d5ca1f87 --- /dev/null +++ b/queue-6.6/net_sched-sch_sfq-don-t-allow-1-packet-limit.patch @@ -0,0 +1,116 @@ +From c0c608a13b348ca4ef14d7e5347179bf4147633b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 3 Dec 2024 19:05:19 -0800 +Subject: net_sched: sch_sfq: don't allow 1 packet limit + +From: Octavian Purdila + +[ Upstream commit 10685681bafce6febb39770f3387621bf5d67d0b ] + +The current implementation does not work correctly with a limit of +1. iproute2 actually checks for this and this patch adds the check in +kernel as well. + +This fixes the following syzkaller reported crash: + +UBSAN: array-index-out-of-bounds in net/sched/sch_sfq.c:210:6 +index 65535 is out of range for type 'struct sfq_head[128]' +CPU: 0 PID: 2569 Comm: syz-executor101 Not tainted 5.10.0-smp-DEV #1 +Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/13/2024 +Call Trace: + __dump_stack lib/dump_stack.c:79 [inline] + dump_stack+0x125/0x19f lib/dump_stack.c:120 + ubsan_epilogue lib/ubsan.c:148 [inline] + __ubsan_handle_out_of_bounds+0xed/0x120 lib/ubsan.c:347 + sfq_link net/sched/sch_sfq.c:210 [inline] + sfq_dec+0x528/0x600 net/sched/sch_sfq.c:238 + sfq_dequeue+0x39b/0x9d0 net/sched/sch_sfq.c:500 + sfq_reset+0x13/0x50 net/sched/sch_sfq.c:525 + qdisc_reset+0xfe/0x510 net/sched/sch_generic.c:1026 + tbf_reset+0x3d/0x100 net/sched/sch_tbf.c:319 + qdisc_reset+0xfe/0x510 net/sched/sch_generic.c:1026 + dev_reset_queue+0x8c/0x140 net/sched/sch_generic.c:1296 + netdev_for_each_tx_queue include/linux/netdevice.h:2350 [inline] + dev_deactivate_many+0x6dc/0xc20 net/sched/sch_generic.c:1362 + __dev_close_many+0x214/0x350 net/core/dev.c:1468 + dev_close_many+0x207/0x510 net/core/dev.c:1506 + unregister_netdevice_many+0x40f/0x16b0 net/core/dev.c:10738 + unregister_netdevice_queue+0x2be/0x310 net/core/dev.c:10695 + unregister_netdevice include/linux/netdevice.h:2893 [inline] + __tun_detach+0x6b6/0x1600 drivers/net/tun.c:689 + tun_detach drivers/net/tun.c:705 [inline] + tun_chr_close+0x104/0x1b0 drivers/net/tun.c:3640 + __fput+0x203/0x840 fs/file_table.c:280 + task_work_run+0x129/0x1b0 kernel/task_work.c:185 + exit_task_work include/linux/task_work.h:33 [inline] + do_exit+0x5ce/0x2200 kernel/exit.c:931 + do_group_exit+0x144/0x310 kernel/exit.c:1046 + __do_sys_exit_group kernel/exit.c:1057 [inline] + __se_sys_exit_group kernel/exit.c:1055 [inline] + __x64_sys_exit_group+0x3b/0x40 kernel/exit.c:1055 + do_syscall_64+0x6c/0xd0 + entry_SYSCALL_64_after_hwframe+0x61/0xcb +RIP: 0033:0x7fe5e7b52479 +Code: Unable to access opcode bytes at RIP 0x7fe5e7b5244f. +RSP: 002b:00007ffd3c800398 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7 +RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fe5e7b52479 +RDX: 000000000000003c RSI: 00000000000000e7 RDI: 0000000000000000 +RBP: 00007fe5e7bcd2d0 R08: ffffffffffffffb8 R09: 0000000000000014 +R10: 0000000000000000 R11: 0000000000000246 R12: 00007fe5e7bcd2d0 +R13: 0000000000000000 R14: 00007fe5e7bcdd20 R15: 00007fe5e7b24270 + +The crash can be also be reproduced with the following (with a tc +recompiled to allow for sfq limits of 1): + +tc qdisc add dev dummy0 handle 1: root tbf rate 1Kbit burst 100b lat 1s +../iproute2-6.9.0/tc/tc qdisc add dev dummy0 handle 2: parent 1:10 sfq limit 1 +ifconfig dummy0 up +ping -I dummy0 -f -c2 -W0.1 8.8.8.8 +sleep 1 + +Scenario that triggers the crash: + +* the first packet is sent and queued in TBF and SFQ; qdisc qlen is 1 + +* TBF dequeues: it peeks from SFQ which moves the packet to the + gso_skb list and keeps qdisc qlen set to 1. TBF is out of tokens so + it schedules itself for later. + +* the second packet is sent and TBF tries to queues it to SFQ. qdisc + qlen is now 2 and because the SFQ limit is 1 the packet is dropped + by SFQ. At this point qlen is 1, and all of the SFQ slots are empty, + however q->tail is not NULL. + +At this point, assuming no more packets are queued, when sch_dequeue +runs again it will decrement the qlen for the current empty slot +causing an underflow and the subsequent out of bounds access. + +Reported-by: syzbot +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Signed-off-by: Octavian Purdila +Reviewed-by: Eric Dumazet +Link: https://patch.msgid.link/20241204030520.2084663-2-tavip@google.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/sched/sch_sfq.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c +index 7d4feae2fae36..60754f366ab7b 100644 +--- a/net/sched/sch_sfq.c ++++ b/net/sched/sch_sfq.c +@@ -652,6 +652,10 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt, + if (!p) + return -ENOMEM; + } ++ if (ctl->limit == 1) { ++ NL_SET_ERR_MSG_MOD(extack, "invalid limit"); ++ return -EINVAL; ++ } + sch_tree_lock(sch); + if (ctl->quantum) + q->quantum = ctl->quantum; +-- +2.39.5 + diff --git a/queue-6.6/net_sched-sch_sfq-handle-bigger-packets.patch b/queue-6.6/net_sched-sch_sfq-handle-bigger-packets.patch new file mode 100644 index 0000000000..fda231bb7f --- /dev/null +++ b/queue-6.6/net_sched-sch_sfq-handle-bigger-packets.patch @@ -0,0 +1,167 @@ +From cab6b17d569246a3f6cd4923faacc17ccbcb76b0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Oct 2024 11:16:03 +0000 +Subject: net_sched: sch_sfq: handle bigger packets +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Eric Dumazet + +[ Upstream commit e4650d7ae4252f67e997a632adfae0dd74d3a99a ] + +SFQ has an assumption on dealing with packets smaller than 64KB. + +Even before BIG TCP, TCA_STAB can provide arbitrary big values +in qdisc_pkt_len(skb) + +It is time to switch (struct sfq_slot)->allot to a 32bit field. + +sizeof(struct sfq_slot) is now 64 bytes, giving better cache locality. + +Signed-off-by: Eric Dumazet +Reviewed-by: Toke Høiland-Jørgensen +Link: https://patch.msgid.link/20241008111603.653140-1-edumazet@google.com +Signed-off-by: Jakub Kicinski +Stable-dep-of: 10685681bafc ("net_sched: sch_sfq: don't allow 1 packet limit") +Signed-off-by: Sasha Levin +--- + net/sched/sch_sfq.c | 39 +++++++++++++-------------------------- + 1 file changed, 13 insertions(+), 26 deletions(-) + +diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c +index ed362eefeea9a..7d4feae2fae36 100644 +--- a/net/sched/sch_sfq.c ++++ b/net/sched/sch_sfq.c +@@ -77,12 +77,6 @@ + #define SFQ_EMPTY_SLOT 0xffff + #define SFQ_DEFAULT_HASH_DIVISOR 1024 + +-/* We use 16 bits to store allot, and want to handle packets up to 64K +- * Scale allot by 8 (1<<3) so that no overflow occurs. +- */ +-#define SFQ_ALLOT_SHIFT 3 +-#define SFQ_ALLOT_SIZE(X) DIV_ROUND_UP(X, 1 << SFQ_ALLOT_SHIFT) +- + /* This type should contain at least SFQ_MAX_DEPTH + 1 + SFQ_MAX_FLOWS values */ + typedef u16 sfq_index; + +@@ -104,7 +98,7 @@ struct sfq_slot { + sfq_index next; /* next slot in sfq RR chain */ + struct sfq_head dep; /* anchor in dep[] chains */ + unsigned short hash; /* hash value (index in ht[]) */ +- short allot; /* credit for this slot */ ++ int allot; /* credit for this slot */ + + unsigned int backlog; + struct red_vars vars; +@@ -120,7 +114,6 @@ struct sfq_sched_data { + siphash_key_t perturbation; + u8 cur_depth; /* depth of longest slot */ + u8 flags; +- unsigned short scaled_quantum; /* SFQ_ALLOT_SIZE(quantum) */ + struct tcf_proto __rcu *filter_list; + struct tcf_block *block; + sfq_index *ht; /* Hash table ('divisor' slots) */ +@@ -456,7 +449,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) + */ + q->tail = slot; + /* We could use a bigger initial quantum for new flows */ +- slot->allot = q->scaled_quantum; ++ slot->allot = q->quantum; + } + if (++sch->q.qlen <= q->limit) + return NET_XMIT_SUCCESS; +@@ -493,7 +486,7 @@ sfq_dequeue(struct Qdisc *sch) + slot = &q->slots[a]; + if (slot->allot <= 0) { + q->tail = slot; +- slot->allot += q->scaled_quantum; ++ slot->allot += q->quantum; + goto next_slot; + } + skb = slot_dequeue_head(slot); +@@ -512,7 +505,7 @@ sfq_dequeue(struct Qdisc *sch) + } + q->tail->next = next_a; + } else { +- slot->allot -= SFQ_ALLOT_SIZE(qdisc_pkt_len(skb)); ++ slot->allot -= qdisc_pkt_len(skb); + } + return skb; + } +@@ -595,7 +588,7 @@ static void sfq_rehash(struct Qdisc *sch) + q->tail->next = x; + } + q->tail = slot; +- slot->allot = q->scaled_quantum; ++ slot->allot = q->quantum; + } + } + sch->q.qlen -= dropped; +@@ -628,7 +621,8 @@ static void sfq_perturbation(struct timer_list *t) + rcu_read_unlock(); + } + +-static int sfq_change(struct Qdisc *sch, struct nlattr *opt) ++static int sfq_change(struct Qdisc *sch, struct nlattr *opt, ++ struct netlink_ext_ack *extack) + { + struct sfq_sched_data *q = qdisc_priv(sch); + struct tc_sfq_qopt *ctl = nla_data(opt); +@@ -646,14 +640,10 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt) + (!is_power_of_2(ctl->divisor) || ctl->divisor > 65536)) + return -EINVAL; + +- /* slot->allot is a short, make sure quantum is not too big. */ +- if (ctl->quantum) { +- unsigned int scaled = SFQ_ALLOT_SIZE(ctl->quantum); +- +- if (scaled <= 0 || scaled > SHRT_MAX) +- return -EINVAL; ++ if ((int)ctl->quantum < 0) { ++ NL_SET_ERR_MSG_MOD(extack, "invalid quantum"); ++ return -EINVAL; + } +- + if (ctl_v1 && !red_check_params(ctl_v1->qth_min, ctl_v1->qth_max, + ctl_v1->Wlog, ctl_v1->Scell_log, NULL)) + return -EINVAL; +@@ -663,10 +653,8 @@ static int sfq_change(struct Qdisc *sch, struct nlattr *opt) + return -ENOMEM; + } + sch_tree_lock(sch); +- if (ctl->quantum) { ++ if (ctl->quantum) + q->quantum = ctl->quantum; +- q->scaled_quantum = SFQ_ALLOT_SIZE(q->quantum); +- } + WRITE_ONCE(q->perturb_period, ctl->perturb_period * HZ); + if (ctl->flows) + q->maxflows = min_t(u32, ctl->flows, SFQ_MAX_FLOWS); +@@ -762,12 +750,11 @@ static int sfq_init(struct Qdisc *sch, struct nlattr *opt, + q->divisor = SFQ_DEFAULT_HASH_DIVISOR; + q->maxflows = SFQ_DEFAULT_FLOWS; + q->quantum = psched_mtu(qdisc_dev(sch)); +- q->scaled_quantum = SFQ_ALLOT_SIZE(q->quantum); + q->perturb_period = 0; + get_random_bytes(&q->perturbation, sizeof(q->perturbation)); + + if (opt) { +- int err = sfq_change(sch, opt); ++ int err = sfq_change(sch, opt, extack); + if (err) + return err; + } +@@ -878,7 +865,7 @@ static int sfq_dump_class_stats(struct Qdisc *sch, unsigned long cl, + if (idx != SFQ_EMPTY_SLOT) { + const struct sfq_slot *slot = &q->slots[idx]; + +- xstats.allot = slot->allot << SFQ_ALLOT_SHIFT; ++ xstats.allot = slot->allot; + qs.qlen = slot->qlen; + qs.backlog = slot->backlog; + } +-- +2.39.5 + diff --git a/queue-6.6/netfilter-nf_tables-de-constify-set-commit-ops-funct.patch b/queue-6.6/netfilter-nf_tables-de-constify-set-commit-ops-funct.patch new file mode 100644 index 0000000000..e8f9803e34 --- /dev/null +++ b/queue-6.6/netfilter-nf_tables-de-constify-set-commit-ops-funct.patch @@ -0,0 +1,64 @@ +From af6789de1a09e35ff50ab267f379996b530f43f2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 Oct 2023 14:18:14 +0200 +Subject: netfilter: nf_tables: de-constify set commit ops function argument + +From: Florian Westphal + +[ Upstream commit 256001672153af5786c6ca148114693d7d76d836 ] + +The set backend using this already has to work around this via ugly +cast, don't spread this pattern. + +Signed-off-by: Florian Westphal +Stable-dep-of: 8d738c1869f6 ("netfilter: nf_tables: fix set size with rbtree backend") +Signed-off-by: Sasha Levin +--- + include/net/netfilter/nf_tables.h | 2 +- + net/netfilter/nft_set_pipapo.c | 7 +++---- + 2 files changed, 4 insertions(+), 5 deletions(-) + +diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h +index 8321915dddb28..12a30d8e7efe0 100644 +--- a/include/net/netfilter/nf_tables.h ++++ b/include/net/netfilter/nf_tables.h +@@ -481,7 +481,7 @@ struct nft_set_ops { + const struct nft_set *set, + const struct nft_set_elem *elem, + unsigned int flags); +- void (*commit)(const struct nft_set *set); ++ void (*commit)(struct nft_set *set); + void (*abort)(const struct nft_set *set); + u64 (*privsize)(const struct nlattr * const nla[], + const struct nft_set_desc *desc); +diff --git a/net/netfilter/nft_set_pipapo.c b/net/netfilter/nft_set_pipapo.c +index 334958ef8d66c..5dab9905ebbec 100644 +--- a/net/netfilter/nft_set_pipapo.c ++++ b/net/netfilter/nft_set_pipapo.c +@@ -1574,12 +1574,11 @@ static void nft_pipapo_gc_deactivate(struct net *net, struct nft_set *set, + + /** + * pipapo_gc() - Drop expired entries from set, destroy start and end elements +- * @_set: nftables API set representation ++ * @set: nftables API set representation + * @m: Matching data + */ +-static void pipapo_gc(const struct nft_set *_set, struct nft_pipapo_match *m) ++static void pipapo_gc(struct nft_set *set, struct nft_pipapo_match *m) + { +- struct nft_set *set = (struct nft_set *) _set; + struct nft_pipapo *priv = nft_set_priv(set); + struct net *net = read_pnet(&set->net); + int rules_f0, first_rule = 0; +@@ -1693,7 +1692,7 @@ static void pipapo_reclaim_match(struct rcu_head *rcu) + * We also need to create a new working copy for subsequent insertions and + * deletions. + */ +-static void nft_pipapo_commit(const struct nft_set *set) ++static void nft_pipapo_commit(struct nft_set *set) + { + struct nft_pipapo *priv = nft_set_priv(set); + struct nft_pipapo_match *new_clone, *old; +-- +2.39.5 + diff --git a/queue-6.6/netfilter-nf_tables-fix-set-size-with-rbtree-backend.patch b/queue-6.6/netfilter-nf_tables-fix-set-size-with-rbtree-backend.patch new file mode 100644 index 0000000000..62e4e9a4bb --- /dev/null +++ b/queue-6.6/netfilter-nf_tables-fix-set-size-with-rbtree-backend.patch @@ -0,0 +1,217 @@ +From 438e7637d02946f3e9e9ec6816ce151435bedd29 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jan 2025 23:40:50 +0100 +Subject: netfilter: nf_tables: fix set size with rbtree backend + +From: Pablo Neira Ayuso + +[ Upstream commit 8d738c1869f611955d91d8d0fd0012d9ef207201 ] + +The existing rbtree implementation uses singleton elements to represent +ranges, however, userspace provides a set size according to the number +of ranges in the set. + +Adjust provided userspace set size to the number of singleton elements +in the kernel by multiplying the range by two. + +Check if the no-match all-zero element is already in the set, in such +case release one slot in the set size. + +Fixes: 0ed6389c483d ("netfilter: nf_tables: rename set implementations") +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + include/net/netfilter/nf_tables.h | 6 ++++ + net/netfilter/nf_tables_api.c | 49 +++++++++++++++++++++++++++++-- + net/netfilter/nft_set_rbtree.c | 43 +++++++++++++++++++++++++++ + 3 files changed, 96 insertions(+), 2 deletions(-) + +diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h +index 12a30d8e7efe0..dcbf3f299548f 100644 +--- a/include/net/netfilter/nf_tables.h ++++ b/include/net/netfilter/nf_tables.h +@@ -429,6 +429,9 @@ struct nft_set_ext; + * @remove: remove element from set + * @walk: iterate over all set elements + * @get: get set elements ++ * @ksize: kernel set size ++ * @usize: userspace set size ++ * @adjust_maxsize: delta to adjust maximum set size + * @commit: commit set elements + * @abort: abort set elements + * @privsize: function to return size of set private data +@@ -481,6 +484,9 @@ struct nft_set_ops { + const struct nft_set *set, + const struct nft_set_elem *elem, + unsigned int flags); ++ u32 (*ksize)(u32 size); ++ u32 (*usize)(u32 size); ++ u32 (*adjust_maxsize)(const struct nft_set *set); + void (*commit)(struct nft_set *set); + void (*abort)(const struct nft_set *set); + u64 (*privsize)(const struct nlattr * const nla[], +diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c +index 1d1e998acd675..42dac335074fb 100644 +--- a/net/netfilter/nf_tables_api.c ++++ b/net/netfilter/nf_tables_api.c +@@ -4552,6 +4552,14 @@ static int nf_tables_fill_set_concat(struct sk_buff *skb, + return 0; + } + ++static u32 nft_set_userspace_size(const struct nft_set_ops *ops, u32 size) ++{ ++ if (ops->usize) ++ return ops->usize(size); ++ ++ return size; ++} ++ + static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx, + const struct nft_set *set, u16 event, u16 flags) + { +@@ -4622,7 +4630,8 @@ static int nf_tables_fill_set(struct sk_buff *skb, const struct nft_ctx *ctx, + if (!nest) + goto nla_put_failure; + if (set->size && +- nla_put_be32(skb, NFTA_SET_DESC_SIZE, htonl(set->size))) ++ nla_put_be32(skb, NFTA_SET_DESC_SIZE, ++ htonl(nft_set_userspace_size(set->ops, set->size)))) + goto nla_put_failure; + + if (set->field_count > 1 && +@@ -4992,6 +5001,15 @@ static bool nft_set_is_same(const struct nft_set *set, + return true; + } + ++static u32 nft_set_kernel_size(const struct nft_set_ops *ops, ++ const struct nft_set_desc *desc) ++{ ++ if (ops->ksize) ++ return ops->ksize(desc->size); ++ ++ return desc->size; ++} ++ + static int nf_tables_newset(struct sk_buff *skb, const struct nfnl_info *info, + const struct nlattr * const nla[]) + { +@@ -5174,6 +5192,9 @@ static int nf_tables_newset(struct sk_buff *skb, const struct nfnl_info *info, + if (err < 0) + return err; + ++ if (desc.size) ++ desc.size = nft_set_kernel_size(set->ops, &desc); ++ + err = 0; + if (!nft_set_is_same(set, &desc, exprs, num_exprs, flags)) { + NL_SET_BAD_ATTR(extack, nla[NFTA_SET_NAME]); +@@ -5196,6 +5217,9 @@ static int nf_tables_newset(struct sk_buff *skb, const struct nfnl_info *info, + if (IS_ERR(ops)) + return PTR_ERR(ops); + ++ if (desc.size) ++ desc.size = nft_set_kernel_size(ops, &desc); ++ + udlen = 0; + if (nla[NFTA_SET_USERDATA]) + udlen = nla_len(nla[NFTA_SET_USERDATA]); +@@ -6679,6 +6703,27 @@ static bool nft_setelem_valid_key_end(const struct nft_set *set, + return true; + } + ++static u32 nft_set_maxsize(const struct nft_set *set) ++{ ++ u32 maxsize, delta; ++ ++ if (!set->size) ++ return UINT_MAX; ++ ++ if (set->ops->adjust_maxsize) ++ delta = set->ops->adjust_maxsize(set); ++ else ++ delta = 0; ++ ++ if (check_add_overflow(set->size, set->ndeact, &maxsize)) ++ return UINT_MAX; ++ ++ if (check_add_overflow(maxsize, delta, &maxsize)) ++ return UINT_MAX; ++ ++ return maxsize; ++} ++ + static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set, + const struct nlattr *attr, u32 nlmsg_flags) + { +@@ -7023,7 +7068,7 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set, + } + + if (!(flags & NFT_SET_ELEM_CATCHALL)) { +- unsigned int max = set->size ? set->size + set->ndeact : UINT_MAX; ++ unsigned int max = nft_set_maxsize(set); + + if (!atomic_add_unless(&set->nelems, 1, max)) { + err = -ENFILE; +diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c +index 26af6008861a6..8ad1e008d12b5 100644 +--- a/net/netfilter/nft_set_rbtree.c ++++ b/net/netfilter/nft_set_rbtree.c +@@ -756,6 +756,46 @@ static void nft_rbtree_gc_init(const struct nft_set *set) + priv->last_gc = jiffies; + } + ++/* rbtree stores ranges as singleton elements, each range is composed of two ++ * elements ... ++ */ ++static u32 nft_rbtree_ksize(u32 size) ++{ ++ return size * 2; ++} ++ ++/* ... hide this detail to userspace. */ ++static u32 nft_rbtree_usize(u32 size) ++{ ++ if (!size) ++ return 0; ++ ++ return size / 2; ++} ++ ++static u32 nft_rbtree_adjust_maxsize(const struct nft_set *set) ++{ ++ struct nft_rbtree *priv = nft_set_priv(set); ++ struct nft_rbtree_elem *rbe; ++ struct rb_node *node; ++ const void *key; ++ ++ node = rb_last(&priv->root); ++ if (!node) ++ return 0; ++ ++ rbe = rb_entry(node, struct nft_rbtree_elem, node); ++ if (!nft_rbtree_interval_end(rbe)) ++ return 0; ++ ++ key = nft_set_ext_key(&rbe->ext); ++ if (memchr(key, 1, set->klen)) ++ return 0; ++ ++ /* this is the all-zero no-match element. */ ++ return 1; ++} ++ + const struct nft_set_type nft_set_rbtree_type = { + .features = NFT_SET_INTERVAL | NFT_SET_MAP | NFT_SET_OBJECT | NFT_SET_TIMEOUT, + .ops = { +@@ -774,5 +814,8 @@ const struct nft_set_type nft_set_rbtree_type = { + .lookup = nft_rbtree_lookup, + .walk = nft_rbtree_walk, + .get = nft_rbtree_get, ++ .ksize = nft_rbtree_ksize, ++ .usize = nft_rbtree_usize, ++ .adjust_maxsize = nft_rbtree_adjust_maxsize, + }, + }; +-- +2.39.5 + diff --git a/queue-6.6/netfilter-nft_flow_offload-update-tcp-state-flags-un.patch b/queue-6.6/netfilter-nft_flow_offload-update-tcp-state-flags-un.patch new file mode 100644 index 0000000000..f7087727df --- /dev/null +++ b/queue-6.6/netfilter-nft_flow_offload-update-tcp-state-flags-un.patch @@ -0,0 +1,63 @@ +From 9d58f8b819ee832c37b72a5d33826a8518a60717 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Jan 2025 00:50:34 +0100 +Subject: netfilter: nft_flow_offload: update tcp state flags under lock + +From: Florian Westphal + +[ Upstream commit 7a4b61406395291ffb7220a10e8951a9a8684819 ] + +The conntrack entry is already public, there is a small chance that another +CPU is handling a packet in reply direction and racing with the tcp state +update. + +Move this under ct spinlock. + +This is done once, when ct is about to be offloaded, so this should +not result in a noticeable performance hit. + +Fixes: 8437a6209f76 ("netfilter: nft_flow_offload: set liberal tracking mode for tcp") +Signed-off-by: Florian Westphal +Signed-off-by: Pablo Neira Ayuso +Signed-off-by: Sasha Levin +--- + net/netfilter/nft_flow_offload.c | 16 +++++++++++----- + 1 file changed, 11 insertions(+), 5 deletions(-) + +diff --git a/net/netfilter/nft_flow_offload.c b/net/netfilter/nft_flow_offload.c +index 397351fa4d5f8..5a3d685420420 100644 +--- a/net/netfilter/nft_flow_offload.c ++++ b/net/netfilter/nft_flow_offload.c +@@ -288,6 +288,15 @@ static bool nft_flow_offload_skip(struct sk_buff *skb, int family) + return false; + } + ++static void flow_offload_ct_tcp(struct nf_conn *ct) ++{ ++ /* conntrack will not see all packets, disable tcp window validation. */ ++ spin_lock_bh(&ct->lock); ++ ct->proto.tcp.seen[0].flags |= IP_CT_TCP_FLAG_BE_LIBERAL; ++ ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL; ++ spin_unlock_bh(&ct->lock); ++} ++ + static void nft_flow_offload_eval(const struct nft_expr *expr, + struct nft_regs *regs, + const struct nft_pktinfo *pkt) +@@ -355,11 +364,8 @@ static void nft_flow_offload_eval(const struct nft_expr *expr, + goto err_flow_alloc; + + flow_offload_route_init(flow, &route); +- +- if (tcph) { +- ct->proto.tcp.seen[0].flags |= IP_CT_TCP_FLAG_BE_LIBERAL; +- ct->proto.tcp.seen[1].flags |= IP_CT_TCP_FLAG_BE_LIBERAL; +- } ++ if (tcph) ++ flow_offload_ct_tcp(ct); + + ret = flow_offload_add(flowtable, flow); + if (ret < 0) +-- +2.39.5 + diff --git a/queue-6.6/netfilter-nft_set_rbtree-prefer-sync-gc-to-async-wor.patch b/queue-6.6/netfilter-nft_set_rbtree-prefer-sync-gc-to-async-wor.patch new file mode 100644 index 0000000000..848fa9bb97 --- /dev/null +++ b/queue-6.6/netfilter-nft_set_rbtree-prefer-sync-gc-to-async-wor.patch @@ -0,0 +1,254 @@ +From 2fd8602974da433807cc6ed3b2d88a9cf2161fa2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 Oct 2023 14:18:16 +0200 +Subject: netfilter: nft_set_rbtree: prefer sync gc to async worker + +From: Florian Westphal + +[ Upstream commit 7d259f021aaa78904b6c836d975e8e00d83a182a ] + +There is no need for asynchronous garbage collection, rbtree inserts +can only happen from the netlink control plane. + +We already perform on-demand gc on insertion, in the area of the +tree where the insertion takes place, but we don't do a full tree +walk there for performance reasons. + +Do a full gc walk at the end of the transaction instead and +remove the async worker. + +Signed-off-by: Florian Westphal +Signed-off-by: Pablo Neira Ayuso +Stable-dep-of: 8d738c1869f6 ("netfilter: nf_tables: fix set size with rbtree backend") +Signed-off-by: Sasha Levin +--- + net/netfilter/nft_set_rbtree.c | 124 +++++++++++++++++---------------- + 1 file changed, 65 insertions(+), 59 deletions(-) + +diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c +index 896a9a7024b04..26af6008861a6 100644 +--- a/net/netfilter/nft_set_rbtree.c ++++ b/net/netfilter/nft_set_rbtree.c +@@ -19,7 +19,7 @@ struct nft_rbtree { + struct rb_root root; + rwlock_t lock; + seqcount_rwlock_t count; +- struct delayed_work gc_work; ++ unsigned long last_gc; + }; + + struct nft_rbtree_elem { +@@ -48,8 +48,7 @@ static int nft_rbtree_cmp(const struct nft_set *set, + + static bool nft_rbtree_elem_expired(const struct nft_rbtree_elem *rbe) + { +- return nft_set_elem_expired(&rbe->ext) || +- nft_set_elem_is_dead(&rbe->ext); ++ return nft_set_elem_expired(&rbe->ext); + } + + static bool __nft_rbtree_lookup(const struct net *net, const struct nft_set *set, +@@ -508,6 +507,15 @@ static int nft_rbtree_insert(const struct net *net, const struct nft_set *set, + return err; + } + ++static void nft_rbtree_erase(struct nft_rbtree *priv, struct nft_rbtree_elem *rbe) ++{ ++ write_lock_bh(&priv->lock); ++ write_seqcount_begin(&priv->count); ++ rb_erase(&rbe->node, &priv->root); ++ write_seqcount_end(&priv->count); ++ write_unlock_bh(&priv->lock); ++} ++ + static void nft_rbtree_remove(const struct net *net, + const struct nft_set *set, + const struct nft_set_elem *elem) +@@ -515,11 +523,7 @@ static void nft_rbtree_remove(const struct net *net, + struct nft_rbtree *priv = nft_set_priv(set); + struct nft_rbtree_elem *rbe = elem->priv; + +- write_lock_bh(&priv->lock); +- write_seqcount_begin(&priv->count); +- rb_erase(&rbe->node, &priv->root); +- write_seqcount_end(&priv->count); +- write_unlock_bh(&priv->lock); ++ nft_rbtree_erase(priv, rbe); + } + + static void nft_rbtree_activate(const struct net *net, +@@ -611,45 +615,40 @@ static void nft_rbtree_walk(const struct nft_ctx *ctx, + read_unlock_bh(&priv->lock); + } + +-static void nft_rbtree_gc(struct work_struct *work) ++static void nft_rbtree_gc_remove(struct net *net, struct nft_set *set, ++ struct nft_rbtree *priv, ++ struct nft_rbtree_elem *rbe) + { ++ struct nft_set_elem elem = { ++ .priv = rbe, ++ }; ++ ++ nft_setelem_data_deactivate(net, set, &elem); ++ nft_rbtree_erase(priv, rbe); ++} ++ ++static void nft_rbtree_gc(struct nft_set *set) ++{ ++ struct nft_rbtree *priv = nft_set_priv(set); + struct nft_rbtree_elem *rbe, *rbe_end = NULL; + struct nftables_pernet *nft_net; +- struct nft_rbtree *priv; ++ struct rb_node *node, *next; + struct nft_trans_gc *gc; +- struct rb_node *node; +- struct nft_set *set; +- unsigned int gc_seq; + struct net *net; + +- priv = container_of(work, struct nft_rbtree, gc_work.work); + set = nft_set_container_of(priv); + net = read_pnet(&set->net); + nft_net = nft_pernet(net); +- gc_seq = READ_ONCE(nft_net->gc_seq); + +- if (nft_set_gc_is_pending(set)) +- goto done; +- +- gc = nft_trans_gc_alloc(set, gc_seq, GFP_KERNEL); ++ gc = nft_trans_gc_alloc(set, 0, GFP_KERNEL); + if (!gc) +- goto done; +- +- read_lock_bh(&priv->lock); +- for (node = rb_first(&priv->root); node != NULL; node = rb_next(node)) { ++ return; + +- /* Ruleset has been updated, try later. */ +- if (READ_ONCE(nft_net->gc_seq) != gc_seq) { +- nft_trans_gc_destroy(gc); +- gc = NULL; +- goto try_later; +- } ++ for (node = rb_first(&priv->root); node ; node = next) { ++ next = rb_next(node); + + rbe = rb_entry(node, struct nft_rbtree_elem, node); + +- if (nft_set_elem_is_dead(&rbe->ext)) +- goto dead_elem; +- + /* elements are reversed in the rbtree for historical reasons, + * from highest to lowest value, that is why end element is + * always visited before the start element. +@@ -661,37 +660,34 @@ static void nft_rbtree_gc(struct work_struct *work) + if (!nft_set_elem_expired(&rbe->ext)) + continue; + +- nft_set_elem_dead(&rbe->ext); +- +- if (!rbe_end) +- continue; +- +- nft_set_elem_dead(&rbe_end->ext); +- +- gc = nft_trans_gc_queue_async(gc, gc_seq, GFP_ATOMIC); ++ gc = nft_trans_gc_queue_sync(gc, GFP_KERNEL); + if (!gc) + goto try_later; + +- nft_trans_gc_elem_add(gc, rbe_end); +- rbe_end = NULL; +-dead_elem: +- gc = nft_trans_gc_queue_async(gc, gc_seq, GFP_ATOMIC); ++ /* end element needs to be removed first, it has ++ * no timeout extension. ++ */ ++ if (rbe_end) { ++ nft_rbtree_gc_remove(net, set, priv, rbe_end); ++ nft_trans_gc_elem_add(gc, rbe_end); ++ rbe_end = NULL; ++ } ++ ++ gc = nft_trans_gc_queue_sync(gc, GFP_KERNEL); + if (!gc) + goto try_later; + ++ nft_rbtree_gc_remove(net, set, priv, rbe); + nft_trans_gc_elem_add(gc, rbe); + } + +- gc = nft_trans_gc_catchall_async(gc, gc_seq); +- + try_later: +- read_unlock_bh(&priv->lock); + +- if (gc) +- nft_trans_gc_queue_async_done(gc); +-done: +- queue_delayed_work(system_power_efficient_wq, &priv->gc_work, +- nft_set_gc_interval(set)); ++ if (gc) { ++ gc = nft_trans_gc_catchall_sync(gc); ++ nft_trans_gc_queue_sync_done(gc); ++ priv->last_gc = jiffies; ++ } + } + + static u64 nft_rbtree_privsize(const struct nlattr * const nla[], +@@ -710,11 +706,6 @@ static int nft_rbtree_init(const struct nft_set *set, + seqcount_rwlock_init(&priv->count, &priv->lock); + priv->root = RB_ROOT; + +- INIT_DEFERRABLE_WORK(&priv->gc_work, nft_rbtree_gc); +- if (set->flags & NFT_SET_TIMEOUT) +- queue_delayed_work(system_power_efficient_wq, &priv->gc_work, +- nft_set_gc_interval(set)); +- + return 0; + } + +@@ -725,8 +716,6 @@ static void nft_rbtree_destroy(const struct nft_ctx *ctx, + struct nft_rbtree_elem *rbe; + struct rb_node *node; + +- cancel_delayed_work_sync(&priv->gc_work); +- rcu_barrier(); + while ((node = priv->root.rb_node) != NULL) { + rb_erase(node, &priv->root); + rbe = rb_entry(node, struct nft_rbtree_elem, node); +@@ -752,6 +741,21 @@ static bool nft_rbtree_estimate(const struct nft_set_desc *desc, u32 features, + return true; + } + ++static void nft_rbtree_commit(struct nft_set *set) ++{ ++ struct nft_rbtree *priv = nft_set_priv(set); ++ ++ if (time_after_eq(jiffies, priv->last_gc + nft_set_gc_interval(set))) ++ nft_rbtree_gc(set); ++} ++ ++static void nft_rbtree_gc_init(const struct nft_set *set) ++{ ++ struct nft_rbtree *priv = nft_set_priv(set); ++ ++ priv->last_gc = jiffies; ++} ++ + const struct nft_set_type nft_set_rbtree_type = { + .features = NFT_SET_INTERVAL | NFT_SET_MAP | NFT_SET_OBJECT | NFT_SET_TIMEOUT, + .ops = { +@@ -765,6 +769,8 @@ const struct nft_set_type nft_set_rbtree_type = { + .deactivate = nft_rbtree_deactivate, + .flush = nft_rbtree_flush, + .activate = nft_rbtree_activate, ++ .commit = nft_rbtree_commit, ++ .gc_init = nft_rbtree_gc_init, + .lookup = nft_rbtree_lookup, + .walk = nft_rbtree_walk, + .get = nft_rbtree_get, +-- +2.39.5 + diff --git a/queue-6.6/netfilter-nft_set_rbtree-rename-gc-deactivate-erase-.patch b/queue-6.6/netfilter-nft_set_rbtree-rename-gc-deactivate-erase-.patch new file mode 100644 index 0000000000..274ef0673f --- /dev/null +++ b/queue-6.6/netfilter-nft_set_rbtree-rename-gc-deactivate-erase-.patch @@ -0,0 +1,67 @@ +From 86c1f5b4dc948893bc910de1c25798e7c1b2b4fb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 Oct 2023 14:18:15 +0200 +Subject: netfilter: nft_set_rbtree: rename gc deactivate+erase function + +From: Florian Westphal + +[ Upstream commit 8079fc30f79799e59d9602e7e080d434936a482d ] + +Next patch adds a cllaer that doesn't hold the priv->write lock and +will need a similar function. + +Rename the existing function to make it clear that it can only +be used for opportunistic gc during insertion. + +Signed-off-by: Florian Westphal +Signed-off-by: Pablo Neira Ayuso +Stable-dep-of: 8d738c1869f6 ("netfilter: nf_tables: fix set size with rbtree backend") +Signed-off-by: Sasha Levin +--- + net/netfilter/nft_set_rbtree.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c +index afbda7e3fd048..896a9a7024b04 100644 +--- a/net/netfilter/nft_set_rbtree.c ++++ b/net/netfilter/nft_set_rbtree.c +@@ -221,14 +221,15 @@ static void *nft_rbtree_get(const struct net *net, const struct nft_set *set, + return rbe; + } + +-static void nft_rbtree_gc_remove(struct net *net, struct nft_set *set, +- struct nft_rbtree *priv, +- struct nft_rbtree_elem *rbe) ++static void nft_rbtree_gc_elem_remove(struct net *net, struct nft_set *set, ++ struct nft_rbtree *priv, ++ struct nft_rbtree_elem *rbe) + { + struct nft_set_elem elem = { + .priv = rbe, + }; + ++ lockdep_assert_held_write(&priv->lock); + nft_setelem_data_deactivate(net, set, &elem); + rb_erase(&rbe->node, &priv->root); + } +@@ -263,7 +264,7 @@ nft_rbtree_gc_elem(const struct nft_set *__set, struct nft_rbtree *priv, + rbe_prev = NULL; + if (prev) { + rbe_prev = rb_entry(prev, struct nft_rbtree_elem, node); +- nft_rbtree_gc_remove(net, set, priv, rbe_prev); ++ nft_rbtree_gc_elem_remove(net, set, priv, rbe_prev); + + /* There is always room in this trans gc for this element, + * memory allocation never actually happens, hence, the warning +@@ -277,7 +278,7 @@ nft_rbtree_gc_elem(const struct nft_set *__set, struct nft_rbtree *priv, + nft_trans_gc_elem_add(gc, rbe_prev); + } + +- nft_rbtree_gc_remove(net, set, priv, rbe); ++ nft_rbtree_gc_elem_remove(net, set, priv, rbe); + gc = nft_trans_gc_queue_sync(gc, GFP_ATOMIC); + if (WARN_ON_ONCE(!gc)) + return ERR_PTR(-ENOMEM); +-- +2.39.5 + diff --git a/queue-6.6/nfsv4.2-fix-copy_notify-xdr-buf-size-calculation.patch b/queue-6.6/nfsv4.2-fix-copy_notify-xdr-buf-size-calculation.patch new file mode 100644 index 0000000000..39d816b106 --- /dev/null +++ b/queue-6.6/nfsv4.2-fix-copy_notify-xdr-buf-size-calculation.patch @@ -0,0 +1,38 @@ +From 5d5ea47f61df8e60da12dcbb3af1181a141829ca Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 Dec 2024 11:52:00 -0500 +Subject: NFSv4.2: fix COPY_NOTIFY xdr buf size calculation + +From: Olga Kornievskaia + +[ Upstream commit e8380c2d06055665b3df6c03964911375d7f9290 ] + +We need to include sequence size in the compound. + +Fixes: 0491567b51ef ("NFS: add COPY_NOTIFY operation") +Signed-off-by: Olga Kornievskaia +Signed-off-by: Anna Schumaker +Signed-off-by: Sasha Levin +--- + fs/nfs/nfs42xdr.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c +index 9e3ae53e22058..becc3149aa9e5 100644 +--- a/fs/nfs/nfs42xdr.c ++++ b/fs/nfs/nfs42xdr.c +@@ -144,9 +144,11 @@ + decode_putfh_maxsz + \ + decode_offload_cancel_maxsz) + #define NFS4_enc_copy_notify_sz (compound_encode_hdr_maxsz + \ ++ encode_sequence_maxsz + \ + encode_putfh_maxsz + \ + encode_copy_notify_maxsz) + #define NFS4_dec_copy_notify_sz (compound_decode_hdr_maxsz + \ ++ decode_sequence_maxsz + \ + decode_putfh_maxsz + \ + decode_copy_notify_maxsz) + #define NFS4_enc_deallocate_sz (compound_encode_hdr_maxsz + \ +-- +2.39.5 + diff --git a/queue-6.6/nfsv4.2-mark-offload_cancel-moveable.patch b/queue-6.6/nfsv4.2-mark-offload_cancel-moveable.patch new file mode 100644 index 0000000000..8b3973ca00 --- /dev/null +++ b/queue-6.6/nfsv4.2-mark-offload_cancel-moveable.patch @@ -0,0 +1,36 @@ +From 23338dbbbfd73b7ae2ccece3daaedb745c964d3f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 13 Dec 2024 11:52:01 -0500 +Subject: NFSv4.2: mark OFFLOAD_CANCEL MOVEABLE + +From: Olga Kornievskaia + +[ Upstream commit 668135b9348c53fd205f5e07d11e82b10f31b55b ] + +OFFLOAD_CANCEL should be marked MOVEABLE for when we need to move +tasks off a non-functional transport. + +Fixes: c975c2092657 ("NFS send OFFLOAD_CANCEL when COPY killed") +Signed-off-by: Olga Kornievskaia +Signed-off-by: Anna Schumaker +Signed-off-by: Sasha Levin +--- + fs/nfs/nfs42proc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c +index 531c9c20ef1d1..9f0d69e652644 100644 +--- a/fs/nfs/nfs42proc.c ++++ b/fs/nfs/nfs42proc.c +@@ -552,7 +552,7 @@ static int nfs42_do_offload_cancel_async(struct file *dst, + .rpc_message = &msg, + .callback_ops = &nfs42_offload_cancel_ops, + .workqueue = nfsiod_workqueue, +- .flags = RPC_TASK_ASYNC, ++ .flags = RPC_TASK_ASYNC | RPC_TASK_MOVEABLE, + }; + int status; + +-- +2.39.5 + diff --git a/queue-6.6/nilfs2-convert-nilfs_lookup_dirty_data_buffers-to-us.patch b/queue-6.6/nilfs2-convert-nilfs_lookup_dirty_data_buffers-to-us.patch new file mode 100644 index 0000000000..c1d999b90b --- /dev/null +++ b/queue-6.6/nilfs2-convert-nilfs_lookup_dirty_data_buffers-to-us.patch @@ -0,0 +1,46 @@ +From 70c180c9d4531ade7ce5bb47e28975779d660a9f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Oct 2023 21:11:03 +0100 +Subject: nilfs2: convert nilfs_lookup_dirty_data_buffers to use + folio_create_empty_buffers + +From: Matthew Wilcox (Oracle) + +[ Upstream commit 922b12eff0b293fc13ae4045c7d7264e18938878 ] + +This function was already using a folio, so this update to the new API +removes a single folio->page->folio conversion. + +Link: https://lkml.kernel.org/r/20231016201114.1928083-17-willy@infradead.org +Signed-off-by: Matthew Wilcox (Oracle) +Acked-by: Ryusuke Konishi +Cc: Andreas Gruenbacher +Cc: Pankaj Raghav +Signed-off-by: Andrew Morton +Stable-dep-of: 367a9bffabe0 ("nilfs2: protect access to buffers with no active references") +Signed-off-by: Sasha Levin +--- + fs/nilfs2/segment.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c +index 0610cb12c11ca..57b535921a73b 100644 +--- a/fs/nilfs2/segment.c ++++ b/fs/nilfs2/segment.c +@@ -731,10 +731,9 @@ static size_t nilfs_lookup_dirty_data_buffers(struct inode *inode, + continue; + } + head = folio_buffers(folio); +- if (!head) { +- create_empty_buffers(&folio->page, i_blocksize(inode), 0); +- head = folio_buffers(folio); +- } ++ if (!head) ++ head = folio_create_empty_buffers(folio, ++ i_blocksize(inode), 0); + folio_unlock(folio); + + bh = head; +-- +2.39.5 + diff --git a/queue-6.6/nilfs2-protect-access-to-buffers-with-no-active-refe.patch b/queue-6.6/nilfs2-protect-access-to-buffers-with-no-active-refe.patch new file mode 100644 index 0000000000..0cbf3f87b7 --- /dev/null +++ b/queue-6.6/nilfs2-protect-access-to-buffers-with-no-active-refe.patch @@ -0,0 +1,61 @@ +From b04c76616f4a18e62714594b259f42c3bcf86f85 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 Jan 2025 05:00:47 +0900 +Subject: nilfs2: protect access to buffers with no active references + +From: Ryusuke Konishi + +[ Upstream commit 367a9bffabe08c04f6d725032cce3d891b2b9e1a ] + +nilfs_lookup_dirty_data_buffers(), which iterates through the buffers +attached to dirty data folios/pages, accesses the attached buffers without +locking the folios/pages. + +For data cache, nilfs_clear_folio_dirty() may be called asynchronously +when the file system degenerates to read only, so +nilfs_lookup_dirty_data_buffers() still has the potential to cause use +after free issues when buffers lose the protection of their dirty state +midway due to this asynchronous clearing and are unintentionally freed by +try_to_free_buffers(). + +Eliminate this race issue by adjusting the lock section in this function. + +Link: https://lkml.kernel.org/r/20250107200202.6432-3-konishi.ryusuke@gmail.com +Signed-off-by: Ryusuke Konishi +Fixes: 8c26c4e2694a ("nilfs2: fix issue with flush kernel thread after remount in RO mode because of driver's internal error or metadata corruption") +Signed-off-by: Andrew Morton +Signed-off-by: Sasha Levin +--- + fs/nilfs2/segment.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c +index 57b535921a73b..d4a98ac72b8ea 100644 +--- a/fs/nilfs2/segment.c ++++ b/fs/nilfs2/segment.c +@@ -734,7 +734,6 @@ static size_t nilfs_lookup_dirty_data_buffers(struct inode *inode, + if (!head) + head = folio_create_empty_buffers(folio, + i_blocksize(inode), 0); +- folio_unlock(folio); + + bh = head; + do { +@@ -744,11 +743,14 @@ static size_t nilfs_lookup_dirty_data_buffers(struct inode *inode, + list_add_tail(&bh->b_assoc_buffers, listp); + ndirties++; + if (unlikely(ndirties >= nlimit)) { ++ folio_unlock(folio); + folio_batch_release(&fbatch); + cond_resched(); + return ndirties; + } + } while (bh = bh->b_this_page, bh != head); ++ ++ folio_unlock(folio); + } + folio_batch_release(&fbatch); + cond_resched(); +-- +2.39.5 + diff --git a/queue-6.6/nvme-add-error-check-for-xa_store-in-nvme_get_effect.patch b/queue-6.6/nvme-add-error-check-for-xa_store-in-nvme_get_effect.patch new file mode 100644 index 0000000000..b1826488a6 --- /dev/null +++ b/queue-6.6/nvme-add-error-check-for-xa_store-in-nvme_get_effect.patch @@ -0,0 +1,52 @@ +From fab15378858baae0979d4b0b3eb71ed165b53045 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 Dec 2024 13:00:47 +0100 +Subject: nvme: Add error check for xa_store in nvme_get_effects_log + +From: Keisuke Nishimura + +[ Upstream commit ac32057acc7f3d7a238dafaa9b2aa2bc9750080e ] + +The xa_store() may fail due to memory allocation failure because there +is no guarantee that the index csi is already used. This fix adds an +error check of the return value of xa_store() in nvme_get_effects_log(). + +Fixes: 1cf7a12e09aa ("nvme: use an xarray to lookup the Commands Supported and Effects log") +Signed-off-by: Keisuke Nishimura +Reviewed-by: Christoph Hellwig +Reviewed-by: Sagi Grimberg +Signed-off-by: Keith Busch +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index 4aad16390d479..37485b8cc1281 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -2853,7 +2853,7 @@ int nvme_get_log(struct nvme_ctrl *ctrl, u32 nsid, u8 log_page, u8 lsp, u8 csi, + static int nvme_get_effects_log(struct nvme_ctrl *ctrl, u8 csi, + struct nvme_effects_log **log) + { +- struct nvme_effects_log *cel = xa_load(&ctrl->cels, csi); ++ struct nvme_effects_log *old, *cel = xa_load(&ctrl->cels, csi); + int ret; + + if (cel) +@@ -2870,7 +2870,11 @@ static int nvme_get_effects_log(struct nvme_ctrl *ctrl, u8 csi, + return ret; + } + +- xa_store(&ctrl->cels, csi, cel, GFP_KERNEL); ++ old = xa_store(&ctrl->cels, csi, cel, GFP_KERNEL); ++ if (xa_is_err(old)) { ++ kfree(cel); ++ return xa_err(old); ++ } + out: + *log = cel; + return 0; +-- +2.39.5 + diff --git a/queue-6.6/nvme-add-error-path-for-xa_store-in-nvme_init_effect.patch b/queue-6.6/nvme-add-error-path-for-xa_store-in-nvme_init_effect.patch new file mode 100644 index 0000000000..3c1bdf1d3d --- /dev/null +++ b/queue-6.6/nvme-add-error-path-for-xa_store-in-nvme_init_effect.patch @@ -0,0 +1,70 @@ +From c975545bb98995ea333c0d07e098ab8d43175ea0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Dec 2024 16:27:20 +0100 +Subject: nvme: Add error path for xa_store in nvme_init_effects + +From: Keisuke Nishimura + +[ Upstream commit d4a95adeabc6b5a39405e49c6d5ed14dd83682c4 ] + +The xa_store() may fail due to memory allocation failure because there +is no guarantee that the index NVME_CSI_NVM is already used. This fix +introduces a new function to handle the error path. + +Fixes: cc115cbe12d9 ("nvme: always initialize known command effects") +Signed-off-by: Keisuke Nishimura +Reviewed-by: Sagi Grimberg +Reviewed-by: Christoph Hellwig +Signed-off-by: Keith Busch +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 26 ++++++++++++++++++++++---- + 1 file changed, 22 insertions(+), 4 deletions(-) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index 37485b8cc1281..75ea4795188f2 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -2945,6 +2945,25 @@ static int nvme_init_non_mdts_limits(struct nvme_ctrl *ctrl) + return ret; + } + ++static int nvme_init_effects_log(struct nvme_ctrl *ctrl, ++ u8 csi, struct nvme_effects_log **log) ++{ ++ struct nvme_effects_log *effects, *old; ++ ++ effects = kzalloc(sizeof(*effects), GFP_KERNEL); ++ if (effects) ++ return -ENOMEM; ++ ++ old = xa_store(&ctrl->cels, csi, effects, GFP_KERNEL); ++ if (xa_is_err(old)) { ++ kfree(effects); ++ return xa_err(old); ++ } ++ ++ *log = effects; ++ return 0; ++} ++ + static void nvme_init_known_nvm_effects(struct nvme_ctrl *ctrl) + { + struct nvme_effects_log *log = ctrl->effects; +@@ -2991,10 +3010,9 @@ static int nvme_init_effects(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) + } + + if (!ctrl->effects) { +- ctrl->effects = kzalloc(sizeof(*ctrl->effects), GFP_KERNEL); +- if (!ctrl->effects) +- return -ENOMEM; +- xa_store(&ctrl->cels, NVME_CSI_NVM, ctrl->effects, GFP_KERNEL); ++ ret = nvme_init_effects_log(ctrl, NVME_CSI_NVM, &ctrl->effects); ++ if (ret < 0) ++ return ret; + } + + nvme_init_known_nvm_effects(ctrl); +-- +2.39.5 + diff --git a/queue-6.6/nvme-fix-bogus-kzalloc-return-check-in-nvme_init_eff.patch b/queue-6.6/nvme-fix-bogus-kzalloc-return-check-in-nvme_init_eff.patch new file mode 100644 index 0000000000..ed2e17e5c9 --- /dev/null +++ b/queue-6.6/nvme-fix-bogus-kzalloc-return-check-in-nvme_init_eff.patch @@ -0,0 +1,36 @@ +From 299926d8ae89a42c77f0d3fa6c7e3cc9a1fb8336 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Jan 2025 10:27:54 -0700 +Subject: nvme: fix bogus kzalloc() return check in nvme_init_effects_log() + +From: Jens Axboe + +[ Upstream commit 170e086ad3997f816d1f551f178a03a626a130b7 ] + +nvme_init_effects_log() returns failure when kzalloc() is successful, +which is obviously wrong and causes failures to boot. Correct the +check. + +Fixes: d4a95adeabc6 ("nvme: Add error path for xa_store in nvme_init_effects") +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + drivers/nvme/host/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c +index 75ea4795188f2..26e3f1896dc39 100644 +--- a/drivers/nvme/host/core.c ++++ b/drivers/nvme/host/core.c +@@ -2951,7 +2951,7 @@ static int nvme_init_effects_log(struct nvme_ctrl *ctrl, + struct nvme_effects_log *effects, *old; + + effects = kzalloc(sizeof(*effects), GFP_KERNEL); +- if (effects) ++ if (!effects) + return -ENOMEM; + + old = xa_store(&ctrl->cels, csi, effects, GFP_KERNEL); +-- +2.39.5 + diff --git a/queue-6.6/ocfs2-mark-dquot-as-inactive-if-failed-to-start-tran.patch b/queue-6.6/ocfs2-mark-dquot-as-inactive-if-failed-to-start-tran.patch new file mode 100644 index 0000000000..47ba30f2f1 --- /dev/null +++ b/queue-6.6/ocfs2-mark-dquot-as-inactive-if-failed-to-start-tran.patch @@ -0,0 +1,68 @@ +From 2702863a586a636474e2ede2899342cbf4b677d3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jan 2025 22:06:53 +0800 +Subject: ocfs2: mark dquot as inactive if failed to start trans while + releasing dquot + +From: Su Yue + +[ Upstream commit 276c61385f6bc3223a5ecd307cf4aba2dfbb9a31 ] + +While running fstests generic/329, the kernel workqueue +quota_release_workfn is dead looping in calling ocfs2_release_dquot(). +The ocfs2 state is already readonly but ocfs2_release_dquot wants to +start a transaction but fails and returns. + +===================================================================== +[ 2918.123602 ][ T275 ] On-disk corruption discovered. Please run +fsck.ocfs2 once the filesystem is unmounted. +[ 2918.124034 ][ T275 ] (kworker/u135:1,275,11):ocfs2_release_dquot:765 +ERROR: status = -30 +[ 2918.124452 ][ T275 ] (kworker/u135:1,275,11):ocfs2_release_dquot:795 +ERROR: status = -30 +[ 2918.124883 ][ T275 ] (kworker/u135:1,275,11):ocfs2_start_trans:357 +ERROR: status = -30 +[ 2918.125276 ][ T275 ] OCFS2: abort (device dm-0): ocfs2_start_trans: +Detected aborted journal +[ 2918.125710 ][ T275 ] On-disk corruption discovered. Please run +fsck.ocfs2 once the filesystem is unmounted. +===================================================================== + +ocfs2_release_dquot() is much like dquot_release(), which is called by +ext4 to handle similar situation. So here fix it by marking the dquot as +inactive like what dquot_release() does. + +Link: https://lkml.kernel.org/r/20250106140653.92292-1-glass.su@suse.com +Fixes: 9e33d69f553a ("ocfs2: Implementation of local and global quota file handling") +Signed-off-by: Su Yue +Reviewed-by: Joseph Qi +Cc: Mark Fasheh +Cc: Joel Becker +Cc: Junxiao Bi +Cc: Changwei Ge +Cc: Jun Piao +Signed-off-by: Andrew Morton +Signed-off-by: Sasha Levin +--- + fs/ocfs2/quota_global.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c +index 0dffd6a44d39d..24b031dc44ee1 100644 +--- a/fs/ocfs2/quota_global.c ++++ b/fs/ocfs2/quota_global.c +@@ -749,6 +749,11 @@ static int ocfs2_release_dquot(struct dquot *dquot) + handle = ocfs2_start_trans(osb, + ocfs2_calc_qdel_credits(dquot->dq_sb, dquot->dq_id.type)); + if (IS_ERR(handle)) { ++ /* ++ * Mark dquot as inactive to avoid endless cycle in ++ * quota_release_workfn(). ++ */ ++ clear_bit(DQ_ACTIVE_B, &dquot->dq_flags); + status = PTR_ERR(handle); + mlog_errno(status); + goto out_ilock; +-- +2.39.5 + diff --git a/queue-6.6/octeon_ep-remove-firmware-stats-fetch-in-ndo_get_sta.patch b/queue-6.6/octeon_ep-remove-firmware-stats-fetch-in-ndo_get_sta.patch new file mode 100644 index 0000000000..eb0be87d19 --- /dev/null +++ b/queue-6.6/octeon_ep-remove-firmware-stats-fetch-in-ndo_get_sta.patch @@ -0,0 +1,82 @@ +From 7823d05f7f398bc2465590fe6345900f48460419 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Jan 2025 01:46:50 -0800 +Subject: octeon_ep: remove firmware stats fetch in ndo_get_stats64 + +From: Shinas Rasheed + +[ Upstream commit 1f64255bb76c11d0c41a7d81d7cec68e49d5362d ] + +The firmware stats fetch call that happens in ndo_get_stats64() +is currently not required, and causes a warning to issue. + +The warn log is given below: + +[ 123.316837] ------------[ cut here ]------------ +[ 123.316840] Voluntary context switch within RCU read-side critical section! +[ 123.316917] pc : rcu_note_context_switch+0x2e4/0x300 +[ 123.316919] lr : rcu_note_context_switch+0x2e4/0x300 +[ 123.316947] Call trace: +[ 123.316949] rcu_note_context_switch+0x2e4/0x300 +[ 123.316952] __schedule+0x84/0x584 +[ 123.316955] schedule+0x38/0x90 +[ 123.316956] schedule_timeout+0xa0/0x1d4 +[ 123.316959] octep_send_mbox_req+0x190/0x230 [octeon_ep] +[ 123.316966] octep_ctrl_net_get_if_stats+0x78/0x100 [octeon_ep] +[ 123.316970] octep_get_stats64+0xd4/0xf0 [octeon_ep] +[ 123.316975] dev_get_stats+0x4c/0x114 +[ 123.316977] dev_seq_printf_stats+0x3c/0x11c +[ 123.316980] dev_seq_show+0x1c/0x40 +[ 123.316982] seq_read_iter+0x3cc/0x4e0 +[ 123.316985] seq_read+0xc8/0x110 +[ 123.316987] proc_reg_read+0x9c/0xec +[ 123.316990] vfs_read+0xc8/0x2ec +[ 123.316993] ksys_read+0x70/0x100 +[ 123.316995] __arm64_sys_read+0x20/0x30 +[ 123.316997] invoke_syscall.constprop.0+0x7c/0xd0 +[ 123.317000] do_el0_svc+0xb4/0xd0 +[ 123.317002] el0_svc+0xe8/0x1f4 +[ 123.317005] el0t_64_sync_handler+0x134/0x150 +[ 123.317006] el0t_64_sync+0x17c/0x180 +[ 123.317008] ---[ end trace 63399811432ab69b ]--- + +Fixes: 6a610a46bad1 ("octeon_ep: add support for ndo ops") +Signed-off-by: Shinas Rasheed +Link: https://patch.msgid.link/20250117094653.2588578-2-srasheed@marvell.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/ethernet/marvell/octeon_ep/octep_main.c | 10 ---------- + 1 file changed, 10 deletions(-) + +diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c +index 2ee1374db4c06..6f1fe7e283d4e 100644 +--- a/drivers/net/ethernet/marvell/octeon_ep/octep_main.c ++++ b/drivers/net/ethernet/marvell/octeon_ep/octep_main.c +@@ -761,12 +761,6 @@ static void octep_get_stats64(struct net_device *netdev, + struct octep_device *oct = netdev_priv(netdev); + int q; + +- if (netif_running(netdev)) +- octep_ctrl_net_get_if_stats(oct, +- OCTEP_CTRL_NET_INVALID_VFID, +- &oct->iface_rx_stats, +- &oct->iface_tx_stats); +- + tx_packets = 0; + tx_bytes = 0; + rx_packets = 0; +@@ -784,10 +778,6 @@ static void octep_get_stats64(struct net_device *netdev, + stats->tx_bytes = tx_bytes; + stats->rx_packets = rx_packets; + stats->rx_bytes = rx_bytes; +- stats->multicast = oct->iface_rx_stats.mcast_pkts; +- stats->rx_errors = oct->iface_rx_stats.err_pkts; +- stats->collisions = oct->iface_tx_stats.xscol; +- stats->tx_fifo_errors = oct->iface_tx_stats.undflw; + } + + /** +-- +2.39.5 + diff --git a/queue-6.6/of-remove-internal-arguments-from-of_property_for_ea.patch b/queue-6.6/of-remove-internal-arguments-from-of_property_for_ea.patch new file mode 100644 index 0000000000..203f7e1d7f --- /dev/null +++ b/queue-6.6/of-remove-internal-arguments-from-of_property_for_ea.patch @@ -0,0 +1,696 @@ +From ad458b2f1f65a19ff9f2891240ec3be1123be082 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 24 Jul 2024 18:33:06 +0200 +Subject: of: remove internal arguments from of_property_for_each_u32() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Luca Ceresoli + +[ Upstream commit 9722c3b66e21ff08aec570d02a97d331087fd70f ] + +The of_property_for_each_u32() macro needs five parameters, two of which +are primarily meant as internal variables for the macro itself (in the +for() clause). Yet these two parameters are used by a few drivers, and this +can be considered misuse or at least bad practice. + +Now that the kernel uses C11 to build, these two parameters can be avoided +by declaring them internally, thus changing this pattern: + + struct property *prop; + const __be32 *p; + u32 val; + + of_property_for_each_u32(np, "xyz", prop, p, val) { ... } + +to this: + + u32 val; + + of_property_for_each_u32(np, "xyz", val) { ... } + +However two variables cannot be declared in the for clause even with C11, +so declare one struct that contain the two variables we actually need. As +the variables inside this struct are not meant to be used by users of this +macro, give the struct instance the noticeable name "_it" so it is visible +during code reviews, helping to avoid new code to use it directly. + +Most usages are trivially converted as they do not use those two +parameters, as expected. The non-trivial cases are: + + - drivers/clk/clk.c, of_clk_get_parent_name(): easily doable anyway + - drivers/clk/clk-si5351.c, si5351_dt_parse(): this is more complex as the + checks had to be replicated in a different way, making code more verbose + and somewhat uglier, but I refrained from a full rework to keep as much + of the original code untouched having no hardware to test my changes + +All the changes have been build tested. The few for which I have the +hardware have been runtime-tested too. + +Reviewed-by: Andre Przywara # drivers/clk/sunxi/clk-simple-gates.c, drivers/clk/sunxi/clk-sun8i-bus-gates.c +Acked-by: Bartosz Golaszewski # drivers/gpio/gpio-brcmstb.c +Acked-by: Nicolas Ferre # drivers/irqchip/irq-atmel-aic-common.c +Acked-by: Jonathan Cameron # drivers/iio/adc/ti_am335x_adc.c +Acked-by: Uwe Kleine-König # drivers/pwm/pwm-samsung.c +Acked-by: Richard Leitner # drivers/usb/misc/usb251xb.c +Acked-by: Mark Brown # sound/soc/codecs/arizona.c +Reviewed-by: Richard Fitzgerald # sound/soc/codecs/arizona.c +Acked-by: Michael Ellerman # arch/powerpc/sysdev/xive/spapr.c +Acked-by: Stephen Boyd # clk +Signed-off-by: Luca Ceresoli +Acked-by: Lee Jones +Link: https://lore.kernel.org/r/20240724-of_property_for_each_u32-v3-1-bea82ce429e2@bootlin.com +Signed-off-by: Rob Herring (Arm) +Stable-dep-of: 28fa3291cad1 ("clk: fix an OF node reference leak in of_clk_get_parent_name()") +Signed-off-by: Sasha Levin +--- + arch/powerpc/sysdev/xive/native.c | 4 +-- + arch/powerpc/sysdev/xive/spapr.c | 3 +- + drivers/bus/ti-sysc.c | 4 +-- + drivers/clk/clk-conf.c | 4 +-- + drivers/clk/clk-si5351.c | 43 +++++++++++++++---------- + drivers/clk/clk.c | 12 +++---- + drivers/clk/qcom/common.c | 4 +-- + drivers/clk/sunxi/clk-simple-gates.c | 4 +-- + drivers/clk/sunxi/clk-sun8i-bus-gates.c | 4 +-- + drivers/clocksource/samsung_pwm_timer.c | 4 +-- + drivers/gpio/gpio-brcmstb.c | 5 +-- + drivers/iio/adc/ti_am335x_adc.c | 4 +-- + drivers/irqchip/irq-atmel-aic-common.c | 4 +-- + drivers/irqchip/irq-pic32-evic.c | 4 +-- + drivers/mfd/ti_am335x_tscadc.c | 4 +-- + drivers/pinctrl/nxp/pinctrl-s32cc.c | 4 +-- + drivers/pinctrl/pinctrl-k210.c | 4 +-- + drivers/pwm/pwm-samsung.c | 4 +-- + drivers/tty/sysrq.c | 4 +-- + drivers/usb/misc/usb251xb.c | 4 +-- + include/linux/of.h | 15 ++++----- + sound/soc/codecs/arizona.c | 12 +++---- + 22 files changed, 61 insertions(+), 93 deletions(-) + +diff --git a/arch/powerpc/sysdev/xive/native.c b/arch/powerpc/sysdev/xive/native.c +index f1c0fa6ece21d..9928b93dbc4d4 100644 +--- a/arch/powerpc/sysdev/xive/native.c ++++ b/arch/powerpc/sysdev/xive/native.c +@@ -559,9 +559,7 @@ bool __init xive_native_init(void) + struct device_node *np; + struct resource r; + void __iomem *tima; +- struct property *prop; + u8 max_prio = 7; +- const __be32 *p; + u32 val, cpu; + s64 rc; + +@@ -592,7 +590,7 @@ bool __init xive_native_init(void) + max_prio = val - 1; + + /* Iterate the EQ sizes and pick one */ +- of_property_for_each_u32(np, "ibm,xive-eq-sizes", prop, p, val) { ++ of_property_for_each_u32(np, "ibm,xive-eq-sizes", val) { + xive_queue_shift = val; + if (val == PAGE_SHIFT) + break; +diff --git a/arch/powerpc/sysdev/xive/spapr.c b/arch/powerpc/sysdev/xive/spapr.c +index e454192643910..f2fa985a2c771 100644 +--- a/arch/powerpc/sysdev/xive/spapr.c ++++ b/arch/powerpc/sysdev/xive/spapr.c +@@ -814,7 +814,6 @@ bool __init xive_spapr_init(void) + struct device_node *np; + struct resource r; + void __iomem *tima; +- struct property *prop; + u8 max_prio; + u32 val; + u32 len; +@@ -866,7 +865,7 @@ bool __init xive_spapr_init(void) + } + + /* Iterate the EQ sizes and pick one */ +- of_property_for_each_u32(np, "ibm,xive-eq-sizes", prop, reg, val) { ++ of_property_for_each_u32(np, "ibm,xive-eq-sizes", val) { + xive_queue_shift = val; + if (val == PAGE_SHIFT) + break; +diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c +index 9ed9239b1228f..65163312dab8a 100644 +--- a/drivers/bus/ti-sysc.c ++++ b/drivers/bus/ti-sysc.c +@@ -2283,11 +2283,9 @@ static int sysc_init_idlemode(struct sysc *ddata, u8 *idlemodes, + const char *name) + { + struct device_node *np = ddata->dev->of_node; +- struct property *prop; +- const __be32 *p; + u32 val; + +- of_property_for_each_u32(np, name, prop, p, val) { ++ of_property_for_each_u32(np, name, val) { + if (val >= SYSC_NR_IDLEMODES) { + dev_err(ddata->dev, "invalid idlemode: %i\n", val); + return -EINVAL; +diff --git a/drivers/clk/clk-conf.c b/drivers/clk/clk-conf.c +index 1a4e6340f95ce..0584205620207 100644 +--- a/drivers/clk/clk-conf.c ++++ b/drivers/clk/clk-conf.c +@@ -81,13 +81,11 @@ static int __set_clk_parents(struct device_node *node, bool clk_supplier) + static int __set_clk_rates(struct device_node *node, bool clk_supplier) + { + struct of_phandle_args clkspec; +- struct property *prop; +- const __be32 *cur; + int rc, index = 0; + struct clk *clk; + u32 rate; + +- of_property_for_each_u32(node, "assigned-clock-rates", prop, cur, rate) { ++ of_property_for_each_u32(node, "assigned-clock-rates", rate) { + if (rate) { + rc = of_parse_phandle_with_args(node, "assigned-clocks", + "#clock-cells", index, &clkspec); +diff --git a/drivers/clk/clk-si5351.c b/drivers/clk/clk-si5351.c +index 95d7afb8cfc6a..dd3573da12545 100644 +--- a/drivers/clk/clk-si5351.c ++++ b/drivers/clk/clk-si5351.c +@@ -1175,8 +1175,8 @@ static int si5351_dt_parse(struct i2c_client *client, + { + struct device_node *child, *np = client->dev.of_node; + struct si5351_platform_data *pdata; +- struct property *prop; +- const __be32 *p; ++ u32 array[4]; ++ int sz, i; + int num = 0; + u32 val; + +@@ -1191,20 +1191,24 @@ static int si5351_dt_parse(struct i2c_client *client, + * property silabs,pll-source : , [<..>] + * allow to selectively set pll source + */ +- of_property_for_each_u32(np, "silabs,pll-source", prop, p, num) { ++ sz = of_property_read_variable_u32_array(np, "silabs,pll-source", array, 2, 4); ++ sz = (sz == -EINVAL) ? 0 : sz; /* Missing property is OK */ ++ if (sz < 0) ++ return dev_err_probe(&client->dev, sz, "invalid pll-source\n"); ++ if (sz % 2) ++ return dev_err_probe(&client->dev, -EINVAL, ++ "missing pll-source for pll %d\n", array[sz - 1]); ++ ++ for (i = 0; i < sz; i += 2) { ++ num = array[i]; ++ val = array[i + 1]; ++ + if (num >= 2) { + dev_err(&client->dev, + "invalid pll %d on pll-source prop\n", num); + return -EINVAL; + } + +- p = of_prop_next_u32(prop, p, &val); +- if (!p) { +- dev_err(&client->dev, +- "missing pll-source for pll %d\n", num); +- return -EINVAL; +- } +- + switch (val) { + case 0: + pdata->pll_src[num] = SI5351_PLL_SRC_XTAL; +@@ -1232,19 +1236,24 @@ static int si5351_dt_parse(struct i2c_client *client, + pdata->pll_reset[0] = true; + pdata->pll_reset[1] = true; + +- of_property_for_each_u32(np, "silabs,pll-reset-mode", prop, p, num) { ++ sz = of_property_read_variable_u32_array(np, "silabs,pll-reset-mode", array, 2, 4); ++ sz = (sz == -EINVAL) ? 0 : sz; /* Missing property is OK */ ++ if (sz < 0) ++ return dev_err_probe(&client->dev, sz, "invalid pll-reset-mode\n"); ++ if (sz % 2) ++ return dev_err_probe(&client->dev, -EINVAL, ++ "missing pll-reset-mode for pll %d\n", array[sz - 1]); ++ ++ for (i = 0; i < sz; i += 2) { ++ num = array[i]; ++ val = array[i + 1]; ++ + if (num >= 2) { + dev_err(&client->dev, + "invalid pll %d on pll-reset-mode prop\n", num); + return -EINVAL; + } + +- p = of_prop_next_u32(prop, p, &val); +- if (!p) { +- dev_err(&client->dev, +- "missing pll-reset-mode for pll %d\n", num); +- return -EINVAL; +- } + + switch (val) { + case 0: +diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c +index f8776065ad1f1..f795773b322a3 100644 +--- a/drivers/clk/clk.c ++++ b/drivers/clk/clk.c +@@ -5316,9 +5316,8 @@ EXPORT_SYMBOL_GPL(of_clk_get_parent_count); + const char *of_clk_get_parent_name(const struct device_node *np, int index) + { + struct of_phandle_args clkspec; +- struct property *prop; + const char *clk_name; +- const __be32 *vp; ++ bool found = false; + u32 pv; + int rc; + int count; +@@ -5335,15 +5334,16 @@ const char *of_clk_get_parent_name(const struct device_node *np, int index) + /* if there is an indices property, use it to transfer the index + * specified into an array offset for the clock-output-names property. + */ +- of_property_for_each_u32(clkspec.np, "clock-indices", prop, vp, pv) { ++ of_property_for_each_u32(clkspec.np, "clock-indices", pv) { + if (index == pv) { + index = count; ++ found = true; + break; + } + count++; + } + /* We went off the end of 'clock-indices' without finding it */ +- if (prop && !vp) ++ if (of_property_present(clkspec.np, "clock-indices") && !found) + return NULL; + + if (of_property_read_string_index(clkspec.np, "clock-output-names", +@@ -5456,14 +5456,12 @@ static int parent_ready(struct device_node *np) + int of_clk_detect_critical(struct device_node *np, int index, + unsigned long *flags) + { +- struct property *prop; +- const __be32 *cur; + uint32_t idx; + + if (!np || !flags) + return -EINVAL; + +- of_property_for_each_u32(np, "clock-critical", prop, cur, idx) ++ of_property_for_each_u32(np, "clock-critical", idx) + if (index == idx) + *flags |= CLK_IS_CRITICAL; + +diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c +index 75f09e6e057e1..35bd987f2e52a 100644 +--- a/drivers/clk/qcom/common.c ++++ b/drivers/clk/qcom/common.c +@@ -208,11 +208,9 @@ EXPORT_SYMBOL_GPL(qcom_cc_register_sleep_clk); + static void qcom_cc_drop_protected(struct device *dev, struct qcom_cc *cc) + { + struct device_node *np = dev->of_node; +- struct property *prop; +- const __be32 *p; + u32 i; + +- of_property_for_each_u32(np, "protected-clocks", prop, p, i) { ++ of_property_for_each_u32(np, "protected-clocks", i) { + if (i >= cc->num_rclks) + continue; + +diff --git a/drivers/clk/sunxi/clk-simple-gates.c b/drivers/clk/sunxi/clk-simple-gates.c +index 0399627c226a6..845efc1ec800b 100644 +--- a/drivers/clk/sunxi/clk-simple-gates.c ++++ b/drivers/clk/sunxi/clk-simple-gates.c +@@ -21,11 +21,9 @@ static void __init sunxi_simple_gates_setup(struct device_node *node, + { + struct clk_onecell_data *clk_data; + const char *clk_parent, *clk_name; +- struct property *prop; + struct resource res; + void __iomem *clk_reg; + void __iomem *reg; +- const __be32 *p; + int number, i = 0, j; + u8 clk_bit; + u32 index; +@@ -47,7 +45,7 @@ static void __init sunxi_simple_gates_setup(struct device_node *node, + if (!clk_data->clks) + goto err_free_data; + +- of_property_for_each_u32(node, "clock-indices", prop, p, index) { ++ of_property_for_each_u32(node, "clock-indices", index) { + of_property_read_string_index(node, "clock-output-names", + i, &clk_name); + +diff --git a/drivers/clk/sunxi/clk-sun8i-bus-gates.c b/drivers/clk/sunxi/clk-sun8i-bus-gates.c +index b87f331f63c9e..8482ac8e5898a 100644 +--- a/drivers/clk/sunxi/clk-sun8i-bus-gates.c ++++ b/drivers/clk/sunxi/clk-sun8i-bus-gates.c +@@ -24,11 +24,9 @@ static void __init sun8i_h3_bus_gates_init(struct device_node *node) + const char *parents[PARENT_MAX]; + struct clk_onecell_data *clk_data; + const char *clk_name; +- struct property *prop; + struct resource res; + void __iomem *clk_reg; + void __iomem *reg; +- const __be32 *p; + int number, i; + u8 clk_bit; + int index; +@@ -58,7 +56,7 @@ static void __init sun8i_h3_bus_gates_init(struct device_node *node) + goto err_free_data; + + i = 0; +- of_property_for_each_u32(node, "clock-indices", prop, p, index) { ++ of_property_for_each_u32(node, "clock-indices", index) { + of_property_read_string_index(node, "clock-output-names", + i, &clk_name); + +diff --git a/drivers/clocksource/samsung_pwm_timer.c b/drivers/clocksource/samsung_pwm_timer.c +index 6e46781bc9acf..b9561e3f196c4 100644 +--- a/drivers/clocksource/samsung_pwm_timer.c ++++ b/drivers/clocksource/samsung_pwm_timer.c +@@ -418,8 +418,6 @@ void __init samsung_pwm_clocksource_init(void __iomem *base, + static int __init samsung_pwm_alloc(struct device_node *np, + const struct samsung_pwm_variant *variant) + { +- struct property *prop; +- const __be32 *cur; + u32 val; + int i, ret; + +@@ -427,7 +425,7 @@ static int __init samsung_pwm_alloc(struct device_node *np, + for (i = 0; i < SAMSUNG_PWM_NUM; ++i) + pwm.irq[i] = irq_of_parse_and_map(np, i); + +- of_property_for_each_u32(np, "samsung,pwm-outputs", prop, cur, val) { ++ of_property_for_each_u32(np, "samsung,pwm-outputs", val) { + if (val >= SAMSUNG_PWM_NUM) { + pr_warn("%s: invalid channel index in samsung,pwm-outputs property\n", __func__); + continue; +diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c +index bccdbfd5ec805..4588666a52d50 100644 +--- a/drivers/gpio/gpio-brcmstb.c ++++ b/drivers/gpio/gpio-brcmstb.c +@@ -594,8 +594,6 @@ static int brcmstb_gpio_probe(struct platform_device *pdev) + void __iomem *reg_base; + struct brcmstb_gpio_priv *priv; + struct resource *res; +- struct property *prop; +- const __be32 *p; + u32 bank_width; + int num_banks = 0; + int err; +@@ -640,8 +638,7 @@ static int brcmstb_gpio_probe(struct platform_device *pdev) + flags = BGPIOF_BIG_ENDIAN_BYTE_ORDER; + #endif + +- of_property_for_each_u32(np, "brcm,gpio-bank-widths", prop, p, +- bank_width) { ++ of_property_for_each_u32(np, "brcm,gpio-bank-widths", bank_width) { + struct brcmstb_gpio_bank *bank; + struct gpio_chip *gc; + +diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c +index 5f87959869954..32f1f91e27204 100644 +--- a/drivers/iio/adc/ti_am335x_adc.c ++++ b/drivers/iio/adc/ti_am335x_adc.c +@@ -564,13 +564,11 @@ static int tiadc_parse_dt(struct platform_device *pdev, + struct tiadc_device *adc_dev) + { + struct device_node *node = pdev->dev.of_node; +- struct property *prop; +- const __be32 *cur; + int channels = 0; + u32 val; + int i; + +- of_property_for_each_u32(node, "ti,adc-channels", prop, cur, val) { ++ of_property_for_each_u32(node, "ti,adc-channels", val) { + adc_dev->channel_line[channels] = val; + + /* Set Default values for optional DT parameters */ +diff --git a/drivers/irqchip/irq-atmel-aic-common.c b/drivers/irqchip/irq-atmel-aic-common.c +index 072bd227b6c67..4525366d16d61 100644 +--- a/drivers/irqchip/irq-atmel-aic-common.c ++++ b/drivers/irqchip/irq-atmel-aic-common.c +@@ -111,8 +111,6 @@ static void __init aic_common_ext_irq_of_init(struct irq_domain *domain) + struct device_node *node = irq_domain_get_of_node(domain); + struct irq_chip_generic *gc; + struct aic_chip_data *aic; +- struct property *prop; +- const __be32 *p; + u32 hwirq; + + gc = irq_get_domain_generic_chip(domain, 0); +@@ -120,7 +118,7 @@ static void __init aic_common_ext_irq_of_init(struct irq_domain *domain) + aic = gc->private; + aic->ext_irqs |= 1; + +- of_property_for_each_u32(node, "atmel,external-irqs", prop, p, hwirq) { ++ of_property_for_each_u32(node, "atmel,external-irqs", hwirq) { + gc = irq_get_domain_generic_chip(domain, hwirq); + if (!gc) { + pr_warn("AIC: external irq %d >= %d skip it\n", +diff --git a/drivers/irqchip/irq-pic32-evic.c b/drivers/irqchip/irq-pic32-evic.c +index 1d9bb28d13e5d..5d6b8e025bb87 100644 +--- a/drivers/irqchip/irq-pic32-evic.c ++++ b/drivers/irqchip/irq-pic32-evic.c +@@ -190,13 +190,11 @@ static void __init pic32_ext_irq_of_init(struct irq_domain *domain) + { + struct device_node *node = irq_domain_get_of_node(domain); + struct evic_chip_data *priv = domain->host_data; +- struct property *prop; +- const __le32 *p; + u32 hwirq; + int i = 0; + const char *pname = "microchip,external-irqs"; + +- of_property_for_each_u32(node, pname, prop, p, hwirq) { ++ of_property_for_each_u32(node, pname, hwirq) { + if (i >= ARRAY_SIZE(priv->ext_irqs)) { + pr_warn("More than %d external irq, skip rest\n", + ARRAY_SIZE(priv->ext_irqs)); +diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c +index b88eb70c17b35..936a9f6c16f0e 100644 +--- a/drivers/mfd/ti_am335x_tscadc.c ++++ b/drivers/mfd/ti_am335x_tscadc.c +@@ -119,8 +119,6 @@ static int ti_tscadc_probe(struct platform_device *pdev) + struct clk *clk; + struct device_node *node; + struct mfd_cell *cell; +- struct property *prop; +- const __be32 *cur; + bool use_tsc = false, use_mag = false; + u32 val; + int err; +@@ -167,7 +165,7 @@ static int ti_tscadc_probe(struct platform_device *pdev) + } + + node = of_get_child_by_name(pdev->dev.of_node, "adc"); +- of_property_for_each_u32(node, "ti,adc-channels", prop, cur, val) { ++ of_property_for_each_u32(node, "ti,adc-channels", val) { + adc_channels++; + if (val > 7) { + dev_err(&pdev->dev, " PIN numbers are 0..7 (not %d)\n", +diff --git a/drivers/pinctrl/nxp/pinctrl-s32cc.c b/drivers/pinctrl/nxp/pinctrl-s32cc.c +index f0cad2c501f76..08d80fb935b3a 100644 +--- a/drivers/pinctrl/nxp/pinctrl-s32cc.c ++++ b/drivers/pinctrl/nxp/pinctrl-s32cc.c +@@ -735,9 +735,7 @@ static int s32_pinctrl_parse_groups(struct device_node *np, + struct s32_pin_group *grp, + struct s32_pinctrl_soc_info *info) + { +- const __be32 *p; + struct device *dev; +- struct property *prop; + unsigned int *pins, *sss; + int i, npins; + u32 pinmux; +@@ -768,7 +766,7 @@ static int s32_pinctrl_parse_groups(struct device_node *np, + return -ENOMEM; + + i = 0; +- of_property_for_each_u32(np, "pinmux", prop, p, pinmux) { ++ of_property_for_each_u32(np, "pinmux", pinmux) { + pins[i] = get_pin_no(pinmux); + sss[i] = get_pin_func(pinmux); + +diff --git a/drivers/pinctrl/pinctrl-k210.c b/drivers/pinctrl/pinctrl-k210.c +index 7c05dbf533e7a..558fc2ad976fc 100644 +--- a/drivers/pinctrl/pinctrl-k210.c ++++ b/drivers/pinctrl/pinctrl-k210.c +@@ -763,8 +763,6 @@ static int k210_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev, + unsigned int *reserved_maps, + unsigned int *num_maps) + { +- struct property *prop; +- const __be32 *p; + int ret, pinmux_groups; + u32 pinmux_group; + unsigned long *configs = NULL; +@@ -797,7 +795,7 @@ static int k210_pinctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev, + if (ret < 0) + goto exit; + +- of_property_for_each_u32(np, "pinmux", prop, p, pinmux_group) { ++ of_property_for_each_u32(np, "pinmux", pinmux_group) { + const char *group_name, *func_name; + u32 pin = FIELD_GET(K210_PG_PIN, pinmux_group); + u32 func = FIELD_GET(K210_PG_FUNC, pinmux_group); +diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c +index e8828f57ab150..7d0966b07dffb 100644 +--- a/drivers/pwm/pwm-samsung.c ++++ b/drivers/pwm/pwm-samsung.c +@@ -521,8 +521,6 @@ static int pwm_samsung_parse_dt(struct samsung_pwm_chip *chip) + { + struct device_node *np = chip->chip.dev->of_node; + const struct of_device_id *match; +- struct property *prop; +- const __be32 *cur; + u32 val; + + match = of_match_node(samsung_pwm_matches, np); +@@ -531,7 +529,7 @@ static int pwm_samsung_parse_dt(struct samsung_pwm_chip *chip) + + memcpy(&chip->variant, match->data, sizeof(chip->variant)); + +- of_property_for_each_u32(np, "samsung,pwm-outputs", prop, cur, val) { ++ of_property_for_each_u32(np, "samsung,pwm-outputs", val) { + if (val >= SAMSUNG_PWM_NUM) { + dev_err(chip->chip.dev, + "%s: invalid channel index in samsung,pwm-outputs property\n", +diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c +index 6b4a28bcf2f5f..5a314f5d7630a 100644 +--- a/drivers/tty/sysrq.c ++++ b/drivers/tty/sysrq.c +@@ -759,8 +759,6 @@ static void sysrq_of_get_keyreset_config(void) + { + u32 key; + struct device_node *np; +- struct property *prop; +- const __be32 *p; + + np = of_find_node_by_path("/chosen/linux,sysrq-reset-seq"); + if (!np) { +@@ -771,7 +769,7 @@ static void sysrq_of_get_keyreset_config(void) + /* Reset in case a __weak definition was present */ + sysrq_reset_seq_len = 0; + +- of_property_for_each_u32(np, "keyset", prop, p, key) { ++ of_property_for_each_u32(np, "keyset", key) { + if (key == KEY_RESERVED || key > KEY_MAX || + sysrq_reset_seq_len == SYSRQ_KEY_RESET_MAX) + break; +diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c +index 7da404f55a6d9..3970bf9ca818a 100644 +--- a/drivers/usb/misc/usb251xb.c ++++ b/drivers/usb/misc/usb251xb.c +@@ -382,11 +382,9 @@ static void usb251xb_get_ports_field(struct usb251xb *hub, + bool ds_only, u8 *fld) + { + struct device *dev = hub->dev; +- struct property *prop; +- const __be32 *p; + u32 port; + +- of_property_for_each_u32(dev->of_node, prop_name, prop, p, port) { ++ of_property_for_each_u32(dev->of_node, prop_name, port) { + if ((port >= ds_only ? 1 : 0) && (port <= port_cnt)) + *fld |= BIT(port); + else +diff --git a/include/linux/of.h b/include/linux/of.h +index 024dda54b9c77..afee93163fddd 100644 +--- a/include/linux/of.h ++++ b/include/linux/of.h +@@ -423,11 +423,9 @@ extern int of_detach_node(struct device_node *); + #define of_match_ptr(_ptr) (_ptr) + + /* +- * struct property *prop; +- * const __be32 *p; + * u32 u; + * +- * of_property_for_each_u32(np, "propname", prop, p, u) ++ * of_property_for_each_u32(np, "propname", u) + * printk("U32 value: %x\n", u); + */ + const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur, +@@ -1399,11 +1397,12 @@ static inline int of_property_read_s32(const struct device_node *np, + err == 0; \ + err = of_phandle_iterator_next(it)) + +-#define of_property_for_each_u32(np, propname, prop, p, u) \ +- for (prop = of_find_property(np, propname, NULL), \ +- p = of_prop_next_u32(prop, NULL, &u); \ +- p; \ +- p = of_prop_next_u32(prop, p, &u)) ++#define of_property_for_each_u32(np, propname, u) \ ++ for (struct {struct property *prop; const __be32 *item; } _it = \ ++ {of_find_property(np, propname, NULL), \ ++ of_prop_next_u32(_it.prop, NULL, &u)}; \ ++ _it.item; \ ++ _it.item = of_prop_next_u32(_it.prop, _it.item, &u)) + + #define of_property_for_each_string(np, propname, prop, s) \ + for (prop = of_find_property(np, propname, NULL), \ +diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c +index 7434aeeda292e..402b9a2ff0240 100644 +--- a/sound/soc/codecs/arizona.c ++++ b/sound/soc/codecs/arizona.c +@@ -2786,15 +2786,13 @@ int arizona_of_get_audio_pdata(struct arizona *arizona) + { + struct arizona_pdata *pdata = &arizona->pdata; + struct device_node *np = arizona->dev->of_node; +- struct property *prop; +- const __be32 *cur; + u32 val; + u32 pdm_val[ARIZONA_MAX_PDM_SPK]; + int ret; + int count = 0; + + count = 0; +- of_property_for_each_u32(np, "wlf,inmode", prop, cur, val) { ++ of_property_for_each_u32(np, "wlf,inmode", val) { + if (count == ARRAY_SIZE(pdata->inmode)) + break; + +@@ -2803,7 +2801,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona) + } + + count = 0; +- of_property_for_each_u32(np, "wlf,dmic-ref", prop, cur, val) { ++ of_property_for_each_u32(np, "wlf,dmic-ref", val) { + if (count == ARRAY_SIZE(pdata->dmic_ref)) + break; + +@@ -2812,7 +2810,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona) + } + + count = 0; +- of_property_for_each_u32(np, "wlf,out-mono", prop, cur, val) { ++ of_property_for_each_u32(np, "wlf,out-mono", val) { + if (count == ARRAY_SIZE(pdata->out_mono)) + break; + +@@ -2821,7 +2819,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona) + } + + count = 0; +- of_property_for_each_u32(np, "wlf,max-channels-clocked", prop, cur, val) { ++ of_property_for_each_u32(np, "wlf,max-channels-clocked", val) { + if (count == ARRAY_SIZE(pdata->max_channels_clocked)) + break; + +@@ -2830,7 +2828,7 @@ int arizona_of_get_audio_pdata(struct arizona *arizona) + } + + count = 0; +- of_property_for_each_u32(np, "wlf,out-volume-limit", prop, cur, val) { ++ of_property_for_each_u32(np, "wlf,out-volume-limit", val) { + if (count == ARRAY_SIZE(pdata->out_vol_limit)) + break; + +-- +2.39.5 + diff --git a/queue-6.6/of-reserved-memory-do-not-make-kmemleak-ignore-freed.patch b/queue-6.6/of-reserved-memory-do-not-make-kmemleak-ignore-freed.patch new file mode 100644 index 0000000000..7850eb0059 --- /dev/null +++ b/queue-6.6/of-reserved-memory-do-not-make-kmemleak-ignore-freed.patch @@ -0,0 +1,48 @@ +From 2277b5fdf89bbdaf9084edae7a65c89e41bac622 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Jan 2025 21:27:01 +0800 +Subject: of: reserved-memory: Do not make kmemleak ignore freed address + +From: Zijun Hu + +[ Upstream commit 29091a52562bca4d6e678dd8f0085dac119d6a21 ] + +early_init_dt_alloc_reserved_memory_arch() will free address @base when +suffers memblock_mark_nomap() error, but it still makes kmemleak ignore +the freed address @base via kmemleak_ignore_phys(). + +That is unnecessary, besides, also causes unnecessary warning messages: + +kmemleak_ignore_phys() + -> make_black_object() + -> paint_ptr() + -> kmemleak_warn() // warning message here. + +Fix by avoiding kmemleak_ignore_phys() when suffer the error. + +Fixes: 658aafc8139c ("memblock: exclude MEMBLOCK_NOMAP regions from kmemleak") +Signed-off-by: Zijun Hu +Link: https://lore.kernel.org/r/20250109-of_core_fix-v4-10-db8a72415b8c@quicinc.com +Signed-off-by: Rob Herring (Arm) +Signed-off-by: Sasha Levin +--- + drivers/of/of_reserved_mem.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c +index 7ec94cfcbddb1..959f1808c240f 100644 +--- a/drivers/of/of_reserved_mem.c ++++ b/drivers/of/of_reserved_mem.c +@@ -50,7 +50,8 @@ static int __init early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, + memblock_phys_free(base, size); + } + +- kmemleak_ignore_phys(base); ++ if (!err) ++ kmemleak_ignore_phys(base); + + return err; + } +-- +2.39.5 + diff --git a/queue-6.6/opp-add-index-check-to-assert-to-avoid-buffer-overfl.patch b/queue-6.6/opp-add-index-check-to-assert-to-avoid-buffer-overfl.patch new file mode 100644 index 0000000000..b6ed628356 --- /dev/null +++ b/queue-6.6/opp-add-index-check-to-assert-to-avoid-buffer-overfl.patch @@ -0,0 +1,185 @@ +From 08bccf006c5f006c78daf67e1d5988a7b8ab3bca Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 3 Dec 2024 09:12:59 +0100 +Subject: OPP: add index check to assert to avoid buffer overflow in + _read_freq() + +From: Neil Armstrong + +[ Upstream commit d659bc68ed489022ea33342cfbda2911a81e7a0d ] + +Pass the freq index to the assert function to make sure +we do not read a freq out of the opp->rates[] table when called +from the indexed variants: +dev_pm_opp_find_freq_exact_indexed() or +dev_pm_opp_find_freq_ceil/floor_indexed(). + +Add a secondary parameter to the assert function, unused +for assert_single_clk() then add assert_clk_index() which +will check for the clock index when called from the _indexed() +find functions. + +Fixes: 142e17c1c2b4 ("OPP: Introduce dev_pm_opp_find_freq_{ceil/floor}_indexed() APIs") +Fixes: a5893928bb17 ("OPP: Add dev_pm_opp_find_freq_exact_indexed()") +Signed-off-by: Neil Armstrong +Signed-off-by: Viresh Kumar +Signed-off-by: Sasha Levin +--- + drivers/opp/core.c | 42 +++++++++++++++++++++++++++--------------- + 1 file changed, 27 insertions(+), 15 deletions(-) + +diff --git a/drivers/opp/core.c b/drivers/opp/core.c +index bceb27b1baa18..3c26130dc75e3 100644 +--- a/drivers/opp/core.c ++++ b/drivers/opp/core.c +@@ -101,11 +101,21 @@ struct opp_table *_find_opp_table(struct device *dev) + * representation in the OPP table and manage the clock configuration themselves + * in an platform specific way. + */ +-static bool assert_single_clk(struct opp_table *opp_table) ++static bool assert_single_clk(struct opp_table *opp_table, ++ unsigned int __always_unused index) + { + return !WARN_ON(opp_table->clk_count > 1); + } + ++/* ++ * Returns true if clock table is large enough to contain the clock index. ++ */ ++static bool assert_clk_index(struct opp_table *opp_table, ++ unsigned int index) ++{ ++ return opp_table->clk_count > index; ++} ++ + /** + * dev_pm_opp_get_voltage() - Gets the voltage corresponding to an opp + * @opp: opp for which voltage has to be returned for +@@ -499,12 +509,12 @@ static struct dev_pm_opp *_opp_table_find_key(struct opp_table *opp_table, + unsigned long (*read)(struct dev_pm_opp *opp, int index), + bool (*compare)(struct dev_pm_opp **opp, struct dev_pm_opp *temp_opp, + unsigned long opp_key, unsigned long key), +- bool (*assert)(struct opp_table *opp_table)) ++ bool (*assert)(struct opp_table *opp_table, unsigned int index)) + { + struct dev_pm_opp *temp_opp, *opp = ERR_PTR(-ERANGE); + + /* Assert that the requirement is met */ +- if (assert && !assert(opp_table)) ++ if (assert && !assert(opp_table, index)) + return ERR_PTR(-EINVAL); + + mutex_lock(&opp_table->lock); +@@ -532,7 +542,7 @@ _find_key(struct device *dev, unsigned long *key, int index, bool available, + unsigned long (*read)(struct dev_pm_opp *opp, int index), + bool (*compare)(struct dev_pm_opp **opp, struct dev_pm_opp *temp_opp, + unsigned long opp_key, unsigned long key), +- bool (*assert)(struct opp_table *opp_table)) ++ bool (*assert)(struct opp_table *opp_table, unsigned int index)) + { + struct opp_table *opp_table; + struct dev_pm_opp *opp; +@@ -555,7 +565,7 @@ _find_key(struct device *dev, unsigned long *key, int index, bool available, + static struct dev_pm_opp *_find_key_exact(struct device *dev, + unsigned long key, int index, bool available, + unsigned long (*read)(struct dev_pm_opp *opp, int index), +- bool (*assert)(struct opp_table *opp_table)) ++ bool (*assert)(struct opp_table *opp_table, unsigned int index)) + { + /* + * The value of key will be updated here, but will be ignored as the +@@ -568,7 +578,7 @@ static struct dev_pm_opp *_find_key_exact(struct device *dev, + static struct dev_pm_opp *_opp_table_find_key_ceil(struct opp_table *opp_table, + unsigned long *key, int index, bool available, + unsigned long (*read)(struct dev_pm_opp *opp, int index), +- bool (*assert)(struct opp_table *opp_table)) ++ bool (*assert)(struct opp_table *opp_table, unsigned int index)) + { + return _opp_table_find_key(opp_table, key, index, available, read, + _compare_ceil, assert); +@@ -577,7 +587,7 @@ static struct dev_pm_opp *_opp_table_find_key_ceil(struct opp_table *opp_table, + static struct dev_pm_opp *_find_key_ceil(struct device *dev, unsigned long *key, + int index, bool available, + unsigned long (*read)(struct dev_pm_opp *opp, int index), +- bool (*assert)(struct opp_table *opp_table)) ++ bool (*assert)(struct opp_table *opp_table, unsigned int index)) + { + return _find_key(dev, key, index, available, read, _compare_ceil, + assert); +@@ -586,7 +596,7 @@ static struct dev_pm_opp *_find_key_ceil(struct device *dev, unsigned long *key, + static struct dev_pm_opp *_find_key_floor(struct device *dev, + unsigned long *key, int index, bool available, + unsigned long (*read)(struct dev_pm_opp *opp, int index), +- bool (*assert)(struct opp_table *opp_table)) ++ bool (*assert)(struct opp_table *opp_table, unsigned int index)) + { + return _find_key(dev, key, index, available, read, _compare_floor, + assert); +@@ -647,7 +657,8 @@ struct dev_pm_opp * + dev_pm_opp_find_freq_exact_indexed(struct device *dev, unsigned long freq, + u32 index, bool available) + { +- return _find_key_exact(dev, freq, index, available, _read_freq, NULL); ++ return _find_key_exact(dev, freq, index, available, _read_freq, ++ assert_clk_index); + } + EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_exact_indexed); + +@@ -707,7 +718,8 @@ struct dev_pm_opp * + dev_pm_opp_find_freq_ceil_indexed(struct device *dev, unsigned long *freq, + u32 index) + { +- return _find_key_ceil(dev, freq, index, true, _read_freq, NULL); ++ return _find_key_ceil(dev, freq, index, true, _read_freq, ++ assert_clk_index); + } + EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_ceil_indexed); + +@@ -760,7 +772,7 @@ struct dev_pm_opp * + dev_pm_opp_find_freq_floor_indexed(struct device *dev, unsigned long *freq, + u32 index) + { +- return _find_key_floor(dev, freq, index, true, _read_freq, NULL); ++ return _find_key_floor(dev, freq, index, true, _read_freq, assert_clk_index); + } + EXPORT_SYMBOL_GPL(dev_pm_opp_find_freq_floor_indexed); + +@@ -1676,7 +1688,7 @@ void dev_pm_opp_remove(struct device *dev, unsigned long freq) + if (IS_ERR(opp_table)) + return; + +- if (!assert_single_clk(opp_table)) ++ if (!assert_single_clk(opp_table, 0)) + goto put_table; + + mutex_lock(&opp_table->lock); +@@ -2027,7 +2039,7 @@ int _opp_add_v1(struct opp_table *opp_table, struct device *dev, + unsigned long tol; + int ret; + +- if (!assert_single_clk(opp_table)) ++ if (!assert_single_clk(opp_table, 0)) + return -EINVAL; + + new_opp = _opp_allocate(opp_table); +@@ -2889,7 +2901,7 @@ static int _opp_set_availability(struct device *dev, unsigned long freq, + return r; + } + +- if (!assert_single_clk(opp_table)) { ++ if (!assert_single_clk(opp_table, 0)) { + r = -EINVAL; + goto put_table; + } +@@ -2965,7 +2977,7 @@ int dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq, + return r; + } + +- if (!assert_single_clk(opp_table)) { ++ if (!assert_single_clk(opp_table, 0)) { + r = -EINVAL; + goto put_table; + } +-- +2.39.5 + diff --git a/queue-6.6/opp-fix-dev_pm_opp_find_bw_-when-bandwidth-table-not.patch b/queue-6.6/opp-fix-dev_pm_opp_find_bw_-when-bandwidth-table-not.patch new file mode 100644 index 0000000000..96ae6db890 --- /dev/null +++ b/queue-6.6/opp-fix-dev_pm_opp_find_bw_-when-bandwidth-table-not.patch @@ -0,0 +1,81 @@ +From 258756a18d43522001e3de24a7673e3f1098da4d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 3 Dec 2024 09:13:00 +0100 +Subject: OPP: fix dev_pm_opp_find_bw_*() when bandwidth table not initialized + +From: Neil Armstrong + +[ Upstream commit b44b9bc7cab2967c3d6a791b1cd542c89fc07f0e ] + +If a driver calls dev_pm_opp_find_bw_ceil/floor() the retrieve bandwidth +from the OPP table but the bandwidth table was not created because the +interconnect properties were missing in the OPP consumer node, the +kernel will crash with: + +Unable to handle kernel NULL pointer dereference at virtual address 0000000000000004 +... +pc : _read_bw+0x8/0x10 +lr : _opp_table_find_key+0x9c/0x174 +... +Call trace: + _read_bw+0x8/0x10 (P) + _opp_table_find_key+0x9c/0x174 (L) + _find_key+0x98/0x168 + dev_pm_opp_find_bw_ceil+0x50/0x88 +... + +In order to fix the crash, create an assert function to check +if the bandwidth table was created before trying to get a +bandwidth with _read_bw(). + +Fixes: add1dc094a74 ("OPP: Use generic key finding helpers for bandwidth key") +Signed-off-by: Neil Armstrong +Signed-off-by: Viresh Kumar +Signed-off-by: Sasha Levin +--- + drivers/opp/core.c | 15 +++++++++++++-- + 1 file changed, 13 insertions(+), 2 deletions(-) + +diff --git a/drivers/opp/core.c b/drivers/opp/core.c +index 3c26130dc75e3..218cb2e7f3605 100644 +--- a/drivers/opp/core.c ++++ b/drivers/opp/core.c +@@ -116,6 +116,15 @@ static bool assert_clk_index(struct opp_table *opp_table, + return opp_table->clk_count > index; + } + ++/* ++ * Returns true if bandwidth table is large enough to contain the bandwidth index. ++ */ ++static bool assert_bandwidth_index(struct opp_table *opp_table, ++ unsigned int index) ++{ ++ return opp_table->path_count > index; ++} ++ + /** + * dev_pm_opp_get_voltage() - Gets the voltage corresponding to an opp + * @opp: opp for which voltage has to be returned for +@@ -850,7 +859,8 @@ struct dev_pm_opp *dev_pm_opp_find_bw_ceil(struct device *dev, unsigned int *bw, + unsigned long temp = *bw; + struct dev_pm_opp *opp; + +- opp = _find_key_ceil(dev, &temp, index, true, _read_bw, NULL); ++ opp = _find_key_ceil(dev, &temp, index, true, _read_bw, ++ assert_bandwidth_index); + *bw = temp; + return opp; + } +@@ -881,7 +891,8 @@ struct dev_pm_opp *dev_pm_opp_find_bw_floor(struct device *dev, + unsigned long temp = *bw; + struct dev_pm_opp *opp; + +- opp = _find_key_floor(dev, &temp, index, true, _read_bw, NULL); ++ opp = _find_key_floor(dev, &temp, index, true, _read_bw, ++ assert_bandwidth_index); + *bw = temp; + return opp; + } +-- +2.39.5 + diff --git a/queue-6.6/opp-of-fix-an-of-node-leak-in-_opp_add_static_v2.patch b/queue-6.6/opp-of-fix-an-of-node-leak-in-_opp_add_static_v2.patch new file mode 100644 index 0000000000..1ba8c329f9 --- /dev/null +++ b/queue-6.6/opp-of-fix-an-of-node-leak-in-_opp_add_static_v2.patch @@ -0,0 +1,46 @@ +From 331599918e7c2f68332df1d7a39d44d197b69610 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Jan 2025 14:44:53 +0900 +Subject: OPP: OF: Fix an OF node leak in _opp_add_static_v2() + +From: Joe Hattori + +[ Upstream commit 1d38eb7f7b26261a0b642f6e0923269c7c000a97 ] + +_opp_add_static_v2() leaks the obtained OF node reference when +_of_opp_alloc_required_opps() fails. Add an of_node_put() call in the +error path. + +Fixes: 3466ea2cd6b6 ("OPP: Don't drop opp->np reference while it is still in use") +Signed-off-by: Joe Hattori +Signed-off-by: Viresh Kumar +Signed-off-by: Sasha Levin +--- + drivers/opp/of.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/opp/of.c b/drivers/opp/of.c +index ada4963c7cfae..657c08d0ad979 100644 +--- a/drivers/opp/of.c ++++ b/drivers/opp/of.c +@@ -932,7 +932,7 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table, + + ret = _of_opp_alloc_required_opps(opp_table, new_opp); + if (ret) +- goto free_opp; ++ goto put_node; + + if (!of_property_read_u32(np, "clock-latency-ns", &val)) + new_opp->clock_latency_ns = val; +@@ -982,6 +982,8 @@ static struct dev_pm_opp *_opp_add_static_v2(struct opp_table *opp_table, + + free_required_opps: + _of_opp_free_required_opps(opp_table, new_opp); ++put_node: ++ of_node_put(np); + free_opp: + _opp_free(new_opp); + +-- +2.39.5 + diff --git a/queue-6.6/padata-add-pd-get-put-refcnt-helper.patch b/queue-6.6/padata-add-pd-get-put-refcnt-helper.patch new file mode 100644 index 0000000000..1d3f2c6dfb --- /dev/null +++ b/queue-6.6/padata-add-pd-get-put-refcnt-helper.patch @@ -0,0 +1,89 @@ +From 28532781077e8bf2942fc117fd6e8de1e73be9ee Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Jan 2025 06:16:37 +0000 +Subject: padata: add pd get/put refcnt helper + +From: Chen Ridong + +[ Upstream commit ae154202cc6a189b035359f3c4e143d5c24d5352 ] + +Add helpers for pd to get/put refcnt to make code consice. + +Signed-off-by: Chen Ridong +Acked-by: Daniel Jordan +Signed-off-by: Herbert Xu +Stable-dep-of: dd7d37ccf6b1 ("padata: avoid UAF for reorder_work") +Signed-off-by: Sasha Levin +--- + kernel/padata.c | 27 ++++++++++++++++++++------- + 1 file changed, 20 insertions(+), 7 deletions(-) + +diff --git a/kernel/padata.c b/kernel/padata.c +index 85ac7cfe87446..6badcbc6d3cb7 100644 +--- a/kernel/padata.c ++++ b/kernel/padata.c +@@ -47,6 +47,22 @@ struct padata_mt_job_state { + static void padata_free_pd(struct parallel_data *pd); + static void __init padata_mt_helper(struct work_struct *work); + ++static inline void padata_get_pd(struct parallel_data *pd) ++{ ++ refcount_inc(&pd->refcnt); ++} ++ ++static inline void padata_put_pd_cnt(struct parallel_data *pd, int cnt) ++{ ++ if (refcount_sub_and_test(cnt, &pd->refcnt)) ++ padata_free_pd(pd); ++} ++ ++static inline void padata_put_pd(struct parallel_data *pd) ++{ ++ padata_put_pd_cnt(pd, 1); ++} ++ + static int padata_index_to_cpu(struct parallel_data *pd, int cpu_index) + { + int cpu, target_cpu; +@@ -206,7 +222,7 @@ int padata_do_parallel(struct padata_shell *ps, + if ((pinst->flags & PADATA_RESET)) + goto out; + +- refcount_inc(&pd->refcnt); ++ padata_get_pd(pd); + padata->pd = pd; + padata->cb_cpu = *cb_cpu; + +@@ -380,8 +396,7 @@ static void padata_serial_worker(struct work_struct *serial_work) + } + local_bh_enable(); + +- if (refcount_sub_and_test(cnt, &pd->refcnt)) +- padata_free_pd(pd); ++ padata_put_pd_cnt(pd, cnt); + } + + /** +@@ -678,8 +693,7 @@ static int padata_replace(struct padata_instance *pinst) + synchronize_rcu(); + + list_for_each_entry_continue_reverse(ps, &pinst->pslist, list) +- if (refcount_dec_and_test(&ps->opd->refcnt)) +- padata_free_pd(ps->opd); ++ padata_put_pd(ps->opd); + + pinst->flags &= ~PADATA_RESET; + +@@ -1127,8 +1141,7 @@ void padata_free_shell(struct padata_shell *ps) + mutex_lock(&ps->pinst->lock); + list_del(&ps->list); + pd = rcu_dereference_protected(ps->pd, 1); +- if (refcount_dec_and_test(&pd->refcnt)) +- padata_free_pd(pd); ++ padata_put_pd(pd); + mutex_unlock(&ps->pinst->lock); + + kfree(ps); +-- +2.39.5 + diff --git a/queue-6.6/padata-avoid-uaf-for-reorder_work.patch b/queue-6.6/padata-avoid-uaf-for-reorder_work.patch new file mode 100644 index 0000000000..e6ff12e6de --- /dev/null +++ b/queue-6.6/padata-avoid-uaf-for-reorder_work.patch @@ -0,0 +1,91 @@ +From a861e0bf5a8e9020b558b292a471529e0a337861 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Jan 2025 06:16:39 +0000 +Subject: padata: avoid UAF for reorder_work + +From: Chen Ridong + +[ Upstream commit dd7d37ccf6b11f3d95e797ebe4e9e886d0332600 ] + +Although the previous patch can avoid ps and ps UAF for _do_serial, it +can not avoid potential UAF issue for reorder_work. This issue can +happen just as below: + +crypto_request crypto_request crypto_del_alg +padata_do_serial + ... + padata_reorder + // processes all remaining + // requests then breaks + while (1) { + if (!padata) + break; + ... + } + + padata_do_serial + // new request added + list_add + // sees the new request + queue_work(reorder_work) + padata_reorder + queue_work_on(squeue->work) +... + + + padata_serial_worker + // completes new request, + // no more outstanding + // requests + + crypto_del_alg + // free pd + + +invoke_padata_reorder + // UAF of pd + +To avoid UAF for 'reorder_work', get 'pd' ref before put 'reorder_work' +into the 'serial_wq' and put 'pd' ref until the 'serial_wq' finish. + +Fixes: bbefa1dd6a6d ("crypto: pcrypt - Avoid deadlock by using per-instance padata queues") +Signed-off-by: Chen Ridong +Acked-by: Daniel Jordan +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + kernel/padata.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/kernel/padata.c b/kernel/padata.c +index 6badcbc6d3cb7..071d8cad80787 100644 +--- a/kernel/padata.c ++++ b/kernel/padata.c +@@ -352,8 +352,14 @@ static void padata_reorder(struct parallel_data *pd) + smp_mb(); + + reorder = per_cpu_ptr(pd->reorder_list, pd->cpu); +- if (!list_empty(&reorder->list) && padata_find_next(pd, false)) ++ if (!list_empty(&reorder->list) && padata_find_next(pd, false)) { ++ /* ++ * Other context(eg. the padata_serial_worker) can finish the request. ++ * To avoid UAF issue, add pd ref here, and put pd ref after reorder_work finish. ++ */ ++ padata_get_pd(pd); + queue_work(pinst->serial_wq, &pd->reorder_work); ++ } + } + + static void invoke_padata_reorder(struct work_struct *work) +@@ -364,6 +370,8 @@ static void invoke_padata_reorder(struct work_struct *work) + pd = container_of(work, struct parallel_data, reorder_work); + padata_reorder(pd); + local_bh_enable(); ++ /* Pairs with putting the reorder_work in the serial_wq */ ++ padata_put_pd(pd); + } + + static void padata_serial_worker(struct work_struct *serial_work) +-- +2.39.5 + diff --git a/queue-6.6/padata-fix-sysfs-store-callback-check.patch b/queue-6.6/padata-fix-sysfs-store-callback-check.patch new file mode 100644 index 0000000000..a6f0133060 --- /dev/null +++ b/queue-6.6/padata-fix-sysfs-store-callback-check.patch @@ -0,0 +1,40 @@ +From 44f6fdca06bbe4b473bcf34422db4a1f912c2300 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 27 Dec 2024 23:32:01 +0100 +Subject: padata: fix sysfs store callback check +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Thomas Weißschuh + +[ Upstream commit 9ff6e943bce67d125781fe4780a5d6f072dc44c0 ] + +padata_sysfs_store() was copied from padata_sysfs_show() but this check +was not adapted. Today there is no attribute which can fail this +check, but if there is one it may as well be correct. + +Fixes: 5e017dc3f8bc ("padata: Added sysfs primitives to padata subsystem") +Signed-off-by: Thomas Weißschuh +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + kernel/padata.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/kernel/padata.c b/kernel/padata.c +index 9bf77b58ee08d..427f28db6b259 100644 +--- a/kernel/padata.c ++++ b/kernel/padata.c +@@ -967,7 +967,7 @@ static ssize_t padata_sysfs_store(struct kobject *kobj, struct attribute *attr, + + pinst = kobj2pinst(kobj); + pentry = attr2pentry(attr); +- if (pentry->show) ++ if (pentry->store) + ret = pentry->store(pinst, attr, buf, count); + + return ret; +-- +2.39.5 + diff --git a/queue-6.6/padata-fix-uaf-in-padata_reorder.patch b/queue-6.6/padata-fix-uaf-in-padata_reorder.patch new file mode 100644 index 0000000000..05b2333b65 --- /dev/null +++ b/queue-6.6/padata-fix-uaf-in-padata_reorder.patch @@ -0,0 +1,94 @@ +From beb44801933f9bc60f35976a7237ffab5c6397b7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Jan 2025 06:16:38 +0000 +Subject: padata: fix UAF in padata_reorder + +From: Chen Ridong + +[ Upstream commit e01780ea4661172734118d2a5f41bc9720765668 ] + +A bug was found when run ltp test: + +BUG: KASAN: slab-use-after-free in padata_find_next+0x29/0x1a0 +Read of size 4 at addr ffff88bbfe003524 by task kworker/u113:2/3039206 + +CPU: 0 PID: 3039206 Comm: kworker/u113:2 Kdump: loaded Not tainted 6.6.0+ +Workqueue: pdecrypt_parallel padata_parallel_worker +Call Trace: + +dump_stack_lvl+0x32/0x50 +print_address_description.constprop.0+0x6b/0x3d0 +print_report+0xdd/0x2c0 +kasan_report+0xa5/0xd0 +padata_find_next+0x29/0x1a0 +padata_reorder+0x131/0x220 +padata_parallel_worker+0x3d/0xc0 +process_one_work+0x2ec/0x5a0 + +If 'mdelay(10)' is added before calling 'padata_find_next' in the +'padata_reorder' function, this issue could be reproduced easily with +ltp test (pcrypt_aead01). + +This can be explained as bellow: + +pcrypt_aead_encrypt +... +padata_do_parallel +refcount_inc(&pd->refcnt); // add refcnt +... +padata_do_serial +padata_reorder // pd +while (1) { +padata_find_next(pd, true); // using pd +queue_work_on +... +padata_serial_worker crypto_del_alg +padata_put_pd_cnt // sub refcnt + padata_free_shell + padata_put_pd(ps->pd); + // pd is freed +// loop again, but pd is freed +// call padata_find_next, UAF +} + +In the padata_reorder function, when it loops in 'while', if the alg is +deleted, the refcnt may be decreased to 0 before entering +'padata_find_next', which leads to UAF. + +As mentioned in [1], do_serial is supposed to be called with BHs disabled +and always happen under RCU protection, to address this issue, add +synchronize_rcu() in 'padata_free_shell' wait for all _do_serial calls +to finish. + +[1] https://lore.kernel.org/all/20221028160401.cccypv4euxikusiq@parnassus.localdomain/ +[2] https://lore.kernel.org/linux-kernel/jfjz5d7zwbytztackem7ibzalm5lnxldi2eofeiczqmqs2m7o6@fq426cwnjtkm/ +Fixes: b128a3040935 ("padata: allocate workqueue internally") +Signed-off-by: Chen Ridong +Signed-off-by: Qu Zicheng +Acked-by: Daniel Jordan +Signed-off-by: Herbert Xu +Signed-off-by: Sasha Levin +--- + kernel/padata.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/kernel/padata.c b/kernel/padata.c +index 427f28db6b259..85ac7cfe87446 100644 +--- a/kernel/padata.c ++++ b/kernel/padata.c +@@ -1118,6 +1118,12 @@ void padata_free_shell(struct padata_shell *ps) + if (!ps) + return; + ++ /* ++ * Wait for all _do_serial calls to finish to avoid touching ++ * freed pd's and ps's. ++ */ ++ synchronize_rcu(); ++ + mutex_lock(&ps->pinst->lock); + list_del(&ps->list); + pd = rcu_dereference_protected(ps->pd, 1); +-- +2.39.5 + diff --git a/queue-6.6/partitions-ldm-remove-the-initial-kernel-doc-notatio.patch b/queue-6.6/partitions-ldm-remove-the-initial-kernel-doc-notatio.patch new file mode 100644 index 0000000000..3830ee586e --- /dev/null +++ b/queue-6.6/partitions-ldm-remove-the-initial-kernel-doc-notatio.patch @@ -0,0 +1,41 @@ +From f6e8168626459a671ec60e440e4a713dac557232 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Jan 2025 22:27:58 -0800 +Subject: partitions: ldm: remove the initial kernel-doc notation + +From: Randy Dunlap + +[ Upstream commit e494e451611a3de6ae95f99e8339210c157d70fb ] + +Remove the file's first comment describing what the file is. +This comment is not in kernel-doc format so it causes a kernel-doc +warning. + +ldm.h:13: warning: expecting prototype for ldm(). Prototype was for _FS_PT_LDM_H_() instead + +Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") +Signed-off-by: Randy Dunlap +Cc: Richard Russon (FlatCap) +Cc: linux-ntfs-dev@lists.sourceforge.net +Cc: Jens Axboe +Link: https://lore.kernel.org/r/20250111062758.910458-1-rdunlap@infradead.org +Signed-off-by: Jens Axboe +Signed-off-by: Sasha Levin +--- + block/partitions/ldm.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/block/partitions/ldm.h b/block/partitions/ldm.h +index 0a747a0c782d5..f98dbee941497 100644 +--- a/block/partitions/ldm.h ++++ b/block/partitions/ldm.h +@@ -1,5 +1,5 @@ + // SPDX-License-Identifier: GPL-2.0-or-later +-/** ++/* + * ldm - Part of the Linux-NTFS project. + * + * Copyright (C) 2001,2002 Richard Russon +-- +2.39.5 + diff --git a/queue-6.6/pci-endpoint-destroy-the-epc-device-in-devm_pci_epc_.patch b/queue-6.6/pci-endpoint-destroy-the-epc-device-in-devm_pci_epc_.patch new file mode 100644 index 0000000000..6745a940e4 --- /dev/null +++ b/queue-6.6/pci-endpoint-destroy-the-epc-device-in-devm_pci_epc_.patch @@ -0,0 +1,43 @@ +From 4b4611a8c5f8458a52ab98259f7551eb4e6a87a3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Dec 2024 22:00:18 +0800 +Subject: PCI: endpoint: Destroy the EPC device in devm_pci_epc_destroy() + +From: Zijun Hu + +[ Upstream commit d4929755e4d02bd3de3ae5569dab69cb9502c54f ] + +The devm_pci_epc_destroy() comment says destroys the EPC device, but it +does not actually do that since devres_destroy() does not call +devm_pci_epc_release(), and it also can not fully undo what the API +devm_pci_epc_create() does, so it is faulty. + +Fortunately, the faulty API has not been used by current kernel tree. Use +devres_release() instead of devres_destroy() so the EPC device will be +released. + +Link: https://lore.kernel.org/r/20241210-pci-epc-core_fix-v3-1-4d86dd573e4b@quicinc.com +Fixes: 5e8cb4033807 ("PCI: endpoint: Add EP core layer to enable EP controller and EP functions") +Signed-off-by: Zijun Hu +Signed-off-by: Bjorn Helgaas +Signed-off-by: Sasha Levin +--- + drivers/pci/endpoint/pci-epc-core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c +index d06623c751f84..3a82c6a613a3c 100644 +--- a/drivers/pci/endpoint/pci-epc-core.c ++++ b/drivers/pci/endpoint/pci-epc-core.c +@@ -808,7 +808,7 @@ void devm_pci_epc_destroy(struct device *dev, struct pci_epc *epc) + { + int r; + +- r = devres_destroy(dev, devm_pci_epc_release, devm_pci_epc_match, ++ r = devres_release(dev, devm_pci_epc_release, devm_pci_epc_match, + epc); + dev_WARN_ONCE(dev, r, "couldn't find PCI EPC resource\n"); + } +-- +2.39.5 + diff --git a/queue-6.6/pci-endpoint-pci-epf-test-fix-check-for-dma-memcpy-t.patch b/queue-6.6/pci-endpoint-pci-epf-test-fix-check-for-dma-memcpy-t.patch new file mode 100644 index 0000000000..67c9d1a2d3 --- /dev/null +++ b/queue-6.6/pci-endpoint-pci-epf-test-fix-check-for-dma-memcpy-t.patch @@ -0,0 +1,47 @@ +From 3651587b2a676ddbb349c24afa86d68562d1b91c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 16 Jan 2025 22:46:47 +0530 +Subject: PCI: endpoint: pci-epf-test: Fix check for DMA MEMCPY test + +From: Manivannan Sadhasivam + +[ Upstream commit 235c2b197a8de2887f13990094a3343d2392155b ] + +Currently, if DMA MEMCPY test is requested by the host, and if the endpoint +DMA controller supports DMA_PRIVATE, the test will fail. This is not +correct since there is no check for DMA_MEMCPY capability and the DMA +controller can support both DMA_PRIVATE and DMA_MEMCPY. + +Fix the check and also reword the error message. + +Link: https://lore.kernel.org/r/20250116171650.33585-2-manivannan.sadhasivam@linaro.org +Fixes: 8353813c88ef ("PCI: endpoint: Enable DMA tests for endpoints with DMA capabilities") +Reported-by: Niklas Cassel +Closes: https://lore.kernel.org/linux-pci/Z3QtEihbiKIGogWA@ryzen +Signed-off-by: Manivannan Sadhasivam +Signed-off-by: Bjorn Helgaas +Tested-by: Niklas Cassel +Reviewed-by: Niklas Cassel +Signed-off-by: Sasha Levin +--- + drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c +index fa7ae8cedb676..ac1dae113f2d9 100644 +--- a/drivers/pci/endpoint/functions/pci-epf-test.c ++++ b/drivers/pci/endpoint/functions/pci-epf-test.c +@@ -361,8 +361,8 @@ static void pci_epf_test_copy(struct pci_epf_test *epf_test, + + ktime_get_ts64(&start); + if (reg->flags & FLAG_USE_DMA) { +- if (epf_test->dma_private) { +- dev_err(dev, "Cannot transfer data using DMA\n"); ++ if (!dma_has_cap(DMA_MEMCPY, epf_test->dma_chan_tx->device->cap_mask)) { ++ dev_err(dev, "DMA controller doesn't support MEMCPY\n"); + ret = -EINVAL; + goto err_map_addr; + } +-- +2.39.5 + diff --git a/queue-6.6/pci-endpoint-pci-epf-test-set-dma_chan_rx-pointer-to.patch b/queue-6.6/pci-endpoint-pci-epf-test-set-dma_chan_rx-pointer-to.patch new file mode 100644 index 0000000000..53bdcc69ad --- /dev/null +++ b/queue-6.6/pci-endpoint-pci-epf-test-set-dma_chan_rx-pointer-to.patch @@ -0,0 +1,44 @@ +From ff7b1a9969c7688c60903ad1aad1bee0d5115d70 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 27 Dec 2024 08:08:41 -0800 +Subject: PCI: endpoint: pci-epf-test: Set dma_chan_rx pointer to NULL on error +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Mohamed Khalfella + +[ Upstream commit b1b1f4b12969130c0a6ec0cf0299460cb01e799c ] + +If dma_chan_tx allocation fails, set dma_chan_rx to NULL after it is +freed. + +Link: https://lore.kernel.org/r/20241227160841.92382-1-khalfella@gmail.com +Fixes: 8353813c88ef ("PCI: endpoint: Enable DMA tests for endpoints with DMA capabilities") +Signed-off-by: Mohamed Khalfella +[kwilczynski: commit log] +Signed-off-by: Krzysztof Wilczyński +Signed-off-by: Bjorn Helgaas +Reviewed-by: Niklas Cassel +Reviewed-by: Manivannan Sadhasivam +Signed-off-by: Sasha Levin +--- + drivers/pci/endpoint/functions/pci-epf-test.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c +index 1f0d2b84296a3..fa7ae8cedb676 100644 +--- a/drivers/pci/endpoint/functions/pci-epf-test.c ++++ b/drivers/pci/endpoint/functions/pci-epf-test.c +@@ -251,7 +251,7 @@ static int pci_epf_test_init_dma_chan(struct pci_epf_test *epf_test) + + fail_back_rx: + dma_release_channel(epf_test->dma_chan_rx); +- epf_test->dma_chan_tx = NULL; ++ epf_test->dma_chan_rx = NULL; + + fail_back_tx: + dma_cap_zero(mask); +-- +2.39.5 + diff --git a/queue-6.6/pci-imx6-simplify-clock-handling-by-using-clk_bulk-f.patch b/queue-6.6/pci-imx6-simplify-clock-handling-by-using-clk_bulk-f.patch new file mode 100644 index 0000000000..8bd9fb420a --- /dev/null +++ b/queue-6.6/pci-imx6-simplify-clock-handling-by-using-clk_bulk-f.patch @@ -0,0 +1,350 @@ +From 0d6743949232c9b1a08f37128a1fe1cc12c8c679 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 20 Feb 2024 11:19:11 -0500 +Subject: PCI: imx6: Simplify clock handling by using clk_bulk*() function + +From: Frank Li + +[ Upstream commit 6a40185838759cdae728ed79738680d798863ce7 ] + +Refactor the clock handling logic. Add 'clk_names' define in drvdata. +Use clk_bulk*() API to simplify the code. + +Link: https://lore.kernel.org/r/20240220161924.3871774-2-Frank.Li@nxp.com +Signed-off-by: Frank Li +Signed-off-by: Lorenzo Pieralisi +Reviewed-by: Manivannan Sadhasivam +Stable-dep-of: f068ffdd034c ("PCI: imx6: Skip controller_id generation logic for i.MX7D") +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/dwc/pci-imx6.c | 138 ++++++++++---------------- + 1 file changed, 50 insertions(+), 88 deletions(-) + +diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c +index 86b09b5d7f249..20c8f2cba4536 100644 +--- a/drivers/pci/controller/dwc/pci-imx6.c ++++ b/drivers/pci/controller/dwc/pci-imx6.c +@@ -61,12 +61,16 @@ enum imx6_pcie_variants { + #define IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE BIT(1) + #define IMX6_PCIE_FLAG_SUPPORTS_SUSPEND BIT(2) + ++#define IMX6_PCIE_MAX_CLKS 6 ++ + struct imx6_pcie_drvdata { + enum imx6_pcie_variants variant; + enum dw_pcie_device_mode mode; + u32 flags; + int dbi_length; + const char *gpr; ++ const char * const *clk_names; ++ const u32 clks_cnt; + }; + + struct imx6_pcie { +@@ -74,11 +78,7 @@ struct imx6_pcie { + int reset_gpio; + bool gpio_active_high; + bool link_is_up; +- struct clk *pcie_bus; +- struct clk *pcie_phy; +- struct clk *pcie_inbound_axi; +- struct clk *pcie; +- struct clk *pcie_aux; ++ struct clk_bulk_data clks[IMX6_PCIE_MAX_CLKS]; + struct regmap *iomuxc_gpr; + u16 msi_ctrl; + u32 controller_id; +@@ -407,13 +407,18 @@ static void imx7d_pcie_wait_for_phy_pll_lock(struct imx6_pcie *imx6_pcie) + + static int imx6_setup_phy_mpll(struct imx6_pcie *imx6_pcie) + { +- unsigned long phy_rate = clk_get_rate(imx6_pcie->pcie_phy); ++ unsigned long phy_rate = 0; + int mult, div; + u16 val; ++ int i; + + if (!(imx6_pcie->drvdata->flags & IMX6_PCIE_FLAG_IMX6_PHY)) + return 0; + ++ for (i = 0; i < imx6_pcie->drvdata->clks_cnt; i++) ++ if (strncmp(imx6_pcie->clks[i].id, "pcie_phy", 8) == 0) ++ phy_rate = clk_get_rate(imx6_pcie->clks[i].clk); ++ + switch (phy_rate) { + case 125000000: + /* +@@ -550,19 +555,11 @@ static int imx6_pcie_attach_pd(struct device *dev) + + static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) + { +- struct dw_pcie *pci = imx6_pcie->pci; +- struct device *dev = pci->dev; + unsigned int offset; + int ret = 0; + + switch (imx6_pcie->drvdata->variant) { + case IMX6SX: +- ret = clk_prepare_enable(imx6_pcie->pcie_inbound_axi); +- if (ret) { +- dev_err(dev, "unable to enable pcie_axi clock\n"); +- break; +- } +- + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR12, + IMX6SX_GPR12_PCIE_TEST_POWERDOWN, 0); + break; +@@ -589,12 +586,6 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) + case IMX8MQ_EP: + case IMX8MP: + case IMX8MP_EP: +- ret = clk_prepare_enable(imx6_pcie->pcie_aux); +- if (ret) { +- dev_err(dev, "unable to enable pcie_aux clock\n"); +- break; +- } +- + offset = imx6_pcie_grp_offset(imx6_pcie); + /* + * Set the over ride low and enabled +@@ -615,9 +606,6 @@ static int imx6_pcie_enable_ref_clk(struct imx6_pcie *imx6_pcie) + static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie) + { + switch (imx6_pcie->drvdata->variant) { +- case IMX6SX: +- clk_disable_unprepare(imx6_pcie->pcie_inbound_axi); +- break; + case IMX6QP: + case IMX6Q: + regmap_update_bits(imx6_pcie->iomuxc_gpr, IOMUXC_GPR1, +@@ -631,14 +619,6 @@ static void imx6_pcie_disable_ref_clk(struct imx6_pcie *imx6_pcie) + IMX7D_GPR12_PCIE_PHY_REFCLK_SEL, + IMX7D_GPR12_PCIE_PHY_REFCLK_SEL); + break; +- case IMX8MM: +- case IMX8MM_EP: +- case IMX8MQ: +- case IMX8MQ_EP: +- case IMX8MP: +- case IMX8MP_EP: +- clk_disable_unprepare(imx6_pcie->pcie_aux); +- break; + default: + break; + } +@@ -650,23 +630,9 @@ static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie) + struct device *dev = pci->dev; + int ret; + +- ret = clk_prepare_enable(imx6_pcie->pcie_phy); +- if (ret) { +- dev_err(dev, "unable to enable pcie_phy clock\n"); ++ ret = clk_bulk_prepare_enable(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); ++ if (ret) + return ret; +- } +- +- ret = clk_prepare_enable(imx6_pcie->pcie_bus); +- if (ret) { +- dev_err(dev, "unable to enable pcie_bus clock\n"); +- goto err_pcie_bus; +- } +- +- ret = clk_prepare_enable(imx6_pcie->pcie); +- if (ret) { +- dev_err(dev, "unable to enable pcie clock\n"); +- goto err_pcie; +- } + + ret = imx6_pcie_enable_ref_clk(imx6_pcie); + if (ret) { +@@ -679,11 +645,7 @@ static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie) + return 0; + + err_ref_clk: +- clk_disable_unprepare(imx6_pcie->pcie); +-err_pcie: +- clk_disable_unprepare(imx6_pcie->pcie_bus); +-err_pcie_bus: +- clk_disable_unprepare(imx6_pcie->pcie_phy); ++ clk_bulk_disable_unprepare(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + + return ret; + } +@@ -691,9 +653,7 @@ static int imx6_pcie_clk_enable(struct imx6_pcie *imx6_pcie) + static void imx6_pcie_clk_disable(struct imx6_pcie *imx6_pcie) + { + imx6_pcie_disable_ref_clk(imx6_pcie); +- clk_disable_unprepare(imx6_pcie->pcie); +- clk_disable_unprepare(imx6_pcie->pcie_bus); +- clk_disable_unprepare(imx6_pcie->pcie_phy); ++ clk_bulk_disable_unprepare(imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); + } + + static void imx6_pcie_assert_core_reset(struct imx6_pcie *imx6_pcie) +@@ -1253,6 +1213,7 @@ static int imx6_pcie_probe(struct platform_device *pdev) + struct device_node *node = dev->of_node; + int ret; + u16 val; ++ int i; + + imx6_pcie = devm_kzalloc(dev, sizeof(*imx6_pcie), GFP_KERNEL); + if (!imx6_pcie) +@@ -1306,32 +1267,20 @@ static int imx6_pcie_probe(struct platform_device *pdev) + return imx6_pcie->reset_gpio; + } + +- /* Fetch clocks */ +- imx6_pcie->pcie_bus = devm_clk_get(dev, "pcie_bus"); +- if (IS_ERR(imx6_pcie->pcie_bus)) +- return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie_bus), +- "pcie_bus clock source missing or invalid\n"); ++ if (imx6_pcie->drvdata->clks_cnt >= IMX6_PCIE_MAX_CLKS) ++ return dev_err_probe(dev, -ENOMEM, "clks_cnt is too big\n"); + +- imx6_pcie->pcie = devm_clk_get(dev, "pcie"); +- if (IS_ERR(imx6_pcie->pcie)) +- return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie), +- "pcie clock source missing or invalid\n"); ++ for (i = 0; i < imx6_pcie->drvdata->clks_cnt; i++) ++ imx6_pcie->clks[i].id = imx6_pcie->drvdata->clk_names[i]; ++ ++ /* Fetch clocks */ ++ ret = devm_clk_bulk_get(dev, imx6_pcie->drvdata->clks_cnt, imx6_pcie->clks); ++ if (ret) ++ return ret; + + switch (imx6_pcie->drvdata->variant) { +- case IMX6SX: +- imx6_pcie->pcie_inbound_axi = devm_clk_get(dev, +- "pcie_inbound_axi"); +- if (IS_ERR(imx6_pcie->pcie_inbound_axi)) +- return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie_inbound_axi), +- "pcie_inbound_axi clock missing or invalid\n"); +- break; + case IMX8MQ: + case IMX8MQ_EP: +- imx6_pcie->pcie_aux = devm_clk_get(dev, "pcie_aux"); +- if (IS_ERR(imx6_pcie->pcie_aux)) +- return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie_aux), +- "pcie_aux clock source missing or invalid\n"); +- fallthrough; + case IMX7D: + if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) + imx6_pcie->controller_id = 1; +@@ -1354,10 +1303,6 @@ static int imx6_pcie_probe(struct platform_device *pdev) + case IMX8MM_EP: + case IMX8MP: + case IMX8MP_EP: +- imx6_pcie->pcie_aux = devm_clk_get(dev, "pcie_aux"); +- if (IS_ERR(imx6_pcie->pcie_aux)) +- return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie_aux), +- "pcie_aux clock source missing or invalid\n"); + imx6_pcie->apps_reset = devm_reset_control_get_exclusive(dev, + "apps"); + if (IS_ERR(imx6_pcie->apps_reset)) +@@ -1373,14 +1318,6 @@ static int imx6_pcie_probe(struct platform_device *pdev) + default: + break; + } +- /* Don't fetch the pcie_phy clock, if it has abstract PHY driver */ +- if (imx6_pcie->phy == NULL) { +- imx6_pcie->pcie_phy = devm_clk_get(dev, "pcie_phy"); +- if (IS_ERR(imx6_pcie->pcie_phy)) +- return dev_err_probe(dev, PTR_ERR(imx6_pcie->pcie_phy), +- "pcie_phy clock source missing or invalid\n"); +- } +- + + /* Grab turnoff reset */ + imx6_pcie->turnoff_reset = devm_reset_control_get_optional_exclusive(dev, "turnoff"); +@@ -1471,6 +1408,11 @@ static void imx6_pcie_shutdown(struct platform_device *pdev) + imx6_pcie_assert_core_reset(imx6_pcie); + } + ++static const char * const imx6q_clks[] = {"pcie_bus", "pcie", "pcie_phy"}; ++static const char * const imx8mm_clks[] = {"pcie_bus", "pcie", "pcie_aux"}; ++static const char * const imx8mq_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_aux"}; ++static const char * const imx6sx_clks[] = {"pcie_bus", "pcie", "pcie_phy", "pcie_inbound_axi"}; ++ + static const struct imx6_pcie_drvdata drvdata[] = { + [IMX6Q] = { + .variant = IMX6Q, +@@ -1478,6 +1420,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { + IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE, + .dbi_length = 0x200, + .gpr = "fsl,imx6q-iomuxc-gpr", ++ .clk_names = imx6q_clks, ++ .clks_cnt = ARRAY_SIZE(imx6q_clks), + }, + [IMX6SX] = { + .variant = IMX6SX, +@@ -1485,6 +1429,8 @@ static const struct imx6_pcie_drvdata drvdata[] = { + IMX6_PCIE_FLAG_IMX6_SPEED_CHANGE | + IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .gpr = "fsl,imx6q-iomuxc-gpr", ++ .clk_names = imx6sx_clks, ++ .clks_cnt = ARRAY_SIZE(imx6sx_clks), + }, + [IMX6QP] = { + .variant = IMX6QP, +@@ -1493,40 +1439,56 @@ static const struct imx6_pcie_drvdata drvdata[] = { + IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .dbi_length = 0x200, + .gpr = "fsl,imx6q-iomuxc-gpr", ++ .clk_names = imx6q_clks, ++ .clks_cnt = ARRAY_SIZE(imx6q_clks), + }, + [IMX7D] = { + .variant = IMX7D, + .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .gpr = "fsl,imx7d-iomuxc-gpr", ++ .clk_names = imx6q_clks, ++ .clks_cnt = ARRAY_SIZE(imx6q_clks), + }, + [IMX8MQ] = { + .variant = IMX8MQ, + .gpr = "fsl,imx8mq-iomuxc-gpr", ++ .clk_names = imx8mq_clks, ++ .clks_cnt = ARRAY_SIZE(imx8mq_clks), + }, + [IMX8MM] = { + .variant = IMX8MM, + .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .gpr = "fsl,imx8mm-iomuxc-gpr", ++ .clk_names = imx8mm_clks, ++ .clks_cnt = ARRAY_SIZE(imx8mm_clks), + }, + [IMX8MP] = { + .variant = IMX8MP, + .flags = IMX6_PCIE_FLAG_SUPPORTS_SUSPEND, + .gpr = "fsl,imx8mp-iomuxc-gpr", ++ .clk_names = imx8mm_clks, ++ .clks_cnt = ARRAY_SIZE(imx8mm_clks), + }, + [IMX8MQ_EP] = { + .variant = IMX8MQ_EP, + .mode = DW_PCIE_EP_TYPE, + .gpr = "fsl,imx8mq-iomuxc-gpr", ++ .clk_names = imx8mq_clks, ++ .clks_cnt = ARRAY_SIZE(imx8mq_clks), + }, + [IMX8MM_EP] = { + .variant = IMX8MM_EP, + .mode = DW_PCIE_EP_TYPE, + .gpr = "fsl,imx8mm-iomuxc-gpr", ++ .clk_names = imx8mm_clks, ++ .clks_cnt = ARRAY_SIZE(imx8mm_clks), + }, + [IMX8MP_EP] = { + .variant = IMX8MP_EP, + .mode = DW_PCIE_EP_TYPE, + .gpr = "fsl,imx8mp-iomuxc-gpr", ++ .clk_names = imx8mm_clks, ++ .clks_cnt = ARRAY_SIZE(imx8mm_clks), + }, + }; + +-- +2.39.5 + diff --git a/queue-6.6/pci-imx6-skip-controller_id-generation-logic-for-i.m.patch b/queue-6.6/pci-imx6-skip-controller_id-generation-logic-for-i.m.patch new file mode 100644 index 0000000000..b1a6d21af2 --- /dev/null +++ b/queue-6.6/pci-imx6-skip-controller_id-generation-logic-for-i.m.patch @@ -0,0 +1,44 @@ +From eb681ccdfa382611be3b888f3a85e08a777521e1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 26 Nov 2024 15:56:56 +0800 +Subject: PCI: imx6: Skip controller_id generation logic for i.MX7D +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Richard Zhu + +[ Upstream commit f068ffdd034c93f0c768acdc87d4d2d7023c1379 ] + +The i.MX7D only has one PCIe controller, so controller_id should always be +0. The previous code is incorrect although yielding the correct result. + +Fix by removing "IMX7D" from the switch case branch. + +Fixes: 2d8ed461dbc9 ("PCI: imx6: Add support for i.MX8MQ") +Link: https://lore.kernel.org/r/20241126075702.4099164-5-hongxing.zhu@nxp.com +Signed-off-by: Richard Zhu +Signed-off-by: Krzysztof Wilczyński +Signed-off-by: Bjorn Helgaas +Reviewed-by: Manivannan Sadhasivam +Reviewed-by: Frank Li +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/dwc/pci-imx6.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c +index 20c8f2cba4536..822a750b064b2 100644 +--- a/drivers/pci/controller/dwc/pci-imx6.c ++++ b/drivers/pci/controller/dwc/pci-imx6.c +@@ -1281,7 +1281,6 @@ static int imx6_pcie_probe(struct platform_device *pdev) + switch (imx6_pcie->drvdata->variant) { + case IMX8MQ: + case IMX8MQ_EP: +- case IMX7D: + if (dbi_base->start == IMX8MQ_PCIE2_BASE_ADDR) + imx6_pcie->controller_id = 1; + +-- +2.39.5 + diff --git a/queue-6.6/pci-rcar-ep-fix-incorrect-variable-used-when-calling.patch b/queue-6.6/pci-rcar-ep-fix-incorrect-variable-used-when-calling.patch new file mode 100644 index 0000000000..3cbf483be3 --- /dev/null +++ b/queue-6.6/pci-rcar-ep-fix-incorrect-variable-used-when-calling.patch @@ -0,0 +1,69 @@ +From f770549ba7dc19ad069ea6733efa719aafba2915 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Jan 2025 08:50:18 +0800 +Subject: PCI: rcar-ep: Fix incorrect variable used when calling + devm_request_mem_region() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: King Dix + +[ Upstream commit 2d2da5a4c1b4509f6f7e5a8db015cd420144beb4 ] + +The rcar_pcie_parse_outbound_ranges() uses the devm_request_mem_region() +macro to request a needed resource. A string variable that lives on the +stack is then used to store a dynamically computed resource name, which +is then passed on as one of the macro arguments. This can lead to +undefined behavior. + +Depending on the current contents of the memory, the manifestations of +errors may vary. One possible output may be as follows: + + $ cat /proc/iomem + 30000000-37ffffff : + 38000000-3fffffff : + +Sometimes, garbage may appear after the colon. + +In very rare cases, if no NULL-terminator is found in memory, the system +might crash because the string iterator will overrun which can lead to +access of unmapped memory above the stack. + +Thus, fix this by replacing outbound_name with the name of the previously +requested resource. With the changes applied, the output will be as +follows: + + $ cat /proc/iomem + 30000000-37ffffff : memory2 + 38000000-3fffffff : memory3 + +Fixes: 2a6d0d63d999 ("PCI: rcar: Add endpoint mode support") +Link: https://lore.kernel.org/r/tencent_DBDCC19D60F361119E76919ADAB25EC13C06@qq.com +Tested-by: Lad Prabhakar +Signed-off-by: King Dix +[kwilczynski: commit log] +Signed-off-by: Krzysztof Wilczyński +Reviewed-by: Lad Prabhakar +Reviewed-by: Manivannan Sadhasivam +Signed-off-by: Sasha Levin +--- + drivers/pci/controller/pcie-rcar-ep.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/pci/controller/pcie-rcar-ep.c b/drivers/pci/controller/pcie-rcar-ep.c +index f9682df1da619..209719fb6ddcc 100644 +--- a/drivers/pci/controller/pcie-rcar-ep.c ++++ b/drivers/pci/controller/pcie-rcar-ep.c +@@ -107,7 +107,7 @@ static int rcar_pcie_parse_outbound_ranges(struct rcar_pcie_endpoint *ep, + } + if (!devm_request_mem_region(&pdev->dev, res->start, + resource_size(res), +- outbound_name)) { ++ res->name)) { + dev_err(pcie->dev, "Cannot request memory region %s.\n", + outbound_name); + return -EIO; +-- +2.39.5 + diff --git a/queue-6.6/perf-bpf-fix-two-memory-leakages-when-calling-perf_e.patch b/queue-6.6/perf-bpf-fix-two-memory-leakages-when-calling-perf_e.patch new file mode 100644 index 0000000000..2a8601a105 --- /dev/null +++ b/queue-6.6/perf-bpf-fix-two-memory-leakages-when-calling-perf_e.patch @@ -0,0 +1,105 @@ +From 04daaf4878f44986ff11d080bd8a8261f7ddeb3e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 5 Dec 2024 16:45:00 +0800 +Subject: perf bpf: Fix two memory leakages when calling + perf_env__insert_bpf_prog_info() + +From: Zhongqiu Han + +[ Upstream commit 03edb7020bb920f1935c3f30acad0bb27fdb99af ] + +If perf_env__insert_bpf_prog_info() returns false due to a duplicate bpf +prog info node insertion, the temporary info_node and info_linear memory +will leak. Add a check to ensure the memory is freed if the function +returns false. + +Fixes: d56354dc49091e33 ("perf tools: Save bpf_prog_info and BTF of new BPF programs") +Reviewed-by: Namhyung Kim +Signed-off-by: Zhongqiu Han +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Kan Liang +Cc: Mark Rutland +Cc: Peter Zijlstra +Cc: Song Liu +Cc: Yicong Yang +Link: https://lore.kernel.org/r/20241205084500.823660-4-quic_zhonhan@quicinc.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/bpf-event.c | 10 ++++++++-- + tools/perf/util/env.c | 8 ++++++-- + tools/perf/util/env.h | 2 +- + 3 files changed, 15 insertions(+), 5 deletions(-) + +diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c +index b00b5a2634c3d..b94b4f16a60a5 100644 +--- a/tools/perf/util/bpf-event.c ++++ b/tools/perf/util/bpf-event.c +@@ -288,7 +288,10 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session, + } + + info_node->info_linear = info_linear; +- perf_env__insert_bpf_prog_info(env, info_node); ++ if (!perf_env__insert_bpf_prog_info(env, info_node)) { ++ free(info_linear); ++ free(info_node); ++ } + info_linear = NULL; + + /* +@@ -476,7 +479,10 @@ static void perf_env__add_bpf_info(struct perf_env *env, u32 id) + info_node = malloc(sizeof(struct bpf_prog_info_node)); + if (info_node) { + info_node->info_linear = info_linear; +- perf_env__insert_bpf_prog_info(env, info_node); ++ if (!perf_env__insert_bpf_prog_info(env, info_node)) { ++ free(info_linear); ++ free(info_node); ++ } + } else + free(info_linear); + +diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c +index 1f1a95bfd4a59..cea15c568602b 100644 +--- a/tools/perf/util/env.c ++++ b/tools/perf/util/env.c +@@ -20,12 +20,16 @@ struct perf_env perf_env; + #include "bpf-utils.h" + #include + +-void perf_env__insert_bpf_prog_info(struct perf_env *env, ++bool perf_env__insert_bpf_prog_info(struct perf_env *env, + struct bpf_prog_info_node *info_node) + { ++ bool ret; ++ + down_write(&env->bpf_progs.lock); +- __perf_env__insert_bpf_prog_info(env, info_node); ++ ret = __perf_env__insert_bpf_prog_info(env, info_node); + up_write(&env->bpf_progs.lock); ++ ++ return ret; + } + + bool __perf_env__insert_bpf_prog_info(struct perf_env *env, struct bpf_prog_info_node *info_node) +diff --git a/tools/perf/util/env.h b/tools/perf/util/env.h +index 7d1360ff79fd8..bc2d0ef351997 100644 +--- a/tools/perf/util/env.h ++++ b/tools/perf/util/env.h +@@ -166,7 +166,7 @@ int perf_env__nr_cpus_avail(struct perf_env *env); + void perf_env__init(struct perf_env *env); + bool __perf_env__insert_bpf_prog_info(struct perf_env *env, + struct bpf_prog_info_node *info_node); +-void perf_env__insert_bpf_prog_info(struct perf_env *env, ++bool perf_env__insert_bpf_prog_info(struct perf_env *env, + struct bpf_prog_info_node *info_node); + struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env, + __u32 prog_id); +-- +2.39.5 + diff --git a/queue-6.6/perf-core-save-raw-sample-data-conditionally-based-o.patch b/queue-6.6/perf-core-save-raw-sample-data-conditionally-based-o.patch new file mode 100644 index 0000000000..905dca992e --- /dev/null +++ b/queue-6.6/perf-core-save-raw-sample-data-conditionally-based-o.patch @@ -0,0 +1,274 @@ +From c4f8d4298114f2b05a5d4618ccb8f017e8cbc348 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 15 May 2024 12:36:07 -0700 +Subject: perf/core: Save raw sample data conditionally based on sample type + +From: Yabin Cui + +[ Upstream commit b9c44b91476b67327a521568a854babecc4070ab ] + +Currently, space for raw sample data is always allocated within sample +records for both BPF output and tracepoint events. This leads to unused +space in sample records when raw sample data is not requested. + +This patch enforces checking sample type of an event in +perf_sample_save_raw_data(). So raw sample data will only be saved if +explicitly requested, reducing overhead when it is not needed. + +Fixes: 0a9081cf0a11 ("perf/core: Add perf_sample_save_raw_data() helper") +Signed-off-by: Yabin Cui +Signed-off-by: Ingo Molnar +Reviewed-by: Ian Rogers +Acked-by: Namhyung Kim +Link: https://lore.kernel.org/r/20240515193610.2350456-2-yabinc@google.com +Signed-off-by: Sasha Levin +--- + arch/s390/kernel/perf_cpum_cf.c | 2 +- + arch/s390/kernel/perf_pai_crypto.c | 2 +- + arch/s390/kernel/perf_pai_ext.c | 2 +- + arch/x86/events/amd/ibs.c | 2 +- + include/linux/perf_event.h | 6 +++++ + kernel/events/core.c | 35 +++++++++++++++--------------- + kernel/trace/bpf_trace.c | 11 +++++----- + 7 files changed, 34 insertions(+), 26 deletions(-) + +diff --git a/arch/s390/kernel/perf_cpum_cf.c b/arch/s390/kernel/perf_cpum_cf.c +index 5466e7bada03d..65a66df5bb865 100644 +--- a/arch/s390/kernel/perf_cpum_cf.c ++++ b/arch/s390/kernel/perf_cpum_cf.c +@@ -977,7 +977,7 @@ static int cfdiag_push_sample(struct perf_event *event, + if (event->attr.sample_type & PERF_SAMPLE_RAW) { + raw.frag.size = cpuhw->usedss; + raw.frag.data = cpuhw->stop; +- perf_sample_save_raw_data(&data, &raw); ++ perf_sample_save_raw_data(&data, event, &raw); + } + + overflow = perf_event_overflow(event, &data, ®s); +diff --git a/arch/s390/kernel/perf_pai_crypto.c b/arch/s390/kernel/perf_pai_crypto.c +index 4a4e914c283c8..044fba8332b22 100644 +--- a/arch/s390/kernel/perf_pai_crypto.c ++++ b/arch/s390/kernel/perf_pai_crypto.c +@@ -365,7 +365,7 @@ static int paicrypt_push_sample(void) + if (event->attr.sample_type & PERF_SAMPLE_RAW) { + raw.frag.size = rawsize; + raw.frag.data = cpump->save; +- perf_sample_save_raw_data(&data, &raw); ++ perf_sample_save_raw_data(&data, event, &raw); + } + + overflow = perf_event_overflow(event, &data, ®s); +diff --git a/arch/s390/kernel/perf_pai_ext.c b/arch/s390/kernel/perf_pai_ext.c +index b5febe22d0546..089bd3104b394 100644 +--- a/arch/s390/kernel/perf_pai_ext.c ++++ b/arch/s390/kernel/perf_pai_ext.c +@@ -454,7 +454,7 @@ static int paiext_push_sample(void) + if (event->attr.sample_type & PERF_SAMPLE_RAW) { + raw.frag.size = rawsize; + raw.frag.data = cpump->save; +- perf_sample_save_raw_data(&data, &raw); ++ perf_sample_save_raw_data(&data, event, &raw); + } + + overflow = perf_event_overflow(event, &data, ®s); +diff --git a/arch/x86/events/amd/ibs.c b/arch/x86/events/amd/ibs.c +index 6911c5399d02f..f483874fa20f1 100644 +--- a/arch/x86/events/amd/ibs.c ++++ b/arch/x86/events/amd/ibs.c +@@ -1115,7 +1115,7 @@ static int perf_ibs_handle_irq(struct perf_ibs *perf_ibs, struct pt_regs *iregs) + .data = ibs_data.data, + }, + }; +- perf_sample_save_raw_data(&data, &raw); ++ perf_sample_save_raw_data(&data, event, &raw); + } + + if (perf_ibs == &perf_ibs_op) +diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h +index 7a5563ffe61b5..fcb834dd75c24 100644 +--- a/include/linux/perf_event.h ++++ b/include/linux/perf_event.h +@@ -1231,12 +1231,18 @@ static inline void perf_sample_save_callchain(struct perf_sample_data *data, + } + + static inline void perf_sample_save_raw_data(struct perf_sample_data *data, ++ struct perf_event *event, + struct perf_raw_record *raw) + { + struct perf_raw_frag *frag = &raw->frag; + u32 sum = 0; + int size; + ++ if (!(event->attr.sample_type & PERF_SAMPLE_RAW)) ++ return; ++ if (WARN_ON_ONCE(data->sample_flags & PERF_SAMPLE_RAW)) ++ return; ++ + do { + sum += frag->size; + if (perf_raw_frag_last(frag)) +diff --git a/kernel/events/core.c b/kernel/events/core.c +index ec0fae49a0dd9..5d6458ea675e9 100644 +--- a/kernel/events/core.c ++++ b/kernel/events/core.c +@@ -10157,9 +10157,9 @@ static struct pmu perf_tracepoint = { + }; + + static int perf_tp_filter_match(struct perf_event *event, +- struct perf_sample_data *data) ++ struct perf_raw_record *raw) + { +- void *record = data->raw->frag.data; ++ void *record = raw->frag.data; + + /* only top level events have filters set */ + if (event->parent) +@@ -10171,7 +10171,7 @@ static int perf_tp_filter_match(struct perf_event *event, + } + + static int perf_tp_event_match(struct perf_event *event, +- struct perf_sample_data *data, ++ struct perf_raw_record *raw, + struct pt_regs *regs) + { + if (event->hw.state & PERF_HES_STOPPED) +@@ -10182,7 +10182,7 @@ static int perf_tp_event_match(struct perf_event *event, + if (event->attr.exclude_kernel && !user_mode(regs)) + return 0; + +- if (!perf_tp_filter_match(event, data)) ++ if (!perf_tp_filter_match(event, raw)) + return 0; + + return 1; +@@ -10208,6 +10208,7 @@ EXPORT_SYMBOL_GPL(perf_trace_run_bpf_submit); + static void __perf_tp_event_target_task(u64 count, void *record, + struct pt_regs *regs, + struct perf_sample_data *data, ++ struct perf_raw_record *raw, + struct perf_event *event) + { + struct trace_entry *entry = record; +@@ -10217,13 +10218,17 @@ static void __perf_tp_event_target_task(u64 count, void *record, + /* Cannot deliver synchronous signal to other task. */ + if (event->attr.sigtrap) + return; +- if (perf_tp_event_match(event, data, regs)) ++ if (perf_tp_event_match(event, raw, regs)) { ++ perf_sample_data_init(data, 0, 0); ++ perf_sample_save_raw_data(data, event, raw); + perf_swevent_event(event, count, data, regs); ++ } + } + + static void perf_tp_event_target_task(u64 count, void *record, + struct pt_regs *regs, + struct perf_sample_data *data, ++ struct perf_raw_record *raw, + struct perf_event_context *ctx) + { + unsigned int cpu = smp_processor_id(); +@@ -10231,15 +10236,15 @@ static void perf_tp_event_target_task(u64 count, void *record, + struct perf_event *event, *sibling; + + perf_event_groups_for_cpu_pmu(event, &ctx->pinned_groups, cpu, pmu) { +- __perf_tp_event_target_task(count, record, regs, data, event); ++ __perf_tp_event_target_task(count, record, regs, data, raw, event); + for_each_sibling_event(sibling, event) +- __perf_tp_event_target_task(count, record, regs, data, sibling); ++ __perf_tp_event_target_task(count, record, regs, data, raw, sibling); + } + + perf_event_groups_for_cpu_pmu(event, &ctx->flexible_groups, cpu, pmu) { +- __perf_tp_event_target_task(count, record, regs, data, event); ++ __perf_tp_event_target_task(count, record, regs, data, raw, event); + for_each_sibling_event(sibling, event) +- __perf_tp_event_target_task(count, record, regs, data, sibling); ++ __perf_tp_event_target_task(count, record, regs, data, raw, sibling); + } + } + +@@ -10257,15 +10262,10 @@ void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size, + }, + }; + +- perf_sample_data_init(&data, 0, 0); +- perf_sample_save_raw_data(&data, &raw); +- + perf_trace_buf_update(record, event_type); + + hlist_for_each_entry_rcu(event, head, hlist_entry) { +- if (perf_tp_event_match(event, &data, regs)) { +- perf_swevent_event(event, count, &data, regs); +- ++ if (perf_tp_event_match(event, &raw, regs)) { + /* + * Here use the same on-stack perf_sample_data, + * some members in data are event-specific and +@@ -10275,7 +10275,8 @@ void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size, + * because data->sample_flags is set. + */ + perf_sample_data_init(&data, 0, 0); +- perf_sample_save_raw_data(&data, &raw); ++ perf_sample_save_raw_data(&data, event, &raw); ++ perf_swevent_event(event, count, &data, regs); + } + } + +@@ -10292,7 +10293,7 @@ void perf_tp_event(u16 event_type, u64 count, void *record, int entry_size, + goto unlock; + + raw_spin_lock(&ctx->lock); +- perf_tp_event_target_task(count, record, regs, &data, ctx); ++ perf_tp_event_target_task(count, record, regs, &data, &raw, ctx); + raw_spin_unlock(&ctx->lock); + unlock: + rcu_read_unlock(); +diff --git a/kernel/trace/bpf_trace.c b/kernel/trace/bpf_trace.c +index aab43ba3daeb5..5f12bb727b850 100644 +--- a/kernel/trace/bpf_trace.c ++++ b/kernel/trace/bpf_trace.c +@@ -616,7 +616,8 @@ static const struct bpf_func_proto bpf_perf_event_read_value_proto = { + + static __always_inline u64 + __bpf_perf_event_output(struct pt_regs *regs, struct bpf_map *map, +- u64 flags, struct perf_sample_data *sd) ++ u64 flags, struct perf_raw_record *raw, ++ struct perf_sample_data *sd) + { + struct bpf_array *array = container_of(map, struct bpf_array, map); + unsigned int cpu = smp_processor_id(); +@@ -641,6 +642,8 @@ __bpf_perf_event_output(struct pt_regs *regs, struct bpf_map *map, + if (unlikely(event->oncpu != cpu)) + return -EOPNOTSUPP; + ++ perf_sample_save_raw_data(sd, event, raw); ++ + return perf_event_output(event, sd, regs); + } + +@@ -684,9 +687,8 @@ BPF_CALL_5(bpf_perf_event_output, struct pt_regs *, regs, struct bpf_map *, map, + } + + perf_sample_data_init(sd, 0, 0); +- perf_sample_save_raw_data(sd, &raw); + +- err = __bpf_perf_event_output(regs, map, flags, sd); ++ err = __bpf_perf_event_output(regs, map, flags, &raw, sd); + out: + this_cpu_dec(bpf_trace_nest_level); + preempt_enable(); +@@ -745,9 +747,8 @@ u64 bpf_event_output(struct bpf_map *map, u64 flags, void *meta, u64 meta_size, + + perf_fetch_caller_regs(regs); + perf_sample_data_init(sd, 0, 0); +- perf_sample_save_raw_data(sd, &raw); + +- ret = __bpf_perf_event_output(regs, map, flags, sd); ++ ret = __bpf_perf_event_output(regs, map, flags, &raw, sd); + out: + this_cpu_dec(bpf_event_output_nest_level); + preempt_enable(); +-- +2.39.5 + diff --git a/queue-6.6/perf-expr-initialize-is_test-value-in-expr__ctx_new.patch b/queue-6.6/perf-expr-initialize-is_test-value-in-expr__ctx_new.patch new file mode 100644 index 0000000000..b972077044 --- /dev/null +++ b/queue-6.6/perf-expr-initialize-is_test-value-in-expr__ctx_new.patch @@ -0,0 +1,55 @@ +From 7fe9fa53900902560985f81d95495e07ec678a1a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 8 Nov 2024 14:34:25 +0000 +Subject: perf expr: Initialize is_test value in expr__ctx_new() + +From: Levi Yun + +[ Upstream commit 1d18ebcfd302a2005b83ae5f13df223894d19902 ] + +When expr_parse_ctx is allocated by expr_ctx_new(), +expr_scanner_ctx->is_test isn't initialize, so it has garbage value. +this can affects the result of expr__parse() return when it parses +non-exist event literal according to garbage value. + +Use calloc instead of malloc in expr_ctx_new() to fix this. + +Fixes: 3340a08354ac286e ("perf pmu-events: Fix testing with JEVENTS_ARCH=all") +Reviewed-by: Ian Rogers +Reviewed-by: James Clark +Signed-off-by: Levi Yun +Cc: Mark Rutland +Cc: Namhyung Kim +Link: https://lore.kernel.org/r/20241108143424.819126-1-yeoreum.yun@arm.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/expr.c | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +diff --git a/tools/perf/util/expr.c b/tools/perf/util/expr.c +index b8875aac8f870..fa0473f7a4ff4 100644 +--- a/tools/perf/util/expr.c ++++ b/tools/perf/util/expr.c +@@ -292,7 +292,7 @@ struct expr_parse_ctx *expr__ctx_new(void) + { + struct expr_parse_ctx *ctx; + +- ctx = malloc(sizeof(struct expr_parse_ctx)); ++ ctx = calloc(1, sizeof(struct expr_parse_ctx)); + if (!ctx) + return NULL; + +@@ -301,9 +301,6 @@ struct expr_parse_ctx *expr__ctx_new(void) + free(ctx); + return NULL; + } +- ctx->sctx.user_requested_cpu_list = NULL; +- ctx->sctx.runtime = 0; +- ctx->sctx.system_wide = false; + + return ctx; + } +-- +2.39.5 + diff --git a/queue-6.6/perf-header-fix-one-memory-leakage-in-process_bpf_bt.patch b/queue-6.6/perf-header-fix-one-memory-leakage-in-process_bpf_bt.patch new file mode 100644 index 0000000000..94fcae4648 --- /dev/null +++ b/queue-6.6/perf-header-fix-one-memory-leakage-in-process_bpf_bt.patch @@ -0,0 +1,51 @@ +From 8c45d01c8f178cf136e96a4b6546859731820aab Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 5 Dec 2024 16:44:58 +0800 +Subject: perf header: Fix one memory leakage in process_bpf_btf() + +From: Zhongqiu Han + +[ Upstream commit 875d22980a062521beed7b5df71fb13a1af15d83 ] + +If __perf_env__insert_btf() returns false due to a duplicate btf node +insertion, the temporary node will leak. Add a check to ensure the memory +is freed if the function returns false. + +Fixes: a70a1123174ab592 ("perf bpf: Save BTF information as headers to perf.data") +Reviewed-by: Namhyung Kim +Signed-off-by: Zhongqiu Han +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Kan Liang +Cc: Mark Rutland +Cc: Peter Zijlstra +Cc: Song Liu +Cc: Yicong Yang +Link: https://lore.kernel.org/r/20241205084500.823660-2-quic_zhonhan@quicinc.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/header.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c +index 1482567e5ac1a..34d3b567ae772 100644 +--- a/tools/perf/util/header.c ++++ b/tools/perf/util/header.c +@@ -3224,7 +3224,8 @@ static int process_bpf_btf(struct feat_fd *ff, void *data __maybe_unused) + if (__do_read(ff, node->data, data_size)) + goto out; + +- __perf_env__insert_btf(env, node); ++ if (!__perf_env__insert_btf(env, node)) ++ free(node); + node = NULL; + } + +-- +2.39.5 + diff --git a/queue-6.6/perf-header-fix-one-memory-leakage-in-process_bpf_pr.patch b/queue-6.6/perf-header-fix-one-memory-leakage-in-process_bpf_pr.patch new file mode 100644 index 0000000000..fea9ed5af2 --- /dev/null +++ b/queue-6.6/perf-header-fix-one-memory-leakage-in-process_bpf_pr.patch @@ -0,0 +1,99 @@ +From f7df2cf9cc2b011e35d958ec9fd7d33620deb8b3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 5 Dec 2024 16:44:59 +0800 +Subject: perf header: Fix one memory leakage in process_bpf_prog_info() + +From: Zhongqiu Han + +[ Upstream commit a7da6c7030e1aec32f0a41c7b4fa70ec96042019 ] + +Function __perf_env__insert_bpf_prog_info() will return without inserting +bpf prog info node into perf env again due to a duplicate bpf prog info +node insertion, causing the temporary info_linear and info_node memory to +leak. Modify the return type of this function to bool and add a check to +ensure the memory is freed if the function returns false. + +Fixes: 606f972b1361f477 ("perf bpf: Save bpf_prog_info information as headers to perf.data") +Reviewed-by: Namhyung Kim +Signed-off-by: Zhongqiu Han +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Kan Liang +Cc: Mark Rutland +Cc: Peter Zijlstra +Cc: Song Liu +Cc: Yicong Yang +Link: https://lore.kernel.org/r/20241205084500.823660-3-quic_zhonhan@quicinc.com +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/env.c | 5 +++-- + tools/perf/util/env.h | 2 +- + tools/perf/util/header.c | 5 ++++- + 3 files changed, 8 insertions(+), 4 deletions(-) + +diff --git a/tools/perf/util/env.c b/tools/perf/util/env.c +index d2c7b6e6eae51..1f1a95bfd4a59 100644 +--- a/tools/perf/util/env.c ++++ b/tools/perf/util/env.c +@@ -28,7 +28,7 @@ void perf_env__insert_bpf_prog_info(struct perf_env *env, + up_write(&env->bpf_progs.lock); + } + +-void __perf_env__insert_bpf_prog_info(struct perf_env *env, struct bpf_prog_info_node *info_node) ++bool __perf_env__insert_bpf_prog_info(struct perf_env *env, struct bpf_prog_info_node *info_node) + { + __u32 prog_id = info_node->info_linear->info.id; + struct bpf_prog_info_node *node; +@@ -46,13 +46,14 @@ void __perf_env__insert_bpf_prog_info(struct perf_env *env, struct bpf_prog_info + p = &(*p)->rb_right; + } else { + pr_debug("duplicated bpf prog info %u\n", prog_id); +- return; ++ return false; + } + } + + rb_link_node(&info_node->rb_node, parent, p); + rb_insert_color(&info_node->rb_node, &env->bpf_progs.infos); + env->bpf_progs.infos_cnt++; ++ return true; + } + + struct bpf_prog_info_node *perf_env__find_bpf_prog_info(struct perf_env *env, +diff --git a/tools/perf/util/env.h b/tools/perf/util/env.h +index 359eff51cb85b..7d1360ff79fd8 100644 +--- a/tools/perf/util/env.h ++++ b/tools/perf/util/env.h +@@ -164,7 +164,7 @@ const char *perf_env__raw_arch(struct perf_env *env); + int perf_env__nr_cpus_avail(struct perf_env *env); + + void perf_env__init(struct perf_env *env); +-void __perf_env__insert_bpf_prog_info(struct perf_env *env, ++bool __perf_env__insert_bpf_prog_info(struct perf_env *env, + struct bpf_prog_info_node *info_node); + void perf_env__insert_bpf_prog_info(struct perf_env *env, + struct bpf_prog_info_node *info_node); +diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c +index 34d3b567ae772..0b44176826bfd 100644 +--- a/tools/perf/util/header.c ++++ b/tools/perf/util/header.c +@@ -3177,7 +3177,10 @@ static int process_bpf_prog_info(struct feat_fd *ff, void *data __maybe_unused) + /* after reading from file, translate offset to address */ + bpil_offs_to_addr(info_linear); + info_node->info_linear = info_linear; +- __perf_env__insert_bpf_prog_info(env, info_node); ++ if (!__perf_env__insert_bpf_prog_info(env, info_node)) { ++ free(info_linear); ++ free(info_node); ++ } + } + + up_write(&env->bpf_progs.lock); +-- +2.39.5 + diff --git a/queue-6.6/perf-lock-fix-parse_lock_type-which-only-retrieve-on.patch b/queue-6.6/perf-lock-fix-parse_lock_type-which-only-retrieve-on.patch new file mode 100644 index 0000000000..70f4c215ce --- /dev/null +++ b/queue-6.6/perf-lock-fix-parse_lock_type-which-only-retrieve-on.patch @@ -0,0 +1,163 @@ +From eefc3ca586a275bcee5f4cbe40e76d4e10a075a0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 16 Jan 2025 15:58:14 -0800 +Subject: perf lock: Fix parse_lock_type which only retrieve one lock flag + +From: Chun-Tse Shao + +[ Upstream commit 1be9264158ef4818393e5d8144887a1a5d3cc480 ] + +`parse_lock_type` can only add the first lock flag in `lock_type_table` +given input `str`. For example, for `Y rwlock`, it only adds `rwlock:R` +into this perf session. Another example is for `-Y mutex`, it only adds +the mutex without `LCB_F_SPIN` flag. The patch fixes this issue, makes +sure both `rwlock:R` and `rwlock:W` will be added with `-Y rwlock`, and +so on. + +Testing: + $ ./perf lock con -ab -Y mutex,rwlock -- perf bench sched pipe + # Running 'sched/pipe' benchmark: + # Executed 1000000 pipe operations between two processes + + Total time: 9.313 [sec] + + 9.313976 usecs/op + 107365 ops/sec + contended total wait max wait avg wait type caller + + 176 1.65 ms 19.43 us 9.38 us mutex pipe_read+0x57 + 34 180.14 us 10.93 us 5.30 us mutex pipe_write+0x50 + 7 77.48 us 16.09 us 11.07 us mutex do_epoll_wait+0x24d + 7 74.70 us 13.50 us 10.67 us mutex do_epoll_wait+0x24d + 3 35.97 us 14.44 us 11.99 us rwlock:W ep_done_scan+0x2d + 3 35.00 us 12.23 us 11.66 us rwlock:W do_epoll_wait+0x255 + 2 15.88 us 11.96 us 7.94 us rwlock:W do_epoll_wait+0x47c + 1 15.23 us 15.23 us 15.23 us rwlock:W do_epoll_wait+0x4d0 + 1 14.26 us 14.26 us 14.26 us rwlock:W ep_done_scan+0x2d + 2 14.00 us 7.99 us 7.00 us mutex pipe_read+0x282 + 1 12.29 us 12.29 us 12.29 us rwlock:R ep_poll_callback+0x35 + 1 12.02 us 12.02 us 12.02 us rwlock:W do_epoll_ctl+0xb65 + 1 10.25 us 10.25 us 10.25 us rwlock:R ep_poll_callback+0x35 + 1 7.86 us 7.86 us 7.86 us mutex do_epoll_ctl+0x6c1 + 1 5.04 us 5.04 us 5.04 us mutex do_epoll_ctl+0x3d4 + +[namhyung: Add a comment and rename to 'mutex:spin' for consistency + +Fixes: d783ea8f62c4 ("perf lock contention: Simplify parse_lock_type()") +Reviewed-by: Namhyung Kim +Signed-off-by: Chun-Tse Shao +Cc: nick.forrington@arm.com +Link: https://lore.kernel.org/r/20250116235838.2769691-1-ctshao@google.com +Signed-off-by: Namhyung Kim +Signed-off-by: Sasha Levin +--- + tools/perf/builtin-lock.c | 66 ++++++++++++++++++++++++--------------- + 1 file changed, 41 insertions(+), 25 deletions(-) + +diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c +index fcb32c58bee7e..bd24ed0af208a 100644 +--- a/tools/perf/builtin-lock.c ++++ b/tools/perf/builtin-lock.c +@@ -1591,8 +1591,8 @@ static const struct { + { LCB_F_PERCPU | LCB_F_WRITE, "pcpu-sem:W", "percpu-rwsem" }, + { LCB_F_MUTEX, "mutex", "mutex" }, + { LCB_F_MUTEX | LCB_F_SPIN, "mutex", "mutex" }, +- /* alias for get_type_flag() */ +- { LCB_F_MUTEX | LCB_F_SPIN, "mutex-spin", "mutex" }, ++ /* alias for optimistic spinning only */ ++ { LCB_F_MUTEX | LCB_F_SPIN, "mutex:spin", "mutex-spin" }, + }; + + static const char *get_type_str(unsigned int flags) +@@ -1617,19 +1617,6 @@ static const char *get_type_name(unsigned int flags) + return "unknown"; + } + +-static unsigned int get_type_flag(const char *str) +-{ +- for (unsigned int i = 0; i < ARRAY_SIZE(lock_type_table); i++) { +- if (!strcmp(lock_type_table[i].name, str)) +- return lock_type_table[i].flags; +- } +- for (unsigned int i = 0; i < ARRAY_SIZE(lock_type_table); i++) { +- if (!strcmp(lock_type_table[i].str, str)) +- return lock_type_table[i].flags; +- } +- return UINT_MAX; +-} +- + static void lock_filter_finish(void) + { + zfree(&filters.types); +@@ -2321,29 +2308,58 @@ static int parse_lock_type(const struct option *opt __maybe_unused, const char * + int unset __maybe_unused) + { + char *s, *tmp, *tok; +- int ret = 0; + + s = strdup(str); + if (s == NULL) + return -1; + + for (tok = strtok_r(s, ", ", &tmp); tok; tok = strtok_r(NULL, ", ", &tmp)) { +- unsigned int flags = get_type_flag(tok); ++ bool found = false; + +- if (flags == -1U) { +- pr_err("Unknown lock flags: %s\n", tok); +- ret = -1; +- break; ++ /* `tok` is `str` in `lock_type_table` if it contains ':'. */ ++ if (strchr(tok, ':')) { ++ for (unsigned int i = 0; i < ARRAY_SIZE(lock_type_table); i++) { ++ if (!strcmp(lock_type_table[i].str, tok) && ++ add_lock_type(lock_type_table[i].flags)) { ++ found = true; ++ break; ++ } ++ } ++ ++ if (!found) { ++ pr_err("Unknown lock flags name: %s\n", tok); ++ free(s); ++ return -1; ++ } ++ ++ continue; + } + +- if (!add_lock_type(flags)) { +- ret = -1; +- break; ++ /* ++ * Otherwise `tok` is `name` in `lock_type_table`. ++ * Single lock name could contain multiple flags. ++ */ ++ for (unsigned int i = 0; i < ARRAY_SIZE(lock_type_table); i++) { ++ if (!strcmp(lock_type_table[i].name, tok)) { ++ if (add_lock_type(lock_type_table[i].flags)) { ++ found = true; ++ } else { ++ free(s); ++ return -1; ++ } ++ } + } ++ ++ if (!found) { ++ pr_err("Unknown lock name: %s\n", tok); ++ free(s); ++ return -1; ++ } ++ + } + + free(s); +- return ret; ++ return 0; + } + + static bool add_lock_addr(unsigned long addr) +-- +2.39.5 + diff --git a/queue-6.6/perf-machine-don-t-ignore-_etext-when-not-a-text-sym.patch b/queue-6.6/perf-machine-don-t-ignore-_etext-when-not-a-text-sym.patch new file mode 100644 index 0000000000..a32d4ca703 --- /dev/null +++ b/queue-6.6/perf-machine-don-t-ignore-_etext-when-not-a-text-sym.patch @@ -0,0 +1,68 @@ +From 06e515690521a70af7f294e83800193392ae69c9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 Jan 2025 10:15:24 +0100 +Subject: perf machine: Don't ignore _etext when not a text symbol + +From: Christophe Leroy + +[ Upstream commit 7a93786c306296f15e728b1dbd949a319e4e3d19 ] + +Depending on how vmlinux.lds is written, _etext might be the very first +data symbol instead of the very last text symbol. + +Don't require it to be a text symbol, accept any symbol type. + +Comitter notes: + +See the first Link for further discussion, but it all boils down to +this: + + --- + # grep -e _stext -e _etext -e _edata /proc/kallsyms + c0000000 T _stext + c08b8000 D _etext + + So there is no _edata and _etext is not text + + $ ppc-linux-objdump -x vmlinux | grep -e _stext -e _etext -e _edata + c0000000 g .head.text 00000000 _stext + c08b8000 g .rodata 00000000 _etext + c1378000 g .sbss 00000000 _edata + --- + +Fixes: ed9adb2035b5be58 ("perf machine: Read also the end of the kernel") +Signed-off-by: Christophe Leroy +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Kan Liang +Cc: linuxppc-dev@lists.ozlabs.org +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Cc: Song Liu +Link: https://lore.kernel.org/r/b3ee1994d95257cb7f2de037c5030ba7d1bed404.1736327613.git.christophe.leroy@csgroup.eu +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/machine.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c +index 7c6874804660e..e2a6facd1c4e2 100644 +--- a/tools/perf/util/machine.c ++++ b/tools/perf/util/machine.c +@@ -1217,7 +1217,7 @@ static int machine__get_running_kernel_start(struct machine *machine, + + err = kallsyms__get_symbol_start(filename, "_edata", &addr); + if (err) +- err = kallsyms__get_function_start(filename, "_etext", &addr); ++ err = kallsyms__get_symbol_start(filename, "_etext", &addr); + if (!err) + *end = addr; + +-- +2.39.5 + diff --git a/queue-6.6/perf-namespaces-fixup-the-nsinfo__in_pidns-return-ty.patch b/queue-6.6/perf-namespaces-fixup-the-nsinfo__in_pidns-return-ty.patch new file mode 100644 index 0000000000..d9f60717f3 --- /dev/null +++ b/queue-6.6/perf-namespaces-fixup-the-nsinfo__in_pidns-return-ty.patch @@ -0,0 +1,64 @@ +From ef9901e43f66bdbc7279d22eab9e1496c4a0e677 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Dec 2024 17:48:28 -0300 +Subject: perf namespaces: Fixup the nsinfo__in_pidns() return type, its bool + +From: Arnaldo Carvalho de Melo + +[ Upstream commit 64a7617efd5ae1d57a75e464d7134eec947c3fe3 ] + +When adding support for refconunt checking a cut'n'paste made this +function, that is just an accessor to a bool member of 'struct nsinfo', +return a pid_t, when that member is a boolean, fix it. + +Fixes: bcaf0a97858de7ab ("perf namespaces: Add functions to access nsinfo") +Reported-by: Francesco Nigro +Reported-by: Ilan Green +Cc: Adrian Hunter +Cc: Clark Williams +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Kan Liang +Cc: Namhyung Kim +Cc: Stephane Eranian +Cc: Thomas Gleixner +Cc: Yonatan Goldschmidt +Link: https://lore.kernel.org/r/20241206204828.507527-6-acme@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/util/namespaces.c | 2 +- + tools/perf/util/namespaces.h | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tools/perf/util/namespaces.c b/tools/perf/util/namespaces.c +index 36047184d76e2..68f5de2d79c72 100644 +--- a/tools/perf/util/namespaces.c ++++ b/tools/perf/util/namespaces.c +@@ -266,7 +266,7 @@ pid_t nsinfo__pid(const struct nsinfo *nsi) + return RC_CHK_ACCESS(nsi)->pid; + } + +-pid_t nsinfo__in_pidns(const struct nsinfo *nsi) ++bool nsinfo__in_pidns(const struct nsinfo *nsi) + { + return RC_CHK_ACCESS(nsi)->in_pidns; + } +diff --git a/tools/perf/util/namespaces.h b/tools/perf/util/namespaces.h +index e014becb9cd8e..e95c79b80e27c 100644 +--- a/tools/perf/util/namespaces.h ++++ b/tools/perf/util/namespaces.h +@@ -58,7 +58,7 @@ void nsinfo__clear_need_setns(struct nsinfo *nsi); + pid_t nsinfo__tgid(const struct nsinfo *nsi); + pid_t nsinfo__nstgid(const struct nsinfo *nsi); + pid_t nsinfo__pid(const struct nsinfo *nsi); +-pid_t nsinfo__in_pidns(const struct nsinfo *nsi); ++bool nsinfo__in_pidns(const struct nsinfo *nsi); + void nsinfo__set_in_pidns(struct nsinfo *nsi); + + void nsinfo__mountns_enter(struct nsinfo *nsi, struct nscookie *nc); +-- +2.39.5 + diff --git a/queue-6.6/perf-namespaces-introduce-nsinfo__set_in_pidns.patch b/queue-6.6/perf-namespaces-introduce-nsinfo__set_in_pidns.patch new file mode 100644 index 0000000000..cf39e5bc8b --- /dev/null +++ b/queue-6.6/perf-namespaces-introduce-nsinfo__set_in_pidns.patch @@ -0,0 +1,86 @@ +From 097868b9f10bf4fd7f62c59d59a5823510c1e2bf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Dec 2024 17:48:26 -0300 +Subject: perf namespaces: Introduce nsinfo__set_in_pidns() + +From: Arnaldo Carvalho de Melo + +[ Upstream commit 9c6a585d257f6845731f4e36b45fe42b5c3162f5 ] + +When we're processing a perf.data file we will, for every thread in that +file do a machine__findnew_thread(machine, pid, tid) that when that pid +is seen for the first time will create a 'struct thread' representing +it. + +That in turn will call nsinfo__new() -> nsinfo__init() and there it will +assume we're running live, which is wrong and will need to be addressed +in a followup patch. + +The nsinfo__new() assumes that if we can't access that thread it has +already finished and will ignore the -1 return from nsinfo__init(), just +taking notes to avoid trying to enter in that namespace, since it isn't +there anymore, a race. + +When doing this from 'perf inject', tho, we can fill in parts of that +nsinfo from what we get from the PERF_RECORD_MMAP2 (pid, tid) and in the +jitdump file name, that has the form of jit-.dump. + +So if the pid in the jitdump file name is not the one in the +PERF_RECORD_MMAP2, we can assume that its the pid of the process +_inside_ the namespace, and that perf was runing outside that namespace. + +This will be done in the following patch. + +Reported-by: Francesco Nigro +Reported-by: Ilan Green +Cc: Adrian Hunter +Cc: Clark Williams +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: James Clark +Cc: Jiri Olsa +Cc: Kan Liang +Cc: Namhyung Kim +Cc: Stephane Eranian +Cc: Thomas Gleixner +Cc: Yonatan Goldschmidt +Link: https://lore.kernel.org/r/20241206204828.507527-4-acme@kernel.org +Signed-off-by: Arnaldo Carvalho de Melo +Stable-dep-of: 64a7617efd5a ("perf namespaces: Fixup the nsinfo__in_pidns() return type, its bool") +Signed-off-by: Sasha Levin +--- + tools/perf/util/namespaces.c | 5 +++++ + tools/perf/util/namespaces.h | 1 + + 2 files changed, 6 insertions(+) + +diff --git a/tools/perf/util/namespaces.c b/tools/perf/util/namespaces.c +index cb185c5659d6b..36047184d76e2 100644 +--- a/tools/perf/util/namespaces.c ++++ b/tools/perf/util/namespaces.c +@@ -271,6 +271,11 @@ pid_t nsinfo__in_pidns(const struct nsinfo *nsi) + return RC_CHK_ACCESS(nsi)->in_pidns; + } + ++void nsinfo__set_in_pidns(struct nsinfo *nsi) ++{ ++ RC_CHK_ACCESS(nsi)->in_pidns = true; ++} ++ + void nsinfo__mountns_enter(struct nsinfo *nsi, + struct nscookie *nc) + { +diff --git a/tools/perf/util/namespaces.h b/tools/perf/util/namespaces.h +index 8c0731c6cbb7e..e014becb9cd8e 100644 +--- a/tools/perf/util/namespaces.h ++++ b/tools/perf/util/namespaces.h +@@ -59,6 +59,7 @@ pid_t nsinfo__tgid(const struct nsinfo *nsi); + pid_t nsinfo__nstgid(const struct nsinfo *nsi); + pid_t nsinfo__pid(const struct nsinfo *nsi); + pid_t nsinfo__in_pidns(const struct nsinfo *nsi); ++void nsinfo__set_in_pidns(struct nsinfo *nsi); + + void nsinfo__mountns_enter(struct nsinfo *nsi, struct nscookie *nc); + void nsinfo__mountns_exit(struct nscookie *nc); +-- +2.39.5 + diff --git a/queue-6.6/perf-report-fix-misleading-help-message-about-demang.patch b/queue-6.6/perf-report-fix-misleading-help-message-about-demang.patch new file mode 100644 index 0000000000..08456586ab --- /dev/null +++ b/queue-6.6/perf-report-fix-misleading-help-message-about-demang.patch @@ -0,0 +1,46 @@ +From 25c6149cdf07b20906c5392e3b0414efc7f62247 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Jan 2025 23:22:19 +0800 +Subject: perf report: Fix misleading help message about --demangle + +From: Jiachen Zhang + +[ Upstream commit ac0ac75189a4d6a29a2765a7adbb62bc6cc650c7 ] + +The wrong help message may mislead users. This commit fixes it. + +Fixes: 328ccdace8855289 ("perf report: Add --no-demangle option") +Reviewed-by: Namhyung Kim +Signed-off-by: Jiachen Zhang +Cc: Adrian Hunter +Cc: Alexander Shishkin +Cc: Ian Rogers +Cc: Ingo Molnar +Cc: Jiri Olsa +Cc: Kan Liang +Cc: Mark Rutland +Cc: Namhyung Kim +Cc: Peter Zijlstra +Link: https://lore.kernel.org/r/20250109152220.1869581-1-me@jcix.top +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/builtin-report.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c +index cd2f3f1a75633..54b06db597862 100644 +--- a/tools/perf/builtin-report.c ++++ b/tools/perf/builtin-report.c +@@ -1352,7 +1352,7 @@ int cmd_report(int argc, const char **argv) + OPT_STRING(0, "addr2line", &addr2line_path, "path", + "addr2line binary to use for line numbers"), + OPT_BOOLEAN(0, "demangle", &symbol_conf.demangle, +- "Disable symbol demangling"), ++ "Symbol demangling. Enabled by default, use --no-demangle to disable."), + OPT_BOOLEAN(0, "demangle-kernel", &symbol_conf.demangle_kernel, + "Enable kernel symbol demangling"), + OPT_BOOLEAN(0, "mem-mode", &report.mem_mode, "mem access profile"), +-- +2.39.5 + diff --git a/queue-6.6/perf-top-don-t-complain-about-lack-of-vmlinux-when-n.patch b/queue-6.6/perf-top-don-t-complain-about-lack-of-vmlinux-when-n.patch new file mode 100644 index 0000000000..4d27c2111b --- /dev/null +++ b/queue-6.6/perf-top-don-t-complain-about-lack-of-vmlinux-when-n.patch @@ -0,0 +1,64 @@ +From a2313cdaaa60634c198eecbf56b6449d658d6f6b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Jan 2025 16:50:39 -0300 +Subject: perf top: Don't complain about lack of vmlinux when not resolving + some kernel samples + +From: Arnaldo Carvalho de Melo + +[ Upstream commit 058b38ccd2af9e5c95590b018e8425fa148d7aca ] + +Recently we got a case where a kernel sample wasn't being resolved due +to a bug that was not setting the end address on kernel functions +implemented in assembly (see Link: tag), and then those were not being +found by machine__resolve() -> map__find_symbol(). + +So we ended up with: + + # perf top --stdio + PerfTop: 0 irqs/s kernel: 0% exact: 0% lost: 0/0 drop: 0/0 [cycles/P] + ----------------------------------------------------------------------- + + Warning: + A vmlinux file was not found. + Kernel samples will not be resolved. + ^Z + [1]+ Stopped perf top --stdio + # + +But then resolving all other kernel symbols. + +So just fixup the logic to only print that warning when there are no +symbols in the kernel map. + +Fixes: d88205db9caa0e9d ("perf dso: Add dso__has_symbols() method") +Reviewed-by: Namhyung Kim +Cc: Adrian Hunter +Cc: Ian Rogers +Cc: Christophe Leroy +Cc: James Clark +Cc: Jiri Olsa +Cc: Kan Liang +Link: https://lore.kernel.org/lkml/Z3buKhcCsZi3_aGb@x1 +Signed-off-by: Arnaldo Carvalho de Melo +Signed-off-by: Sasha Levin +--- + tools/perf/builtin-top.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c +index 1c1ec444d501e..381274c70a9af 100644 +--- a/tools/perf/builtin-top.c ++++ b/tools/perf/builtin-top.c +@@ -809,7 +809,7 @@ static void perf_event__process_sample(struct perf_tool *tool, + * invalid --vmlinux ;-) + */ + if (!machine->kptr_restrict_warned && !top->vmlinux_warned && +- __map__is_kernel(al.map) && map__has_symbols(al.map)) { ++ __map__is_kernel(al.map) && !map__has_symbols(al.map)) { + if (symbol_conf.vmlinux_name) { + char serr[256]; + +-- +2.39.5 + diff --git a/queue-6.6/perf-trace-fix-runtime-error-of-index-out-of-bounds.patch b/queue-6.6/perf-trace-fix-runtime-error-of-index-out-of-bounds.patch new file mode 100644 index 0000000000..037124e2b5 --- /dev/null +++ b/queue-6.6/perf-trace-fix-runtime-error-of-index-out-of-bounds.patch @@ -0,0 +1,63 @@ +From a6f71120f99fe6c72623e12b01f2f97de3312548 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 21 Jan 2025 18:55:19 -0800 +Subject: perf trace: Fix runtime error of index out of bounds + +From: Howard Chu + +[ Upstream commit c7b87ce0dd10b64b68a0b22cb83bbd556e28fe81 ] + +libtraceevent parses and returns an array of argument fields, sometimes +larger than RAW_SYSCALL_ARGS_NUM (6) because it includes "__syscall_nr", +idx will traverse to index 6 (7th element) whereas sc->fmt->arg holds 6 +elements max, creating an out-of-bounds access. This runtime error is +found by UBsan. The error message: + + $ sudo UBSAN_OPTIONS=print_stacktrace=1 ./perf trace -a --max-events=1 + builtin-trace.c:1966:35: runtime error: index 6 out of bounds for type 'syscall_arg_fmt [6]' + #0 0x5c04956be5fe in syscall__alloc_arg_fmts /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:1966 + #1 0x5c04956c0510 in trace__read_syscall_info /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:2110 + #2 0x5c04956c372b in trace__syscall_info /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:2436 + #3 0x5c04956d2f39 in trace__init_syscalls_bpf_prog_array_maps /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:3897 + #4 0x5c04956d6d25 in trace__run /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:4335 + #5 0x5c04956e112e in cmd_trace /home/howard/hw/linux-perf/tools/perf/builtin-trace.c:5502 + #6 0x5c04956eda7d in run_builtin /home/howard/hw/linux-perf/tools/perf/perf.c:351 + #7 0x5c04956ee0a8 in handle_internal_command /home/howard/hw/linux-perf/tools/perf/perf.c:404 + #8 0x5c04956ee37f in run_argv /home/howard/hw/linux-perf/tools/perf/perf.c:448 + #9 0x5c04956ee8e9 in main /home/howard/hw/linux-perf/tools/perf/perf.c:556 + #10 0x79eb3622a3b7 in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58 + #11 0x79eb3622a47a in __libc_start_main_impl ../csu/libc-start.c:360 + #12 0x5c04955422d4 in _start (/home/howard/hw/linux-perf/tools/perf/perf+0x4e02d4) (BuildId: 5b6cab2d59e96a4341741765ad6914a4d784dbc6) + + 0.000 ( 0.014 ms): Chrome_ChildIO/117244 write(fd: 238, buf: !, count: 1) = 1 + +Fixes: 5e58fcfaf4c6 ("perf trace: Allow allocating sc->arg_fmt even without the syscall tracepoint") +Signed-off-by: Howard Chu +Link: https://lore.kernel.org/r/20250122025519.361873-1-howardchu95@gmail.com +Signed-off-by: Namhyung Kim +Signed-off-by: Sasha Levin +--- + tools/perf/builtin-trace.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c +index 3ecd6868be2d6..12bdbf3ecc6ae 100644 +--- a/tools/perf/builtin-trace.c ++++ b/tools/perf/builtin-trace.c +@@ -1850,8 +1850,12 @@ static int trace__read_syscall_info(struct trace *trace, int id) + return PTR_ERR(sc->tp_format); + } + ++ /* ++ * The tracepoint format contains __syscall_nr field, so it's one more ++ * than the actual number of syscall arguments. ++ */ + if (syscall__alloc_arg_fmts(sc, IS_ERR(sc->tp_format) ? +- RAW_SYSCALL_ARGS_NUM : sc->tp_format->format.nr_fields)) ++ RAW_SYSCALL_ARGS_NUM : sc->tp_format->format.nr_fields - 1)) + return -ENOMEM; + + sc->args = sc->tp_format->format.fields; +-- +2.39.5 + diff --git a/queue-6.6/pinctrl-amd-take-suspend-type-into-consideration-whi.patch b/queue-6.6/pinctrl-amd-take-suspend-type-into-consideration-whi.patch new file mode 100644 index 0000000000..3ff0cbbb27 --- /dev/null +++ b/queue-6.6/pinctrl-amd-take-suspend-type-into-consideration-whi.patch @@ -0,0 +1,126 @@ +From 7c6ca469ab1aa94e1aa38146f1512f5d0085f3d6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jan 2025 18:41:15 +0100 +Subject: pinctrl: amd: Take suspend type into consideration which pins are + non-wake + +From: Maciej S. Szmigiero + +[ Upstream commit f31f33dbb3bab572bad9fe7b849ab0dcbe6fd279 ] + +Some laptops have pins which are a wake source for S0i3/S3 but which +aren't a wake source for S4/S5 and which cause issues when left unmasked +during hibernation (S4). + +For example HP EliteBook 855 G7 has pin #24 that causes instant wakeup +(hibernation failure) if left unmasked (it is a wake source only for +S0i3/S3). +GPIO pin #24 on this platform is likely dedicated to WWAN XMM7360 +modem since this pin triggers wake notify to WWAN modem's parent PCIe +port. + +Fix this by considering a pin a wake source only if it is marked as one +for the current suspend type (S0i3/S3 vs S4/S5). + +Since Z-wake pins only make sense at runtime these were excluded from +both of suspend categories, so pins with only the Z-wake flag set are +effectively treated as non-wake pins. + +Fixes: 2fff0b5e1a6b ("pinctrl: amd: Mask non-wake source pins with interrupt enabled at suspend") +Signed-off-by: Maciej S. Szmigiero +Reviewed-by: Mario Limonciello +Link: https://lore.kernel.org/d4b2d076366fdd08a0c1cd9b7ecd91dc95e07269.1736184752.git.mail@maciej.szmigiero.name +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/pinctrl-amd.c | 27 +++++++++++++++++++++------ + drivers/pinctrl/pinctrl-amd.h | 7 +++---- + 2 files changed, 24 insertions(+), 10 deletions(-) + +diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c +index 86034c457c043..75bff325a4251 100644 +--- a/drivers/pinctrl/pinctrl-amd.c ++++ b/drivers/pinctrl/pinctrl-amd.c +@@ -908,12 +908,13 @@ static bool amd_gpio_should_save(struct amd_gpio *gpio_dev, unsigned int pin) + return false; + } + +-static int amd_gpio_suspend(struct device *dev) ++static int amd_gpio_suspend_hibernate_common(struct device *dev, bool is_suspend) + { + struct amd_gpio *gpio_dev = dev_get_drvdata(dev); + struct pinctrl_desc *desc = gpio_dev->pctrl->desc; + unsigned long flags; + int i; ++ u32 wake_mask = is_suspend ? WAKE_SOURCE_SUSPEND : WAKE_SOURCE_HIBERNATE; + + for (i = 0; i < desc->npins; i++) { + int pin = desc->pins[i].number; +@@ -925,11 +926,11 @@ static int amd_gpio_suspend(struct device *dev) + gpio_dev->saved_regs[i] = readl(gpio_dev->base + pin * 4) & ~PIN_IRQ_PENDING; + + /* mask any interrupts not intended to be a wake source */ +- if (!(gpio_dev->saved_regs[i] & WAKE_SOURCE)) { ++ if (!(gpio_dev->saved_regs[i] & wake_mask)) { + writel(gpio_dev->saved_regs[i] & ~BIT(INTERRUPT_MASK_OFF), + gpio_dev->base + pin * 4); +- pm_pr_dbg("Disabling GPIO #%d interrupt for suspend.\n", +- pin); ++ pm_pr_dbg("Disabling GPIO #%d interrupt for %s.\n", ++ pin, is_suspend ? "suspend" : "hibernate"); + } + + raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); +@@ -938,6 +939,16 @@ static int amd_gpio_suspend(struct device *dev) + return 0; + } + ++static int amd_gpio_suspend(struct device *dev) ++{ ++ return amd_gpio_suspend_hibernate_common(dev, true); ++} ++ ++static int amd_gpio_hibernate(struct device *dev) ++{ ++ return amd_gpio_suspend_hibernate_common(dev, false); ++} ++ + static int amd_gpio_resume(struct device *dev) + { + struct amd_gpio *gpio_dev = dev_get_drvdata(dev); +@@ -961,8 +972,12 @@ static int amd_gpio_resume(struct device *dev) + } + + static const struct dev_pm_ops amd_gpio_pm_ops = { +- SET_LATE_SYSTEM_SLEEP_PM_OPS(amd_gpio_suspend, +- amd_gpio_resume) ++ .suspend_late = amd_gpio_suspend, ++ .resume_early = amd_gpio_resume, ++ .freeze_late = amd_gpio_hibernate, ++ .thaw_early = amd_gpio_resume, ++ .poweroff_late = amd_gpio_hibernate, ++ .restore_early = amd_gpio_resume, + }; + #endif + +diff --git a/drivers/pinctrl/pinctrl-amd.h b/drivers/pinctrl/pinctrl-amd.h +index cf59089f27763..c9522c62d7910 100644 +--- a/drivers/pinctrl/pinctrl-amd.h ++++ b/drivers/pinctrl/pinctrl-amd.h +@@ -80,10 +80,9 @@ + #define FUNCTION_MASK GENMASK(1, 0) + #define FUNCTION_INVALID GENMASK(7, 0) + +-#define WAKE_SOURCE (BIT(WAKE_CNTRL_OFF_S0I3) | \ +- BIT(WAKE_CNTRL_OFF_S3) | \ +- BIT(WAKE_CNTRL_OFF_S4) | \ +- BIT(WAKECNTRL_Z_OFF)) ++#define WAKE_SOURCE_SUSPEND (BIT(WAKE_CNTRL_OFF_S0I3) | \ ++ BIT(WAKE_CNTRL_OFF_S3)) ++#define WAKE_SOURCE_HIBERNATE BIT(WAKE_CNTRL_OFF_S4) + + struct amd_function { + const char *name; +-- +2.39.5 + diff --git a/queue-6.6/pinctrl-stm32-add-check-for-clk_enable.patch b/queue-6.6/pinctrl-stm32-add-check-for-clk_enable.patch new file mode 100644 index 0000000000..21f88f20ad --- /dev/null +++ b/queue-6.6/pinctrl-stm32-add-check-for-clk_enable.patch @@ -0,0 +1,201 @@ +From 060d91b2680d534789b56cbd612af0a1276f11ec Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jan 2025 17:06:59 -0500 +Subject: pinctrl: stm32: Add check for clk_enable() + +From: Mingwei Zheng + +[ Upstream commit 451bc9aea9a1a6fe53969e81a5cb1bd785c0d989 ] + +Convert the driver to clk_bulk*() API. +Add check for the return value of clk_bulk_enable() to catch +the potential error. + +Fixes: 05d8af449d93 ("pinctrl: stm32: Keep pinctrl block clock enabled when LEVEL IRQ requested") +Signed-off-by: Mingwei Zheng +Signed-off-by: Jiasheng Jiang +Reviewed-by: Antonio Borneo +Link: https://lore.kernel.org/20250106220659.2640365-1-zmw12306@gmail.com +Signed-off-by: Linus Walleij +Signed-off-by: Sasha Levin +--- + drivers/pinctrl/stm32/pinctrl-stm32.c | 76 +++++++++++++-------------- + 1 file changed, 38 insertions(+), 38 deletions(-) + +diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c +index 5e91def607847..84121b125d90e 100644 +--- a/drivers/pinctrl/stm32/pinctrl-stm32.c ++++ b/drivers/pinctrl/stm32/pinctrl-stm32.c +@@ -86,7 +86,6 @@ struct stm32_pinctrl_group { + + struct stm32_gpio_bank { + void __iomem *base; +- struct clk *clk; + struct reset_control *rstc; + spinlock_t lock; + struct gpio_chip gpio_chip; +@@ -108,6 +107,7 @@ struct stm32_pinctrl { + unsigned ngroups; + const char **grp_names; + struct stm32_gpio_bank *banks; ++ struct clk_bulk_data *clks; + unsigned nbanks; + const struct stm32_pinctrl_match_data *match_data; + struct irq_domain *domain; +@@ -1321,12 +1321,6 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct fwnode + if (IS_ERR(bank->base)) + return PTR_ERR(bank->base); + +- err = clk_prepare_enable(bank->clk); +- if (err) { +- dev_err(dev, "failed to prepare_enable clk (%d)\n", err); +- return err; +- } +- + bank->gpio_chip = stm32_gpio_template; + + fwnode_property_read_string(fwnode, "st,bank-name", &bank->gpio_chip.label); +@@ -1373,26 +1367,20 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct fwnode + bank->fwnode, &stm32_gpio_domain_ops, + bank); + +- if (!bank->domain) { +- err = -ENODEV; +- goto err_clk; +- } ++ if (!bank->domain) ++ return -ENODEV; + } + + names = devm_kcalloc(dev, npins, sizeof(char *), GFP_KERNEL); +- if (!names) { +- err = -ENOMEM; +- goto err_clk; +- } ++ if (!names) ++ return -ENOMEM; + + for (i = 0; i < npins; i++) { + stm32_pin = stm32_pctrl_get_desc_pin_from_gpio(pctl, bank, i); + if (stm32_pin && stm32_pin->pin.name) { + names[i] = devm_kasprintf(dev, GFP_KERNEL, "%s", stm32_pin->pin.name); +- if (!names[i]) { +- err = -ENOMEM; +- goto err_clk; +- } ++ if (!names[i]) ++ return -ENOMEM; + } else { + names[i] = NULL; + } +@@ -1403,15 +1391,11 @@ static int stm32_gpiolib_register_bank(struct stm32_pinctrl *pctl, struct fwnode + err = gpiochip_add_data(&bank->gpio_chip, bank); + if (err) { + dev_err(dev, "Failed to add gpiochip(%d)!\n", bank_nr); +- goto err_clk; ++ return err; + } + + dev_info(dev, "%s bank added\n", bank->gpio_chip.label); + return 0; +- +-err_clk: +- clk_disable_unprepare(bank->clk); +- return err; + } + + static struct irq_domain *stm32_pctrl_get_irq_domain(struct platform_device *pdev) +@@ -1634,6 +1618,11 @@ int stm32_pctl_probe(struct platform_device *pdev) + if (!pctl->banks) + return -ENOMEM; + ++ pctl->clks = devm_kcalloc(dev, banks, sizeof(*pctl->clks), ++ GFP_KERNEL); ++ if (!pctl->clks) ++ return -ENOMEM; ++ + i = 0; + for_each_gpiochip_node(dev, child) { + struct stm32_gpio_bank *bank = &pctl->banks[i]; +@@ -1645,24 +1634,27 @@ int stm32_pctl_probe(struct platform_device *pdev) + return -EPROBE_DEFER; + } + +- bank->clk = of_clk_get_by_name(np, NULL); +- if (IS_ERR(bank->clk)) { ++ pctl->clks[i].clk = of_clk_get_by_name(np, NULL); ++ if (IS_ERR(pctl->clks[i].clk)) { + fwnode_handle_put(child); +- return dev_err_probe(dev, PTR_ERR(bank->clk), ++ return dev_err_probe(dev, PTR_ERR(pctl->clks[i].clk), + "failed to get clk\n"); + } ++ pctl->clks[i].id = "pctl"; + i++; + } + ++ ret = clk_bulk_prepare_enable(banks, pctl->clks); ++ if (ret) { ++ dev_err(dev, "failed to prepare_enable clk (%d)\n", ret); ++ return ret; ++ } ++ + for_each_gpiochip_node(dev, child) { + ret = stm32_gpiolib_register_bank(pctl, child); + if (ret) { + fwnode_handle_put(child); +- +- for (i = 0; i < pctl->nbanks; i++) +- clk_disable_unprepare(pctl->banks[i].clk); +- +- return ret; ++ goto err_register; + } + + pctl->nbanks++; +@@ -1671,6 +1663,15 @@ int stm32_pctl_probe(struct platform_device *pdev) + dev_info(dev, "Pinctrl STM32 initialized\n"); + + return 0; ++err_register: ++ for (i = 0; i < pctl->nbanks; i++) { ++ struct stm32_gpio_bank *bank = &pctl->banks[i]; ++ ++ gpiochip_remove(&bank->gpio_chip); ++ } ++ ++ clk_bulk_disable_unprepare(banks, pctl->clks); ++ return ret; + } + + static int __maybe_unused stm32_pinctrl_restore_gpio_regs( +@@ -1739,10 +1740,8 @@ static int __maybe_unused stm32_pinctrl_restore_gpio_regs( + int __maybe_unused stm32_pinctrl_suspend(struct device *dev) + { + struct stm32_pinctrl *pctl = dev_get_drvdata(dev); +- int i; + +- for (i = 0; i < pctl->nbanks; i++) +- clk_disable(pctl->banks[i].clk); ++ clk_bulk_disable(pctl->nbanks, pctl->clks); + + return 0; + } +@@ -1751,10 +1750,11 @@ int __maybe_unused stm32_pinctrl_resume(struct device *dev) + { + struct stm32_pinctrl *pctl = dev_get_drvdata(dev); + struct stm32_pinctrl_group *g = pctl->groups; +- int i; ++ int i, ret; + +- for (i = 0; i < pctl->nbanks; i++) +- clk_enable(pctl->banks[i].clk); ++ ret = clk_bulk_enable(pctl->nbanks, pctl->clks); ++ if (ret) ++ return ret; + + for (i = 0; i < pctl->ngroups; i++, g++) + stm32_pinctrl_restore_gpio_regs(pctl, g->pin); +-- +2.39.5 + diff --git a/queue-6.6/pm-hibernate-add-error-handling-for-syscore_suspend.patch b/queue-6.6/pm-hibernate-add-error-handling-for-syscore_suspend.patch new file mode 100644 index 0000000000..405ff344a1 --- /dev/null +++ b/queue-6.6/pm-hibernate-add-error-handling-for-syscore_suspend.patch @@ -0,0 +1,58 @@ +From 2d06954222a6a03c60f01fb201ea29e98aaa9355 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 19 Jan 2025 22:32:05 +0800 +Subject: PM: hibernate: Add error handling for syscore_suspend() + +From: Wentao Liang + +[ Upstream commit e20a70c572539a486dbd91b225fa6a194a5e2122 ] + +In hibernation_platform_enter(), the code did not check the +return value of syscore_suspend(), potentially leading to a +situation where syscore_resume() would be called even if +syscore_suspend() failed. This could cause unpredictable +behavior or system instability. + +Modify the code sequence in question to properly handle errors returned +by syscore_suspend(). If an error occurs in the suspend path, the code +now jumps to label 'Enable_irqs' skipping the syscore_resume() call and +only enabling interrupts after setting the system state to SYSTEM_RUNNING. + +Fixes: 40dc166cb5dd ("PM / Core: Introduce struct syscore_ops for core subsystems PM") +Signed-off-by: Wentao Liang +Link: https://patch.msgid.link/20250119143205.2103-1-vulab@iscas.ac.cn +[ rjw: Changelog edits ] +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Sasha Levin +--- + kernel/power/hibernate.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/kernel/power/hibernate.c b/kernel/power/hibernate.c +index 8d35b9f9aaa3f..c2fc58938dee5 100644 +--- a/kernel/power/hibernate.c ++++ b/kernel/power/hibernate.c +@@ -599,7 +599,11 @@ int hibernation_platform_enter(void) + + local_irq_disable(); + system_state = SYSTEM_SUSPEND; +- syscore_suspend(); ++ ++ error = syscore_suspend(); ++ if (error) ++ goto Enable_irqs; ++ + if (pm_wakeup_pending()) { + error = -EAGAIN; + goto Power_up; +@@ -611,6 +615,7 @@ int hibernation_platform_enter(void) + + Power_up: + syscore_resume(); ++ Enable_irqs: + system_state = SYSTEM_RUNNING; + local_irq_enable(); + +-- +2.39.5 + diff --git a/queue-6.6/pm-sleep-core-synchronize-runtime-pm-status-of-paren.patch b/queue-6.6/pm-sleep-core-synchronize-runtime-pm-status-of-paren.patch new file mode 100644 index 0000000000..c36425ebaa --- /dev/null +++ b/queue-6.6/pm-sleep-core-synchronize-runtime-pm-status-of-paren.patch @@ -0,0 +1,119 @@ +From 30a4530dee525c5f9befb6db9f8729504eab634c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 28 Jan 2025 20:24:41 +0100 +Subject: PM: sleep: core: Synchronize runtime PM status of parents and + children + +From: Rafael J. Wysocki + +[ Upstream commit 3775fc538f535a7c5adaf11990c7932a0bd1f9eb ] + +Commit 6e176bf8d461 ("PM: sleep: core: Do not skip callbacks in the +resume phase") overlooked the case in which the parent of a device with +DPM_FLAG_SMART_SUSPEND set did not use that flag and could be runtime- +suspended before a transition into a system-wide sleep state. In that +case, if the child is resumed during the subsequent transition from +that state into the working state, its runtime PM status will be set to +RPM_ACTIVE, but the runtime PM status of the parent will not be updated +accordingly, even though the parent will be resumed too, because of the +dev_pm_skip_suspend() check in device_resume_noirq(). + +Address this problem by tracking the need to set the runtime PM status +to RPM_ACTIVE during system-wide resume transitions for devices with +DPM_FLAG_SMART_SUSPEND set and all of the devices depended on by them. + +Fixes: 6e176bf8d461 ("PM: sleep: core: Do not skip callbacks in the resume phase") +Closes: https://lore.kernel.org/linux-pm/Z30p2Etwf3F2AUvD@hovoldconsulting.com/ +Reported-by: Johan Hovold +Tested-by: Manivannan Sadhasivam +Signed-off-by: Rafael J. Wysocki +Reviewed-by: Johan Hovold +Tested-by: Johan Hovold +Link: https://patch.msgid.link/12619233.O9o76ZdvQC@rjwysocki.net +Signed-off-by: Sasha Levin +--- + drivers/base/power/main.c | 29 ++++++++++++++++++++--------- + include/linux/pm.h | 1 + + 2 files changed, 21 insertions(+), 9 deletions(-) + +diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c +index fadcd0379dc2d..fd2d975de536f 100644 +--- a/drivers/base/power/main.c ++++ b/drivers/base/power/main.c +@@ -614,13 +614,15 @@ static void device_resume_noirq(struct device *dev, pm_message_t state, bool asy + * so change its status accordingly. + * + * Otherwise, the device is going to be resumed, so set its PM-runtime +- * status to "active", but do that only if DPM_FLAG_SMART_SUSPEND is set +- * to avoid confusing drivers that don't use it. ++ * status to "active" unless its power.set_active flag is clear, in ++ * which case it is not necessary to update its PM-runtime status. + */ +- if (skip_resume) ++ if (skip_resume) { + pm_runtime_set_suspended(dev); +- else if (dev_pm_skip_suspend(dev)) ++ } else if (dev->power.set_active) { + pm_runtime_set_active(dev); ++ dev->power.set_active = false; ++ } + + if (dev->pm_domain) { + info = "noirq power domain "; +@@ -1170,18 +1172,24 @@ static pm_message_t resume_event(pm_message_t sleep_state) + return PMSG_ON; + } + +-static void dpm_superior_set_must_resume(struct device *dev) ++static void dpm_superior_set_must_resume(struct device *dev, bool set_active) + { + struct device_link *link; + int idx; + +- if (dev->parent) ++ if (dev->parent) { + dev->parent->power.must_resume = true; ++ if (set_active) ++ dev->parent->power.set_active = true; ++ } + + idx = device_links_read_lock(); + +- list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node) ++ list_for_each_entry_rcu_locked(link, &dev->links.suppliers, c_node) { + link->supplier->power.must_resume = true; ++ if (set_active) ++ link->supplier->power.set_active = true; ++ } + + device_links_read_unlock(idx); + } +@@ -1257,8 +1265,11 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool a + dev->power.may_skip_resume)) + dev->power.must_resume = true; + +- if (dev->power.must_resume) +- dpm_superior_set_must_resume(dev); ++ if (dev->power.must_resume) { ++ dev->power.set_active = dev->power.set_active || ++ dev_pm_test_driver_flags(dev, DPM_FLAG_SMART_SUSPEND); ++ dpm_superior_set_must_resume(dev, dev->power.set_active); ++ } + + Complete: + complete_all(&dev->power.completion); +diff --git a/include/linux/pm.h b/include/linux/pm.h +index 9e1c60cd60e5a..1ad57c98264af 100644 +--- a/include/linux/pm.h ++++ b/include/linux/pm.h +@@ -683,6 +683,7 @@ struct dev_pm_info { + bool no_pm_callbacks:1; /* Owned by the PM core */ + bool async_in_progress:1; /* Owned by the PM core */ + bool must_resume:1; /* Owned by the PM core */ ++ bool set_active:1; /* Owned by the PM core */ + bool may_skip_resume:1; /* Set by subsystems */ + #else + bool should_wakeup:1; +-- +2.39.5 + diff --git a/queue-6.6/pm-sleep-restore-asynchronous-device-resume-optimiza.patch b/queue-6.6/pm-sleep-restore-asynchronous-device-resume-optimiza.patch new file mode 100644 index 0000000000..aa38fbaf82 --- /dev/null +++ b/queue-6.6/pm-sleep-restore-asynchronous-device-resume-optimiza.patch @@ -0,0 +1,284 @@ +From 68ac17b8f6584d7d8e5174cac4f2f25e9bdf98a2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 9 Jan 2024 17:59:22 +0100 +Subject: PM: sleep: Restore asynchronous device resume optimization + +From: Rafael J. Wysocki + +[ Upstream commit 3e999770ac1c7c31a70685dd5b88e89473509e9c ] + +Before commit 7839d0078e0d ("PM: sleep: Fix possible deadlocks in core +system-wide PM code"), the resume of devices that were allowed to resume +asynchronously was scheduled before starting the resume of the other +devices, so the former did not have to wait for the latter unless +functional dependencies were present. + +Commit 7839d0078e0d removed that optimization in order to address a +correctness issue, but it can be restored with the help of a new device +power management flag, so do that now. + +Signed-off-by: Rafael J. Wysocki +Reviewed-by: Stanislaw Gruszka +Stable-dep-of: 3775fc538f53 ("PM: sleep: core: Synchronize runtime PM status of parents and children") +Signed-off-by: Sasha Levin +--- + drivers/base/power/main.c | 117 +++++++++++++++++++++----------------- + include/linux/pm.h | 1 + + 2 files changed, 65 insertions(+), 53 deletions(-) + +diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c +index 9c5a5f4dba5a6..fadcd0379dc2d 100644 +--- a/drivers/base/power/main.c ++++ b/drivers/base/power/main.c +@@ -579,7 +579,7 @@ bool dev_pm_skip_resume(struct device *dev) + } + + /** +- * __device_resume_noirq - Execute a "noirq resume" callback for given device. ++ * device_resume_noirq - Execute a "noirq resume" callback for given device. + * @dev: Device to handle. + * @state: PM transition of the system being carried out. + * @async: If true, the device is being resumed asynchronously. +@@ -587,7 +587,7 @@ bool dev_pm_skip_resume(struct device *dev) + * The driver of @dev will not receive interrupts while this function is being + * executed. + */ +-static void __device_resume_noirq(struct device *dev, pm_message_t state, bool async) ++static void device_resume_noirq(struct device *dev, pm_message_t state, bool async) + { + pm_callback_t callback = NULL; + const char *info = NULL; +@@ -674,16 +674,22 @@ static bool dpm_async_fn(struct device *dev, async_func_t func) + { + reinit_completion(&dev->power.completion); + +- if (!is_async(dev)) +- return false; +- +- get_device(dev); ++ if (is_async(dev)) { ++ dev->power.async_in_progress = true; + +- if (async_schedule_dev_nocall(func, dev)) +- return true; ++ get_device(dev); + +- put_device(dev); ++ if (async_schedule_dev_nocall(func, dev)) ++ return true; + ++ put_device(dev); ++ } ++ /* ++ * Because async_schedule_dev_nocall() above has returned false or it ++ * has not been called at all, func() is not running and it is safe to ++ * update the async_in_progress flag without extra synchronization. ++ */ ++ dev->power.async_in_progress = false; + return false; + } + +@@ -691,18 +697,10 @@ static void async_resume_noirq(void *data, async_cookie_t cookie) + { + struct device *dev = data; + +- __device_resume_noirq(dev, pm_transition, true); ++ device_resume_noirq(dev, pm_transition, true); + put_device(dev); + } + +-static void device_resume_noirq(struct device *dev) +-{ +- if (dpm_async_fn(dev, async_resume_noirq)) +- return; +- +- __device_resume_noirq(dev, pm_transition, false); +-} +- + static void dpm_noirq_resume_devices(pm_message_t state) + { + struct device *dev; +@@ -712,18 +710,28 @@ static void dpm_noirq_resume_devices(pm_message_t state) + mutex_lock(&dpm_list_mtx); + pm_transition = state; + ++ /* ++ * Trigger the resume of "async" devices upfront so they don't have to ++ * wait for the "non-async" ones they don't depend on. ++ */ ++ list_for_each_entry(dev, &dpm_noirq_list, power.entry) ++ dpm_async_fn(dev, async_resume_noirq); ++ + while (!list_empty(&dpm_noirq_list)) { + dev = to_device(dpm_noirq_list.next); +- get_device(dev); + list_move_tail(&dev->power.entry, &dpm_late_early_list); + +- mutex_unlock(&dpm_list_mtx); ++ if (!dev->power.async_in_progress) { ++ get_device(dev); + +- device_resume_noirq(dev); ++ mutex_unlock(&dpm_list_mtx); + +- put_device(dev); ++ device_resume_noirq(dev, state, false); + +- mutex_lock(&dpm_list_mtx); ++ put_device(dev); ++ ++ mutex_lock(&dpm_list_mtx); ++ } + } + mutex_unlock(&dpm_list_mtx); + async_synchronize_full(); +@@ -747,14 +755,14 @@ void dpm_resume_noirq(pm_message_t state) + } + + /** +- * __device_resume_early - Execute an "early resume" callback for given device. ++ * device_resume_early - Execute an "early resume" callback for given device. + * @dev: Device to handle. + * @state: PM transition of the system being carried out. + * @async: If true, the device is being resumed asynchronously. + * + * Runtime PM is disabled for @dev while this function is being executed. + */ +-static void __device_resume_early(struct device *dev, pm_message_t state, bool async) ++static void device_resume_early(struct device *dev, pm_message_t state, bool async) + { + pm_callback_t callback = NULL; + const char *info = NULL; +@@ -820,18 +828,10 @@ static void async_resume_early(void *data, async_cookie_t cookie) + { + struct device *dev = data; + +- __device_resume_early(dev, pm_transition, true); ++ device_resume_early(dev, pm_transition, true); + put_device(dev); + } + +-static void device_resume_early(struct device *dev) +-{ +- if (dpm_async_fn(dev, async_resume_early)) +- return; +- +- __device_resume_early(dev, pm_transition, false); +-} +- + /** + * dpm_resume_early - Execute "early resume" callbacks for all devices. + * @state: PM transition of the system being carried out. +@@ -845,18 +845,28 @@ void dpm_resume_early(pm_message_t state) + mutex_lock(&dpm_list_mtx); + pm_transition = state; + ++ /* ++ * Trigger the resume of "async" devices upfront so they don't have to ++ * wait for the "non-async" ones they don't depend on. ++ */ ++ list_for_each_entry(dev, &dpm_late_early_list, power.entry) ++ dpm_async_fn(dev, async_resume_early); ++ + while (!list_empty(&dpm_late_early_list)) { + dev = to_device(dpm_late_early_list.next); +- get_device(dev); + list_move_tail(&dev->power.entry, &dpm_suspended_list); + +- mutex_unlock(&dpm_list_mtx); ++ if (!dev->power.async_in_progress) { ++ get_device(dev); + +- device_resume_early(dev); ++ mutex_unlock(&dpm_list_mtx); + +- put_device(dev); ++ device_resume_early(dev, state, false); + +- mutex_lock(&dpm_list_mtx); ++ put_device(dev); ++ ++ mutex_lock(&dpm_list_mtx); ++ } + } + mutex_unlock(&dpm_list_mtx); + async_synchronize_full(); +@@ -876,12 +886,12 @@ void dpm_resume_start(pm_message_t state) + EXPORT_SYMBOL_GPL(dpm_resume_start); + + /** +- * __device_resume - Execute "resume" callbacks for given device. ++ * device_resume - Execute "resume" callbacks for given device. + * @dev: Device to handle. + * @state: PM transition of the system being carried out. + * @async: If true, the device is being resumed asynchronously. + */ +-static void __device_resume(struct device *dev, pm_message_t state, bool async) ++static void device_resume(struct device *dev, pm_message_t state, bool async) + { + pm_callback_t callback = NULL; + const char *info = NULL; +@@ -975,18 +985,10 @@ static void async_resume(void *data, async_cookie_t cookie) + { + struct device *dev = data; + +- __device_resume(dev, pm_transition, true); ++ device_resume(dev, pm_transition, true); + put_device(dev); + } + +-static void device_resume(struct device *dev) +-{ +- if (dpm_async_fn(dev, async_resume)) +- return; +- +- __device_resume(dev, pm_transition, false); +-} +- + /** + * dpm_resume - Execute "resume" callbacks for non-sysdev devices. + * @state: PM transition of the system being carried out. +@@ -1006,16 +1008,25 @@ void dpm_resume(pm_message_t state) + pm_transition = state; + async_error = 0; + ++ /* ++ * Trigger the resume of "async" devices upfront so they don't have to ++ * wait for the "non-async" ones they don't depend on. ++ */ ++ list_for_each_entry(dev, &dpm_suspended_list, power.entry) ++ dpm_async_fn(dev, async_resume); ++ + while (!list_empty(&dpm_suspended_list)) { + dev = to_device(dpm_suspended_list.next); + + get_device(dev); + +- mutex_unlock(&dpm_list_mtx); ++ if (!dev->power.async_in_progress) { ++ mutex_unlock(&dpm_list_mtx); + +- device_resume(dev); ++ device_resume(dev, state, false); + +- mutex_lock(&dpm_list_mtx); ++ mutex_lock(&dpm_list_mtx); ++ } + + if (!list_empty(&dev->power.entry)) + list_move_tail(&dev->power.entry, &dpm_prepared_list); +diff --git a/include/linux/pm.h b/include/linux/pm.h +index 629c1633bbd00..943b553720f82 100644 +--- a/include/linux/pm.h ++++ b/include/linux/pm.h +@@ -681,6 +681,7 @@ struct dev_pm_info { + bool wakeup_path:1; + bool syscore:1; + bool no_pm_callbacks:1; /* Owned by the PM core */ ++ bool async_in_progress:1; /* Owned by the PM core */ + unsigned int must_resume:1; /* Owned by the PM core */ + unsigned int may_skip_resume:1; /* Set by subsystems */ + #else +-- +2.39.5 + diff --git a/queue-6.6/pm-sleep-use-bool-for-all-1-bit-fields-in-struct-dev.patch b/queue-6.6/pm-sleep-use-bool-for-all-1-bit-fields-in-struct-dev.patch new file mode 100644 index 0000000000..61793628ae --- /dev/null +++ b/queue-6.6/pm-sleep-use-bool-for-all-1-bit-fields-in-struct-dev.patch @@ -0,0 +1,86 @@ +From a7c49715eabc9705990ba3d1a04dec93ac36cd21 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 22 Jan 2024 17:11:26 +0100 +Subject: PM: sleep: Use bool for all 1-bit fields in struct dev_pm_info + +From: Rafael J. Wysocki + +[ Upstream commit b017500ab53c06441ff7d3a681484e37039b4f57 ] + +For some 1-bit fields in struct dev_pm_info the data type is bool, while +for some other 1-bit fields in there it is unsigned int, and these +differences are somewhat arbitrary. + +For consistency, change the data type of the latter to bool, so that all +of the 1-bit fields in struct dev_pm_info fields are bool. + +No intentional functional impact. + +Signed-off-by: Rafael J. Wysocki +Reviewed-by: Greg Kroah-Hartman +Stable-dep-of: 3775fc538f53 ("PM: sleep: core: Synchronize runtime PM status of parents and children") +Signed-off-by: Sasha Levin +--- + include/linux/pm.h | 30 +++++++++++++++--------------- + 1 file changed, 15 insertions(+), 15 deletions(-) + +diff --git a/include/linux/pm.h b/include/linux/pm.h +index 943b553720f82..9e1c60cd60e5a 100644 +--- a/include/linux/pm.h ++++ b/include/linux/pm.h +@@ -662,8 +662,8 @@ struct pm_subsys_data { + + struct dev_pm_info { + pm_message_t power_state; +- unsigned int can_wakeup:1; +- unsigned int async_suspend:1; ++ bool can_wakeup:1; ++ bool async_suspend:1; + bool in_dpm_list:1; /* Owned by the PM core */ + bool is_prepared:1; /* Owned by the PM core */ + bool is_suspended:1; /* Ditto */ +@@ -682,10 +682,10 @@ struct dev_pm_info { + bool syscore:1; + bool no_pm_callbacks:1; /* Owned by the PM core */ + bool async_in_progress:1; /* Owned by the PM core */ +- unsigned int must_resume:1; /* Owned by the PM core */ +- unsigned int may_skip_resume:1; /* Set by subsystems */ ++ bool must_resume:1; /* Owned by the PM core */ ++ bool may_skip_resume:1; /* Set by subsystems */ + #else +- unsigned int should_wakeup:1; ++ bool should_wakeup:1; + #endif + #ifdef CONFIG_PM + struct hrtimer suspend_timer; +@@ -696,17 +696,17 @@ struct dev_pm_info { + atomic_t usage_count; + atomic_t child_count; + unsigned int disable_depth:3; +- unsigned int idle_notification:1; +- unsigned int request_pending:1; +- unsigned int deferred_resume:1; +- unsigned int needs_force_resume:1; +- unsigned int runtime_auto:1; ++ bool idle_notification:1; ++ bool request_pending:1; ++ bool deferred_resume:1; ++ bool needs_force_resume:1; ++ bool runtime_auto:1; + bool ignore_children:1; +- unsigned int no_callbacks:1; +- unsigned int irq_safe:1; +- unsigned int use_autosuspend:1; +- unsigned int timer_autosuspends:1; +- unsigned int memalloc_noio:1; ++ bool no_callbacks:1; ++ bool irq_safe:1; ++ bool use_autosuspend:1; ++ bool timer_autosuspends:1; ++ bool memalloc_noio:1; + unsigned int links_count; + enum rpm_request request; + enum rpm_status runtime_status; +-- +2.39.5 + diff --git a/queue-6.6/posix-clock-introduce-posix_clock_context-concept.patch b/queue-6.6/posix-clock-introduce-posix_clock_context-concept.patch new file mode 100644 index 0000000000..2382a922bf --- /dev/null +++ b/queue-6.6/posix-clock-introduce-posix_clock_context-concept.patch @@ -0,0 +1,318 @@ +From 6aa5f6e5c889cb4cc82d1e6bbb4efd4ed25d4bd4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Oct 2023 00:39:53 +0200 +Subject: posix-clock: introduce posix_clock_context concept + +From: Xabier Marquiegui + +[ Upstream commit 60c6946675fc06dd2fd2b7a4b6fd1c1f046f1056 ] + +Add the necessary structure to support custom private-data per +posix-clock user. + +The previous implementation of posix-clock assumed all file open +instances need access to the same clock structure on private_data. + +The need for individual data structures per file open instance has been +identified when developing support for multiple timestamp event queue +users for ptp_clock. + +Signed-off-by: Xabier Marquiegui +Suggested-by: Richard Cochran +Suggested-by: Vinicius Costa Gomes +Signed-off-by: David S. Miller +Stable-dep-of: 19ae40f572a9 ("ptp: Properly handle compat ioctls") +Signed-off-by: Sasha Levin +--- + drivers/ptp/ptp_chardev.c | 21 +++++++++++++-------- + drivers/ptp/ptp_private.h | 16 +++++++++------- + include/linux/posix-clock.h | 35 +++++++++++++++++++++++++++-------- + kernel/time/posix-clock.c | 36 +++++++++++++++++++++++++++--------- + 4 files changed, 76 insertions(+), 32 deletions(-) + +diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c +index 91cc6ffa0095e..666ea6653b04a 100644 +--- a/drivers/ptp/ptp_chardev.c ++++ b/drivers/ptp/ptp_chardev.c +@@ -102,14 +102,16 @@ int ptp_set_pinfunc(struct ptp_clock *ptp, unsigned int pin, + return 0; + } + +-int ptp_open(struct posix_clock *pc, fmode_t fmode) ++int ptp_open(struct posix_clock_context *pccontext, fmode_t fmode) + { + return 0; + } + +-long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) ++long ptp_ioctl(struct posix_clock_context *pccontext, unsigned int cmd, ++ unsigned long arg) + { +- struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); ++ struct ptp_clock *ptp = ++ container_of(pccontext->clk, struct ptp_clock, clock); + struct ptp_sys_offset_extended *extoff = NULL; + struct ptp_sys_offset_precise precise_offset; + struct system_device_crosststamp xtstamp; +@@ -433,9 +435,11 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) + return err; + } + +-__poll_t ptp_poll(struct posix_clock *pc, struct file *fp, poll_table *wait) ++__poll_t ptp_poll(struct posix_clock_context *pccontext, struct file *fp, ++ poll_table *wait) + { +- struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); ++ struct ptp_clock *ptp = ++ container_of(pccontext->clk, struct ptp_clock, clock); + + poll_wait(fp, &ptp->tsev_wq, wait); + +@@ -444,10 +448,11 @@ __poll_t ptp_poll(struct posix_clock *pc, struct file *fp, poll_table *wait) + + #define EXTTS_BUFSIZE (PTP_BUF_TIMESTAMPS * sizeof(struct ptp_extts_event)) + +-ssize_t ptp_read(struct posix_clock *pc, +- uint rdflags, char __user *buf, size_t cnt) ++ssize_t ptp_read(struct posix_clock_context *pccontext, uint rdflags, ++ char __user *buf, size_t cnt) + { +- struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock); ++ struct ptp_clock *ptp = ++ container_of(pccontext->clk, struct ptp_clock, clock); + struct timestamp_event_queue *queue = &ptp->tsevq; + struct ptp_extts_event *event; + unsigned long flags; +diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h +index b8d4f61f14be4..f92b0181b6463 100644 +--- a/drivers/ptp/ptp_private.h ++++ b/drivers/ptp/ptp_private.h +@@ -121,16 +121,18 @@ extern struct class *ptp_class; + int ptp_set_pinfunc(struct ptp_clock *ptp, unsigned int pin, + enum ptp_pin_function func, unsigned int chan); + +-long ptp_ioctl(struct posix_clock *pc, +- unsigned int cmd, unsigned long arg); ++long ptp_ioctl(struct posix_clock_context *pccontext, unsigned int cmd, ++ unsigned long arg); + +-int ptp_open(struct posix_clock *pc, fmode_t fmode); ++int ptp_open(struct posix_clock_context *pccontext, fmode_t fmode); + +-ssize_t ptp_read(struct posix_clock *pc, +- uint flags, char __user *buf, size_t cnt); ++int ptp_release(struct posix_clock_context *pccontext); + +-__poll_t ptp_poll(struct posix_clock *pc, +- struct file *fp, poll_table *wait); ++ssize_t ptp_read(struct posix_clock_context *pccontext, uint flags, char __user *buf, ++ size_t cnt); ++ ++__poll_t ptp_poll(struct posix_clock_context *pccontext, struct file *fp, ++ poll_table *wait); + + /* + * see ptp_sysfs.c +diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h +index 468328b1e1dd5..ef8619f489203 100644 +--- a/include/linux/posix-clock.h ++++ b/include/linux/posix-clock.h +@@ -14,6 +14,7 @@ + #include + + struct posix_clock; ++struct posix_clock_context; + + /** + * struct posix_clock_operations - functional interface to the clock +@@ -50,18 +51,18 @@ struct posix_clock_operations { + /* + * Optional character device methods: + */ +- long (*ioctl) (struct posix_clock *pc, +- unsigned int cmd, unsigned long arg); ++ long (*ioctl)(struct posix_clock_context *pccontext, unsigned int cmd, ++ unsigned long arg); + +- int (*open) (struct posix_clock *pc, fmode_t f_mode); ++ int (*open)(struct posix_clock_context *pccontext, fmode_t f_mode); + +- __poll_t (*poll) (struct posix_clock *pc, +- struct file *file, poll_table *wait); ++ __poll_t (*poll)(struct posix_clock_context *pccontext, struct file *file, ++ poll_table *wait); + +- int (*release) (struct posix_clock *pc); ++ int (*release)(struct posix_clock_context *pccontext); + +- ssize_t (*read) (struct posix_clock *pc, +- uint flags, char __user *buf, size_t cnt); ++ ssize_t (*read)(struct posix_clock_context *pccontext, uint flags, ++ char __user *buf, size_t cnt); + }; + + /** +@@ -90,6 +91,24 @@ struct posix_clock { + bool zombie; + }; + ++/** ++ * struct posix_clock_context - represents clock file operations context ++ * ++ * @clk: Pointer to the clock ++ * @private_clkdata: Pointer to user data ++ * ++ * Drivers should use struct posix_clock_context during specific character ++ * device file operation methods to access the posix clock. ++ * ++ * Drivers can store a private data structure during the open operation ++ * if they have specific information that is required in other file ++ * operations. ++ */ ++struct posix_clock_context { ++ struct posix_clock *clk; ++ void *private_clkdata; ++}; ++ + /** + * posix_clock_register() - register a new clock + * @clk: Pointer to the clock. Caller must provide 'ops' field +diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c +index 05e73d209aa87..706559ed75793 100644 +--- a/kernel/time/posix-clock.c ++++ b/kernel/time/posix-clock.c +@@ -19,7 +19,8 @@ + */ + static struct posix_clock *get_posix_clock(struct file *fp) + { +- struct posix_clock *clk = fp->private_data; ++ struct posix_clock_context *pccontext = fp->private_data; ++ struct posix_clock *clk = pccontext->clk; + + down_read(&clk->rwsem); + +@@ -39,6 +40,7 @@ static void put_posix_clock(struct posix_clock *clk) + static ssize_t posix_clock_read(struct file *fp, char __user *buf, + size_t count, loff_t *ppos) + { ++ struct posix_clock_context *pccontext = fp->private_data; + struct posix_clock *clk = get_posix_clock(fp); + int err = -EINVAL; + +@@ -46,7 +48,7 @@ static ssize_t posix_clock_read(struct file *fp, char __user *buf, + return -ENODEV; + + if (clk->ops.read) +- err = clk->ops.read(clk, fp->f_flags, buf, count); ++ err = clk->ops.read(pccontext, fp->f_flags, buf, count); + + put_posix_clock(clk); + +@@ -55,6 +57,7 @@ static ssize_t posix_clock_read(struct file *fp, char __user *buf, + + static __poll_t posix_clock_poll(struct file *fp, poll_table *wait) + { ++ struct posix_clock_context *pccontext = fp->private_data; + struct posix_clock *clk = get_posix_clock(fp); + __poll_t result = 0; + +@@ -62,7 +65,7 @@ static __poll_t posix_clock_poll(struct file *fp, poll_table *wait) + return EPOLLERR; + + if (clk->ops.poll) +- result = clk->ops.poll(clk, fp, wait); ++ result = clk->ops.poll(pccontext, fp, wait); + + put_posix_clock(clk); + +@@ -72,6 +75,7 @@ static __poll_t posix_clock_poll(struct file *fp, poll_table *wait) + static long posix_clock_ioctl(struct file *fp, + unsigned int cmd, unsigned long arg) + { ++ struct posix_clock_context *pccontext = fp->private_data; + struct posix_clock *clk = get_posix_clock(fp); + int err = -ENOTTY; + +@@ -79,7 +83,7 @@ static long posix_clock_ioctl(struct file *fp, + return -ENODEV; + + if (clk->ops.ioctl) +- err = clk->ops.ioctl(clk, cmd, arg); ++ err = clk->ops.ioctl(pccontext, cmd, arg); + + put_posix_clock(clk); + +@@ -90,6 +94,7 @@ static long posix_clock_ioctl(struct file *fp, + static long posix_clock_compat_ioctl(struct file *fp, + unsigned int cmd, unsigned long arg) + { ++ struct posix_clock_context *pccontext = fp->private_data; + struct posix_clock *clk = get_posix_clock(fp); + int err = -ENOTTY; + +@@ -97,7 +102,7 @@ static long posix_clock_compat_ioctl(struct file *fp, + return -ENODEV; + + if (clk->ops.ioctl) +- err = clk->ops.ioctl(clk, cmd, arg); ++ err = clk->ops.ioctl(pccontext, cmd, arg); + + put_posix_clock(clk); + +@@ -110,6 +115,7 @@ static int posix_clock_open(struct inode *inode, struct file *fp) + int err; + struct posix_clock *clk = + container_of(inode->i_cdev, struct posix_clock, cdev); ++ struct posix_clock_context *pccontext; + + down_read(&clk->rwsem); + +@@ -117,14 +123,20 @@ static int posix_clock_open(struct inode *inode, struct file *fp) + err = -ENODEV; + goto out; + } ++ pccontext = kzalloc(sizeof(*pccontext), GFP_KERNEL); ++ if (!pccontext) { ++ err = -ENOMEM; ++ goto out; ++ } ++ pccontext->clk = clk; ++ fp->private_data = pccontext; + if (clk->ops.open) +- err = clk->ops.open(clk, fp->f_mode); ++ err = clk->ops.open(pccontext, fp->f_mode); + else + err = 0; + + if (!err) { + get_device(clk->dev); +- fp->private_data = clk; + } + out: + up_read(&clk->rwsem); +@@ -133,14 +145,20 @@ static int posix_clock_open(struct inode *inode, struct file *fp) + + static int posix_clock_release(struct inode *inode, struct file *fp) + { +- struct posix_clock *clk = fp->private_data; ++ struct posix_clock_context *pccontext = fp->private_data; ++ struct posix_clock *clk; + int err = 0; + ++ if (!pccontext) ++ return -ENODEV; ++ clk = pccontext->clk; ++ + if (clk->ops.release) +- err = clk->ops.release(clk); ++ err = clk->ops.release(pccontext); + + put_device(clk->dev); + ++ kfree(pccontext); + fp->private_data = NULL; + + return err; +-- +2.39.5 + diff --git a/queue-6.6/powerpc-book3s64-hugetlb-fix-disabling-hugetlb-when-.patch b/queue-6.6/powerpc-book3s64-hugetlb-fix-disabling-hugetlb-when-.patch new file mode 100644 index 0000000000..a11b0e6105 --- /dev/null +++ b/queue-6.6/powerpc-book3s64-hugetlb-fix-disabling-hugetlb-when-.patch @@ -0,0 +1,55 @@ +From bceed757bfe9c37c02b2a462fdba5f6a3493e515 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 17 Dec 2024 13:16:40 +0530 +Subject: powerpc/book3s64/hugetlb: Fix disabling hugetlb when fadump is active + +From: Sourabh Jain + +[ Upstream commit d629d7a8efc33d05d62f4805c0ffb44727e3d99f ] + +Commit 8597538712eb ("powerpc/fadump: Do not use hugepages when fadump +is active") disabled hugetlb support when fadump is active by returning +early from hugetlbpage_init():arch/powerpc/mm/hugetlbpage.c and not +populating hpage_shift/HPAGE_SHIFT. + +Later, commit 2354ad252b66 ("powerpc/mm: Update default hugetlb size +early") moved the allocation of hpage_shift/HPAGE_SHIFT to early boot, +which inadvertently re-enabled hugetlb support when fadump is active. + +Fix this by implementing hugepages_supported() on powerpc. This ensures +that disabling hugetlb for the fadump kernel is independent of +hpage_shift/HPAGE_SHIFT. + +Fixes: 2354ad252b66 ("powerpc/mm: Update default hugetlb size early") +Reviewed-by: Ritesh Harjani (IBM) +Signed-off-by: Sourabh Jain +Signed-off-by: Madhavan Srinivasan +Link: https://patch.msgid.link/20241217074640.1064510-1-sourabhjain@linux.ibm.com +Signed-off-by: Sasha Levin +--- + arch/powerpc/include/asm/hugetlb.h | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/arch/powerpc/include/asm/hugetlb.h b/arch/powerpc/include/asm/hugetlb.h +index ea71f7245a63e..8d8f4909ae1a4 100644 +--- a/arch/powerpc/include/asm/hugetlb.h ++++ b/arch/powerpc/include/asm/hugetlb.h +@@ -15,6 +15,15 @@ + + extern bool hugetlb_disabled; + ++static inline bool hugepages_supported(void) ++{ ++ if (hugetlb_disabled) ++ return false; ++ ++ return HPAGE_SHIFT != 0; ++} ++#define hugepages_supported hugepages_supported ++ + void __init hugetlbpage_init_defaultsize(void); + + int slice_is_hugepage_only_range(struct mm_struct *mm, unsigned long addr, +-- +2.39.5 + diff --git a/queue-6.6/pstore-blk-trivial-typo-fixes.patch b/queue-6.6/pstore-blk-trivial-typo-fixes.patch new file mode 100644 index 0000000000..ccefe194be --- /dev/null +++ b/queue-6.6/pstore-blk-trivial-typo-fixes.patch @@ -0,0 +1,46 @@ +From 09e381f9352369e5b5dcf321a77e42697f72c5ec Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 1 Jan 2025 13:19:21 +0200 +Subject: pstore/blk: trivial typo fixes + +From: Eugen Hristev + +[ Upstream commit 542243af7182efaeaf6d0f4643f7de437541a9af ] + +Fix trivial typos in comments. + +Fixes: 2a03ddbde1e1 ("pstore/blk: Move verify_size() macro out of function") +Fixes: 17639f67c1d6 ("pstore/blk: Introduce backend for block devices") +Signed-off-by: Eugen Hristev +Link: https://lore.kernel.org/r/20250101111921.850406-1-eugen.hristev@linaro.org +Signed-off-by: Kees Cook +Signed-off-by: Sasha Levin +--- + fs/pstore/blk.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fs/pstore/blk.c b/fs/pstore/blk.c +index de8cf5d75f34d..85668cb31c3d2 100644 +--- a/fs/pstore/blk.c ++++ b/fs/pstore/blk.c +@@ -89,7 +89,7 @@ static struct pstore_device_info *pstore_device_info; + _##name_ = check_size(name, alignsize); \ + else \ + _##name_ = 0; \ +- /* Synchronize module parameters with resuls. */ \ ++ /* Synchronize module parameters with results. */ \ + name = _##name_ / 1024; \ + dev->zone.name = _##name_; \ + } +@@ -121,7 +121,7 @@ static int __register_pstore_device(struct pstore_device_info *dev) + if (pstore_device_info) + return -EBUSY; + +- /* zero means not limit on which backends to attempt to store. */ ++ /* zero means no limit on which backends attempt to store. */ + if (!dev->flags) + dev->flags = UINT_MAX; + +-- +2.39.5 + diff --git a/queue-6.6/ptp-properly-handle-compat-ioctls.patch b/queue-6.6/ptp-properly-handle-compat-ioctls.patch new file mode 100644 index 0000000000..702f7b4fd4 --- /dev/null +++ b/queue-6.6/ptp-properly-handle-compat-ioctls.patch @@ -0,0 +1,56 @@ +From 8c29a76b76bb089095af8d29efec226a005274ca Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 25 Jan 2025 10:28:38 +0100 +Subject: ptp: Properly handle compat ioctls +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Thomas Weißschuh + +[ Upstream commit 19ae40f572a9ce1ade9954990af709a03fd37010 ] + +Pointer arguments passed to ioctls need to pass through compat_ptr() to +work correctly on s390; as explained in Documentation/driver-api/ioctl.rst. +Detect compat mode at runtime and call compat_ptr() for those commands +which do take pointer arguments. + +Suggested-by: Arnd Bergmann +Link: https://lore.kernel.org/lkml/1ba5d3a4-7931-455b-a3ce-85a968a7cb10@app.fastmail.com/ +Fixes: d94ba80ebbea ("ptp: Added a brand new class driver for ptp clocks.") +Signed-off-by: Thomas Weißschuh +Reviewed-by: Cyrill Gorcunov +Reviewed-by: Arnd Bergmann +Acked-by: Richard Cochran +Link: https://patch.msgid.link/20250125-posix-clock-compat_ioctl-v2-1-11c865c500eb@weissschuh.net +Signed-off-by: Paolo Abeni +Signed-off-by: Sasha Levin +--- + drivers/ptp/ptp_chardev.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c +index 4fcd24e179f20..9662858cf8538 100644 +--- a/drivers/ptp/ptp_chardev.c ++++ b/drivers/ptp/ptp_chardev.c +@@ -4,6 +4,7 @@ + * + * Copyright (C) 2010 OMICRON electronics GmbH + */ ++#include + #include + #include + #include +@@ -159,6 +160,9 @@ long ptp_ioctl(struct posix_clock_context *pccontext, unsigned int cmd, + struct timespec64 ts; + int enable, err = 0; + ++ if (in_compat_syscall() && cmd != PTP_ENABLE_PPS && cmd != PTP_ENABLE_PPS2) ++ arg = (unsigned long)compat_ptr(arg); ++ + tsevq = pccontext->private_clkdata; + + switch (cmd) { +-- +2.39.5 + diff --git a/queue-6.6/ptp-replace-timestamp-event-queue-with-linked-list.patch b/queue-6.6/ptp-replace-timestamp-event-queue-with-linked-list.patch new file mode 100644 index 0000000000..cac9264a8e --- /dev/null +++ b/queue-6.6/ptp-replace-timestamp-event-queue-with-linked-list.patch @@ -0,0 +1,193 @@ +From 661051dcda1235052bd1091ffc69ab64a0668e6a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Oct 2023 00:39:54 +0200 +Subject: ptp: Replace timestamp event queue with linked list + +From: Xabier Marquiegui + +[ Upstream commit d26ab5a35ad9920940a9e07665130d501b2ae1a3 ] + +Introduce linked lists to access the timestamp event queue. + +Signed-off-by: Xabier Marquiegui +Suggested-by: Richard Cochran +Signed-off-by: David S. Miller +Stable-dep-of: 19ae40f572a9 ("ptp: Properly handle compat ioctls") +Signed-off-by: Sasha Levin +--- + drivers/ptp/ptp_chardev.c | 12 ++++++++++-- + drivers/ptp/ptp_clock.c | 26 ++++++++++++++++++++++++-- + drivers/ptp/ptp_private.h | 4 +++- + drivers/ptp/ptp_sysfs.c | 6 +++++- + 4 files changed, 42 insertions(+), 6 deletions(-) + +diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c +index 666ea6653b04a..56b52dd52d977 100644 +--- a/drivers/ptp/ptp_chardev.c ++++ b/drivers/ptp/ptp_chardev.c +@@ -440,10 +440,14 @@ __poll_t ptp_poll(struct posix_clock_context *pccontext, struct file *fp, + { + struct ptp_clock *ptp = + container_of(pccontext->clk, struct ptp_clock, clock); ++ struct timestamp_event_queue *queue; + + poll_wait(fp, &ptp->tsev_wq, wait); + +- return queue_cnt(&ptp->tsevq) ? EPOLLIN : 0; ++ /* Extract only the first element in the queue list */ ++ queue = list_first_entry(&ptp->tsevqs, struct timestamp_event_queue, qlist); ++ ++ return queue_cnt(queue) ? EPOLLIN : 0; + } + + #define EXTTS_BUFSIZE (PTP_BUF_TIMESTAMPS * sizeof(struct ptp_extts_event)) +@@ -453,12 +457,16 @@ ssize_t ptp_read(struct posix_clock_context *pccontext, uint rdflags, + { + struct ptp_clock *ptp = + container_of(pccontext->clk, struct ptp_clock, clock); +- struct timestamp_event_queue *queue = &ptp->tsevq; ++ struct timestamp_event_queue *queue; + struct ptp_extts_event *event; + unsigned long flags; + size_t qcnt, i; + int result; + ++ /* Extract only the first element in the queue list */ ++ queue = list_first_entry(&ptp->tsevqs, struct timestamp_event_queue, ++ qlist); ++ + if (cnt % sizeof(struct ptp_extts_event) != 0) + return -EINVAL; + +diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c +index b586da2e30023..5850cb185ead3 100644 +--- a/drivers/ptp/ptp_clock.c ++++ b/drivers/ptp/ptp_clock.c +@@ -171,12 +171,21 @@ static struct posix_clock_operations ptp_clock_ops = { + static void ptp_clock_release(struct device *dev) + { + struct ptp_clock *ptp = container_of(dev, struct ptp_clock, dev); ++ struct timestamp_event_queue *tsevq; ++ unsigned long flags; + + ptp_cleanup_pin_groups(ptp); + kfree(ptp->vclock_index); + mutex_destroy(&ptp->tsevq_mux); + mutex_destroy(&ptp->pincfg_mux); + mutex_destroy(&ptp->n_vclocks_mux); ++ /* Delete first entry */ ++ tsevq = list_first_entry(&ptp->tsevqs, struct timestamp_event_queue, ++ qlist); ++ spin_lock_irqsave(&tsevq->lock, flags); ++ list_del(&tsevq->qlist); ++ spin_unlock_irqrestore(&tsevq->lock, flags); ++ kfree(tsevq); + ida_free(&ptp_clocks_map, ptp->index); + kfree(ptp); + } +@@ -208,6 +217,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, + struct device *parent) + { + struct ptp_clock *ptp; ++ struct timestamp_event_queue *queue = NULL; + int err = 0, index, major = MAJOR(ptp_devt); + size_t size; + +@@ -230,7 +240,12 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, + ptp->info = info; + ptp->devid = MKDEV(major, index); + ptp->index = index; +- spin_lock_init(&ptp->tsevq.lock); ++ INIT_LIST_HEAD(&ptp->tsevqs); ++ queue = kzalloc(sizeof(*queue), GFP_KERNEL); ++ if (!queue) ++ goto no_memory_queue; ++ spin_lock_init(&queue->lock); ++ list_add_tail(&queue->qlist, &ptp->tsevqs); + mutex_init(&ptp->tsevq_mux); + mutex_init(&ptp->pincfg_mux); + mutex_init(&ptp->n_vclocks_mux); +@@ -335,6 +350,9 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, + mutex_destroy(&ptp->tsevq_mux); + mutex_destroy(&ptp->pincfg_mux); + mutex_destroy(&ptp->n_vclocks_mux); ++ list_del(&queue->qlist); ++ kfree(queue); ++no_memory_queue: + ida_free(&ptp_clocks_map, index); + no_slot: + kfree(ptp); +@@ -377,6 +395,7 @@ EXPORT_SYMBOL(ptp_clock_unregister); + + void ptp_clock_event(struct ptp_clock *ptp, struct ptp_clock_event *event) + { ++ struct timestamp_event_queue *tsevq; + struct pps_event_time evt; + + switch (event->type) { +@@ -385,7 +404,10 @@ void ptp_clock_event(struct ptp_clock *ptp, struct ptp_clock_event *event) + break; + + case PTP_CLOCK_EXTTS: +- enqueue_external_timestamp(&ptp->tsevq, event); ++ /* Enqueue timestamp on all queues */ ++ list_for_each_entry(tsevq, &ptp->tsevqs, qlist) { ++ enqueue_external_timestamp(tsevq, event); ++ } + wake_up_interruptible(&ptp->tsev_wq); + break; + +diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h +index f92b0181b6463..2ef0126f2869f 100644 +--- a/drivers/ptp/ptp_private.h ++++ b/drivers/ptp/ptp_private.h +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + + #define PTP_MAX_TIMESTAMPS 128 + #define PTP_BUF_TIMESTAMPS 30 +@@ -25,6 +26,7 @@ struct timestamp_event_queue { + int head; + int tail; + spinlock_t lock; ++ struct list_head qlist; + }; + + struct ptp_clock { +@@ -35,7 +37,7 @@ struct ptp_clock { + int index; /* index into clocks.map */ + struct pps_device *pps_source; + long dialed_frequency; /* remembers the frequency adjustment */ +- struct timestamp_event_queue tsevq; /* simple fifo for time stamps */ ++ struct list_head tsevqs; /* timestamp fifo list */ + struct mutex tsevq_mux; /* one process at a time reading the fifo */ + struct mutex pincfg_mux; /* protect concurrent info->pin_config access */ + wait_queue_head_t tsev_wq; +diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c +index aefc06ae5d099..952d3e968bdf9 100644 +--- a/drivers/ptp/ptp_sysfs.c ++++ b/drivers/ptp/ptp_sysfs.c +@@ -75,12 +75,16 @@ static ssize_t extts_fifo_show(struct device *dev, + struct device_attribute *attr, char *page) + { + struct ptp_clock *ptp = dev_get_drvdata(dev); +- struct timestamp_event_queue *queue = &ptp->tsevq; ++ struct timestamp_event_queue *queue; + struct ptp_extts_event event; + unsigned long flags; + size_t qcnt; + int cnt = 0; + ++ /* The sysfs fifo will always draw from the fist queue */ ++ queue = list_first_entry(&ptp->tsevqs, struct timestamp_event_queue, ++ qlist); ++ + memset(&event, 0, sizeof(event)); + + if (mutex_lock_interruptible(&ptp->tsevq_mux)) +-- +2.39.5 + diff --git a/queue-6.6/ptp-support-event-queue-reader-channel-masks.patch b/queue-6.6/ptp-support-event-queue-reader-channel-masks.patch new file mode 100644 index 0000000000..99f7f0fa17 --- /dev/null +++ b/queue-6.6/ptp-support-event-queue-reader-channel-masks.patch @@ -0,0 +1,195 @@ +From 74c52fbd3d7fbd105892c1060c1527ebc26bec23 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Oct 2023 00:39:56 +0200 +Subject: ptp: support event queue reader channel masks + +From: Xabier Marquiegui + +[ Upstream commit c5a445b1e9347b14752b01f1a304bd7a2f260acc ] + +On systems with multiple timestamp event channels, some readers might +want to receive only a subset of those channels. + +Add the necessary modifications to support timestamp event channel +filtering, including two IOCTL operations: + +- Clear all channels +- Enable one channel + +The mask modification operations will be applied exclusively on the +event queue assigned to the file descriptor used on the IOCTL operation, +so the typical procedure to have a reader receiving only a subset of the +enabled channels would be: + +- Open device file +- ioctl: clear all channels +- ioctl: enable one channel +- start reading + +Calling the enable one channel ioctl more than once will result in +multiple enabled channels. + +Signed-off-by: Xabier Marquiegui +Suggested-by: Richard Cochran +Suggested-by: Vinicius Costa Gomes +Signed-off-by: David S. Miller +Stable-dep-of: 19ae40f572a9 ("ptp: Properly handle compat ioctls") +Signed-off-by: Sasha Levin +--- + drivers/ptp/ptp_chardev.c | 26 ++++++++++++++++++++++++++ + drivers/ptp/ptp_clock.c | 12 ++++++++++-- + drivers/ptp/ptp_private.h | 3 +++ + include/uapi/linux/ptp_clock.h | 2 ++ + 4 files changed, 41 insertions(+), 2 deletions(-) + +diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c +index 32661889f6df1..4fcd24e179f20 100644 +--- a/drivers/ptp/ptp_chardev.c ++++ b/drivers/ptp/ptp_chardev.c +@@ -111,6 +111,12 @@ int ptp_open(struct posix_clock_context *pccontext, fmode_t fmode) + queue = kzalloc(sizeof(*queue), GFP_KERNEL); + if (!queue) + return -EINVAL; ++ queue->mask = bitmap_alloc(PTP_MAX_CHANNELS, GFP_KERNEL); ++ if (!queue->mask) { ++ kfree(queue); ++ return -EINVAL; ++ } ++ bitmap_set(queue->mask, 0, PTP_MAX_CHANNELS); + spin_lock_init(&queue->lock); + list_add_tail(&queue->qlist, &ptp->tsevqs); + pccontext->private_clkdata = queue; +@@ -127,6 +133,7 @@ int ptp_release(struct posix_clock_context *pccontext) + spin_lock_irqsave(&queue->lock, flags); + list_del(&queue->qlist); + spin_unlock_irqrestore(&queue->lock, flags); ++ bitmap_free(queue->mask); + kfree(queue); + } + return 0; +@@ -142,6 +149,7 @@ long ptp_ioctl(struct posix_clock_context *pccontext, unsigned int cmd, + struct system_device_crosststamp xtstamp; + struct ptp_clock_info *ops = ptp->info; + struct ptp_sys_offset *sysoff = NULL; ++ struct timestamp_event_queue *tsevq; + struct ptp_system_timestamp sts; + struct ptp_clock_request req; + struct ptp_clock_caps caps; +@@ -151,6 +159,8 @@ long ptp_ioctl(struct posix_clock_context *pccontext, unsigned int cmd, + struct timespec64 ts; + int enable, err = 0; + ++ tsevq = pccontext->private_clkdata; ++ + switch (cmd) { + + case PTP_CLOCK_GETCAPS: +@@ -449,6 +459,22 @@ long ptp_ioctl(struct posix_clock_context *pccontext, unsigned int cmd, + mutex_unlock(&ptp->pincfg_mux); + break; + ++ case PTP_MASK_CLEAR_ALL: ++ bitmap_clear(tsevq->mask, 0, PTP_MAX_CHANNELS); ++ break; ++ ++ case PTP_MASK_EN_SINGLE: ++ if (copy_from_user(&i, (void __user *)arg, sizeof(i))) { ++ err = -EFAULT; ++ break; ++ } ++ if (i >= PTP_MAX_CHANNELS) { ++ err = -EFAULT; ++ break; ++ } ++ set_bit(i, tsevq->mask); ++ break; ++ + default: + err = -ENOTTY; + break; +diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c +index 06b9ca8f4e1ab..28eb1026fcd95 100644 +--- a/drivers/ptp/ptp_clock.c ++++ b/drivers/ptp/ptp_clock.c +@@ -185,6 +185,7 @@ static void ptp_clock_release(struct device *dev) + spin_lock_irqsave(&tsevq->lock, flags); + list_del(&tsevq->qlist); + spin_unlock_irqrestore(&tsevq->lock, flags); ++ bitmap_free(tsevq->mask); + kfree(tsevq); + ida_free(&ptp_clocks_map, ptp->index); + kfree(ptp); +@@ -245,6 +246,10 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, + if (!queue) + goto no_memory_queue; + list_add_tail(&queue->qlist, &ptp->tsevqs); ++ queue->mask = bitmap_alloc(PTP_MAX_CHANNELS, GFP_KERNEL); ++ if (!queue->mask) ++ goto no_memory_bitmap; ++ bitmap_set(queue->mask, 0, PTP_MAX_CHANNELS); + spin_lock_init(&queue->lock); + mutex_init(&ptp->pincfg_mux); + mutex_init(&ptp->n_vclocks_mux); +@@ -348,6 +353,8 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, + kworker_err: + mutex_destroy(&ptp->pincfg_mux); + mutex_destroy(&ptp->n_vclocks_mux); ++ bitmap_free(queue->mask); ++no_memory_bitmap: + list_del(&queue->qlist); + kfree(queue); + no_memory_queue: +@@ -402,9 +409,10 @@ void ptp_clock_event(struct ptp_clock *ptp, struct ptp_clock_event *event) + break; + + case PTP_CLOCK_EXTTS: +- /* Enqueue timestamp on all queues */ ++ /* Enqueue timestamp on selected queues */ + list_for_each_entry(tsevq, &ptp->tsevqs, qlist) { +- enqueue_external_timestamp(tsevq, event); ++ if (test_bit((unsigned int)event->index, tsevq->mask)) ++ enqueue_external_timestamp(tsevq, event); + } + wake_up_interruptible(&ptp->tsev_wq); + break; +diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h +index 6565f5a9e7755..c6ccfeb211ada 100644 +--- a/drivers/ptp/ptp_private.h ++++ b/drivers/ptp/ptp_private.h +@@ -16,10 +16,12 @@ + #include + #include + #include ++#include + + #define PTP_MAX_TIMESTAMPS 128 + #define PTP_BUF_TIMESTAMPS 30 + #define PTP_DEFAULT_MAX_VCLOCKS 20 ++#define PTP_MAX_CHANNELS 2048 + + struct timestamp_event_queue { + struct ptp_extts_event buf[PTP_MAX_TIMESTAMPS]; +@@ -27,6 +29,7 @@ struct timestamp_event_queue { + int tail; + spinlock_t lock; + struct list_head qlist; ++ unsigned long *mask; + }; + + struct ptp_clock { +diff --git a/include/uapi/linux/ptp_clock.h b/include/uapi/linux/ptp_clock.h +index 05cc35fc94acf..da700999cad4a 100644 +--- a/include/uapi/linux/ptp_clock.h ++++ b/include/uapi/linux/ptp_clock.h +@@ -224,6 +224,8 @@ struct ptp_pin_desc { + _IOWR(PTP_CLK_MAGIC, 17, struct ptp_sys_offset_precise) + #define PTP_SYS_OFFSET_EXTENDED2 \ + _IOWR(PTP_CLK_MAGIC, 18, struct ptp_sys_offset_extended) ++#define PTP_MASK_CLEAR_ALL _IO(PTP_CLK_MAGIC, 19) ++#define PTP_MASK_EN_SINGLE _IOW(PTP_CLK_MAGIC, 20, unsigned int) + + struct ptp_extts_event { + struct ptp_clock_time t; /* Time event occured. */ +-- +2.39.5 + diff --git a/queue-6.6/ptp-support-multiple-timestamp-event-readers.patch b/queue-6.6/ptp-support-multiple-timestamp-event-readers.patch new file mode 100644 index 0000000000..e373044d79 --- /dev/null +++ b/queue-6.6/ptp-support-multiple-timestamp-event-readers.patch @@ -0,0 +1,231 @@ +From ac1580f66edb681eb08f9b0d82c7c13a1adb7f76 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Oct 2023 00:39:55 +0200 +Subject: ptp: support multiple timestamp event readers + +From: Xabier Marquiegui + +[ Upstream commit 8f5de6fb245326704f37d91780b9a10253a8a100 ] + +Use linked lists to create one event queue per open file. This enables +simultaneous readers for timestamp event queues. + +Signed-off-by: Xabier Marquiegui +Suggested-by: Richard Cochran +Signed-off-by: David S. Miller +Stable-dep-of: 19ae40f572a9 ("ptp: Properly handle compat ioctls") +Signed-off-by: Sasha Levin +--- + drivers/ptp/ptp_chardev.c | 68 ++++++++++++++++++++++++++++----------- + drivers/ptp/ptp_clock.c | 6 ++-- + drivers/ptp/ptp_private.h | 1 - + drivers/ptp/ptp_sysfs.c | 9 +++--- + 4 files changed, 55 insertions(+), 29 deletions(-) + +diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c +index 56b52dd52d977..32661889f6df1 100644 +--- a/drivers/ptp/ptp_chardev.c ++++ b/drivers/ptp/ptp_chardev.c +@@ -104,6 +104,31 @@ int ptp_set_pinfunc(struct ptp_clock *ptp, unsigned int pin, + + int ptp_open(struct posix_clock_context *pccontext, fmode_t fmode) + { ++ struct ptp_clock *ptp = ++ container_of(pccontext->clk, struct ptp_clock, clock); ++ struct timestamp_event_queue *queue; ++ ++ queue = kzalloc(sizeof(*queue), GFP_KERNEL); ++ if (!queue) ++ return -EINVAL; ++ spin_lock_init(&queue->lock); ++ list_add_tail(&queue->qlist, &ptp->tsevqs); ++ pccontext->private_clkdata = queue; ++ return 0; ++} ++ ++int ptp_release(struct posix_clock_context *pccontext) ++{ ++ struct timestamp_event_queue *queue = pccontext->private_clkdata; ++ unsigned long flags; ++ ++ if (queue) { ++ pccontext->private_clkdata = NULL; ++ spin_lock_irqsave(&queue->lock, flags); ++ list_del(&queue->qlist); ++ spin_unlock_irqrestore(&queue->lock, flags); ++ kfree(queue); ++ } + return 0; + } + +@@ -442,10 +467,11 @@ __poll_t ptp_poll(struct posix_clock_context *pccontext, struct file *fp, + container_of(pccontext->clk, struct ptp_clock, clock); + struct timestamp_event_queue *queue; + +- poll_wait(fp, &ptp->tsev_wq, wait); ++ queue = pccontext->private_clkdata; ++ if (!queue) ++ return EPOLLERR; + +- /* Extract only the first element in the queue list */ +- queue = list_first_entry(&ptp->tsevqs, struct timestamp_event_queue, qlist); ++ poll_wait(fp, &ptp->tsev_wq, wait); + + return queue_cnt(queue) ? EPOLLIN : 0; + } +@@ -463,36 +489,36 @@ ssize_t ptp_read(struct posix_clock_context *pccontext, uint rdflags, + size_t qcnt, i; + int result; + +- /* Extract only the first element in the queue list */ +- queue = list_first_entry(&ptp->tsevqs, struct timestamp_event_queue, +- qlist); ++ queue = pccontext->private_clkdata; ++ if (!queue) { ++ result = -EINVAL; ++ goto exit; ++ } + +- if (cnt % sizeof(struct ptp_extts_event) != 0) +- return -EINVAL; ++ if (cnt % sizeof(struct ptp_extts_event) != 0) { ++ result = -EINVAL; ++ goto exit; ++ } + + if (cnt > EXTTS_BUFSIZE) + cnt = EXTTS_BUFSIZE; + + cnt = cnt / sizeof(struct ptp_extts_event); + +- if (mutex_lock_interruptible(&ptp->tsevq_mux)) +- return -ERESTARTSYS; +- + if (wait_event_interruptible(ptp->tsev_wq, + ptp->defunct || queue_cnt(queue))) { +- mutex_unlock(&ptp->tsevq_mux); + return -ERESTARTSYS; + } + + if (ptp->defunct) { +- mutex_unlock(&ptp->tsevq_mux); +- return -ENODEV; ++ result = -ENODEV; ++ goto exit; + } + + event = kmalloc(EXTTS_BUFSIZE, GFP_KERNEL); + if (!event) { +- mutex_unlock(&ptp->tsevq_mux); +- return -ENOMEM; ++ result = -ENOMEM; ++ goto exit; + } + + spin_lock_irqsave(&queue->lock, flags); +@@ -512,12 +538,16 @@ ssize_t ptp_read(struct posix_clock_context *pccontext, uint rdflags, + + cnt = cnt * sizeof(struct ptp_extts_event); + +- mutex_unlock(&ptp->tsevq_mux); +- + result = cnt; +- if (copy_to_user(buf, event, cnt)) ++ if (copy_to_user(buf, event, cnt)) { + result = -EFAULT; ++ goto free_event; ++ } + ++free_event: + kfree(event); ++exit: ++ if (result < 0) ++ ptp_release(pccontext); + return result; + } +diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c +index 5850cb185ead3..06b9ca8f4e1ab 100644 +--- a/drivers/ptp/ptp_clock.c ++++ b/drivers/ptp/ptp_clock.c +@@ -164,6 +164,7 @@ static struct posix_clock_operations ptp_clock_ops = { + .clock_settime = ptp_clock_settime, + .ioctl = ptp_ioctl, + .open = ptp_open, ++ .release = ptp_release, + .poll = ptp_poll, + .read = ptp_read, + }; +@@ -176,7 +177,6 @@ static void ptp_clock_release(struct device *dev) + + ptp_cleanup_pin_groups(ptp); + kfree(ptp->vclock_index); +- mutex_destroy(&ptp->tsevq_mux); + mutex_destroy(&ptp->pincfg_mux); + mutex_destroy(&ptp->n_vclocks_mux); + /* Delete first entry */ +@@ -244,9 +244,8 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, + queue = kzalloc(sizeof(*queue), GFP_KERNEL); + if (!queue) + goto no_memory_queue; +- spin_lock_init(&queue->lock); + list_add_tail(&queue->qlist, &ptp->tsevqs); +- mutex_init(&ptp->tsevq_mux); ++ spin_lock_init(&queue->lock); + mutex_init(&ptp->pincfg_mux); + mutex_init(&ptp->n_vclocks_mux); + init_waitqueue_head(&ptp->tsev_wq); +@@ -347,7 +346,6 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info, + if (ptp->kworker) + kthread_destroy_worker(ptp->kworker); + kworker_err: +- mutex_destroy(&ptp->tsevq_mux); + mutex_destroy(&ptp->pincfg_mux); + mutex_destroy(&ptp->n_vclocks_mux); + list_del(&queue->qlist); +diff --git a/drivers/ptp/ptp_private.h b/drivers/ptp/ptp_private.h +index 2ef0126f2869f..6565f5a9e7755 100644 +--- a/drivers/ptp/ptp_private.h ++++ b/drivers/ptp/ptp_private.h +@@ -38,7 +38,6 @@ struct ptp_clock { + struct pps_device *pps_source; + long dialed_frequency; /* remembers the frequency adjustment */ + struct list_head tsevqs; /* timestamp fifo list */ +- struct mutex tsevq_mux; /* one process at a time reading the fifo */ + struct mutex pincfg_mux; /* protect concurrent info->pin_config access */ + wait_queue_head_t tsev_wq; + int defunct; /* tells readers to go away when clock is being removed */ +diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c +index 952d3e968bdf9..2cdac19b5402d 100644 +--- a/drivers/ptp/ptp_sysfs.c ++++ b/drivers/ptp/ptp_sysfs.c +@@ -81,15 +81,15 @@ static ssize_t extts_fifo_show(struct device *dev, + size_t qcnt; + int cnt = 0; + ++ cnt = list_count_nodes(&ptp->tsevqs); ++ if (cnt <= 0) ++ goto out; ++ + /* The sysfs fifo will always draw from the fist queue */ + queue = list_first_entry(&ptp->tsevqs, struct timestamp_event_queue, + qlist); + + memset(&event, 0, sizeof(event)); +- +- if (mutex_lock_interruptible(&ptp->tsevq_mux)) +- return -ERESTARTSYS; +- + spin_lock_irqsave(&queue->lock, flags); + qcnt = queue_cnt(queue); + if (qcnt) { +@@ -105,7 +105,6 @@ static ssize_t extts_fifo_show(struct device *dev, + cnt = snprintf(page, PAGE_SIZE, "%u %lld %u\n", + event.index, event.t.sec, event.t.nsec); + out: +- mutex_unlock(&ptp->tsevq_mux); + return cnt; + } + static DEVICE_ATTR(fifo, 0444, extts_fifo_show, NULL); +-- +2.39.5 + diff --git a/queue-6.6/pwm-stm32-add-check-for-clk_enable.patch b/queue-6.6/pwm-stm32-add-check-for-clk_enable.patch new file mode 100644 index 0000000000..86999c159c --- /dev/null +++ b/queue-6.6/pwm-stm32-add-check-for-clk_enable.patch @@ -0,0 +1,46 @@ +From 3762c920d35f73db3fff3759ca8953b168175c55 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 15 Dec 2024 17:47:52 -0500 +Subject: pwm: stm32: Add check for clk_enable() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Mingwei Zheng + +[ Upstream commit e8c59791ebb60790c74b2c3ab520f04a8a57219a ] + +Add check for the return value of clk_enable() to catch the potential +error. + +Fixes: 19f1016ea960 ("pwm: stm32: Fix enable count for clk in .probe()") +Signed-off-by: Mingwei Zheng +Signed-off-by: Jiasheng Jiang +Link: https://lore.kernel.org/r/20241215224752.220318-1-zmw12306@gmail.com +Signed-off-by: Uwe Kleine-König +Signed-off-by: Sasha Levin +--- + drivers/pwm/pwm-stm32.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/pwm/pwm-stm32.c b/drivers/pwm/pwm-stm32.c +index b91a14c895bea..67414b97ef4d2 100644 +--- a/drivers/pwm/pwm-stm32.c ++++ b/drivers/pwm/pwm-stm32.c +@@ -635,8 +635,11 @@ static int stm32_pwm_probe(struct platform_device *pdev) + priv->chip.npwm = stm32_pwm_detect_channels(priv, &num_enabled); + + /* Initialize clock refcount to number of enabled PWM channels. */ +- for (i = 0; i < num_enabled; i++) +- clk_enable(priv->clk); ++ for (i = 0; i < num_enabled; i++) { ++ ret = clk_enable(priv->clk); ++ if (ret) ++ return ret; ++ } + + ret = devm_pwmchip_add(dev, &priv->chip); + if (ret < 0) +-- +2.39.5 + diff --git a/queue-6.6/pwm-stm32-lp-add-check-for-clk_enable.patch b/queue-6.6/pwm-stm32-lp-add-check-for-clk_enable.patch new file mode 100644 index 0000000000..7941fe29b5 --- /dev/null +++ b/queue-6.6/pwm-stm32-lp-add-check-for-clk_enable.patch @@ -0,0 +1,48 @@ +From 77446549da4f052ce8a5445c351564078429f5fa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Dec 2024 16:53:18 -0500 +Subject: pwm: stm32-lp: Add check for clk_enable() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Mingwei Zheng + +[ Upstream commit cce16e7f6216227964cda25f5f23634bce2c500f ] + +Add check for the return value of clk_enable() to catch the potential +error. +We used APP-Miner to find it. + +Fixes: e70a540b4e02 ("pwm: Add STM32 LPTimer PWM driver") +Signed-off-by: Mingwei Zheng +Signed-off-by: Jiasheng Jiang +Link: https://lore.kernel.org/r/20241206215318.3402860-1-zmw12306@gmail.com +Signed-off-by: Uwe Kleine-König +Signed-off-by: Sasha Levin +--- + drivers/pwm/pwm-stm32-lp.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/drivers/pwm/pwm-stm32-lp.c b/drivers/pwm/pwm-stm32-lp.c +index bb3a045a73343..7799258638dfa 100644 +--- a/drivers/pwm/pwm-stm32-lp.c ++++ b/drivers/pwm/pwm-stm32-lp.c +@@ -168,8 +168,12 @@ static int stm32_pwm_lp_get_state(struct pwm_chip *chip, + regmap_read(priv->regmap, STM32_LPTIM_CR, &val); + state->enabled = !!FIELD_GET(STM32_LPTIM_ENABLE, val); + /* Keep PWM counter clock refcount in sync with PWM initial state */ +- if (state->enabled) +- clk_enable(priv->clk); ++ if (state->enabled) { ++ int ret = clk_enable(priv->clk); ++ ++ if (ret) ++ return ret; ++ } + + regmap_read(priv->regmap, STM32_LPTIM_CFGR, &val); + presc = FIELD_GET(STM32_LPTIM_PRESC, val); +-- +2.39.5 + diff --git a/queue-6.6/rdma-bnxt_re-fix-to-drop-reference-to-the-mmap-entry.patch b/queue-6.6/rdma-bnxt_re-fix-to-drop-reference-to-the-mmap-entry.patch new file mode 100644 index 0000000000..4c77e6c81d --- /dev/null +++ b/queue-6.6/rdma-bnxt_re-fix-to-drop-reference-to-the-mmap-entry.patch @@ -0,0 +1,47 @@ +From 09010a6fac79583e0ad31b09d021a49023e416b6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 4 Jan 2025 11:45:19 +0530 +Subject: RDMA/bnxt_re: Fix to drop reference to the mmap entry in case of + error + +From: Kalesh AP + +[ Upstream commit c84f0f4f49d81645f49c3269fdcc3b84ce61e795 ] + +In the error handling path of bnxt_re_mmap(), driver should invoke +rdma_user_mmap_entry_put() to free the reference of mmap entry in case +the error happens after rdma_user_mmap_entry_get was called. + +Fixes: ea2224857882 ("RDMA/bnxt_re: Update alloc_page uapi for pacing") +Reviewed-by: Saravanan Vajravel +Reviewed-by: Kashyap Desai +Signed-off-by: Kalesh AP +Signed-off-by: Selvin Xavier +Link: https://patch.msgid.link/20250104061519.2540178-1-kalesh-anakkur.purayil@broadcom.com +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/hw/bnxt_re/ib_verbs.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c +index 08da793969ee5..f7345e4890a14 100644 +--- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c ++++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c +@@ -4278,9 +4278,10 @@ int bnxt_re_mmap(struct ib_ucontext *ib_uctx, struct vm_area_struct *vma) + case BNXT_RE_MMAP_DBR_PAGE: + /* Driver doesn't expect write access for user space */ + if (vma->vm_flags & VM_WRITE) +- return -EFAULT; +- ret = vm_insert_page(vma, vma->vm_start, +- virt_to_page((void *)bnxt_entry->mem_offset)); ++ ret = -EFAULT; ++ else ++ ret = vm_insert_page(vma, vma->vm_start, ++ virt_to_page((void *)bnxt_entry->mem_offset)); + break; + default: + ret = -EINVAL; +-- +2.39.5 + diff --git a/queue-6.6/rdma-cxgb4-prevent-potential-integer-overflow-on-32b.patch b/queue-6.6/rdma-cxgb4-prevent-potential-integer-overflow-on-32b.patch new file mode 100644 index 0000000000..27e763a5aa --- /dev/null +++ b/queue-6.6/rdma-cxgb4-prevent-potential-integer-overflow-on-32b.patch @@ -0,0 +1,43 @@ +From 694cca1ac1ae49fafe3737b3124e20cc6eb5a6b6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 30 Nov 2024 13:01:37 +0300 +Subject: rdma/cxgb4: Prevent potential integer overflow on 32bit + +From: Dan Carpenter + +[ Upstream commit bd96a3935e89486304461a21752f824fc25e0f0b ] + +The "gl->tot_len" variable is controlled by the user. It comes from +process_responses(). On 32bit systems, the "gl->tot_len + sizeof(struct +cpl_pass_accept_req) + sizeof(struct rss_header)" addition could have an +integer wrapping bug. Use size_add() to prevent this. + +Fixes: 1cab775c3e75 ("RDMA/cxgb4: Fix LE hash collision bug for passive open connection") +Link: https://patch.msgid.link/r/86b404e1-4a75-4a35-a34e-e3054fa554c7@stanley.mountain +Signed-off-by: Dan Carpenter +Signed-off-by: Jason Gunthorpe +Signed-off-by: Sasha Levin +--- + drivers/infiniband/hw/cxgb4/device.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/infiniband/hw/cxgb4/device.c b/drivers/infiniband/hw/cxgb4/device.c +index 80970a1738f8a..034b85c422555 100644 +--- a/drivers/infiniband/hw/cxgb4/device.c ++++ b/drivers/infiniband/hw/cxgb4/device.c +@@ -1114,8 +1114,10 @@ static inline struct sk_buff *copy_gl_to_skb_pkt(const struct pkt_gl *gl, + * The math here assumes sizeof cpl_pass_accept_req >= sizeof + * cpl_rx_pkt. + */ +- skb = alloc_skb(gl->tot_len + sizeof(struct cpl_pass_accept_req) + +- sizeof(struct rss_header) - pktshift, GFP_ATOMIC); ++ skb = alloc_skb(size_add(gl->tot_len, ++ sizeof(struct cpl_pass_accept_req) + ++ sizeof(struct rss_header)) - pktshift, ++ GFP_ATOMIC); + if (unlikely(!skb)) + return NULL; + +-- +2.39.5 + diff --git a/queue-6.6/rdma-hns-add-debugfs-to-hns-roce.patch b/queue-6.6/rdma-hns-add-debugfs-to-hns-roce.patch new file mode 100644 index 0000000000..ddcb15a4c7 --- /dev/null +++ b/queue-6.6/rdma-hns-add-debugfs-to-hns-roce.patch @@ -0,0 +1,207 @@ +From f63255cc0d301897eab67847d095d3bdf79fb091 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Nov 2023 20:34:48 +0800 +Subject: RDMA/hns: Add debugfs to hns RoCE + +From: Junxian Huang + +[ Upstream commit ca7ad04cd5d2f8070cd34c2c428cea36de516afc ] + +Add debugfs to hns RoCE. This patch only adds an empty directory +"hns_roce" to debugs root directory. + +Signed-off-by: Junxian Huang +Link: https://lore.kernel.org/r/20231114123449.1106162-3-huangjunxian6@hisilicon.com +Signed-off-by: Leon Romanovsky +Stable-dep-of: 8977b561216c ("RDMA/hns: Clean up the legacy CONFIG_INFINIBAND_HNS") +Signed-off-by: Sasha Levin +--- + drivers/infiniband/hw/hns/Makefile | 3 +- + drivers/infiniband/hw/hns/hns_roce_debugfs.c | 63 ++++++++++++++++++++ + drivers/infiniband/hw/hns/hns_roce_debugfs.h | 27 +++++++++ + drivers/infiniband/hw/hns/hns_roce_device.h | 2 + + drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 + + drivers/infiniband/hw/hns/hns_roce_main.c | 3 + + 6 files changed, 99 insertions(+), 1 deletion(-) + create mode 100644 drivers/infiniband/hw/hns/hns_roce_debugfs.c + create mode 100644 drivers/infiniband/hw/hns/hns_roce_debugfs.h + +diff --git a/drivers/infiniband/hw/hns/Makefile b/drivers/infiniband/hw/hns/Makefile +index a7d259238305b..be1e1cdbcfa8a 100644 +--- a/drivers/infiniband/hw/hns/Makefile ++++ b/drivers/infiniband/hw/hns/Makefile +@@ -7,7 +7,8 @@ ccflags-y := -I $(srctree)/drivers/net/ethernet/hisilicon/hns3 + + hns-roce-objs := hns_roce_main.o hns_roce_cmd.o hns_roce_pd.o \ + hns_roce_ah.o hns_roce_hem.o hns_roce_mr.o hns_roce_qp.o \ +- hns_roce_cq.o hns_roce_alloc.o hns_roce_db.o hns_roce_srq.o hns_roce_restrack.o ++ hns_roce_cq.o hns_roce_alloc.o hns_roce_db.o hns_roce_srq.o hns_roce_restrack.o \ ++ hns_roce_debugfs.o + + ifdef CONFIG_INFINIBAND_HNS_HIP08 + hns-roce-hw-v2-objs := hns_roce_hw_v2.o $(hns-roce-objs) +diff --git a/drivers/infiniband/hw/hns/hns_roce_debugfs.c b/drivers/infiniband/hw/hns/hns_roce_debugfs.c +new file mode 100644 +index 0000000000000..79825570cc353 +--- /dev/null ++++ b/drivers/infiniband/hw/hns/hns_roce_debugfs.c +@@ -0,0 +1,63 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++/* ++ * Copyright (c) 2023 Hisilicon Limited. ++ */ ++ ++#include ++#include ++ ++#include "hns_roce_device.h" ++ ++static struct dentry *hns_roce_dbgfs_root; ++ ++static int hns_debugfs_seqfile_open(struct inode *inode, struct file *f) ++{ ++ struct hns_debugfs_seqfile *seqfile = inode->i_private; ++ ++ return single_open(f, seqfile->read, seqfile->data); ++} ++ ++static const struct file_operations hns_debugfs_seqfile_fops = { ++ .owner = THIS_MODULE, ++ .open = hns_debugfs_seqfile_open, ++ .release = single_release, ++ .read = seq_read, ++ .llseek = seq_lseek ++}; ++ ++static void init_debugfs_seqfile(struct hns_debugfs_seqfile *seq, ++ const char *name, struct dentry *parent, ++ int (*read_fn)(struct seq_file *, void *), ++ void *data) ++{ ++ debugfs_create_file(name, 0400, parent, seq, &hns_debugfs_seqfile_fops); ++ ++ seq->read = read_fn; ++ seq->data = data; ++} ++ ++/* debugfs for device */ ++void hns_roce_register_debugfs(struct hns_roce_dev *hr_dev) ++{ ++ struct hns_roce_dev_debugfs *dbgfs = &hr_dev->dbgfs; ++ ++ dbgfs->root = debugfs_create_dir(dev_name(&hr_dev->ib_dev.dev), ++ hns_roce_dbgfs_root); ++} ++ ++void hns_roce_unregister_debugfs(struct hns_roce_dev *hr_dev) ++{ ++ debugfs_remove_recursive(hr_dev->dbgfs.root); ++} ++ ++/* debugfs for hns module */ ++void hns_roce_init_debugfs(void) ++{ ++ hns_roce_dbgfs_root = debugfs_create_dir("hns_roce", NULL); ++} ++ ++void hns_roce_cleanup_debugfs(void) ++{ ++ debugfs_remove_recursive(hns_roce_dbgfs_root); ++ hns_roce_dbgfs_root = NULL; ++} +diff --git a/drivers/infiniband/hw/hns/hns_roce_debugfs.h b/drivers/infiniband/hw/hns/hns_roce_debugfs.h +new file mode 100644 +index 0000000000000..ece71fe6730c0 +--- /dev/null ++++ b/drivers/infiniband/hw/hns/hns_roce_debugfs.h +@@ -0,0 +1,27 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++/* ++ * Copyright (c) 2023 Hisilicon Limited. ++ */ ++ ++#ifndef __HNS_ROCE_DEBUGFS_H ++#define __HNS_ROCE_DEBUGFS_H ++ ++/* debugfs seqfile */ ++struct hns_debugfs_seqfile { ++ int (*read)(struct seq_file *seq, void *data); ++ void *data; ++}; ++ ++/* Debugfs for device */ ++struct hns_roce_dev_debugfs { ++ struct dentry *root; ++}; ++ ++struct hns_roce_dev; ++ ++void hns_roce_init_debugfs(void); ++void hns_roce_cleanup_debugfs(void); ++void hns_roce_register_debugfs(struct hns_roce_dev *hr_dev); ++void hns_roce_unregister_debugfs(struct hns_roce_dev *hr_dev); ++ ++#endif +diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h +index 03b6546f63cdc..b064088ed3272 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_device.h ++++ b/drivers/infiniband/hw/hns/hns_roce_device.h +@@ -35,6 +35,7 @@ + + #include + #include ++#include "hns_roce_debugfs.h" + + #define PCI_REVISION_ID_HIP08 0x21 + #define PCI_REVISION_ID_HIP09 0x30 +@@ -981,6 +982,7 @@ struct hns_roce_dev { + u32 is_vf; + u32 cong_algo_tmpl_id; + u64 dwqe_page; ++ struct hns_roce_dev_debugfs dbgfs; + }; + + static inline struct hns_roce_dev *to_hr_dev(struct ib_device *ib_dev) +diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +index aded0a7f42838..7005aafb10ffb 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c ++++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +@@ -6967,12 +6967,14 @@ static struct hnae3_client hns_roce_hw_v2_client = { + + static int __init hns_roce_hw_v2_init(void) + { ++ hns_roce_init_debugfs(); + return hnae3_register_client(&hns_roce_hw_v2_client); + } + + static void __exit hns_roce_hw_v2_exit(void) + { + hnae3_unregister_client(&hns_roce_hw_v2_client); ++ hns_roce_cleanup_debugfs(); + } + + module_init(hns_roce_hw_v2_init); +diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c +index c8c49110a3378..8af0dfe06a9ea 100644 +--- a/drivers/infiniband/hw/hns/hns_roce_main.c ++++ b/drivers/infiniband/hw/hns/hns_roce_main.c +@@ -1078,6 +1078,8 @@ int hns_roce_init(struct hns_roce_dev *hr_dev) + if (ret) + goto error_failed_register_device; + ++ hns_roce_register_debugfs(hr_dev); ++ + return 0; + + error_failed_register_device: +@@ -1107,6 +1109,7 @@ int hns_roce_init(struct hns_roce_dev *hr_dev) + + void hns_roce_exit(struct hns_roce_dev *hr_dev) + { ++ hns_roce_unregister_debugfs(hr_dev); + hns_roce_unregister_device(hr_dev); + + if (hr_dev->hw->hw_exit) +-- +2.39.5 + diff --git a/queue-6.6/rdma-hns-clean-up-the-legacy-config_infiniband_hns.patch b/queue-6.6/rdma-hns-clean-up-the-legacy-config_infiniband_hns.patch new file mode 100644 index 0000000000..da6f9acad5 --- /dev/null +++ b/queue-6.6/rdma-hns-clean-up-the-legacy-config_infiniband_hns.patch @@ -0,0 +1,96 @@ +From ba74f34e4246c963f9ca22ec2f64b7d3340f0e93 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jan 2025 19:12:11 +0800 +Subject: RDMA/hns: Clean up the legacy CONFIG_INFINIBAND_HNS + +From: Junxian Huang + +[ Upstream commit 8977b561216c7e693d61c6442657e33f134bfeb5 ] + +hns driver used to support hip06 and hip08 devices with +CONFIG_INFINIBAND_HNS_HIP06 and CONFIG_INFINIBAND_HNS_HIP08 +respectively, which both depended on CONFIG_INFINIBAND_HNS. + +But we no longer provide support for hip06 and only support +hip08 and higher since the commit in fixes line, so there is +no need to have CONFIG_INFINIBAND_HNS any more. Remove it and +only keep CONFIG_INFINIBAND_HNS_HIP08. + +Fixes: 38d220882426 ("RDMA/hns: Remove support for HIP06") +Signed-off-by: Junxian Huang +Link: https://patch.msgid.link/20250106111211.3945051-1-huangjunxian6@hisilicon.com +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/hw/Makefile | 2 +- + drivers/infiniband/hw/hns/Kconfig | 20 +++++--------------- + drivers/infiniband/hw/hns/Makefile | 9 +++------ + 3 files changed, 9 insertions(+), 22 deletions(-) + +diff --git a/drivers/infiniband/hw/Makefile b/drivers/infiniband/hw/Makefile +index 1211f4317a9f4..aba96ca9bce5d 100644 +--- a/drivers/infiniband/hw/Makefile ++++ b/drivers/infiniband/hw/Makefile +@@ -11,7 +11,7 @@ obj-$(CONFIG_INFINIBAND_OCRDMA) += ocrdma/ + obj-$(CONFIG_INFINIBAND_VMWARE_PVRDMA) += vmw_pvrdma/ + obj-$(CONFIG_INFINIBAND_USNIC) += usnic/ + obj-$(CONFIG_INFINIBAND_HFI1) += hfi1/ +-obj-$(CONFIG_INFINIBAND_HNS) += hns/ ++obj-$(CONFIG_INFINIBAND_HNS_HIP08) += hns/ + obj-$(CONFIG_INFINIBAND_QEDR) += qedr/ + obj-$(CONFIG_INFINIBAND_BNXT_RE) += bnxt_re/ + obj-$(CONFIG_INFINIBAND_ERDMA) += erdma/ +diff --git a/drivers/infiniband/hw/hns/Kconfig b/drivers/infiniband/hw/hns/Kconfig +index ab3fbba70789c..44cdb706fe276 100644 +--- a/drivers/infiniband/hw/hns/Kconfig ++++ b/drivers/infiniband/hw/hns/Kconfig +@@ -1,21 +1,11 @@ + # SPDX-License-Identifier: GPL-2.0-only +-config INFINIBAND_HNS +- tristate "HNS RoCE Driver" +- depends on NET_VENDOR_HISILICON +- depends on ARM64 || (COMPILE_TEST && 64BIT) +- depends on (HNS_DSAF && HNS_ENET) || HNS3 +- help +- This is a RoCE/RDMA driver for the Hisilicon RoCE engine. +- +- To compile HIP08 driver as module, choose M here. +- + config INFINIBAND_HNS_HIP08 +- bool "Hisilicon Hip08 Family RoCE support" +- depends on INFINIBAND_HNS && PCI && HNS3 +- depends on INFINIBAND_HNS=m || HNS3=y ++ tristate "Hisilicon Hip08 Family RoCE support" ++ depends on ARM64 || (COMPILE_TEST && 64BIT) ++ depends on PCI && HNS3 + help + RoCE driver support for Hisilicon RoCE engine in Hisilicon Hip08 SoC. + The RoCE engine is a PCI device. + +- To compile this driver, choose Y here: if INFINIBAND_HNS is m, this +- module will be called hns-roce-hw-v2. ++ To compile this driver, choose M here. This module will be called ++ hns-roce-hw-v2. +diff --git a/drivers/infiniband/hw/hns/Makefile b/drivers/infiniband/hw/hns/Makefile +index be1e1cdbcfa8a..7917af8e6380e 100644 +--- a/drivers/infiniband/hw/hns/Makefile ++++ b/drivers/infiniband/hw/hns/Makefile +@@ -5,12 +5,9 @@ + + ccflags-y := -I $(srctree)/drivers/net/ethernet/hisilicon/hns3 + +-hns-roce-objs := hns_roce_main.o hns_roce_cmd.o hns_roce_pd.o \ ++hns-roce-hw-v2-objs := hns_roce_main.o hns_roce_cmd.o hns_roce_pd.o \ + hns_roce_ah.o hns_roce_hem.o hns_roce_mr.o hns_roce_qp.o \ + hns_roce_cq.o hns_roce_alloc.o hns_roce_db.o hns_roce_srq.o hns_roce_restrack.o \ +- hns_roce_debugfs.o ++ hns_roce_debugfs.o hns_roce_hw_v2.o + +-ifdef CONFIG_INFINIBAND_HNS_HIP08 +-hns-roce-hw-v2-objs := hns_roce_hw_v2.o $(hns-roce-objs) +-obj-$(CONFIG_INFINIBAND_HNS) += hns-roce-hw-v2.o +-endif ++obj-$(CONFIG_INFINIBAND_HNS_HIP08) += hns-roce-hw-v2.o +-- +2.39.5 + diff --git a/queue-6.6/rdma-mlx4-avoid-false-error-about-access-to-uninitia.patch b/queue-6.6/rdma-mlx4-avoid-false-error-about-access-to-uninitia.patch new file mode 100644 index 0000000000..f7bc00d7bb --- /dev/null +++ b/queue-6.6/rdma-mlx4-avoid-false-error-about-access-to-uninitia.patch @@ -0,0 +1,54 @@ +From 03117a152e8c905b786545bb779c46366b767cd7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 3 Dec 2024 15:44:25 +0200 +Subject: RDMA/mlx4: Avoid false error about access to uninitialized gids array + +From: Leon Romanovsky + +[ Upstream commit 1f53d88cbb0dcc7df235bf6611ae632b254fccd8 ] + +Smatch generates the following false error report: +drivers/infiniband/hw/mlx4/main.c:393 mlx4_ib_del_gid() error: uninitialized symbol 'gids'. + +Traditionally, we are not changing kernel code and asking people to fix +the tools. However in this case, the fix can be done by simply rearranging +the code to be more clear. + +Fixes: e26be1bfef81 ("IB/mlx4: Implement ib_device callbacks") +Link: https://patch.msgid.link/6a3a1577463da16962463fcf62883a87506e9b62.1733233426.git.leonro@nvidia.com +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/hw/mlx4/main.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c +index 529db874d67c6..b1bbdcff631d5 100644 +--- a/drivers/infiniband/hw/mlx4/main.c ++++ b/drivers/infiniband/hw/mlx4/main.c +@@ -351,7 +351,7 @@ static int mlx4_ib_del_gid(const struct ib_gid_attr *attr, void **context) + struct mlx4_port_gid_table *port_gid_table; + int ret = 0; + int hw_update = 0; +- struct gid_entry *gids; ++ struct gid_entry *gids = NULL; + + if (!rdma_cap_roce_gid_table(attr->device, attr->port_num)) + return -EINVAL; +@@ -389,10 +389,10 @@ static int mlx4_ib_del_gid(const struct ib_gid_attr *attr, void **context) + } + spin_unlock_bh(&iboe->lock); + +- if (!ret && hw_update) { ++ if (gids) + ret = mlx4_ib_update_gids(gids, ibdev, attr->port_num); +- kfree(gids); +- } ++ ++ kfree(gids); + return ret; + } + +-- +2.39.5 + diff --git a/queue-6.6/rdma-mlx5-fix-indirect-mkey-odp-page-count.patch b/queue-6.6/rdma-mlx5-fix-indirect-mkey-odp-page-count.patch new file mode 100644 index 0000000000..5ace6c6fb4 --- /dev/null +++ b/queue-6.6/rdma-mlx5-fix-indirect-mkey-odp-page-count.patch @@ -0,0 +1,148 @@ +From 133a4f2419535dd068b9df21898e018860630a98 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 6 Jan 2025 20:27:10 +0200 +Subject: RDMA/mlx5: Fix indirect mkey ODP page count + +From: Michael Guralnik + +[ Upstream commit 235f238402194a78ac5fb882a46717eac817e5d1 ] + +Restrict the check for the number of pages handled during an ODP page +fault to direct mkeys. +Perform the check right after handling the page fault and don't +propagate the number of handled pages to callers. + +Indirect mkeys and their associated direct mkeys can have different +start addresses. As a result, the calculation of the number of pages to +handle for an indirect mkey may not match the actual page fault +handling done on the direct mkey. + +For example: +A 4K sized page fault on a KSM mkey that has a start address that is not +aligned to a page will result a calculation that assumes the number of +pages required to handle are 2. +While the underlying MTT might be aligned will require fetching only a +single page. +Thus, do the calculation and compare number of pages handled only per +direct mkey. + +Fixes: db570d7deafb ("IB/mlx5: Add ODP support to MW") +Signed-off-by: Michael Guralnik +Reviewed-by: Artemy Kovalyov +Link: https://patch.msgid.link/86c483d9e75ce8fe14e9ff85b62df72b779f8ab1.1736187990.git.leon@kernel.org +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/hw/mlx5/odp.c | 32 +++++++++++++++----------------- + 1 file changed, 15 insertions(+), 17 deletions(-) + +diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c +index 3a4605fda6d57..f1a0a324223c0 100644 +--- a/drivers/infiniband/hw/mlx5/odp.c ++++ b/drivers/infiniband/hw/mlx5/odp.c +@@ -807,8 +807,7 @@ static bool mkey_is_eq(struct mlx5_ib_mkey *mmkey, u32 key) + /* + * Handle a single data segment in a page-fault WQE or RDMA region. + * +- * Returns number of OS pages retrieved on success. The caller may continue to +- * the next data segment. ++ * Returns zero on success. The caller may continue to the next data segment. + * Can return the following error codes: + * -EAGAIN to designate a temporary error. The caller will abort handling the + * page fault and resolve it. +@@ -821,7 +820,7 @@ static int pagefault_single_data_segment(struct mlx5_ib_dev *dev, + u32 *bytes_committed, + u32 *bytes_mapped) + { +- int npages = 0, ret, i, outlen, cur_outlen = 0, depth = 0; ++ int ret, i, outlen, cur_outlen = 0, depth = 0, pages_in_range; + struct pf_frame *head = NULL, *frame; + struct mlx5_ib_mkey *mmkey; + struct mlx5_ib_mr *mr; +@@ -864,13 +863,20 @@ static int pagefault_single_data_segment(struct mlx5_ib_dev *dev, + case MLX5_MKEY_MR: + mr = container_of(mmkey, struct mlx5_ib_mr, mmkey); + ++ pages_in_range = (ALIGN(io_virt + bcnt, PAGE_SIZE) - ++ (io_virt & PAGE_MASK)) >> ++ PAGE_SHIFT; + ret = pagefault_mr(mr, io_virt, bcnt, bytes_mapped, 0, false); + if (ret < 0) + goto end; + + mlx5_update_odp_stats(mr, faults, ret); + +- npages += ret; ++ if (ret < pages_in_range) { ++ ret = -EFAULT; ++ goto end; ++ } ++ + ret = 0; + break; + +@@ -961,7 +967,7 @@ static int pagefault_single_data_segment(struct mlx5_ib_dev *dev, + kfree(out); + + *bytes_committed = 0; +- return ret ? ret : npages; ++ return ret; + } + + /* +@@ -980,8 +986,7 @@ static int pagefault_single_data_segment(struct mlx5_ib_dev *dev, + * the committed bytes). + * @receive_queue: receive WQE end of sg list + * +- * Returns the number of pages loaded if positive, zero for an empty WQE, or a +- * negative error code. ++ * Returns zero for success or a negative error code. + */ + static int pagefault_data_segments(struct mlx5_ib_dev *dev, + struct mlx5_pagefault *pfault, +@@ -989,7 +994,7 @@ static int pagefault_data_segments(struct mlx5_ib_dev *dev, + void *wqe_end, u32 *bytes_mapped, + u32 *total_wqe_bytes, bool receive_queue) + { +- int ret = 0, npages = 0; ++ int ret = 0; + u64 io_virt; + __be32 key; + u32 byte_count; +@@ -1046,10 +1051,9 @@ static int pagefault_data_segments(struct mlx5_ib_dev *dev, + bytes_mapped); + if (ret < 0) + break; +- npages += ret; + } + +- return ret < 0 ? ret : npages; ++ return ret; + } + + /* +@@ -1285,12 +1289,6 @@ static void mlx5_ib_mr_wqe_pfault_handler(struct mlx5_ib_dev *dev, + free_page((unsigned long)wqe_start); + } + +-static int pages_in_range(u64 address, u32 length) +-{ +- return (ALIGN(address + length, PAGE_SIZE) - +- (address & PAGE_MASK)) >> PAGE_SHIFT; +-} +- + static void mlx5_ib_mr_rdma_pfault_handler(struct mlx5_ib_dev *dev, + struct mlx5_pagefault *pfault) + { +@@ -1329,7 +1327,7 @@ static void mlx5_ib_mr_rdma_pfault_handler(struct mlx5_ib_dev *dev, + if (ret == -EAGAIN) { + /* We're racing with an invalidation, don't prefetch */ + prefetch_activated = 0; +- } else if (ret < 0 || pages_in_range(address, length) > ret) { ++ } else if (ret < 0) { + mlx5_ib_page_fault_resume(dev, pfault, 1); + if (ret != -ENOENT) + mlx5_ib_dbg(dev, "PAGE FAULT error %d. QP 0x%x, type: 0x%x\n", +-- +2.39.5 + diff --git a/queue-6.6/rdma-rxe-fix-mismatched-max_msg_sz.patch b/queue-6.6/rdma-rxe-fix-mismatched-max_msg_sz.patch new file mode 100644 index 0000000000..2b53854f4f --- /dev/null +++ b/queue-6.6/rdma-rxe-fix-mismatched-max_msg_sz.patch @@ -0,0 +1,64 @@ +From 68cf20df35bcb339c051882e3d6db524bb1a5a81 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 16 Dec 2024 20:19:53 +0800 +Subject: RDMA/rxe: Fix mismatched max_msg_sz + +From: zhenwei pi + +[ Upstream commit db03b70969aab4ef111a3369cfd90ea4da3a6aa0 ] + +User mode queries max_msg_sz as 0x800000 by command 'ibv_devinfo -v', +however ibv_post_send/ibv_post_recv has a limit of 2^31. Fix this +mismatched information. + +Signed-off-by: zhenwei pi +Fixes: f605f26ea196 ("RDMA/rxe: Protect QP state with qp->state_lock") +Fixes: 5bf944f24129 ("RDMA/rxe: Add error messages") +Link: https://patch.msgid.link/20241216121953.765331-1-pizhenwei@bytedance.com +Review-by: Zhu Yanjun +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/sw/rxe/rxe_param.h | 2 +- + drivers/infiniband/sw/rxe/rxe_verbs.c | 5 ++--- + 2 files changed, 3 insertions(+), 4 deletions(-) + +diff --git a/drivers/infiniband/sw/rxe/rxe_param.h b/drivers/infiniband/sw/rxe/rxe_param.h +index d2f57ead78ad1..003f681e5dc02 100644 +--- a/drivers/infiniband/sw/rxe/rxe_param.h ++++ b/drivers/infiniband/sw/rxe/rxe_param.h +@@ -129,7 +129,7 @@ enum rxe_device_param { + enum rxe_port_param { + RXE_PORT_GID_TBL_LEN = 1024, + RXE_PORT_PORT_CAP_FLAGS = IB_PORT_CM_SUP, +- RXE_PORT_MAX_MSG_SZ = 0x800000, ++ RXE_PORT_MAX_MSG_SZ = (1UL << 31), + RXE_PORT_BAD_PKEY_CNTR = 0, + RXE_PORT_QKEY_VIOL_CNTR = 0, + RXE_PORT_LID = 0, +diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c +index b00d611857e0f..dbb9baa4ffd00 100644 +--- a/drivers/infiniband/sw/rxe/rxe_verbs.c ++++ b/drivers/infiniband/sw/rxe/rxe_verbs.c +@@ -688,7 +688,7 @@ static int validate_send_wr(struct rxe_qp *qp, const struct ib_send_wr *ibwr, + for (i = 0; i < ibwr->num_sge; i++) + length += ibwr->sg_list[i].length; + +- if (length > (1UL << 31)) { ++ if (length > RXE_PORT_MAX_MSG_SZ) { + rxe_err_qp(qp, "message length too long\n"); + break; + } +@@ -977,8 +977,7 @@ static int post_one_recv(struct rxe_rq *rq, const struct ib_recv_wr *ibwr) + for (i = 0; i < num_sge; i++) + length += ibwr->sg_list[i].length; + +- /* IBA max message size is 2^31 */ +- if (length >= (1UL<<31)) { ++ if (length > RXE_PORT_MAX_MSG_SZ) { + err = -EINVAL; + rxe_dbg("message length too long\n"); + goto err_out; +-- +2.39.5 + diff --git a/queue-6.6/rdma-rxe-fix-the-warning-__rxe_cleanup-0x12c-0x170-r.patch b/queue-6.6/rdma-rxe-fix-the-warning-__rxe_cleanup-0x12c-0x170-r.patch new file mode 100644 index 0000000000..5e5b4c0536 --- /dev/null +++ b/queue-6.6/rdma-rxe-fix-the-warning-__rxe_cleanup-0x12c-0x170-r.patch @@ -0,0 +1,99 @@ +From 31c39a2fa5b195eeee8d50cb8b521a7912b608f8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 10 Jan 2025 17:09:27 +0100 +Subject: RDMA/rxe: Fix the warning "__rxe_cleanup+0x12c/0x170 [rdma_rxe]" + +From: Zhu Yanjun + +[ Upstream commit edc4ef0e0154096d6c0cf5e06af6fc330dbad9d1 ] + +The Call Trace is as below: +" + + ? show_regs.cold+0x1a/0x1f + ? __rxe_cleanup+0x12c/0x170 [rdma_rxe] + ? __warn+0x84/0xd0 + ? __rxe_cleanup+0x12c/0x170 [rdma_rxe] + ? report_bug+0x105/0x180 + ? handle_bug+0x46/0x80 + ? exc_invalid_op+0x19/0x70 + ? asm_exc_invalid_op+0x1b/0x20 + ? __rxe_cleanup+0x12c/0x170 [rdma_rxe] + ? __rxe_cleanup+0x124/0x170 [rdma_rxe] + rxe_destroy_qp.cold+0x24/0x29 [rdma_rxe] + ib_destroy_qp_user+0x118/0x190 [ib_core] + rdma_destroy_qp.cold+0x43/0x5e [rdma_cm] + rtrs_cq_qp_destroy.cold+0x1d/0x2b [rtrs_core] + rtrs_srv_close_work.cold+0x1b/0x31 [rtrs_server] + process_one_work+0x21d/0x3f0 + worker_thread+0x4a/0x3c0 + ? process_one_work+0x3f0/0x3f0 + kthread+0xf0/0x120 + ? kthread_complete_and_exit+0x20/0x20 + ret_from_fork+0x22/0x30 + +" +When too many rdma resources are allocated, rxe needs more time to +handle these rdma resources. Sometimes with the current timeout, rxe +can not release the rdma resources correctly. + +Compared with other rdma drivers, a bigger timeout is used. + +Fixes: 215d0a755e1b ("RDMA/rxe: Stop lookup of partially built objects") +Signed-off-by: Zhu Yanjun +Link: https://patch.msgid.link/20250110160927.55014-1-yanjun.zhu@linux.dev +Tested-by: Joe Klein +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/sw/rxe/rxe_pool.c | 11 +++++------ + 1 file changed, 5 insertions(+), 6 deletions(-) + +diff --git a/drivers/infiniband/sw/rxe/rxe_pool.c b/drivers/infiniband/sw/rxe/rxe_pool.c +index 6215c6de3a840..368e366f254d4 100644 +--- a/drivers/infiniband/sw/rxe/rxe_pool.c ++++ b/drivers/infiniband/sw/rxe/rxe_pool.c +@@ -178,7 +178,6 @@ int __rxe_cleanup(struct rxe_pool_elem *elem, bool sleepable) + { + struct rxe_pool *pool = elem->pool; + struct xarray *xa = &pool->xa; +- static int timeout = RXE_POOL_TIMEOUT; + int ret, err = 0; + void *xa_ret; + +@@ -202,19 +201,19 @@ int __rxe_cleanup(struct rxe_pool_elem *elem, bool sleepable) + * return to rdma-core + */ + if (sleepable) { +- if (!completion_done(&elem->complete) && timeout) { ++ if (!completion_done(&elem->complete)) { + ret = wait_for_completion_timeout(&elem->complete, +- timeout); ++ msecs_to_jiffies(50000)); + + /* Shouldn't happen. There are still references to + * the object but, rather than deadlock, free the + * object or pass back to rdma-core. + */ + if (WARN_ON(!ret)) +- err = -EINVAL; ++ err = -ETIMEDOUT; + } + } else { +- unsigned long until = jiffies + timeout; ++ unsigned long until = jiffies + RXE_POOL_TIMEOUT; + + /* AH objects are unique in that the destroy_ah verb + * can be called in atomic context. This delay +@@ -226,7 +225,7 @@ int __rxe_cleanup(struct rxe_pool_elem *elem, bool sleepable) + mdelay(1); + + if (WARN_ON(!completion_done(&elem->complete))) +- err = -EINVAL; ++ err = -ETIMEDOUT; + } + + if (pool->cleanup) +-- +2.39.5 + diff --git a/queue-6.6/rdma-rxe-improve-newline-in-printing-messages.patch b/queue-6.6/rdma-rxe-improve-newline-in-printing-messages.patch new file mode 100644 index 0000000000..d6fac43d40 --- /dev/null +++ b/queue-6.6/rdma-rxe-improve-newline-in-printing-messages.patch @@ -0,0 +1,1230 @@ +From 8330857bfa8da80df4516a37750c78a22ae827a3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 9 Jan 2024 16:32:52 +0800 +Subject: RDMA/rxe: Improve newline in printing messages + +From: Li Zhijian + +[ Upstream commit 6482718086bf69f9616d0b86d03514b17afaeb08 ] + +Previously rxe_{dbg,info,err}() macros are appended built-in newline, +but some users will add redundant newline sometimes. So remove the +built-in newline for these macros. + +In terms of rxe_{dbg,info,err}_xxx() macros, because they don't have +built-in newline, append newline when using them. + +CC: Daisuke Matsuda +Reviewed-by: Daisuke Matsuda +Acked-by: Zhu Yanjun +Signed-off-by: Li Zhijian +Link: https://lore.kernel.org/r/20240109083253.3629967-1-lizhijian@fujitsu.com +Signed-off-by: Leon Romanovsky +Stable-dep-of: db03b70969aa ("RDMA/rxe: Fix mismatched max_msg_sz") +Signed-off-by: Sasha Levin +--- + drivers/infiniband/sw/rxe/rxe.c | 6 +- + drivers/infiniband/sw/rxe/rxe.h | 6 +- + drivers/infiniband/sw/rxe/rxe_comp.c | 4 +- + drivers/infiniband/sw/rxe/rxe_cq.c | 4 +- + drivers/infiniband/sw/rxe/rxe_mr.c | 16 +- + drivers/infiniband/sw/rxe/rxe_mw.c | 2 +- + drivers/infiniband/sw/rxe/rxe_qp.c | 8 +- + drivers/infiniband/sw/rxe/rxe_resp.c | 12 +- + drivers/infiniband/sw/rxe/rxe_task.c | 4 +- + drivers/infiniband/sw/rxe/rxe_verbs.c | 216 +++++++++++++------------- + 10 files changed, 139 insertions(+), 139 deletions(-) + +diff --git a/drivers/infiniband/sw/rxe/rxe.c b/drivers/infiniband/sw/rxe/rxe.c +index 6f9ec8db014c7..0f8356cea2931 100644 +--- a/drivers/infiniband/sw/rxe/rxe.c ++++ b/drivers/infiniband/sw/rxe/rxe.c +@@ -163,7 +163,7 @@ void rxe_set_mtu(struct rxe_dev *rxe, unsigned int ndev_mtu) + port->attr.active_mtu = mtu; + port->mtu_cap = ib_mtu_enum_to_int(mtu); + +- rxe_info_dev(rxe, "Set mtu to %d", port->mtu_cap); ++ rxe_info_dev(rxe, "Set mtu to %d\n", port->mtu_cap); + } + + /* called by ifc layer to create new rxe device. +@@ -183,7 +183,7 @@ static int rxe_newlink(const char *ibdev_name, struct net_device *ndev) + int err = 0; + + if (is_vlan_dev(ndev)) { +- rxe_err("rxe creation allowed on top of a real device only"); ++ rxe_err("rxe creation allowed on top of a real device only\n"); + err = -EPERM; + goto err; + } +@@ -191,7 +191,7 @@ static int rxe_newlink(const char *ibdev_name, struct net_device *ndev) + rxe = rxe_get_dev_from_net(ndev); + if (rxe) { + ib_device_put(&rxe->ib_dev); +- rxe_err_dev(rxe, "already configured on %s", ndev->name); ++ rxe_err_dev(rxe, "already configured on %s\n", ndev->name); + err = -EEXIST; + goto err; + } +diff --git a/drivers/infiniband/sw/rxe/rxe.h b/drivers/infiniband/sw/rxe/rxe.h +index d33dd6cf83d37..d8fb2c7af30a7 100644 +--- a/drivers/infiniband/sw/rxe/rxe.h ++++ b/drivers/infiniband/sw/rxe/rxe.h +@@ -38,7 +38,7 @@ + + #define RXE_ROCE_V2_SPORT (0xc000) + +-#define rxe_dbg(fmt, ...) pr_debug("%s: " fmt "\n", __func__, ##__VA_ARGS__) ++#define rxe_dbg(fmt, ...) pr_debug("%s: " fmt, __func__, ##__VA_ARGS__) + #define rxe_dbg_dev(rxe, fmt, ...) ibdev_dbg(&(rxe)->ib_dev, \ + "%s: " fmt, __func__, ##__VA_ARGS__) + #define rxe_dbg_uc(uc, fmt, ...) ibdev_dbg((uc)->ibuc.device, \ +@@ -58,7 +58,7 @@ + #define rxe_dbg_mw(mw, fmt, ...) ibdev_dbg((mw)->ibmw.device, \ + "mw#%d %s: " fmt, (mw)->elem.index, __func__, ##__VA_ARGS__) + +-#define rxe_err(fmt, ...) pr_err_ratelimited("%s: " fmt "\n", __func__, \ ++#define rxe_err(fmt, ...) pr_err_ratelimited("%s: " fmt, __func__, \ + ##__VA_ARGS__) + #define rxe_err_dev(rxe, fmt, ...) ibdev_err_ratelimited(&(rxe)->ib_dev, \ + "%s: " fmt, __func__, ##__VA_ARGS__) +@@ -79,7 +79,7 @@ + #define rxe_err_mw(mw, fmt, ...) ibdev_err_ratelimited((mw)->ibmw.device, \ + "mw#%d %s: " fmt, (mw)->elem.index, __func__, ##__VA_ARGS__) + +-#define rxe_info(fmt, ...) pr_info_ratelimited("%s: " fmt "\n", __func__, \ ++#define rxe_info(fmt, ...) pr_info_ratelimited("%s: " fmt, __func__, \ + ##__VA_ARGS__) + #define rxe_info_dev(rxe, fmt, ...) ibdev_info_ratelimited(&(rxe)->ib_dev, \ + "%s: " fmt, __func__, ##__VA_ARGS__) +diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c +index acd2172bf092b..c997b7cbf2a9e 100644 +--- a/drivers/infiniband/sw/rxe/rxe_comp.c ++++ b/drivers/infiniband/sw/rxe/rxe_comp.c +@@ -433,7 +433,7 @@ static void make_send_cqe(struct rxe_qp *qp, struct rxe_send_wqe *wqe, + } + } else { + if (wqe->status != IB_WC_WR_FLUSH_ERR) +- rxe_err_qp(qp, "non-flush error status = %d", ++ rxe_err_qp(qp, "non-flush error status = %d\n", + wqe->status); + } + } +@@ -582,7 +582,7 @@ static int flush_send_wqe(struct rxe_qp *qp, struct rxe_send_wqe *wqe) + + err = rxe_cq_post(qp->scq, &cqe, 0); + if (err) +- rxe_dbg_cq(qp->scq, "post cq failed, err = %d", err); ++ rxe_dbg_cq(qp->scq, "post cq failed, err = %d\n", err); + + return err; + } +diff --git a/drivers/infiniband/sw/rxe/rxe_cq.c b/drivers/infiniband/sw/rxe/rxe_cq.c +index d5486cbb3f100..fec87c9030abd 100644 +--- a/drivers/infiniband/sw/rxe/rxe_cq.c ++++ b/drivers/infiniband/sw/rxe/rxe_cq.c +@@ -27,7 +27,7 @@ int rxe_cq_chk_attr(struct rxe_dev *rxe, struct rxe_cq *cq, + if (cq) { + count = queue_count(cq->queue, QUEUE_TYPE_TO_CLIENT); + if (cqe < count) { +- rxe_dbg_cq(cq, "cqe(%d) < current # elements in queue (%d)", ++ rxe_dbg_cq(cq, "cqe(%d) < current # elements in queue (%d)\n", + cqe, count); + goto err1; + } +@@ -96,7 +96,7 @@ int rxe_cq_post(struct rxe_cq *cq, struct rxe_cqe *cqe, int solicited) + + full = queue_full(cq->queue, QUEUE_TYPE_TO_CLIENT); + if (unlikely(full)) { +- rxe_err_cq(cq, "queue full"); ++ rxe_err_cq(cq, "queue full\n"); + spin_unlock_irqrestore(&cq->cq_lock, flags); + if (cq->ibcq.event_handler) { + ev.device = cq->ibcq.device; +diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c +index f54042e9aeb26..bc81fde696ee9 100644 +--- a/drivers/infiniband/sw/rxe/rxe_mr.c ++++ b/drivers/infiniband/sw/rxe/rxe_mr.c +@@ -34,7 +34,7 @@ int mr_check_range(struct rxe_mr *mr, u64 iova, size_t length) + case IB_MR_TYPE_MEM_REG: + if (iova < mr->ibmr.iova || + iova + length > mr->ibmr.iova + mr->ibmr.length) { +- rxe_dbg_mr(mr, "iova/length out of range"); ++ rxe_dbg_mr(mr, "iova/length out of range\n"); + return -EINVAL; + } + return 0; +@@ -319,7 +319,7 @@ int rxe_mr_copy(struct rxe_mr *mr, u64 iova, void *addr, + + err = mr_check_range(mr, iova, length); + if (unlikely(err)) { +- rxe_dbg_mr(mr, "iova out of range"); ++ rxe_dbg_mr(mr, "iova out of range\n"); + return err; + } + +@@ -477,7 +477,7 @@ int rxe_mr_do_atomic_op(struct rxe_mr *mr, u64 iova, int opcode, + u64 *va; + + if (unlikely(mr->state != RXE_MR_STATE_VALID)) { +- rxe_dbg_mr(mr, "mr not in valid state"); ++ rxe_dbg_mr(mr, "mr not in valid state\n"); + return RESPST_ERR_RKEY_VIOLATION; + } + +@@ -490,7 +490,7 @@ int rxe_mr_do_atomic_op(struct rxe_mr *mr, u64 iova, int opcode, + + err = mr_check_range(mr, iova, sizeof(value)); + if (err) { +- rxe_dbg_mr(mr, "iova out of range"); ++ rxe_dbg_mr(mr, "iova out of range\n"); + return RESPST_ERR_RKEY_VIOLATION; + } + page_offset = rxe_mr_iova_to_page_offset(mr, iova); +@@ -501,7 +501,7 @@ int rxe_mr_do_atomic_op(struct rxe_mr *mr, u64 iova, int opcode, + } + + if (unlikely(page_offset & 0x7)) { +- rxe_dbg_mr(mr, "iova not aligned"); ++ rxe_dbg_mr(mr, "iova not aligned\n"); + return RESPST_ERR_MISALIGNED_ATOMIC; + } + +@@ -534,7 +534,7 @@ int rxe_mr_do_atomic_write(struct rxe_mr *mr, u64 iova, u64 value) + + /* See IBA oA19-28 */ + if (unlikely(mr->state != RXE_MR_STATE_VALID)) { +- rxe_dbg_mr(mr, "mr not in valid state"); ++ rxe_dbg_mr(mr, "mr not in valid state\n"); + return RESPST_ERR_RKEY_VIOLATION; + } + +@@ -548,7 +548,7 @@ int rxe_mr_do_atomic_write(struct rxe_mr *mr, u64 iova, u64 value) + /* See IBA oA19-28 */ + err = mr_check_range(mr, iova, sizeof(value)); + if (unlikely(err)) { +- rxe_dbg_mr(mr, "iova out of range"); ++ rxe_dbg_mr(mr, "iova out of range\n"); + return RESPST_ERR_RKEY_VIOLATION; + } + page_offset = rxe_mr_iova_to_page_offset(mr, iova); +@@ -560,7 +560,7 @@ int rxe_mr_do_atomic_write(struct rxe_mr *mr, u64 iova, u64 value) + + /* See IBA A19.4.2 */ + if (unlikely(page_offset & 0x7)) { +- rxe_dbg_mr(mr, "misaligned address"); ++ rxe_dbg_mr(mr, "misaligned address\n"); + return RESPST_ERR_MISALIGNED_ATOMIC; + } + +diff --git a/drivers/infiniband/sw/rxe/rxe_mw.c b/drivers/infiniband/sw/rxe/rxe_mw.c +index d9312b5c9d207..379e65bfcd49a 100644 +--- a/drivers/infiniband/sw/rxe/rxe_mw.c ++++ b/drivers/infiniband/sw/rxe/rxe_mw.c +@@ -198,7 +198,7 @@ int rxe_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe) + } + + if (access & ~RXE_ACCESS_SUPPORTED_MW) { +- rxe_err_mw(mw, "access %#x not supported", access); ++ rxe_err_mw(mw, "access %#x not supported\n", access); + ret = -EOPNOTSUPP; + goto err_drop_mr; + } +diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c +index 3767d7fc0aac8..287fc8b8f5baf 100644 +--- a/drivers/infiniband/sw/rxe/rxe_qp.c ++++ b/drivers/infiniband/sw/rxe/rxe_qp.c +@@ -201,7 +201,7 @@ static int rxe_init_sq(struct rxe_qp *qp, struct ib_qp_init_attr *init, + qp->sq.queue = rxe_queue_init(rxe, &qp->sq.max_wr, wqe_size, + QUEUE_TYPE_FROM_CLIENT); + if (!qp->sq.queue) { +- rxe_err_qp(qp, "Unable to allocate send queue"); ++ rxe_err_qp(qp, "Unable to allocate send queue\n"); + err = -ENOMEM; + goto err_out; + } +@@ -211,7 +211,7 @@ static int rxe_init_sq(struct rxe_qp *qp, struct ib_qp_init_attr *init, + qp->sq.queue->buf, qp->sq.queue->buf_size, + &qp->sq.queue->ip); + if (err) { +- rxe_err_qp(qp, "do_mmap_info failed, err = %d", err); ++ rxe_err_qp(qp, "do_mmap_info failed, err = %d\n", err); + goto err_free; + } + +@@ -292,7 +292,7 @@ static int rxe_init_rq(struct rxe_qp *qp, struct ib_qp_init_attr *init, + qp->rq.queue = rxe_queue_init(rxe, &qp->rq.max_wr, wqe_size, + QUEUE_TYPE_FROM_CLIENT); + if (!qp->rq.queue) { +- rxe_err_qp(qp, "Unable to allocate recv queue"); ++ rxe_err_qp(qp, "Unable to allocate recv queue\n"); + err = -ENOMEM; + goto err_out; + } +@@ -302,7 +302,7 @@ static int rxe_init_rq(struct rxe_qp *qp, struct ib_qp_init_attr *init, + qp->rq.queue->buf, qp->rq.queue->buf_size, + &qp->rq.queue->ip); + if (err) { +- rxe_err_qp(qp, "do_mmap_info failed, err = %d", err); ++ rxe_err_qp(qp, "do_mmap_info failed, err = %d\n", err); + goto err_free; + } + +diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c +index c02aa27fe5d81..fa2b87c749292 100644 +--- a/drivers/infiniband/sw/rxe/rxe_resp.c ++++ b/drivers/infiniband/sw/rxe/rxe_resp.c +@@ -375,18 +375,18 @@ static enum resp_states rxe_resp_check_length(struct rxe_qp *qp, + if ((pkt->mask & RXE_START_MASK) && + (pkt->mask & RXE_END_MASK)) { + if (unlikely(payload > mtu)) { +- rxe_dbg_qp(qp, "only packet too long"); ++ rxe_dbg_qp(qp, "only packet too long\n"); + return RESPST_ERR_LENGTH; + } + } else if ((pkt->mask & RXE_START_MASK) || + (pkt->mask & RXE_MIDDLE_MASK)) { + if (unlikely(payload != mtu)) { +- rxe_dbg_qp(qp, "first or middle packet not mtu"); ++ rxe_dbg_qp(qp, "first or middle packet not mtu\n"); + return RESPST_ERR_LENGTH; + } + } else if (pkt->mask & RXE_END_MASK) { + if (unlikely((payload == 0) || (payload > mtu))) { +- rxe_dbg_qp(qp, "last packet zero or too long"); ++ rxe_dbg_qp(qp, "last packet zero or too long\n"); + return RESPST_ERR_LENGTH; + } + } +@@ -395,7 +395,7 @@ static enum resp_states rxe_resp_check_length(struct rxe_qp *qp, + /* See IBA C9-94 */ + if (pkt->mask & RXE_RETH_MASK) { + if (reth_len(pkt) > (1U << 31)) { +- rxe_dbg_qp(qp, "dma length too long"); ++ rxe_dbg_qp(qp, "dma length too long\n"); + return RESPST_ERR_LENGTH; + } + } +@@ -1146,7 +1146,7 @@ static enum resp_states do_complete(struct rxe_qp *qp, + } + } else { + if (wc->status != IB_WC_WR_FLUSH_ERR) +- rxe_err_qp(qp, "non-flush error status = %d", ++ rxe_err_qp(qp, "non-flush error status = %d\n", + wc->status); + } + +@@ -1455,7 +1455,7 @@ static int flush_recv_wqe(struct rxe_qp *qp, struct rxe_recv_wqe *wqe) + + err = rxe_cq_post(qp->rcq, &cqe, 0); + if (err) +- rxe_dbg_cq(qp->rcq, "post cq failed err = %d", err); ++ rxe_dbg_cq(qp->rcq, "post cq failed err = %d\n", err); + + return err; + } +diff --git a/drivers/infiniband/sw/rxe/rxe_task.c b/drivers/infiniband/sw/rxe/rxe_task.c +index 1501120d4f524..80332638d9e3a 100644 +--- a/drivers/infiniband/sw/rxe/rxe_task.c ++++ b/drivers/infiniband/sw/rxe/rxe_task.c +@@ -156,7 +156,7 @@ static void do_task(struct rxe_task *task) + + default: + WARN_ON(1); +- rxe_dbg_qp(task->qp, "unexpected task state = %d", ++ rxe_dbg_qp(task->qp, "unexpected task state = %d\n", + task->state); + task->state = TASK_STATE_IDLE; + } +@@ -167,7 +167,7 @@ static void do_task(struct rxe_task *task) + if (WARN_ON(task->num_done != task->num_sched)) + rxe_dbg_qp( + task->qp, +- "%ld tasks scheduled, %ld tasks done", ++ "%ld tasks scheduled, %ld tasks done\n", + task->num_sched, task->num_done); + } + spin_unlock_irqrestore(&task->lock, flags); +diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c +index 9f46b9f74825f..b00d611857e0f 100644 +--- a/drivers/infiniband/sw/rxe/rxe_verbs.c ++++ b/drivers/infiniband/sw/rxe/rxe_verbs.c +@@ -23,7 +23,7 @@ static int rxe_query_device(struct ib_device *ibdev, + int err; + + if (udata->inlen || udata->outlen) { +- rxe_dbg_dev(rxe, "malformed udata"); ++ rxe_dbg_dev(rxe, "malformed udata\n"); + err = -EINVAL; + goto err_out; + } +@@ -33,7 +33,7 @@ static int rxe_query_device(struct ib_device *ibdev, + return 0; + + err_out: +- rxe_err_dev(rxe, "returned err = %d", err); ++ rxe_err_dev(rxe, "returned err = %d\n", err); + return err; + } + +@@ -45,7 +45,7 @@ static int rxe_query_port(struct ib_device *ibdev, + + if (port_num != 1) { + err = -EINVAL; +- rxe_dbg_dev(rxe, "bad port_num = %d", port_num); ++ rxe_dbg_dev(rxe, "bad port_num = %d\n", port_num); + goto err_out; + } + +@@ -67,7 +67,7 @@ static int rxe_query_port(struct ib_device *ibdev, + return ret; + + err_out: +- rxe_err_dev(rxe, "returned err = %d", err); ++ rxe_err_dev(rxe, "returned err = %d\n", err); + return err; + } + +@@ -79,7 +79,7 @@ static int rxe_query_pkey(struct ib_device *ibdev, + + if (index != 0) { + err = -EINVAL; +- rxe_dbg_dev(rxe, "bad pkey index = %d", index); ++ rxe_dbg_dev(rxe, "bad pkey index = %d\n", index); + goto err_out; + } + +@@ -87,7 +87,7 @@ static int rxe_query_pkey(struct ib_device *ibdev, + return 0; + + err_out: +- rxe_err_dev(rxe, "returned err = %d", err); ++ rxe_err_dev(rxe, "returned err = %d\n", err); + return err; + } + +@@ -100,7 +100,7 @@ static int rxe_modify_device(struct ib_device *ibdev, + if (mask & ~(IB_DEVICE_MODIFY_SYS_IMAGE_GUID | + IB_DEVICE_MODIFY_NODE_DESC)) { + err = -EOPNOTSUPP; +- rxe_dbg_dev(rxe, "unsupported mask = 0x%x", mask); ++ rxe_dbg_dev(rxe, "unsupported mask = 0x%x\n", mask); + goto err_out; + } + +@@ -115,7 +115,7 @@ static int rxe_modify_device(struct ib_device *ibdev, + return 0; + + err_out: +- rxe_err_dev(rxe, "returned err = %d", err); ++ rxe_err_dev(rxe, "returned err = %d\n", err); + return err; + } + +@@ -128,14 +128,14 @@ static int rxe_modify_port(struct ib_device *ibdev, u32 port_num, + + if (port_num != 1) { + err = -EINVAL; +- rxe_dbg_dev(rxe, "bad port_num = %d", port_num); ++ rxe_dbg_dev(rxe, "bad port_num = %d\n", port_num); + goto err_out; + } + + //TODO is shutdown useful + if (mask & ~(IB_PORT_RESET_QKEY_CNTR)) { + err = -EOPNOTSUPP; +- rxe_dbg_dev(rxe, "unsupported mask = 0x%x", mask); ++ rxe_dbg_dev(rxe, "unsupported mask = 0x%x\n", mask); + goto err_out; + } + +@@ -149,7 +149,7 @@ static int rxe_modify_port(struct ib_device *ibdev, u32 port_num, + return 0; + + err_out: +- rxe_err_dev(rxe, "returned err = %d", err); ++ rxe_err_dev(rxe, "returned err = %d\n", err); + return err; + } + +@@ -161,14 +161,14 @@ static enum rdma_link_layer rxe_get_link_layer(struct ib_device *ibdev, + + if (port_num != 1) { + err = -EINVAL; +- rxe_dbg_dev(rxe, "bad port_num = %d", port_num); ++ rxe_dbg_dev(rxe, "bad port_num = %d\n", port_num); + goto err_out; + } + + return IB_LINK_LAYER_ETHERNET; + + err_out: +- rxe_err_dev(rxe, "returned err = %d", err); ++ rxe_err_dev(rxe, "returned err = %d\n", err); + return err; + } + +@@ -181,7 +181,7 @@ static int rxe_port_immutable(struct ib_device *ibdev, u32 port_num, + + if (port_num != 1) { + err = -EINVAL; +- rxe_dbg_dev(rxe, "bad port_num = %d", port_num); ++ rxe_dbg_dev(rxe, "bad port_num = %d\n", port_num); + goto err_out; + } + +@@ -197,7 +197,7 @@ static int rxe_port_immutable(struct ib_device *ibdev, u32 port_num, + return 0; + + err_out: +- rxe_err_dev(rxe, "returned err = %d", err); ++ rxe_err_dev(rxe, "returned err = %d\n", err); + return err; + } + +@@ -210,7 +210,7 @@ static int rxe_alloc_ucontext(struct ib_ucontext *ibuc, struct ib_udata *udata) + + err = rxe_add_to_pool(&rxe->uc_pool, uc); + if (err) +- rxe_err_dev(rxe, "unable to create uc"); ++ rxe_err_dev(rxe, "unable to create uc\n"); + + return err; + } +@@ -222,7 +222,7 @@ static void rxe_dealloc_ucontext(struct ib_ucontext *ibuc) + + err = rxe_cleanup(uc); + if (err) +- rxe_err_uc(uc, "cleanup failed, err = %d", err); ++ rxe_err_uc(uc, "cleanup failed, err = %d\n", err); + } + + /* pd */ +@@ -234,14 +234,14 @@ static int rxe_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) + + err = rxe_add_to_pool(&rxe->pd_pool, pd); + if (err) { +- rxe_dbg_dev(rxe, "unable to alloc pd"); ++ rxe_dbg_dev(rxe, "unable to alloc pd\n"); + goto err_out; + } + + return 0; + + err_out: +- rxe_err_dev(rxe, "returned err = %d", err); ++ rxe_err_dev(rxe, "returned err = %d\n", err); + return err; + } + +@@ -252,7 +252,7 @@ static int rxe_dealloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) + + err = rxe_cleanup(pd); + if (err) +- rxe_err_pd(pd, "cleanup failed, err = %d", err); ++ rxe_err_pd(pd, "cleanup failed, err = %d\n", err); + + return 0; + } +@@ -279,7 +279,7 @@ static int rxe_create_ah(struct ib_ah *ibah, + err = rxe_add_to_pool_ah(&rxe->ah_pool, ah, + init_attr->flags & RDMA_CREATE_AH_SLEEPABLE); + if (err) { +- rxe_dbg_dev(rxe, "unable to create ah"); ++ rxe_dbg_dev(rxe, "unable to create ah\n"); + goto err_out; + } + +@@ -288,7 +288,7 @@ static int rxe_create_ah(struct ib_ah *ibah, + + err = rxe_ah_chk_attr(ah, init_attr->ah_attr); + if (err) { +- rxe_dbg_ah(ah, "bad attr"); ++ rxe_dbg_ah(ah, "bad attr\n"); + goto err_cleanup; + } + +@@ -298,7 +298,7 @@ static int rxe_create_ah(struct ib_ah *ibah, + sizeof(uresp->ah_num)); + if (err) { + err = -EFAULT; +- rxe_dbg_ah(ah, "unable to copy to user"); ++ rxe_dbg_ah(ah, "unable to copy to user\n"); + goto err_cleanup; + } + } else if (ah->is_user) { +@@ -314,9 +314,9 @@ static int rxe_create_ah(struct ib_ah *ibah, + err_cleanup: + cleanup_err = rxe_cleanup(ah); + if (cleanup_err) +- rxe_err_ah(ah, "cleanup failed, err = %d", cleanup_err); ++ rxe_err_ah(ah, "cleanup failed, err = %d\n", cleanup_err); + err_out: +- rxe_err_ah(ah, "returned err = %d", err); ++ rxe_err_ah(ah, "returned err = %d\n", err); + return err; + } + +@@ -327,7 +327,7 @@ static int rxe_modify_ah(struct ib_ah *ibah, struct rdma_ah_attr *attr) + + err = rxe_ah_chk_attr(ah, attr); + if (err) { +- rxe_dbg_ah(ah, "bad attr"); ++ rxe_dbg_ah(ah, "bad attr\n"); + goto err_out; + } + +@@ -336,7 +336,7 @@ static int rxe_modify_ah(struct ib_ah *ibah, struct rdma_ah_attr *attr) + return 0; + + err_out: +- rxe_err_ah(ah, "returned err = %d", err); ++ rxe_err_ah(ah, "returned err = %d\n", err); + return err; + } + +@@ -358,7 +358,7 @@ static int rxe_destroy_ah(struct ib_ah *ibah, u32 flags) + + err = rxe_cleanup_ah(ah, flags & RDMA_DESTROY_AH_SLEEPABLE); + if (err) +- rxe_err_ah(ah, "cleanup failed, err = %d", err); ++ rxe_err_ah(ah, "cleanup failed, err = %d\n", err); + + return 0; + } +@@ -376,7 +376,7 @@ static int rxe_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init, + if (udata) { + if (udata->outlen < sizeof(*uresp)) { + err = -EINVAL; +- rxe_err_dev(rxe, "malformed udata"); ++ rxe_err_dev(rxe, "malformed udata\n"); + goto err_out; + } + uresp = udata->outbuf; +@@ -384,20 +384,20 @@ static int rxe_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init, + + if (init->srq_type != IB_SRQT_BASIC) { + err = -EOPNOTSUPP; +- rxe_dbg_dev(rxe, "srq type = %d, not supported", ++ rxe_dbg_dev(rxe, "srq type = %d, not supported\n", + init->srq_type); + goto err_out; + } + + err = rxe_srq_chk_init(rxe, init); + if (err) { +- rxe_dbg_dev(rxe, "invalid init attributes"); ++ rxe_dbg_dev(rxe, "invalid init attributes\n"); + goto err_out; + } + + err = rxe_add_to_pool(&rxe->srq_pool, srq); + if (err) { +- rxe_dbg_dev(rxe, "unable to create srq, err = %d", err); ++ rxe_dbg_dev(rxe, "unable to create srq, err = %d\n", err); + goto err_out; + } + +@@ -406,7 +406,7 @@ static int rxe_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init, + + err = rxe_srq_from_init(rxe, srq, init, udata, uresp); + if (err) { +- rxe_dbg_srq(srq, "create srq failed, err = %d", err); ++ rxe_dbg_srq(srq, "create srq failed, err = %d\n", err); + goto err_cleanup; + } + +@@ -415,9 +415,9 @@ static int rxe_create_srq(struct ib_srq *ibsrq, struct ib_srq_init_attr *init, + err_cleanup: + cleanup_err = rxe_cleanup(srq); + if (cleanup_err) +- rxe_err_srq(srq, "cleanup failed, err = %d", cleanup_err); ++ rxe_err_srq(srq, "cleanup failed, err = %d\n", cleanup_err); + err_out: +- rxe_err_dev(rxe, "returned err = %d", err); ++ rxe_err_dev(rxe, "returned err = %d\n", err); + return err; + } + +@@ -433,34 +433,34 @@ static int rxe_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, + if (udata) { + if (udata->inlen < sizeof(cmd)) { + err = -EINVAL; +- rxe_dbg_srq(srq, "malformed udata"); ++ rxe_dbg_srq(srq, "malformed udata\n"); + goto err_out; + } + + err = ib_copy_from_udata(&cmd, udata, sizeof(cmd)); + if (err) { + err = -EFAULT; +- rxe_dbg_srq(srq, "unable to read udata"); ++ rxe_dbg_srq(srq, "unable to read udata\n"); + goto err_out; + } + } + + err = rxe_srq_chk_attr(rxe, srq, attr, mask); + if (err) { +- rxe_dbg_srq(srq, "bad init attributes"); ++ rxe_dbg_srq(srq, "bad init attributes\n"); + goto err_out; + } + + err = rxe_srq_from_attr(rxe, srq, attr, mask, &cmd, udata); + if (err) { +- rxe_dbg_srq(srq, "bad attr"); ++ rxe_dbg_srq(srq, "bad attr\n"); + goto err_out; + } + + return 0; + + err_out: +- rxe_err_srq(srq, "returned err = %d", err); ++ rxe_err_srq(srq, "returned err = %d\n", err); + return err; + } + +@@ -471,7 +471,7 @@ static int rxe_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr) + + if (srq->error) { + err = -EINVAL; +- rxe_dbg_srq(srq, "srq in error state"); ++ rxe_dbg_srq(srq, "srq in error state\n"); + goto err_out; + } + +@@ -481,7 +481,7 @@ static int rxe_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr) + return 0; + + err_out: +- rxe_err_srq(srq, "returned err = %d", err); ++ rxe_err_srq(srq, "returned err = %d\n", err); + return err; + } + +@@ -505,7 +505,7 @@ static int rxe_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr, + + if (err) { + *bad_wr = wr; +- rxe_err_srq(srq, "returned err = %d", err); ++ rxe_err_srq(srq, "returned err = %d\n", err); + } + + return err; +@@ -518,7 +518,7 @@ static int rxe_destroy_srq(struct ib_srq *ibsrq, struct ib_udata *udata) + + err = rxe_cleanup(srq); + if (err) +- rxe_err_srq(srq, "cleanup failed, err = %d", err); ++ rxe_err_srq(srq, "cleanup failed, err = %d\n", err); + + return 0; + } +@@ -536,13 +536,13 @@ static int rxe_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init, + if (udata) { + if (udata->inlen) { + err = -EINVAL; +- rxe_dbg_dev(rxe, "malformed udata, err = %d", err); ++ rxe_dbg_dev(rxe, "malformed udata, err = %d\n", err); + goto err_out; + } + + if (udata->outlen < sizeof(*uresp)) { + err = -EINVAL; +- rxe_dbg_dev(rxe, "malformed udata, err = %d", err); ++ rxe_dbg_dev(rxe, "malformed udata, err = %d\n", err); + goto err_out; + } + +@@ -554,25 +554,25 @@ static int rxe_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init, + + if (init->create_flags) { + err = -EOPNOTSUPP; +- rxe_dbg_dev(rxe, "unsupported create_flags, err = %d", err); ++ rxe_dbg_dev(rxe, "unsupported create_flags, err = %d\n", err); + goto err_out; + } + + err = rxe_qp_chk_init(rxe, init); + if (err) { +- rxe_dbg_dev(rxe, "bad init attr, err = %d", err); ++ rxe_dbg_dev(rxe, "bad init attr, err = %d\n", err); + goto err_out; + } + + err = rxe_add_to_pool(&rxe->qp_pool, qp); + if (err) { +- rxe_dbg_dev(rxe, "unable to create qp, err = %d", err); ++ rxe_dbg_dev(rxe, "unable to create qp, err = %d\n", err); + goto err_out; + } + + err = rxe_qp_from_init(rxe, qp, pd, init, uresp, ibqp->pd, udata); + if (err) { +- rxe_dbg_qp(qp, "create qp failed, err = %d", err); ++ rxe_dbg_qp(qp, "create qp failed, err = %d\n", err); + goto err_cleanup; + } + +@@ -582,9 +582,9 @@ static int rxe_create_qp(struct ib_qp *ibqp, struct ib_qp_init_attr *init, + err_cleanup: + cleanup_err = rxe_cleanup(qp); + if (cleanup_err) +- rxe_err_qp(qp, "cleanup failed, err = %d", cleanup_err); ++ rxe_err_qp(qp, "cleanup failed, err = %d\n", cleanup_err); + err_out: +- rxe_err_dev(rxe, "returned err = %d", err); ++ rxe_err_dev(rxe, "returned err = %d\n", err); + return err; + } + +@@ -597,20 +597,20 @@ static int rxe_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, + + if (mask & ~IB_QP_ATTR_STANDARD_BITS) { + err = -EOPNOTSUPP; +- rxe_dbg_qp(qp, "unsupported mask = 0x%x, err = %d", ++ rxe_dbg_qp(qp, "unsupported mask = 0x%x, err = %d\n", + mask, err); + goto err_out; + } + + err = rxe_qp_chk_attr(rxe, qp, attr, mask); + if (err) { +- rxe_dbg_qp(qp, "bad mask/attr, err = %d", err); ++ rxe_dbg_qp(qp, "bad mask/attr, err = %d\n", err); + goto err_out; + } + + err = rxe_qp_from_attr(qp, attr, mask, udata); + if (err) { +- rxe_dbg_qp(qp, "modify qp failed, err = %d", err); ++ rxe_dbg_qp(qp, "modify qp failed, err = %d\n", err); + goto err_out; + } + +@@ -622,7 +622,7 @@ static int rxe_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, + return 0; + + err_out: +- rxe_err_qp(qp, "returned err = %d", err); ++ rxe_err_qp(qp, "returned err = %d\n", err); + return err; + } + +@@ -644,18 +644,18 @@ static int rxe_destroy_qp(struct ib_qp *ibqp, struct ib_udata *udata) + + err = rxe_qp_chk_destroy(qp); + if (err) { +- rxe_dbg_qp(qp, "unable to destroy qp, err = %d", err); ++ rxe_dbg_qp(qp, "unable to destroy qp, err = %d\n", err); + goto err_out; + } + + err = rxe_cleanup(qp); + if (err) +- rxe_err_qp(qp, "cleanup failed, err = %d", err); ++ rxe_err_qp(qp, "cleanup failed, err = %d\n", err); + + return 0; + + err_out: +- rxe_err_qp(qp, "returned err = %d", err); ++ rxe_err_qp(qp, "returned err = %d\n", err); + return err; + } + +@@ -675,12 +675,12 @@ static int validate_send_wr(struct rxe_qp *qp, const struct ib_send_wr *ibwr, + do { + mask = wr_opcode_mask(ibwr->opcode, qp); + if (!mask) { +- rxe_err_qp(qp, "bad wr opcode for qp type"); ++ rxe_err_qp(qp, "bad wr opcode for qp type\n"); + break; + } + + if (num_sge > sq->max_sge) { +- rxe_err_qp(qp, "num_sge > max_sge"); ++ rxe_err_qp(qp, "num_sge > max_sge\n"); + break; + } + +@@ -689,27 +689,27 @@ static int validate_send_wr(struct rxe_qp *qp, const struct ib_send_wr *ibwr, + length += ibwr->sg_list[i].length; + + if (length > (1UL << 31)) { +- rxe_err_qp(qp, "message length too long"); ++ rxe_err_qp(qp, "message length too long\n"); + break; + } + + if (mask & WR_ATOMIC_MASK) { + if (length != 8) { +- rxe_err_qp(qp, "atomic length != 8"); ++ rxe_err_qp(qp, "atomic length != 8\n"); + break; + } + if (atomic_wr(ibwr)->remote_addr & 0x7) { +- rxe_err_qp(qp, "misaligned atomic address"); ++ rxe_err_qp(qp, "misaligned atomic address\n"); + break; + } + } + if (ibwr->send_flags & IB_SEND_INLINE) { + if (!(mask & WR_INLINE_MASK)) { +- rxe_err_qp(qp, "opcode doesn't support inline data"); ++ rxe_err_qp(qp, "opcode doesn't support inline data\n"); + break; + } + if (length > sq->max_inline) { +- rxe_err_qp(qp, "inline length too big"); ++ rxe_err_qp(qp, "inline length too big\n"); + break; + } + } +@@ -747,7 +747,7 @@ static int init_send_wr(struct rxe_qp *qp, struct rxe_send_wr *wr, + case IB_WR_SEND: + break; + default: +- rxe_err_qp(qp, "bad wr opcode %d for UD/GSI QP", ++ rxe_err_qp(qp, "bad wr opcode %d for UD/GSI QP\n", + wr->opcode); + return -EINVAL; + } +@@ -795,7 +795,7 @@ static int init_send_wr(struct rxe_qp *qp, struct rxe_send_wr *wr, + case IB_WR_ATOMIC_WRITE: + break; + default: +- rxe_err_qp(qp, "unsupported wr opcode %d", ++ rxe_err_qp(qp, "unsupported wr opcode %d\n", + wr->opcode); + return -EINVAL; + } +@@ -870,7 +870,7 @@ static int post_one_send(struct rxe_qp *qp, const struct ib_send_wr *ibwr) + + full = queue_full(sq->queue, QUEUE_TYPE_FROM_ULP); + if (unlikely(full)) { +- rxe_err_qp(qp, "send queue full"); ++ rxe_err_qp(qp, "send queue full\n"); + return -ENOMEM; + } + +@@ -926,14 +926,14 @@ static int rxe_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr, + /* caller has already called destroy_qp */ + if (WARN_ON_ONCE(!qp->valid)) { + spin_unlock_irqrestore(&qp->state_lock, flags); +- rxe_err_qp(qp, "qp has been destroyed"); ++ rxe_err_qp(qp, "qp has been destroyed\n"); + return -EINVAL; + } + + if (unlikely(qp_state(qp) < IB_QPS_RTS)) { + spin_unlock_irqrestore(&qp->state_lock, flags); + *bad_wr = wr; +- rxe_err_qp(qp, "qp not ready to send"); ++ rxe_err_qp(qp, "qp not ready to send\n"); + return -EINVAL; + } + spin_unlock_irqrestore(&qp->state_lock, flags); +@@ -963,13 +963,13 @@ static int post_one_recv(struct rxe_rq *rq, const struct ib_recv_wr *ibwr) + full = queue_full(rq->queue, QUEUE_TYPE_FROM_ULP); + if (unlikely(full)) { + err = -ENOMEM; +- rxe_dbg("queue full"); ++ rxe_dbg("queue full\n"); + goto err_out; + } + + if (unlikely(num_sge > rq->max_sge)) { + err = -EINVAL; +- rxe_dbg("bad num_sge > max_sge"); ++ rxe_dbg("bad num_sge > max_sge\n"); + goto err_out; + } + +@@ -980,7 +980,7 @@ static int post_one_recv(struct rxe_rq *rq, const struct ib_recv_wr *ibwr) + /* IBA max message size is 2^31 */ + if (length >= (1UL<<31)) { + err = -EINVAL; +- rxe_dbg("message length too long"); ++ rxe_dbg("message length too long\n"); + goto err_out; + } + +@@ -1000,7 +1000,7 @@ static int post_one_recv(struct rxe_rq *rq, const struct ib_recv_wr *ibwr) + return 0; + + err_out: +- rxe_dbg("returned err = %d", err); ++ rxe_dbg("returned err = %d\n", err); + return err; + } + +@@ -1016,7 +1016,7 @@ static int rxe_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + /* caller has already called destroy_qp */ + if (WARN_ON_ONCE(!qp->valid)) { + spin_unlock_irqrestore(&qp->state_lock, flags); +- rxe_err_qp(qp, "qp has been destroyed"); ++ rxe_err_qp(qp, "qp has been destroyed\n"); + return -EINVAL; + } + +@@ -1024,14 +1024,14 @@ static int rxe_post_recv(struct ib_qp *ibqp, const struct ib_recv_wr *wr, + if (unlikely((qp_state(qp) < IB_QPS_INIT))) { + spin_unlock_irqrestore(&qp->state_lock, flags); + *bad_wr = wr; +- rxe_dbg_qp(qp, "qp not ready to post recv"); ++ rxe_dbg_qp(qp, "qp not ready to post recv\n"); + return -EINVAL; + } + spin_unlock_irqrestore(&qp->state_lock, flags); + + if (unlikely(qp->srq)) { + *bad_wr = wr; +- rxe_dbg_qp(qp, "qp has srq, use post_srq_recv instead"); ++ rxe_dbg_qp(qp, "qp has srq, use post_srq_recv instead\n"); + return -EINVAL; + } + +@@ -1069,7 +1069,7 @@ static int rxe_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, + if (udata) { + if (udata->outlen < sizeof(*uresp)) { + err = -EINVAL; +- rxe_dbg_dev(rxe, "malformed udata, err = %d", err); ++ rxe_dbg_dev(rxe, "malformed udata, err = %d\n", err); + goto err_out; + } + uresp = udata->outbuf; +@@ -1077,26 +1077,26 @@ static int rxe_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, + + if (attr->flags) { + err = -EOPNOTSUPP; +- rxe_dbg_dev(rxe, "bad attr->flags, err = %d", err); ++ rxe_dbg_dev(rxe, "bad attr->flags, err = %d\n", err); + goto err_out; + } + + err = rxe_cq_chk_attr(rxe, NULL, attr->cqe, attr->comp_vector); + if (err) { +- rxe_dbg_dev(rxe, "bad init attributes, err = %d", err); ++ rxe_dbg_dev(rxe, "bad init attributes, err = %d\n", err); + goto err_out; + } + + err = rxe_add_to_pool(&rxe->cq_pool, cq); + if (err) { +- rxe_dbg_dev(rxe, "unable to create cq, err = %d", err); ++ rxe_dbg_dev(rxe, "unable to create cq, err = %d\n", err); + goto err_out; + } + + err = rxe_cq_from_init(rxe, cq, attr->cqe, attr->comp_vector, udata, + uresp); + if (err) { +- rxe_dbg_cq(cq, "create cq failed, err = %d", err); ++ rxe_dbg_cq(cq, "create cq failed, err = %d\n", err); + goto err_cleanup; + } + +@@ -1105,9 +1105,9 @@ static int rxe_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr, + err_cleanup: + cleanup_err = rxe_cleanup(cq); + if (cleanup_err) +- rxe_err_cq(cq, "cleanup failed, err = %d", cleanup_err); ++ rxe_err_cq(cq, "cleanup failed, err = %d\n", cleanup_err); + err_out: +- rxe_err_dev(rxe, "returned err = %d", err); ++ rxe_err_dev(rxe, "returned err = %d\n", err); + return err; + } + +@@ -1121,7 +1121,7 @@ static int rxe_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata) + if (udata) { + if (udata->outlen < sizeof(*uresp)) { + err = -EINVAL; +- rxe_dbg_cq(cq, "malformed udata"); ++ rxe_dbg_cq(cq, "malformed udata\n"); + goto err_out; + } + uresp = udata->outbuf; +@@ -1129,20 +1129,20 @@ static int rxe_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata) + + err = rxe_cq_chk_attr(rxe, cq, cqe, 0); + if (err) { +- rxe_dbg_cq(cq, "bad attr, err = %d", err); ++ rxe_dbg_cq(cq, "bad attr, err = %d\n", err); + goto err_out; + } + + err = rxe_cq_resize_queue(cq, cqe, uresp, udata); + if (err) { +- rxe_dbg_cq(cq, "resize cq failed, err = %d", err); ++ rxe_dbg_cq(cq, "resize cq failed, err = %d\n", err); + goto err_out; + } + + return 0; + + err_out: +- rxe_err_cq(cq, "returned err = %d", err); ++ rxe_err_cq(cq, "returned err = %d\n", err); + return err; + } + +@@ -1206,18 +1206,18 @@ static int rxe_destroy_cq(struct ib_cq *ibcq, struct ib_udata *udata) + */ + if (atomic_read(&cq->num_wq)) { + err = -EINVAL; +- rxe_dbg_cq(cq, "still in use"); ++ rxe_dbg_cq(cq, "still in use\n"); + goto err_out; + } + + err = rxe_cleanup(cq); + if (err) +- rxe_err_cq(cq, "cleanup failed, err = %d", err); ++ rxe_err_cq(cq, "cleanup failed, err = %d\n", err); + + return 0; + + err_out: +- rxe_err_cq(cq, "returned err = %d", err); ++ rxe_err_cq(cq, "returned err = %d\n", err); + return err; + } + +@@ -1235,7 +1235,7 @@ static struct ib_mr *rxe_get_dma_mr(struct ib_pd *ibpd, int access) + + err = rxe_add_to_pool(&rxe->mr_pool, mr); + if (err) { +- rxe_dbg_dev(rxe, "unable to create mr"); ++ rxe_dbg_dev(rxe, "unable to create mr\n"); + goto err_free; + } + +@@ -1249,7 +1249,7 @@ static struct ib_mr *rxe_get_dma_mr(struct ib_pd *ibpd, int access) + + err_free: + kfree(mr); +- rxe_err_pd(pd, "returned err = %d", err); ++ rxe_err_pd(pd, "returned err = %d\n", err); + return ERR_PTR(err); + } + +@@ -1263,7 +1263,7 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd, u64 start, + int err, cleanup_err; + + if (access & ~RXE_ACCESS_SUPPORTED_MR) { +- rxe_err_pd(pd, "access = %#x not supported (%#x)", access, ++ rxe_err_pd(pd, "access = %#x not supported (%#x)\n", access, + RXE_ACCESS_SUPPORTED_MR); + return ERR_PTR(-EOPNOTSUPP); + } +@@ -1274,7 +1274,7 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd, u64 start, + + err = rxe_add_to_pool(&rxe->mr_pool, mr); + if (err) { +- rxe_dbg_pd(pd, "unable to create mr"); ++ rxe_dbg_pd(pd, "unable to create mr\n"); + goto err_free; + } + +@@ -1284,7 +1284,7 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd, u64 start, + + err = rxe_mr_init_user(rxe, start, length, iova, access, mr); + if (err) { +- rxe_dbg_mr(mr, "reg_user_mr failed, err = %d", err); ++ rxe_dbg_mr(mr, "reg_user_mr failed, err = %d\n", err); + goto err_cleanup; + } + +@@ -1294,10 +1294,10 @@ static struct ib_mr *rxe_reg_user_mr(struct ib_pd *ibpd, u64 start, + err_cleanup: + cleanup_err = rxe_cleanup(mr); + if (cleanup_err) +- rxe_err_mr(mr, "cleanup failed, err = %d", cleanup_err); ++ rxe_err_mr(mr, "cleanup failed, err = %d\n", cleanup_err); + err_free: + kfree(mr); +- rxe_err_pd(pd, "returned err = %d", err); ++ rxe_err_pd(pd, "returned err = %d\n", err); + return ERR_PTR(err); + } + +@@ -1314,7 +1314,7 @@ static struct ib_mr *rxe_rereg_user_mr(struct ib_mr *ibmr, int flags, + * rereg_pd and rereg_access + */ + if (flags & ~RXE_MR_REREG_SUPPORTED) { +- rxe_err_mr(mr, "flags = %#x not supported", flags); ++ rxe_err_mr(mr, "flags = %#x not supported\n", flags); + return ERR_PTR(-EOPNOTSUPP); + } + +@@ -1326,7 +1326,7 @@ static struct ib_mr *rxe_rereg_user_mr(struct ib_mr *ibmr, int flags, + + if (flags & IB_MR_REREG_ACCESS) { + if (access & ~RXE_ACCESS_SUPPORTED_MR) { +- rxe_err_mr(mr, "access = %#x not supported", access); ++ rxe_err_mr(mr, "access = %#x not supported\n", access); + return ERR_PTR(-EOPNOTSUPP); + } + mr->access = access; +@@ -1345,7 +1345,7 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type, + + if (mr_type != IB_MR_TYPE_MEM_REG) { + err = -EINVAL; +- rxe_dbg_pd(pd, "mr type %d not supported, err = %d", ++ rxe_dbg_pd(pd, "mr type %d not supported, err = %d\n", + mr_type, err); + goto err_out; + } +@@ -1364,7 +1364,7 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type, + + err = rxe_mr_init_fast(max_num_sg, mr); + if (err) { +- rxe_dbg_mr(mr, "alloc_mr failed, err = %d", err); ++ rxe_dbg_mr(mr, "alloc_mr failed, err = %d\n", err); + goto err_cleanup; + } + +@@ -1374,11 +1374,11 @@ static struct ib_mr *rxe_alloc_mr(struct ib_pd *ibpd, enum ib_mr_type mr_type, + err_cleanup: + cleanup_err = rxe_cleanup(mr); + if (cleanup_err) +- rxe_err_mr(mr, "cleanup failed, err = %d", err); ++ rxe_err_mr(mr, "cleanup failed, err = %d\n", err); + err_free: + kfree(mr); + err_out: +- rxe_err_pd(pd, "returned err = %d", err); ++ rxe_err_pd(pd, "returned err = %d\n", err); + return ERR_PTR(err); + } + +@@ -1390,19 +1390,19 @@ static int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata) + /* See IBA 10.6.7.2.6 */ + if (atomic_read(&mr->num_mw) > 0) { + err = -EINVAL; +- rxe_dbg_mr(mr, "mr has mw's bound"); ++ rxe_dbg_mr(mr, "mr has mw's bound\n"); + goto err_out; + } + + cleanup_err = rxe_cleanup(mr); + if (cleanup_err) +- rxe_err_mr(mr, "cleanup failed, err = %d", cleanup_err); ++ rxe_err_mr(mr, "cleanup failed, err = %d\n", cleanup_err); + + kfree_rcu_mightsleep(mr); + return 0; + + err_out: +- rxe_err_mr(mr, "returned err = %d", err); ++ rxe_err_mr(mr, "returned err = %d\n", err); + return err; + } + +-- +2.39.5 + diff --git a/queue-6.6/rdma-srp-fix-error-handling-in-srp_add_port.patch b/queue-6.6/rdma-srp-fix-error-handling-in-srp_add_port.patch new file mode 100644 index 0000000000..31c2733f63 --- /dev/null +++ b/queue-6.6/rdma-srp-fix-error-handling-in-srp_add_port.patch @@ -0,0 +1,43 @@ +From da005d9fab3e9c638af1d0dc7aab83ee15190cb0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 17 Dec 2024 15:55:38 +0800 +Subject: RDMA/srp: Fix error handling in srp_add_port + +From: Ma Ke + +[ Upstream commit a3cbf68c69611188cd304229e346bffdabfd4277 ] + +As comment of device_add() says, if device_add() succeeds, you should +call device_del() when you want to get rid of it. If device_add() has +not succeeded, use only put_device() to drop the reference count. + +Add a put_device() call before returning from the function to decrement +reference count for cleanup. + +Found by code review. + +Fixes: c8e4c2397655 ("RDMA/srp: Rework the srp_add_port() error path") +Signed-off-by: Ma Ke +Link: https://patch.msgid.link/20241217075538.2909996-1-make_ruc2021@163.com +Signed-off-by: Bart Van Assche +Signed-off-by: Leon Romanovsky +Signed-off-by: Sasha Levin +--- + drivers/infiniband/ulp/srp/ib_srp.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c +index 2916e77f589b8..7289ae0b83ace 100644 +--- a/drivers/infiniband/ulp/srp/ib_srp.c ++++ b/drivers/infiniband/ulp/srp/ib_srp.c +@@ -3978,7 +3978,6 @@ static struct srp_host *srp_add_port(struct srp_device *device, u32 port) + return host; + + put_host: +- device_del(&host->dev); + put_device(&host->dev); + return NULL; + } +-- +2.39.5 + diff --git a/queue-6.6/regulator-core-add-missing-newline-character.patch b/queue-6.6/regulator-core-add-missing-newline-character.patch new file mode 100644 index 0000000000..99f5f28348 --- /dev/null +++ b/queue-6.6/regulator-core-add-missing-newline-character.patch @@ -0,0 +1,36 @@ +From 7e7861da7c4b2325fea6dc07f4a38eebd625da46 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 22 Jan 2025 08:20:19 +0100 +Subject: regulator: core: Add missing newline character + +From: Alexander Stein + +[ Upstream commit 155c569fa4c3b340fbf8571a0e42dd415c025377 ] + +dev_err_probe() error messages need newline character. + +Fixes: 6eabfc018e8d ("regulator: core: Allow specifying an initial load w/ the bulk API") +Signed-off-by: Alexander Stein +Link: https://patch.msgid.link/20250122072019.1926093-1-alexander.stein@ew.tq-group.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/regulator/core.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c +index c96bf095695fd..352131d2df4ca 100644 +--- a/drivers/regulator/core.c ++++ b/drivers/regulator/core.c +@@ -4876,7 +4876,7 @@ int _regulator_bulk_get(struct device *dev, int num_consumers, + consumers[i].supply, get_type); + if (IS_ERR(consumers[i].consumer)) { + ret = dev_err_probe(dev, PTR_ERR(consumers[i].consumer), +- "Failed to get supply '%s'", ++ "Failed to get supply '%s'\n", + consumers[i].supply); + consumers[i].consumer = NULL; + goto err; +-- +2.39.5 + diff --git a/queue-6.6/regulator-dt-bindings-mt6315-drop-regulator-compatib.patch b/queue-6.6/regulator-dt-bindings-mt6315-drop-regulator-compatib.patch new file mode 100644 index 0000000000..c813e9b483 --- /dev/null +++ b/queue-6.6/regulator-dt-bindings-mt6315-drop-regulator-compatib.patch @@ -0,0 +1,62 @@ +From 6dbe20d9ade18dbbd68924dcccce1fccec0c00e9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Dec 2024 13:24:19 +0800 +Subject: regulator: dt-bindings: mt6315: Drop regulator-compatible property + +From: Chen-Yu Tsai + +[ Upstream commit 08242719a8af603db54a2a79234a8fe600680105 ] + +The "regulator-compatible" property has been deprecated since 2012 in +commit 13511def87b9 ("regulator: deprecate regulator-compatible DT +property"), which is so old it's not even mentioned in the converted +regulator bindings YAML file. It should not have been used for new +submissions such as the MT6315. + +Drop the property from the MT6315 regulator binding and its examples. + +Fixes: 977fb5b58469 ("regulator: document binding for MT6315 regulator") +Fixes: 6d435a94ba5b ("regulator: mt6315: Enforce regulator-compatible, not name") +Signed-off-by: Chen-Yu Tsai +Reviewed-by: AngeloGioacchino Del Regno +Link: https://patch.msgid.link/20241211052427.4178367-2-wenst@chromium.org +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + .../devicetree/bindings/regulator/mt6315-regulator.yaml | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/Documentation/devicetree/bindings/regulator/mt6315-regulator.yaml b/Documentation/devicetree/bindings/regulator/mt6315-regulator.yaml +index 6317daf76d1fb..2bed57a347827 100644 +--- a/Documentation/devicetree/bindings/regulator/mt6315-regulator.yaml ++++ b/Documentation/devicetree/bindings/regulator/mt6315-regulator.yaml +@@ -31,10 +31,6 @@ properties: + $ref: regulator.yaml# + unevaluatedProperties: false + +- properties: +- regulator-compatible: +- pattern: "^vbuck[1-4]$" +- + additionalProperties: false + + required: +@@ -52,7 +48,6 @@ examples: + + regulators { + vbuck1 { +- regulator-compatible = "vbuck1"; + regulator-min-microvolt = <300000>; + regulator-max-microvolt = <1193750>; + regulator-enable-ramp-delay = <256>; +@@ -60,7 +55,6 @@ examples: + }; + + vbuck3 { +- regulator-compatible = "vbuck3"; + regulator-min-microvolt = <300000>; + regulator-max-microvolt = <1193750>; + regulator-enable-ramp-delay = <256>; +-- +2.39.5 + diff --git a/queue-6.6/regulator-of-implement-the-unwind-path-of-of_regulat.patch b/queue-6.6/regulator-of-implement-the-unwind-path-of-of_regulat.patch new file mode 100644 index 0000000000..ee87b6c883 --- /dev/null +++ b/queue-6.6/regulator-of-implement-the-unwind-path-of-of_regulat.patch @@ -0,0 +1,66 @@ +From 03d236b631203e9fbbef56a4c732d4e31b4dcfeb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 4 Jan 2025 17:04:53 +0900 +Subject: regulator: of: Implement the unwind path of of_regulator_match() + +From: Joe Hattori + +[ Upstream commit dddca3b2fc676113c58b04aaefe84bfb958ac83e ] + +of_regulator_match() does not release the OF node reference in the error +path, resulting in an OF node leak. Therefore, call of_node_put() on the +obtained nodes before returning the EINVAL error. + +Since it is possible that some drivers call this function and do not +exit on failure, such as s2mps11_pmic_driver, clear the init_data and +of_node in the error path. + +This was reported by an experimental verification tool that I am +developing. As I do not have access to actual devices nor the QEMU board +configuration to test drivers that call this function, no runtime test +was able to be performed. + +Fixes: 1c8fa58f4750 ("regulator: Add generic DT parsing for regulators") +Signed-off-by: Joe Hattori +Link: https://patch.msgid.link/20250104080453.2153592-1-joe@pf.is.s.u-tokyo.ac.jp +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/regulator/of_regulator.c | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c +index 59e71fd0db439..f23c12f4ffbfa 100644 +--- a/drivers/regulator/of_regulator.c ++++ b/drivers/regulator/of_regulator.c +@@ -435,7 +435,7 @@ int of_regulator_match(struct device *dev, struct device_node *node, + "failed to parse DT for regulator %pOFn\n", + child); + of_node_put(child); +- return -EINVAL; ++ goto err_put; + } + match->of_node = of_node_get(child); + count++; +@@ -444,6 +444,18 @@ int of_regulator_match(struct device *dev, struct device_node *node, + } + + return count; ++ ++err_put: ++ for (i = 0; i < num_matches; i++) { ++ struct of_regulator_match *match = &matches[i]; ++ ++ match->init_data = NULL; ++ if (match->of_node) { ++ of_node_put(match->of_node); ++ match->of_node = NULL; ++ } ++ } ++ return -EINVAL; + } + EXPORT_SYMBOL_GPL(of_regulator_match); + +-- +2.39.5 + diff --git a/queue-6.6/rtc-loongson-clear-toy_match0_reg-in-loongson_rtc_is.patch b/queue-6.6/rtc-loongson-clear-toy_match0_reg-in-loongson_rtc_is.patch new file mode 100644 index 0000000000..72d4fdd42f --- /dev/null +++ b/queue-6.6/rtc-loongson-clear-toy_match0_reg-in-loongson_rtc_is.patch @@ -0,0 +1,66 @@ +From 92119baa634c7e54e6f6518ada8d5d2146a8abb2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 5 Dec 2024 19:43:07 +0800 +Subject: rtc: loongson: clear TOY_MATCH0_REG in loongson_rtc_isr() + +From: Ming Wang + +[ Upstream commit 09471d8f5b390883eaf21b917c4bf3ced1b8a1df ] + +The TOY_MATCH0_REG should be cleared to 0 in the RTC interrupt handler, +otherwise the interrupt cannot be cleared, which will cause the +loongson_rtc_isr() to be triggered multiple times. + +The previous code cleared TOY_MATCH0_REG in the loongson_rtc_handler(), +which is an ACPI interrupt. This did not prevent loongson_rtc_isr() +from being triggered multiple times. + +This commit moves the clearing of TOY_MATCH0_REG to the +loongson_rtc_isr() to ensure that the interrupt is properly cleared. + +Fixes: 1b733a9ebc3d ("rtc: Add rtc driver for the Loongson family chips") +Signed-off-by: Ming Wang +Reviewed-by: Huacai Chen +Reviewed-by: Keguang Zhang # on LS1B +Tested-by: Keguang Zhang +Link: https://lore.kernel.org/r/20241205114307.1891418-1-wangming01@loongson.cn +Signed-off-by: Alexandre Belloni +Signed-off-by: Sasha Levin +--- + drivers/rtc/rtc-loongson.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/drivers/rtc/rtc-loongson.c b/drivers/rtc/rtc-loongson.c +index e8ffc1ab90b02..90e9d97a86b48 100644 +--- a/drivers/rtc/rtc-loongson.c ++++ b/drivers/rtc/rtc-loongson.c +@@ -114,6 +114,13 @@ static irqreturn_t loongson_rtc_isr(int irq, void *id) + struct loongson_rtc_priv *priv = (struct loongson_rtc_priv *)id; + + rtc_update_irq(priv->rtcdev, 1, RTC_AF | RTC_IRQF); ++ ++ /* ++ * The TOY_MATCH0_REG should be cleared 0 here, ++ * otherwise the interrupt cannot be cleared. ++ */ ++ regmap_write(priv->regmap, TOY_MATCH0_REG, 0); ++ + return IRQ_HANDLED; + } + +@@ -131,11 +138,7 @@ static u32 loongson_rtc_handler(void *id) + writel(RTC_STS, priv->pm_base + PM1_STS_REG); + spin_unlock(&priv->lock); + +- /* +- * The TOY_MATCH0_REG should be cleared 0 here, +- * otherwise the interrupt cannot be cleared. +- */ +- return regmap_write(priv->regmap, TOY_MATCH0_REG, 0); ++ return ACPI_INTERRUPT_HANDLED; + } + + static int loongson_rtc_set_enabled(struct device *dev) +-- +2.39.5 + diff --git a/queue-6.6/rtc-pcf85063-fix-potential-oob-write-in-pcf85063-nvm.patch b/queue-6.6/rtc-pcf85063-fix-potential-oob-write-in-pcf85063-nvm.patch new file mode 100644 index 0000000000..eeb157364a --- /dev/null +++ b/queue-6.6/rtc-pcf85063-fix-potential-oob-write-in-pcf85063-nvm.patch @@ -0,0 +1,51 @@ +From 9dbe4128f4051f2203bf014a613420c986accc18 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 18 Dec 2024 20:34:58 +0100 +Subject: rtc: pcf85063: fix potential OOB write in PCF85063 NVMEM read + +From: Oleksij Rempel + +[ Upstream commit 3ab8c5ed4f84fa20cd16794fe8dc31f633fbc70c ] + +The nvmem interface supports variable buffer sizes, while the regmap +interface operates with fixed-size storage. If an nvmem client uses a +buffer size less than 4 bytes, regmap_read will write out of bounds +as it expects the buffer to point at an unsigned int. + +Fix this by using an intermediary unsigned int to hold the value. + +Fixes: fadfd092ee91 ("rtc: pcf85063: add nvram support") +Signed-off-by: Oleksij Rempel +Signed-off-by: Ahmad Fatoum +Link: https://lore.kernel.org/r/20241218-rtc-pcf85063-stack-corruption-v1-1-12fd0ee0f046@pengutronix.de +Signed-off-by: Alexandre Belloni +Signed-off-by: Sasha Levin +--- + drivers/rtc/rtc-pcf85063.c | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/drivers/rtc/rtc-pcf85063.c b/drivers/rtc/rtc-pcf85063.c +index fdbc07f14036a..905986c616559 100644 +--- a/drivers/rtc/rtc-pcf85063.c ++++ b/drivers/rtc/rtc-pcf85063.c +@@ -322,7 +322,16 @@ static const struct rtc_class_ops pcf85063_rtc_ops = { + static int pcf85063_nvmem_read(void *priv, unsigned int offset, + void *val, size_t bytes) + { +- return regmap_read(priv, PCF85063_REG_RAM, val); ++ unsigned int tmp; ++ int ret; ++ ++ ret = regmap_read(priv, PCF85063_REG_RAM, &tmp); ++ if (ret < 0) ++ return ret; ++ ++ *(u8 *)val = tmp; ++ ++ return 0; + } + + static int pcf85063_nvmem_write(void *priv, unsigned int offset, +-- +2.39.5 + diff --git a/queue-6.6/rxrpc-fix-handling-of-received-connection-abort.patch b/queue-6.6/rxrpc-fix-handling-of-received-connection-abort.patch new file mode 100644 index 0000000000..e9a6b7d718 --- /dev/null +++ b/queue-6.6/rxrpc-fix-handling-of-received-connection-abort.patch @@ -0,0 +1,118 @@ +From acb63441d4fd8de015f24b4151b6a7988f610e8d Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 4 Dec 2024 07:46:30 +0000 +Subject: rxrpc: Fix handling of received connection abort + +From: David Howells + +[ Upstream commit 0e56ebde245e4799ce74d38419426f2a80d39950 ] + +Fix the handling of a connection abort that we've received. Though the +abort is at the connection level, it needs propagating to the calls on that +connection. Whilst the propagation bit is performed, the calls aren't then +woken up to go and process their termination, and as no further input is +forthcoming, they just hang. + +Also add some tracing for the logging of connection aborts. + +Fixes: 248f219cb8bc ("rxrpc: Rewrite the data and ack handling code") +Signed-off-by: David Howells +cc: Marc Dionne +cc: linux-afs@lists.infradead.org +Link: https://patch.msgid.link/20241204074710.990092-3-dhowells@redhat.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + include/trace/events/rxrpc.h | 25 +++++++++++++++++++++++++ + net/rxrpc/conn_event.c | 12 ++++++++---- + 2 files changed, 33 insertions(+), 4 deletions(-) + +diff --git a/include/trace/events/rxrpc.h b/include/trace/events/rxrpc.h +index ed36f5f577a9d..252bb90aca599 100644 +--- a/include/trace/events/rxrpc.h ++++ b/include/trace/events/rxrpc.h +@@ -117,6 +117,7 @@ + #define rxrpc_call_poke_traces \ + EM(rxrpc_call_poke_abort, "Abort") \ + EM(rxrpc_call_poke_complete, "Compl") \ ++ EM(rxrpc_call_poke_conn_abort, "Conn-abort") \ + EM(rxrpc_call_poke_error, "Error") \ + EM(rxrpc_call_poke_idle, "Idle") \ + EM(rxrpc_call_poke_start, "Start") \ +@@ -278,6 +279,7 @@ + EM(rxrpc_call_see_activate_client, "SEE act-clnt") \ + EM(rxrpc_call_see_connect_failed, "SEE con-fail") \ + EM(rxrpc_call_see_connected, "SEE connect ") \ ++ EM(rxrpc_call_see_conn_abort, "SEE conn-abt") \ + EM(rxrpc_call_see_disconnected, "SEE disconn ") \ + EM(rxrpc_call_see_distribute_error, "SEE dist-err") \ + EM(rxrpc_call_see_input, "SEE input ") \ +@@ -961,6 +963,29 @@ TRACE_EVENT(rxrpc_rx_abort, + __entry->abort_code) + ); + ++TRACE_EVENT(rxrpc_rx_conn_abort, ++ TP_PROTO(const struct rxrpc_connection *conn, const struct sk_buff *skb), ++ ++ TP_ARGS(conn, skb), ++ ++ TP_STRUCT__entry( ++ __field(unsigned int, conn) ++ __field(rxrpc_serial_t, serial) ++ __field(u32, abort_code) ++ ), ++ ++ TP_fast_assign( ++ __entry->conn = conn->debug_id; ++ __entry->serial = rxrpc_skb(skb)->hdr.serial; ++ __entry->abort_code = skb->priority; ++ ), ++ ++ TP_printk("C=%08x ABORT %08x ac=%d", ++ __entry->conn, ++ __entry->serial, ++ __entry->abort_code) ++ ); ++ + TRACE_EVENT(rxrpc_rx_challenge, + TP_PROTO(struct rxrpc_connection *conn, rxrpc_serial_t serial, + u32 version, u32 nonce, u32 min_level), +diff --git a/net/rxrpc/conn_event.c b/net/rxrpc/conn_event.c +index 598b4ee389fc1..2a1396cd892f3 100644 +--- a/net/rxrpc/conn_event.c ++++ b/net/rxrpc/conn_event.c +@@ -63,11 +63,12 @@ int rxrpc_abort_conn(struct rxrpc_connection *conn, struct sk_buff *skb, + /* + * Mark a connection as being remotely aborted. + */ +-static bool rxrpc_input_conn_abort(struct rxrpc_connection *conn, ++static void rxrpc_input_conn_abort(struct rxrpc_connection *conn, + struct sk_buff *skb) + { +- return rxrpc_set_conn_aborted(conn, skb, skb->priority, -ECONNABORTED, +- RXRPC_CALL_REMOTELY_ABORTED); ++ trace_rxrpc_rx_conn_abort(conn, skb); ++ rxrpc_set_conn_aborted(conn, skb, skb->priority, -ECONNABORTED, ++ RXRPC_CALL_REMOTELY_ABORTED); + } + + /* +@@ -202,11 +203,14 @@ static void rxrpc_abort_calls(struct rxrpc_connection *conn) + + for (i = 0; i < RXRPC_MAXCALLS; i++) { + call = conn->channels[i].call; +- if (call) ++ if (call) { ++ rxrpc_see_call(call, rxrpc_call_see_conn_abort); + rxrpc_set_call_completion(call, + conn->completion, + conn->abort_code, + conn->error); ++ rxrpc_poke_call(call, rxrpc_call_poke_conn_abort); ++ } + } + + _leave(""); +-- +2.39.5 + diff --git a/queue-6.6/samples-landlock-fix-possible-null-dereference-in-pa.patch b/queue-6.6/samples-landlock-fix-possible-null-dereference-in-pa.patch new file mode 100644 index 0000000000..6d1887de6b --- /dev/null +++ b/queue-6.6/samples-landlock-fix-possible-null-dereference-in-pa.patch @@ -0,0 +1,53 @@ +From 2b427f94801ab41f21458f30dba5f973759f26d1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 27 Nov 2024 21:29:56 -0600 +Subject: samples/landlock: Fix possible NULL dereference in parse_path() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Zichen Xie + +[ Upstream commit 078bf9438a31567e2c0587159ccefde835fb1ced ] + +malloc() may return NULL, leading to NULL dereference. Add a NULL +check. + +Fixes: ba84b0bf5a16 ("samples/landlock: Add a sandbox manager example") +Signed-off-by: Zichen Xie +Link: https://lore.kernel.org/r/20241128032955.11711-1-zichenxie0106@gmail.com +[mic: Simplify fix] +Signed-off-by: Mickaël Salaün +Signed-off-by: Sasha Levin +--- + samples/landlock/sandboxer.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/samples/landlock/sandboxer.c b/samples/landlock/sandboxer.c +index e2056c8b902c5..be4fec95c4601 100644 +--- a/samples/landlock/sandboxer.c ++++ b/samples/landlock/sandboxer.c +@@ -65,6 +65,9 @@ static int parse_path(char *env_path, const char ***const path_list) + } + } + *path_list = malloc(num_paths * sizeof(**path_list)); ++ if (!*path_list) ++ return -1; ++ + for (i = 0; i < num_paths; i++) + (*path_list)[i] = strsep(&env_path, ENV_PATH_TOKEN); + +@@ -100,6 +103,10 @@ static int populate_ruleset(const char *const env_var, const int ruleset_fd, + env_path_name = strdup(env_path_name); + unsetenv(env_var); + num_paths = parse_path(env_path_name, &path_list); ++ if (num_paths < 0) { ++ fprintf(stderr, "Failed to allocate memory\n"); ++ goto out_free_name; ++ } + if (num_paths == 1 && path_list[0][0] == '\0') { + /* + * Allows to not use all possible restrictions (e.g. use +-- +2.39.5 + diff --git a/queue-6.6/sched-fair-fix-value-reported-by-hot-tasks-pulled-in.patch b/queue-6.6/sched-fair-fix-value-reported-by-hot-tasks-pulled-in.patch new file mode 100644 index 0000000000..903c986e60 --- /dev/null +++ b/queue-6.6/sched-fair-fix-value-reported-by-hot-tasks-pulled-in.patch @@ -0,0 +1,97 @@ +From e41f7cd4250e42c601ac4820551e6debd177caff Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 20 Dec 2024 06:32:19 +0000 +Subject: sched/fair: Fix value reported by hot tasks pulled in /proc/schedstat + +From: Peter Zijlstra + +[ Upstream commit a430d99e349026d53e2557b7b22bd2ebd61fe12a ] + +In /proc/schedstat, lb_hot_gained reports the number hot tasks pulled +during load balance. This value is incremented in can_migrate_task() +if the task is migratable and hot. After incrementing the value, +load balancer can still decide not to migrate this task leading to wrong +accounting. Fix this by incrementing stats when hot tasks are detached. +This issue only exists in detach_tasks() where we can decide to not +migrate hot task even if it is migratable. However, in detach_one_task(), +we migrate it unconditionally. + +[Swapnil: Handled the case where nr_failed_migrations_hot was not accounted properly and wrote commit log] + +Fixes: d31980846f96 ("sched: Move up affinity check to mitigate useless redoing overhead") +Signed-off-by: Peter Zijlstra (Intel) +Reported-by: "Gautham R. Shenoy" +Not-yet-signed-off-by: Peter Zijlstra +Signed-off-by: Swapnil Sapkal +Signed-off-by: Peter Zijlstra (Intel) +Link: https://lore.kernel.org/r/20241220063224.17767-2-swapnil.sapkal@amd.com +Signed-off-by: Sasha Levin +--- + include/linux/sched.h | 1 + + kernel/sched/fair.c | 17 +++++++++++++---- + 2 files changed, 14 insertions(+), 4 deletions(-) + +diff --git a/include/linux/sched.h b/include/linux/sched.h +index d4f9d82c69e0b..2af0a8859d647 100644 +--- a/include/linux/sched.h ++++ b/include/linux/sched.h +@@ -896,6 +896,7 @@ struct task_struct { + unsigned sched_reset_on_fork:1; + unsigned sched_contributes_to_load:1; + unsigned sched_migrated:1; ++ unsigned sched_task_hot:1; + + /* Force alignment to the next boundary: */ + unsigned :0; +diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c +index 3b2cfdb8d788d..cd9b411706b52 100644 +--- a/kernel/sched/fair.c ++++ b/kernel/sched/fair.c +@@ -8921,6 +8921,8 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env) + int tsk_cache_hot; + + lockdep_assert_rq_held(env->src_rq); ++ if (p->sched_task_hot) ++ p->sched_task_hot = 0; + + /* + * We do not migrate tasks that are: +@@ -8993,10 +8995,8 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env) + + if (tsk_cache_hot <= 0 || + env->sd->nr_balance_failed > env->sd->cache_nice_tries) { +- if (tsk_cache_hot == 1) { +- schedstat_inc(env->sd->lb_hot_gained[env->idle]); +- schedstat_inc(p->stats.nr_forced_migrations); +- } ++ if (tsk_cache_hot == 1) ++ p->sched_task_hot = 1; + return 1; + } + +@@ -9011,6 +9011,12 @@ static void detach_task(struct task_struct *p, struct lb_env *env) + { + lockdep_assert_rq_held(env->src_rq); + ++ if (p->sched_task_hot) { ++ p->sched_task_hot = 0; ++ schedstat_inc(env->sd->lb_hot_gained[env->idle]); ++ schedstat_inc(p->stats.nr_forced_migrations); ++ } ++ + deactivate_task(env->src_rq, p, DEQUEUE_NOCLOCK); + set_task_cpu(p, env->dst_cpu); + } +@@ -9171,6 +9177,9 @@ static int detach_tasks(struct lb_env *env) + + continue; + next: ++ if (p->sched_task_hot) ++ schedstat_inc(p->stats.nr_failed_migrations_hot); ++ + list_move(&p->se.group_node, tasks); + } + +-- +2.39.5 + diff --git a/queue-6.6/sched-topology-rename-die-domain-to-pkg.patch b/queue-6.6/sched-topology-rename-die-domain-to-pkg.patch new file mode 100644 index 0000000000..2baaead77b --- /dev/null +++ b/queue-6.6/sched-topology-rename-die-domain-to-pkg.patch @@ -0,0 +1,147 @@ +From 907ebd828f772e3c9e045a8a06352b34f3b5cda7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 12 Jul 2023 16:10:56 +0200 +Subject: sched/topology: Rename 'DIE' domain to 'PKG' + +From: Peter Zijlstra + +[ Upstream commit f577cd57bfaa889cf0718e30e92c08c7f78c9d85 ] + +While reworking the x86 topology code Thomas tripped over creating a 'DIE' domain +for the package mask. :-) + +Since these names are CONFIG_SCHED_DEBUG=y only, rename them to make the +name less ambiguous. + +[ Shrikanth Hegde: rename on s390 as well. ] +[ Valentin Schneider: also rename it in the comments. ] +[ mingo: port to recent kernels & find all remaining occurances. ] + +Reported-by: Thomas Gleixner +Signed-off-by: Peter Zijlstra (Intel) +Signed-off-by: Ingo Molnar +Acked-by: Valentin Schneider +Acked-by: Mel Gorman +Acked-by: Heiko Carstens +Acked-by: Gautham R. Shenoy +Acked-by: Vincent Guittot +Link: https://lore.kernel.org/r/20230712141056.GI3100107@hirez.programming.kicks-ass.net +Stable-dep-of: e1bc02646527 ("x86/topology: Use x86_sched_itmt_flags for PKG domain unconditionally") +Signed-off-by: Sasha Levin +--- + arch/powerpc/kernel/smp.c | 4 ++-- + arch/s390/kernel/topology.c | 2 +- + arch/x86/kernel/smpboot.c | 4 ++-- + kernel/sched/fair.c | 2 +- + kernel/sched/topology.c | 8 ++++---- + 5 files changed, 10 insertions(+), 10 deletions(-) + +diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c +index 5826f5108a124..4e4870031265c 100644 +--- a/arch/powerpc/kernel/smp.c ++++ b/arch/powerpc/kernel/smp.c +@@ -1051,7 +1051,7 @@ static struct sched_domain_topology_level powerpc_topology[] = { + #endif + { shared_cache_mask, powerpc_shared_cache_flags, SD_INIT_NAME(CACHE) }, + { cpu_mc_mask, SD_INIT_NAME(MC) }, +- { cpu_cpu_mask, SD_INIT_NAME(DIE) }, ++ { cpu_cpu_mask, SD_INIT_NAME(PKG) }, + { NULL, }, + }; + +@@ -1595,7 +1595,7 @@ static void add_cpu_to_masks(int cpu) + /* Skip all CPUs already part of current CPU core mask */ + cpumask_andnot(mask, cpu_online_mask, cpu_core_mask(cpu)); + +- /* If chip_id is -1; limit the cpu_core_mask to within DIE*/ ++ /* If chip_id is -1; limit the cpu_core_mask to within PKG */ + if (chip_id == -1) + cpumask_and(mask, mask, cpu_cpu_mask(cpu)); + +diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c +index 68adf1de8888b..66bda6a8f918c 100644 +--- a/arch/s390/kernel/topology.c ++++ b/arch/s390/kernel/topology.c +@@ -522,7 +522,7 @@ static struct sched_domain_topology_level s390_topology[] = { + { cpu_coregroup_mask, cpu_core_flags, SD_INIT_NAME(MC) }, + { cpu_book_mask, SD_INIT_NAME(BOOK) }, + { cpu_drawer_mask, SD_INIT_NAME(DRAWER) }, +- { cpu_cpu_mask, SD_INIT_NAME(DIE) }, ++ { cpu_cpu_mask, SD_INIT_NAME(PKG) }, + { NULL, }, + }; + +diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c +index ce77dac9a0202..e4781e7496f6f 100644 +--- a/arch/x86/kernel/smpboot.c ++++ b/arch/x86/kernel/smpboot.c +@@ -641,13 +641,13 @@ static void __init build_sched_topology(void) + }; + #endif + /* +- * When there is NUMA topology inside the package skip the DIE domain ++ * When there is NUMA topology inside the package skip the PKG domain + * since the NUMA domains will auto-magically create the right spanning + * domains based on the SLIT. + */ + if (!x86_has_numa_in_package) { + x86_topology[i++] = (struct sched_domain_topology_level){ +- cpu_cpu_mask, x86_die_flags, SD_INIT_NAME(DIE) ++ cpu_cpu_mask, x86_die_flags, SD_INIT_NAME(PKG) + }; + } + +diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c +index cd9b411706b52..726fa69c4d88b 100644 +--- a/kernel/sched/fair.c ++++ b/kernel/sched/fair.c +@@ -9782,7 +9782,7 @@ static bool sched_use_asym_prio(struct sched_domain *sd, int cpu) + * can only do it if @group is an SMT group and has exactly on busy CPU. Larger + * imbalances in the number of CPUS are dealt with in find_busiest_group(). + * +- * If we are balancing load within an SMT core, or at DIE domain level, always ++ * If we are balancing load within an SMT core, or at PKG domain level, always + * proceed. + * + * Return: true if @env::dst_cpu can do with asym_packing load balance. False +diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c +index 3a13cecf17740..2ed884bb36213 100644 +--- a/kernel/sched/topology.c ++++ b/kernel/sched/topology.c +@@ -1117,7 +1117,7 @@ build_overlap_sched_groups(struct sched_domain *sd, int cpu) + * + * - Simultaneous multithreading (SMT) + * - Multi-Core Cache (MC) +- * - Package (DIE) ++ * - Package (PKG) + * + * Where the last one more or less denotes everything up to a NUMA node. + * +@@ -1139,13 +1139,13 @@ build_overlap_sched_groups(struct sched_domain *sd, int cpu) + * + * CPU 0 1 2 3 4 5 6 7 + * +- * DIE [ ] ++ * PKG [ ] + * MC [ ] [ ] + * SMT [ ] [ ] [ ] [ ] + * + * - or - + * +- * DIE 0-7 0-7 0-7 0-7 0-7 0-7 0-7 0-7 ++ * PKG 0-7 0-7 0-7 0-7 0-7 0-7 0-7 0-7 + * MC 0-3 0-3 0-3 0-3 4-7 4-7 4-7 4-7 + * SMT 0-1 0-1 2-3 2-3 4-5 4-5 6-7 6-7 + * +@@ -1679,7 +1679,7 @@ static struct sched_domain_topology_level default_topology[] = { + #ifdef CONFIG_SCHED_MC + { cpu_coregroup_mask, cpu_core_flags, SD_INIT_NAME(MC) }, + #endif +- { cpu_cpu_mask, SD_INIT_NAME(DIE) }, ++ { cpu_cpu_mask, SD_INIT_NAME(PKG) }, + { NULL, }, + }; + +-- +2.39.5 + diff --git a/queue-6.6/scsi-mpt3sas-set-ioc-manu_pg11.eedptagmode-directly-.patch b/queue-6.6/scsi-mpt3sas-set-ioc-manu_pg11.eedptagmode-directly-.patch new file mode 100644 index 0000000000..578e075d43 --- /dev/null +++ b/queue-6.6/scsi-mpt3sas-set-ioc-manu_pg11.eedptagmode-directly-.patch @@ -0,0 +1,46 @@ +From 8872ad97e0e7e0cd865d4fad37b4c20b40267687 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Dec 2024 23:18:12 +0100 +Subject: scsi: mpt3sas: Set ioc->manu_pg11.EEDPTagMode directly to 1 + +From: Paul Menzel + +[ Upstream commit ad7c3c0cb8f61d6d5a48b83e62ca4a9fd2f26153 ] + +Currently, the code does: + + if (x == 0) { + x &= ~0x3; + x |= 0x1; + } + +Zeroing bits 0 and 1 of a variable that is 0 is not necessary. So directly +set the variable to 1. + +Cc: Sreekanth Reddy +Fixes: f92363d12359 ("[SCSI] mpt3sas: add new driver supporting 12GB SAS") +Signed-off-by: Paul Menzel +Link: https://lore.kernel.org/r/20241212221817.78940-2-pmenzel@molgen.mpg.de +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/scsi/mpt3sas/mpt3sas_base.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt3sas_base.c +index a5d12b95fbd09..cd00f19670355 100644 +--- a/drivers/scsi/mpt3sas/mpt3sas_base.c ++++ b/drivers/scsi/mpt3sas/mpt3sas_base.c +@@ -5638,8 +5638,7 @@ _base_static_config_pages(struct MPT3SAS_ADAPTER *ioc) + if (!ioc->is_gen35_ioc && ioc->manu_pg11.EEDPTagMode == 0) { + pr_err("%s: overriding NVDATA EEDPTagMode setting\n", + ioc->name); +- ioc->manu_pg11.EEDPTagMode &= ~0x3; +- ioc->manu_pg11.EEDPTagMode |= 0x1; ++ ioc->manu_pg11.EEDPTagMode = 0x1; + mpt3sas_config_set_manufacturing_pg11(ioc, &mpi_reply, + &ioc->manu_pg11); + } +-- +2.39.5 + diff --git a/queue-6.6/scsi-ufs-bsg-delete-bsg_dev-when-setting-up-bsg-fail.patch b/queue-6.6/scsi-ufs-bsg-delete-bsg_dev-when-setting-up-bsg-fail.patch new file mode 100644 index 0000000000..e9d235eaef --- /dev/null +++ b/queue-6.6/scsi-ufs-bsg-delete-bsg_dev-when-setting-up-bsg-fail.patch @@ -0,0 +1,37 @@ +From 66e6f691679a5025e411d4b5ba55e6df45bd97bc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 18 Dec 2024 09:42:13 +0800 +Subject: scsi: ufs: bsg: Delete bsg_dev when setting up bsg fails + +From: Guixin Liu + +[ Upstream commit fcf247deb3c3e1c6be5774e3fa03bbd018eff1a9 ] + +We should remove the bsg device when bsg_setup_queue() fails to release the +resources. + +Fixes: df032bf27a41 ("scsi: ufs: Add a bsg endpoint that supports UPIUs") +Signed-off-by: Guixin Liu +Link: https://lore.kernel.org/r/20241218014214.64533-2-kanie@linux.alibaba.com +Reviewed-by: Avri Altman +Signed-off-by: Martin K. Petersen +Signed-off-by: Sasha Levin +--- + drivers/ufs/core/ufs_bsg.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/ufs/core/ufs_bsg.c b/drivers/ufs/core/ufs_bsg.c +index fec5993c66c39..f21423a7a6d7d 100644 +--- a/drivers/ufs/core/ufs_bsg.c ++++ b/drivers/ufs/core/ufs_bsg.c +@@ -256,6 +256,7 @@ int ufs_bsg_probe(struct ufs_hba *hba) + q = bsg_setup_queue(bsg_dev, dev_name(bsg_dev), ufs_bsg_request, NULL, 0); + if (IS_ERR(q)) { + ret = PTR_ERR(q); ++ device_del(bsg_dev); + goto out; + } + +-- +2.39.5 + diff --git a/queue-6.6/select-fix-unbalanced-user_access_end.patch b/queue-6.6/select-fix-unbalanced-user_access_end.patch new file mode 100644 index 0000000000..8b2e7507aa --- /dev/null +++ b/queue-6.6/select-fix-unbalanced-user_access_end.patch @@ -0,0 +1,56 @@ +From 5411559363025b08fd2ac270e178bceb4c0d071c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Jan 2025 09:37:24 +0100 +Subject: select: Fix unbalanced user_access_end() + +From: Christophe Leroy + +[ Upstream commit 344af27715ddbf357cf76978d674428b88f8e92d ] + +While working on implementing user access validation on powerpc +I got the following warnings on a pmac32_defconfig build: + + CC fs/select.o + fs/select.o: warning: objtool: sys_pselect6+0x1bc: redundant UACCESS disable + fs/select.o: warning: objtool: sys_pselect6_time32+0x1bc: redundant UACCESS disable + +On powerpc/32s, user_read_access_begin/end() are no-ops, but the +failure path has a user_access_end() instead of user_read_access_end() +which means an access end without any prior access begin. + +Replace that user_access_end() by user_read_access_end(). + +Fixes: 7e71609f64ec ("pselect6() and friends: take handling the combined 6th/7th args into helper") +Signed-off-by: Christophe Leroy +Link: https://lore.kernel.org/r/a7139e28d767a13e667ee3c79599a8047222ef36.1736751221.git.christophe.leroy@csgroup.eu +Signed-off-by: Christian Brauner +Signed-off-by: Sasha Levin +--- + fs/select.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fs/select.c b/fs/select.c +index d4d881d439dcd..3f730b8581f65 100644 +--- a/fs/select.c ++++ b/fs/select.c +@@ -788,7 +788,7 @@ static inline int get_sigset_argpack(struct sigset_argpack *to, + } + return 0; + Efault: +- user_access_end(); ++ user_read_access_end(); + return -EFAULT; + } + +@@ -1361,7 +1361,7 @@ static inline int get_compat_sigset_argpack(struct compat_sigset_argpack *to, + } + return 0; + Efault: +- user_access_end(); ++ user_read_access_end(); + return -EFAULT; + } + +-- +2.39.5 + diff --git a/queue-6.6/selftests-bpf-fix-fill_link_info-selftest-on-powerpc.patch b/queue-6.6/selftests-bpf-fix-fill_link_info-selftest-on-powerpc.patch new file mode 100644 index 0000000000..487ed0e630 --- /dev/null +++ b/queue-6.6/selftests-bpf-fix-fill_link_info-selftest-on-powerpc.patch @@ -0,0 +1,98 @@ +From 5a4651ff2d9ee12d204b13b48dd6099c1fcef8dc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Dec 2024 12:27:20 +0530 +Subject: selftests/bpf: Fix fill_link_info selftest on powerpc + +From: Saket Kumar Bhaskar + +[ Upstream commit 4d33dc1bc31df80356c49e40dbd3ddff19500bcb ] + +With CONFIG_KPROBES_ON_FTRACE enabled on powerpc, ftrace_location_range +returns ftrace location for bpf_fentry_test1 at offset of 4 bytes from +function entry. This is because branch to _mcount function is at offset +of 4 bytes in function profile sequence. + +To fix this, add entry_offset of 4 bytes while verifying the address for +kprobe entry address of bpf_fentry_test1 in verify_perf_link_info in +selftest, when CONFIG_KPROBES_ON_FTRACE is enabled. + +Disassemble of bpf_fentry_test1: + +c000000000e4b080 : +c000000000e4b080: a6 02 08 7c mflr r0 +c000000000e4b084: b9 e2 22 4b bl c00000000007933c <_mcount> +c000000000e4b088: 01 00 63 38 addi r3,r3,1 +c000000000e4b08c: b4 07 63 7c extsw r3,r3 +c000000000e4b090: 20 00 80 4e blr + +When CONFIG_PPC_FTRACE_OUT_OF_LINE [1] is enabled, these function profile +sequence is moved out of line with an unconditional branch at offset 0. +So, the test works without altering the offset for +'CONFIG_KPROBES_ON_FTRACE && CONFIG_PPC_FTRACE_OUT_OF_LINE' case. + +Disassemble of bpf_fentry_test1: + +c000000000f95190 : +c000000000f95190: 00 00 00 60 nop +c000000000f95194: 01 00 63 38 addi r3,r3,1 +c000000000f95198: b4 07 63 7c extsw r3,r3 +c000000000f9519c: 20 00 80 4e blr + +[1] https://lore.kernel.org/all/20241030070850.1361304-13-hbathini@linux.ibm.com/ + +Fixes: 23cf7aa539dc ("selftests/bpf: Add selftest for fill_link_info") +Signed-off-by: Saket Kumar Bhaskar +Signed-off-by: Andrii Nakryiko +Link: https://lore.kernel.org/bpf/20241209065720.234344-1-skb99@linux.ibm.com +Signed-off-by: Sasha Levin +--- + .../selftests/bpf/prog_tests/fill_link_info.c | 4 ++++ + .../selftests/bpf/progs/test_fill_link_info.c | 13 ++++++++++--- + 2 files changed, 14 insertions(+), 3 deletions(-) + +diff --git a/tools/testing/selftests/bpf/prog_tests/fill_link_info.c b/tools/testing/selftests/bpf/prog_tests/fill_link_info.c +index 5b0c6a04cdbfe..e0208b0e53f16 100644 +--- a/tools/testing/selftests/bpf/prog_tests/fill_link_info.c ++++ b/tools/testing/selftests/bpf/prog_tests/fill_link_info.c +@@ -164,6 +164,10 @@ static void test_kprobe_fill_link_info(struct test_fill_link_info *skel, + /* See also arch_adjust_kprobe_addr(). */ + if (skel->kconfig->CONFIG_X86_KERNEL_IBT) + entry_offset = 4; ++ if (skel->kconfig->CONFIG_PPC64 && ++ skel->kconfig->CONFIG_KPROBES_ON_FTRACE && ++ !skel->kconfig->CONFIG_PPC_FTRACE_OUT_OF_LINE) ++ entry_offset = 4; + err = verify_perf_link_info(link_fd, type, kprobe_addr, 0, entry_offset); + ASSERT_OK(err, "verify_perf_link_info"); + } else { +diff --git a/tools/testing/selftests/bpf/progs/test_fill_link_info.c b/tools/testing/selftests/bpf/progs/test_fill_link_info.c +index 564f402d56fef..54b53ad05339d 100644 +--- a/tools/testing/selftests/bpf/progs/test_fill_link_info.c ++++ b/tools/testing/selftests/bpf/progs/test_fill_link_info.c +@@ -6,13 +6,20 @@ + #include + + extern bool CONFIG_X86_KERNEL_IBT __kconfig __weak; ++extern bool CONFIG_PPC_FTRACE_OUT_OF_LINE __kconfig __weak; ++extern bool CONFIG_KPROBES_ON_FTRACE __kconfig __weak; ++extern bool CONFIG_PPC64 __kconfig __weak; + +-/* This function is here to have CONFIG_X86_KERNEL_IBT +- * used and added to object BTF. ++/* This function is here to have CONFIG_X86_KERNEL_IBT, ++ * CONFIG_PPC_FTRACE_OUT_OF_LINE, CONFIG_KPROBES_ON_FTRACE, ++ * CONFIG_PPC6 used and added to object BTF. + */ + int unused(void) + { +- return CONFIG_X86_KERNEL_IBT ? 0 : 1; ++ return CONFIG_X86_KERNEL_IBT || ++ CONFIG_PPC_FTRACE_OUT_OF_LINE || ++ CONFIG_KPROBES_ON_FTRACE || ++ CONFIG_PPC64 ? 0 : 1; + } + + SEC("kprobe") +-- +2.39.5 + diff --git a/queue-6.6/selftests-harness-fix-printing-of-mismatch-values-in.patch b/queue-6.6/selftests-harness-fix-printing-of-mismatch-values-in.patch new file mode 100644 index 0000000000..df22c6478b --- /dev/null +++ b/queue-6.6/selftests-harness-fix-printing-of-mismatch-values-in.patch @@ -0,0 +1,83 @@ +From 6e90ed02c3489202df2d11ac0cac3719d3bb6899 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 Jan 2025 19:07:57 +0200 +Subject: selftests: harness: fix printing of mismatch values in __EXPECT() + +From: Dmitry V. Levin + +[ Upstream commit 02bc220dc6dc7c56edc4859bc5dd2c08b95d5fb5 ] + +intptr_t and uintptr_t are not big enough types on 32-bit architectures +when printing 64-bit values, resulting to the following incorrect +diagnostic output: + + # get_syscall_info.c:209:get_syscall_info:Expected exp_args[2] (3134324433) == info.entry.args[1] (3134324433) + +Replace intptr_t and uintptr_t with intmax_t and uintmax_t, respectively. +With this fix, the same test produces more usable diagnostic output: + + # get_syscall_info.c:209:get_syscall_info:Expected exp_args[2] (3134324433) == info.entry.args[1] (18446744072548908753) + +Link: https://lore.kernel.org/r/20250108170757.GA6723@strace.io +Fixes: b5bb6d3068ea ("selftests/seccomp: fix 32-bit build warnings") +Signed-off-by: Dmitry V. Levin +Reviewed-by: Kees Cook +Signed-off-by: Shuah Khan +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/kselftest_harness.h | 24 ++++++++++----------- + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/tools/testing/selftests/kselftest_harness.h b/tools/testing/selftests/kselftest_harness.h +index e05ac82610467..878aac3b5ed54 100644 +--- a/tools/testing/selftests/kselftest_harness.h ++++ b/tools/testing/selftests/kselftest_harness.h +@@ -710,33 +710,33 @@ + /* Report with actual signedness to avoid weird output. */ \ + switch (is_signed_type(__exp) * 2 + is_signed_type(__seen)) { \ + case 0: { \ +- unsigned long long __exp_print = (uintptr_t)__exp; \ +- unsigned long long __seen_print = (uintptr_t)__seen; \ +- __TH_LOG("Expected %s (%llu) %s %s (%llu)", \ ++ uintmax_t __exp_print = (uintmax_t)__exp; \ ++ uintmax_t __seen_print = (uintmax_t)__seen; \ ++ __TH_LOG("Expected %s (%ju) %s %s (%ju)", \ + _expected_str, __exp_print, #_t, \ + _seen_str, __seen_print); \ + break; \ + } \ + case 1: { \ +- unsigned long long __exp_print = (uintptr_t)__exp; \ +- long long __seen_print = (intptr_t)__seen; \ +- __TH_LOG("Expected %s (%llu) %s %s (%lld)", \ ++ uintmax_t __exp_print = (uintmax_t)__exp; \ ++ intmax_t __seen_print = (intmax_t)__seen; \ ++ __TH_LOG("Expected %s (%ju) %s %s (%jd)", \ + _expected_str, __exp_print, #_t, \ + _seen_str, __seen_print); \ + break; \ + } \ + case 2: { \ +- long long __exp_print = (intptr_t)__exp; \ +- unsigned long long __seen_print = (uintptr_t)__seen; \ +- __TH_LOG("Expected %s (%lld) %s %s (%llu)", \ ++ intmax_t __exp_print = (intmax_t)__exp; \ ++ uintmax_t __seen_print = (uintmax_t)__seen; \ ++ __TH_LOG("Expected %s (%jd) %s %s (%ju)", \ + _expected_str, __exp_print, #_t, \ + _seen_str, __seen_print); \ + break; \ + } \ + case 3: { \ +- long long __exp_print = (intptr_t)__exp; \ +- long long __seen_print = (intptr_t)__seen; \ +- __TH_LOG("Expected %s (%lld) %s %s (%lld)", \ ++ intmax_t __exp_print = (intmax_t)__exp; \ ++ intmax_t __seen_print = (intmax_t)__seen; \ ++ __TH_LOG("Expected %s (%jd) %s %s (%jd)", \ + _expected_str, __exp_print, #_t, \ + _seen_str, __seen_print); \ + break; \ +-- +2.39.5 + diff --git a/queue-6.6/selftests-landlock-fix-error-message.patch b/queue-6.6/selftests-landlock-fix-error-message.patch new file mode 100644 index 0000000000..5e7b161fad --- /dev/null +++ b/queue-6.6/selftests-landlock-fix-error-message.patch @@ -0,0 +1,41 @@ +From c3a024d1ebdeabc31cf53101ea44f329c0e34096 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 8 Jan 2025 16:43:28 +0100 +Subject: selftests/landlock: Fix error message +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Mickaël Salaün + +[ Upstream commit 2107c35128ad751b201eb92fe91443450d9e5c37 ] + +The global variable errno may not be set in test_execute(). Do not use +it in related error message. + +Cc: Günther Noack +Fixes: e1199815b47b ("selftests/landlock: Add user space tests") +Link: https://lore.kernel.org/r/20250108154338.1129069-21-mic@digikod.net +Signed-off-by: Mickaël Salaün +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/landlock/fs_test.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/tools/testing/selftests/landlock/fs_test.c b/tools/testing/selftests/landlock/fs_test.c +index 720bafa0f87be..c239838c796a4 100644 +--- a/tools/testing/selftests/landlock/fs_test.c ++++ b/tools/testing/selftests/landlock/fs_test.c +@@ -1861,8 +1861,7 @@ static void test_execute(struct __test_metadata *const _metadata, const int err, + ASSERT_EQ(1, WIFEXITED(status)); + ASSERT_EQ(err ? 2 : 0, WEXITSTATUS(status)) + { +- TH_LOG("Unexpected return code for \"%s\": %s", path, +- strerror(errno)); ++ TH_LOG("Unexpected return code for \"%s\"", path); + }; + } + +-- +2.39.5 + diff --git a/queue-6.6/selftests-powerpc-fix-argument-order-to-timer_sub.patch b/queue-6.6/selftests-powerpc-fix-argument-order-to-timer_sub.patch new file mode 100644 index 0000000000..e0c1f76550 --- /dev/null +++ b/queue-6.6/selftests-powerpc-fix-argument-order-to-timer_sub.patch @@ -0,0 +1,51 @@ +From d144d6279c441517eb47f64b83e8132ac80a1349 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 18 Dec 2024 22:43:47 +1100 +Subject: selftests/powerpc: Fix argument order to timer_sub() + +From: Michael Ellerman + +[ Upstream commit 2bf66e66d2e6feece6175ec09ec590a0a8563bdd ] + +Commit c814bf958926 ("powerpc/selftests: Use timersub() for +gettimeofday()"), got the order of arguments to timersub() wrong, +leading to a negative time delta being reported, eg: + + test: gettimeofday + tags: git_version:v6.12-rc5-409-gdddf291c3030 + time = -3.297781 + success: gettimeofday + +The correct order is minuend, subtrahend, which in this case is end, +start. Which gives: + + test: gettimeofday + tags: git_version:v6.12-rc5-409-gdddf291c3030-dirty + time = 3.300650 + success: gettimeofday + +Fixes: c814bf958926 ("powerpc/selftests: Use timersub() for gettimeofday()") +Signed-off-by: Michael Ellerman +Signed-off-by: Madhavan Srinivasan +Link: https://patch.msgid.link/20241218114347.428108-1-mpe@ellerman.id.au +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/powerpc/benchmarks/gettimeofday.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/testing/selftests/powerpc/benchmarks/gettimeofday.c b/tools/testing/selftests/powerpc/benchmarks/gettimeofday.c +index 580fcac0a09f3..b71ef8a493ed1 100644 +--- a/tools/testing/selftests/powerpc/benchmarks/gettimeofday.c ++++ b/tools/testing/selftests/powerpc/benchmarks/gettimeofday.c +@@ -20,7 +20,7 @@ static int test_gettimeofday(void) + gettimeofday(&tv_end, NULL); + } + +- timersub(&tv_start, &tv_end, &tv_diff); ++ timersub(&tv_end, &tv_start, &tv_diff); + + printf("time = %.6f\n", tv_diff.tv_sec + (tv_diff.tv_usec) * 1e-6); + +-- +2.39.5 + diff --git a/queue-6.6/selftests-timers-clocksource-switch-adapt-progress-t.patch b/queue-6.6/selftests-timers-clocksource-switch-adapt-progress-t.patch new file mode 100644 index 0000000000..305e1d3aab --- /dev/null +++ b/queue-6.6/selftests-timers-clocksource-switch-adapt-progress-t.patch @@ -0,0 +1,52 @@ +From 295a5730b7b82e3f0d9993d6a152111429c87b12 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 12 Dec 2024 10:02:56 +0100 +Subject: selftests: timers: clocksource-switch: Adapt progress to kselftest + framework + +From: Geert Uytterhoeven + +[ Upstream commit 8694e6a7f7dba23d3abd9f5a96f64d161704c7b1 ] + +When adapting the test to the kselftest framework, a few printf() calls +indicating test progress were not updated. + +Fix this by replacing these printf() calls by ksft_print_msg() calls. + +Link: https://lore.kernel.org/r/7dd4b9ab6e43268846e250878ebf25ae6d3d01ce.1733994134.git.geert+renesas@glider.be +Fixes: ce7d101750ff ("selftests: timers: clocksource-switch: adapt to kselftest framework") +Signed-off-by: Geert Uytterhoeven +Reviewed-by: Thomas Gleixner +Signed-off-by: Shuah Khan +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/timers/clocksource-switch.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/tools/testing/selftests/timers/clocksource-switch.c b/tools/testing/selftests/timers/clocksource-switch.c +index c5264594064c8..83faa4e354e38 100644 +--- a/tools/testing/selftests/timers/clocksource-switch.c ++++ b/tools/testing/selftests/timers/clocksource-switch.c +@@ -156,8 +156,8 @@ int main(int argc, char **argv) + /* Check everything is sane before we start switching asynchronously */ + if (do_sanity_check) { + for (i = 0; i < count; i++) { +- printf("Validating clocksource %s\n", +- clocksource_list[i]); ++ ksft_print_msg("Validating clocksource %s\n", ++ clocksource_list[i]); + if (change_clocksource(clocksource_list[i])) { + status = -1; + goto out; +@@ -169,7 +169,7 @@ int main(int argc, char **argv) + } + } + +- printf("Running Asynchronous Switching Tests...\n"); ++ ksft_print_msg("Running Asynchronous Switching Tests...\n"); + pid = fork(); + if (!pid) + return run_tests(runtime); +-- +2.39.5 + diff --git a/queue-6.6/serial-8250-adjust-the-timeout-for-fifo-mode.patch b/queue-6.6/serial-8250-adjust-the-timeout-for-fifo-mode.patch new file mode 100644 index 0000000000..5978ac6f84 --- /dev/null +++ b/queue-6.6/serial-8250-adjust-the-timeout-for-fifo-mode.patch @@ -0,0 +1,122 @@ +From 18b1c4cc45af80b44564b29dfe0a6c9d88fbca81 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Jan 2025 22:32:57 +0106 +Subject: serial: 8250: Adjust the timeout for FIFO mode + +From: John Ogness + +[ Upstream commit d91f98be26510f5f81ec66425bb0306d1ccd571a ] + +After a console has written a record into UART_TX, it uses +wait_for_xmitr() to wait until the data has been sent out before +returning. However, wait_for_xmitr() will timeout after 10ms, +regardless if the data has been transmitted or not. + +For single bytes, this timeout is sufficient even at very slow +baud rates, such as 1200bps. However, when FIFO mode is used, +there may be 64 bytes pushed into the FIFO at once. At a baud +rate of 115200bps, the 10ms timeout is still sufficient. But +when using lower baud rates (such as 57600bps), the timeout +is _not_ sufficient. This causes longer lines to be cut off, +resulting in lost and horribly misformatted output on the +console. + +When using FIFO mode, take the number of bytes into account to +determine an appropriate maximum timeout. Increasing the timeout +does not affect performance since ideally the timeout never +occurs. + +Fixes: 8f3631f0f6eb ("serial/8250: Use fifo in 8250 console driver") +Signed-off-by: John Ogness +Reviewed-by: Andy Shevchenko +Reviewed-by: Wander Lairson Costa +Reviewed-by: Petr Mladek +Link: https://lore.kernel.org/r/20250107212702.169493-2-john.ogness@linutronix.de +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/8250/8250_port.c | 32 +++++++++++++++++++++++------ + 1 file changed, 26 insertions(+), 6 deletions(-) + +diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c +index a17803da83f8c..2b1b2928ef7b7 100644 +--- a/drivers/tty/serial/8250/8250_port.c ++++ b/drivers/tty/serial/8250/8250_port.c +@@ -2074,7 +2074,8 @@ static void serial8250_break_ctl(struct uart_port *port, int break_state) + serial8250_rpm_put(up); + } + +-static void wait_for_lsr(struct uart_8250_port *up, int bits) ++/* Returns true if @bits were set, false on timeout */ ++static bool wait_for_lsr(struct uart_8250_port *up, int bits) + { + unsigned int status, tmout = 10000; + +@@ -2089,11 +2090,11 @@ static void wait_for_lsr(struct uart_8250_port *up, int bits) + udelay(1); + touch_nmi_watchdog(); + } ++ ++ return (tmout != 0); + } + +-/* +- * Wait for transmitter & holding register to empty +- */ ++/* Wait for transmitter and holding register to empty with timeout */ + static void wait_for_xmitr(struct uart_8250_port *up, int bits) + { + unsigned int tmout; +@@ -3350,6 +3351,16 @@ static void serial8250_console_restore(struct uart_8250_port *up) + serial8250_out_MCR(up, up->mcr | UART_MCR_DTR | UART_MCR_RTS); + } + ++static void fifo_wait_for_lsr(struct uart_8250_port *up, unsigned int count) ++{ ++ unsigned int i; ++ ++ for (i = 0; i < count; i++) { ++ if (wait_for_lsr(up, UART_LSR_THRE)) ++ return; ++ } ++} ++ + /* + * Print a string to the serial port using the device FIFO + * +@@ -3359,13 +3370,15 @@ static void serial8250_console_restore(struct uart_8250_port *up) + static void serial8250_console_fifo_write(struct uart_8250_port *up, + const char *s, unsigned int count) + { +- int i; + const char *end = s + count; + unsigned int fifosize = up->tx_loadsz; ++ unsigned int tx_count = 0; + bool cr_sent = false; ++ unsigned int i; + + while (s != end) { +- wait_for_lsr(up, UART_LSR_THRE); ++ /* Allow timeout for each byte of a possibly full FIFO */ ++ fifo_wait_for_lsr(up, fifosize); + + for (i = 0; i < fifosize && s != end; ++i) { + if (*s == '\n' && !cr_sent) { +@@ -3376,7 +3389,14 @@ static void serial8250_console_fifo_write(struct uart_8250_port *up, + cr_sent = false; + } + } ++ tx_count = i; + } ++ ++ /* ++ * Allow timeout for each byte written since the caller will only wait ++ * for UART_LSR_BOTH_EMPTY using the timeout of a single character ++ */ ++ fifo_wait_for_lsr(up, tx_count); + } + + /* +-- +2.39.5 + diff --git a/queue-6.6/serial-sc16is7xx-use-device_property-apis-when-confi.patch b/queue-6.6/serial-sc16is7xx-use-device_property-apis-when-confi.patch new file mode 100644 index 0000000000..d302937e4c --- /dev/null +++ b/queue-6.6/serial-sc16is7xx-use-device_property-apis-when-confi.patch @@ -0,0 +1,77 @@ +From 595cfb8ac004bb0c9c09675a34149356a0653c02 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 27 Sep 2023 12:01:52 -0400 +Subject: serial: sc16is7xx: use device_property APIs when configuring irda + mode + +From: Hugo Villeneuve + +[ Upstream commit 1a0a2a1e57aa8dcdae25229f6e95cf6bd4817faf ] + +Convert driver to be property provider agnostic and allow it to be +used on non-OF platforms. + +Signed-off-by: Hugo Villeneuve +Link: https://lore.kernel.org/r/20230927160153.2717788-2-hugo@hugovil.com +Signed-off-by: Greg Kroah-Hartman +Stable-dep-of: 28fa3291cad1 ("clk: fix an OF node reference leak in of_clk_get_parent_name()") +Signed-off-by: Sasha Levin +--- + drivers/tty/serial/sc16is7xx.c | 34 ++++++++++++++++++++++++---------- + 1 file changed, 24 insertions(+), 10 deletions(-) + +diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c +index f290fbe21d633..8a2ce2ca6b394 100644 +--- a/drivers/tty/serial/sc16is7xx.c ++++ b/drivers/tty/serial/sc16is7xx.c +@@ -1410,6 +1410,29 @@ static int sc16is7xx_setup_gpio_chip(struct sc16is7xx_port *s) + } + #endif + ++static void sc16is7xx_setup_irda_ports(struct sc16is7xx_port *s) ++{ ++ int i; ++ int ret; ++ int count; ++ u32 irda_port[2]; ++ struct device *dev = s->p[0].port.dev; ++ ++ count = device_property_count_u32(dev, "irda-mode-ports"); ++ if (count < 0 || count > ARRAY_SIZE(irda_port)) ++ return; ++ ++ ret = device_property_read_u32_array(dev, "irda-mode-ports", ++ irda_port, count); ++ if (ret) ++ return; ++ ++ for (i = 0; i < count; i++) { ++ if (irda_port[i] < s->devtype->nr_uart) ++ s->p[irda_port[i]].irda_mode = true; ++ } ++} ++ + /* + * Configure ports designated to operate as modem control lines. + */ +@@ -1603,16 +1626,7 @@ static int sc16is7xx_probe(struct device *dev, + sc16is7xx_power(&s->p[i].port, 0); + } + +- if (dev->of_node) { +- struct property *prop; +- const __be32 *p; +- u32 u; +- +- of_property_for_each_u32(dev->of_node, "irda-mode-ports", +- prop, p, u) +- if (u < devtype->nr_uart) +- s->p[u].irda_mode = true; +- } ++ sc16is7xx_setup_irda_ports(s); + + ret = sc16is7xx_setup_mctrl_ports(s, regmaps[0]); + if (ret) +-- +2.39.5 + diff --git a/queue-6.6/series b/queue-6.6/series new file mode 100644 index 0000000000..449b2c4ca8 --- /dev/null +++ b/queue-6.6/series @@ -0,0 +1,358 @@ +powerpc-book3s64-hugetlb-fix-disabling-hugetlb-when-.patch +dlm-fix-srcu_read_lock-return-type-to-int.patch +afs-fix-eexist-error-returned-from-afs_rmdir-to-be-e.patch +afs-fix-directory-format-encoding-struct.patch +afs-fix-cleanup-of-immediately-failed-async-calls.patch +fs-fix-proc_handler-for-sysctl_nr_open.patch +block-retry-call-probe-after-request_module-in-blk_r.patch +nbd-don-t-allow-reconnect-after-disconnect.patch +pstore-blk-trivial-typo-fixes.patch +nvme-add-error-check-for-xa_store-in-nvme_get_effect.patch +selftests-powerpc-fix-argument-order-to-timer_sub.patch +nvme-add-error-path-for-xa_store-in-nvme_init_effect.patch +partitions-ldm-remove-the-initial-kernel-doc-notatio.patch +select-fix-unbalanced-user_access_end.patch +nvme-fix-bogus-kzalloc-return-check-in-nvme_init_eff.patch +afs-fix-the-fallback-handling-for-the-yfs.removefile.patch +perf-core-save-raw-sample-data-conditionally-based-o.patch +sched-fair-fix-value-reported-by-hot-tasks-pulled-in.patch +sched-topology-rename-die-domain-to-pkg.patch +x86-cpu-enable-sd_asym_packing-for-pkg-domain-on-amd.patch +x86-topology-use-x86_sched_itmt_flags-for-pkg-domain.patch +drm-msm-dp-set-safe_to_exit_level-before-printing-it.patch +drm-etnaviv-fix-page-property-being-used-for-non-wri.patch +drm-etnaviv-drop-the-second-argument-of-the-etnaviv_.patch +drm-etnaviv-drop-the-len-parameter-of-etnaviv_iommu_.patch +drm-etnaviv-record-gpu-visible-size-of-gem-bo-separa.patch +drm-etnaviv-map-and-unmap-gpuva-range-with-respect-t.patch +drm-etnaviv-drop-the-offset-in-page-manipulation.patch +drm-amd-pm-fix-an-error-handling-path-in-vega10_enab.patch +drm-amdgpu-fix-potential-null-pointer-dereference-in.patch +drm-rockchip-vop2-fix-cluster-windows-alpha-ctrl-reg.patch +drm-rockchip-vop2-fix-the-mixer-alpha-setup-for-laye.patch +drm-rockchip-vop2-set-yuv-rgb-overlay-mode.patch +drm-rockchip-vop2-set-bg-dly-and-prescan-dly-at-vop2.patch +drm-rockchip-vop2-fix-the-windows-switch-between-dif.patch +drm-rockchip-vop2-check-linear-format-for-cluster-wi.patch +drm-rockchip-move-output-interface-related-definitio.patch +drm-rockchip-vop2-include-rockchip_drm_drv.h.patch +drm-amdgpu-vcn-reset-fw_shared-under-sriov.patch +opp-add-index-check-to-assert-to-avoid-buffer-overfl.patch +opp-fix-dev_pm_opp_find_bw_-when-bandwidth-table-not.patch +drm-msm-dpu-link-dspp_2-_3-blocks-on-sm8150.patch +drm-msm-dpu-link-dspp_2-_3-blocks-on-sc8180x.patch +drm-msm-dpu-link-dspp_2-_3-blocks-on-sm8250.patch +drm-msm-dpu-link-dspp_2-_3-blocks-on-sm8350.patch +drm-msm-dpu-link-dspp_2-_3-blocks-on-sm8550.patch +drm-msm-check-return-value-of-of_dma_configure.patch +drm-bridge-it6505-change-definition-of-aux_fifo_max_.patch +drm-amdgpu-tear-down-ttm-range-manager-for-doorbell-.patch +genirq-make-handle_enforce_irqctx-unconditionally-av.patch +ipmi-ipmb-add-check-devm_kasprintf-returned-value.patch +wifi-ath11k-fix-unexpected-return-buffer-manager-err.patch +wifi-rtlwifi-do-not-complete-firmware-loading-needle.patch +wifi-rtlwifi-rtl8192se-rise-completion-of-firmware-l.patch +wifi-rtlwifi-wait-for-firmware-loading-before-releas.patch +wifi-rtlwifi-fix-init_sw_vars-leak-when-probe-fails.patch +wifi-rtlwifi-usb-fix-workqueue-leak-when-probe-fails.patch +wifi-wcn36xx-fix-channel-survey-memory-allocation-si.patch +net_sched-sch_sfq-annotate-data-races-around-q-pertu.patch +net_sched-sch_sfq-handle-bigger-packets.patch +net_sched-sch_sfq-don-t-allow-1-packet-limit.patch +spi-zynq-qspi-add-check-for-clk_enable.patch +rxrpc-fix-handling-of-received-connection-abort.patch +dt-bindings-mmc-controller-clarify-the-address-cells.patch +serial-sc16is7xx-use-device_property-apis-when-confi.patch +clk-si5351-allow-plls-to-be-adjusted-without-reset.patch +of-remove-internal-arguments-from-of_property_for_ea.patch +clk-fix-an-of-node-reference-leak-in-of_clk_get_pare.patch +dt-bindings-leds-class-multicolor-fix-path-to-color-.patch +wifi-rtlwifi-remove-unused-check_buddy_priv.patch +wifi-rtlwifi-destroy-workqueue-at-rtl_deinit_core.patch +wifi-rtlwifi-fix-memory-leaks-and-invalid-access-at-.patch +wifi-rtlwifi-pci-wait-for-firmware-loading-before-re.patch +hid-multitouch-fix-support-for-goodix-pid-0x01e9.patch +regulator-dt-bindings-mt6315-drop-regulator-compatib.patch +wifi-brcmfmac-add-missing-header-include-for-brcmf_d.patch +acpi-fan-cleanup-resources-in-the-error-path-of-.pro.patch +cpupower-fix-tsc-mhz-calculation.patch +dt-bindings-mfd-bd71815-fix-rsense-and-typos.patch +leds-netxbig-fix-an-of-node-reference-leak-in-netxbi.patch +inetpeer-remove-create-argument-of-inet_getpeer_v-46.patch +inetpeer-remove-create-argument-of-inet_getpeer.patch +inetpeer-update-inetpeer-timestamp-in-inet_getpeer.patch +inetpeer-do-not-get-a-refcount-in-inet_getpeer.patch +pwm-stm32-lp-add-check-for-clk_enable.patch +cpufreq-schedutil-fix-superfluous-updates-caused-by-.patch +gpio-pca953x-drop-unused-fields-in-struct-pca953x_pl.patch +gpio-pca953x-fully-convert-to-device-managed-resourc.patch +gpio-pca953x-log-an-error-when-failing-to-get-the-re.patch +cpufreq-qcom-fix-qcom_cpufreq_hw_recalc_rate-to-quer.patch +cpufreq-qcom-implement-clk_ops-determine_rate-for-qc.patch +udp-deal-with-race-between-udp-socket-address-change.patch +clk-imx8mp-fix-clkout1-2-support.patch +team-prevent-adding-a-device-which-is-already-a-team.patch +dt-bindings-clock-sunxi-export-pll_video_2x-and-pll_.patch +clk-sunxi-ng-a64-drop-redundant-clk_pll_video0_2x-an.patch +clk-sunxi-ng-a64-stop-force-selecting-pll-mipi-as-tc.patch +regulator-of-implement-the-unwind-path-of-of_regulat.patch +ax25-rcu-protect-dev-ax25_ptr.patch +opp-of-fix-an-of-node-leak-in-_opp_add_static_v2.patch +ipmi-ssif_bmc-fix-new-request-loss-when-bmc-ready-fo.patch +wifi-ath12k-fix-tx-power-max-reg-power-update-to-fir.patch +clk-qcom-gcc-sdm845-do-not-use-shared-clk_ops-for-qu.patch +hid-hid-thrustmaster-fix-warning-in-thrustmaster_pro.patch +hid-fix-generic-desktop-d-pad-controls.patch +leds-cht-wcove-use-devm_led_classdev_register-to-avo.patch +mfd-syscon-remove-extern-from-function-prototypes.patch +mfd-syscon-add-of_syscon_register_regmap-api.patch +mfd-syscon-use-scoped-variables-with-memory-allocato.patch +mfd-syscon-fix-race-in-device_node_get_regmap.patch +samples-landlock-fix-possible-null-dereference-in-pa.patch +wifi-wlcore-fix-unbalanced-pm_runtime-calls.patch +wifi-mt76-mt7915-fix-mesh-scan-on-mt7916-dbdc.patch +wifi-mac80211-prohibit-deactivating-all-links.patch +wifi-mac80211-fix-tid-removal-during-mesh-forwarding.patch +wifi-mac80211-fix-common-size-calculation-for-ml-ele.patch +wifi-mac80211-don-t-flush-non-uploaded-stas.patch +clk-ralink-mtmips-remove-duplicated-xtal-clock-for-r.patch +net-smc-fix-data-error-when-recvmsg-with-msg_peek-fl.patch +landlock-handle-weird-files.patch +wifi-mt76-mt76u_vendor_request-do-not-print-error-me.patch +wifi-mt76-mt7921-fix-using-incorrect-group-cipher-af.patch +wifi-mt76-mt7915-fix-overflows-seen-when-writing-lim.patch +wifi-mt76-mt7996-fix-rx-filter-setting-for-bfee-func.patch +wifi-mt76-mt7915-firmware-restart-on-devices-with-a-.patch +wifi-mt76-connac-move-mt7615_mcu_del_wtbl_all-to-con.patch +wifi-mt76-mt7915-improve-hardware-restart-reliabilit.patch +wifi-mt76-mt7915-fix-omac-index-assignment-after-har.patch +wifi-mt76-mt7915-fix-register-mapping.patch +wifi-mt76-mt7996-fix-register-mapping.patch +wifi-mt76-mt7996-add-max-mpdu-len-capability.patch +wifi-mt76-mt7996-fix-the-capability-of-reception-of-.patch +wifi-mt76-mt7996-fix-he-phy-capability.patch +wifi-mt76-mt7996-fix-incorrect-indexing-of-mib-fw-ev.patch +wifi-mt76-mt7996-fix-ldpc-setting.patch +cpufreq-acpi-fix-max-frequency-computation.patch +selftests-timers-clocksource-switch-adapt-progress-t.patch +selftests-harness-fix-printing-of-mismatch-values-in.patch +wifi-cfg80211-handle-specific-bssid-in-6ghz-scanning.patch +wifi-cfg80211-adjust-allocation-of-colocated-ap-data.patch +inet-ipmr-fix-data-races.patch +clk-analogbits-fix-incorrect-calculation-of-vco-rate.patch +pwm-stm32-add-check-for-clk_enable.patch +selftests-landlock-fix-error-message.patch +net-let-net.core.dev_weight-always-be-non-zero.patch +net-mlxfw-drop-hard-coded-max-fw-flash-image-size.patch +octeon_ep-remove-firmware-stats-fetch-in-ndo_get_sta.patch +net-avoid-race-between-device-unregistration-and-eth.patch +net-sched-disallow-replacing-of-child-qdisc-from-one.patch +netfilter-nf_tables-de-constify-set-commit-ops-funct.patch +netfilter-nft_set_rbtree-rename-gc-deactivate-erase-.patch +netfilter-nft_set_rbtree-prefer-sync-gc-to-async-wor.patch +netfilter-nf_tables-fix-set-size-with-rbtree-backend.patch +netfilter-nft_flow_offload-update-tcp-state-flags-un.patch +net-ethernet-ti-am65-cpsw-fix-freeing-irq-in-am65_cp.patch +tcp_cubic-fix-incorrect-hystart-round-start-detectio.patch +net-rose-prevent-integer-overflows-in-rose_setsockop.patch +libbpf-don-t-adjust-usdt-semaphore-address-if-.staps.patch +tools-testing-selftests-bpf-test_tc_tunnel.sh-fix-wa.patch +libbpf-fix-segfault-due-to-libelf-functions-not-sett.patch +asoc-sun4i-spdif-add-clock-multiplier-settings.patch +selftests-bpf-fix-fill_link_info-selftest-on-powerpc.patch +crypto-api-fix-boot-up-self-test-race.patch +crypto-caam-use-jobr-s-space-to-access-page-0-regs.patch +perf-header-fix-one-memory-leakage-in-process_bpf_bt.patch +perf-header-fix-one-memory-leakage-in-process_bpf_pr.patch +perf-bpf-fix-two-memory-leakages-when-calling-perf_e.patch +asoc-renesas-rz-ssi-use-only-the-proper-amount-of-di.patch +perf-expr-initialize-is_test-value-in-expr__ctx_new.patch +ktest.pl-remove-unused-declarations-in-run_bisect_te.patch +bpf-bpf_local_storage-always-use-bpf_mem_alloc-in-pr.patch +crypto-hisilicon-sec2-optimize-the-error-return-proc.patch +crypto-hisilicon-sec2-fix-for-aead-icv-error.patch +crypto-hisilicon-sec2-fix-for-aead-invalid-authsize.patch +crypto-ixp4xx-fix-of-node-reference-leaks-in-init_ix.patch +alsa-seq-remove-redundant-tristate-for-snd_seq_ump_c.patch +alsa-seq-make-dependency-on-ump-clearer.patch +padata-fix-sysfs-store-callback-check.patch +perf-top-don-t-complain-about-lack-of-vmlinux-when-n.patch +perf-machine-don-t-ignore-_etext-when-not-a-text-sym.patch +perf-namespaces-introduce-nsinfo__set_in_pidns.patch +perf-namespaces-fixup-the-nsinfo__in_pidns-return-ty.patch +asoc-intel-avs-prefix-skl-apl-specific-members.patch +asoc-intel-avs-abstract-ipc-handling.patch +asoc-intel-avs-do-not-readq-u32-registers.patch +asoc-intel-avs-fix-theoretical-infinite-loop.patch +perf-report-fix-misleading-help-message-about-demang.patch +pinctrl-stm32-add-check-for-clk_enable.patch +pinctrl-amd-take-suspend-type-into-consideration-whi.patch +bpf-send-signals-asynchronously-if-preemptible.patch +bpf-tcp-mark-bpf_load_hdr_opt-arg2-as-read-write.patch +alsa-hda-realtek-fixed-headphone-distorted-sound-on-.patch +perf-lock-fix-parse_lock_type-which-only-retrieve-on.patch +padata-fix-uaf-in-padata_reorder.patch +padata-add-pd-get-put-refcnt-helper.patch +padata-avoid-uaf-for-reorder_work.patch +smb-client-fix-oops-due-to-unset-link-speed.patch +cifs-use-cifs_autodisable_serverino-for-disabling-ci.patch +soc-atmel-fix-device_node-release-in-atmel_soc_devic.patch +arm-at91-pm-change-bu-power-switch-to-automatic-mode.patch +arm64-dts-mediatek-mt8186-move-wakeup-to-mtu3-to-get.patch +arm64-dts-mt8183-set-dmic-one-wire-mode-on-damu.patch +arm64-dts-mediatek-mt8516-fix-gicv2-range.patch +arm64-dts-mediatek-mt8516-fix-wdt-irq-type.patch +arm64-dts-mediatek-mt8516-add-i2c-clock-div-property.patch +arm64-dts-mediatek-mt8516-reserve-192-kib-for-tf-a.patch +arm-dts-stm32-fix-ipcc-exti-declaration-on-stm32mp15.patch +rdma-mlx4-avoid-false-error-about-access-to-uninitia.patch +rdma-cxgb4-prevent-potential-integer-overflow-on-32b.patch +arm64-dts-mediatek-mt8173-evb-drop-regulator-compati.patch +arm64-dts-mediatek-mt8173-elm-drop-regulator-compati.patch +arm64-dts-mediatek-mt8192-asurada-drop-regulator-com.patch +arm64-dts-mediatek-mt8195-cherry-drop-regulator-comp.patch +arm64-dts-mediatek-mt8195-demo-drop-regulator-compat.patch +arm64-dts-mediatek-mt8173-elm-fix-mt6397-pmic-sub-no.patch +arm64-dts-mediatek-mt8173-evb-fix-mt6397-pmic-sub-no.patch +arm-dts-aspeed-yosemite4-correct-the-compatible-stri.patch +arm-dts-aspeed-yosemite4-add-required-properties-for.patch +arm-dts-aspeed-yosemite4-correct-the-compatible-stri.patch-2077 +arm-dts-socfpga-use-reset-name-stmmaceth-ocp-instead.patch +rdma-rxe-improve-newline-in-printing-messages.patch +rdma-rxe-fix-mismatched-max_msg_sz.patch +arm64-dts-mediatek-mt8183-kenzo-support-second-sourc.patch +arm64-dts-mediatek-mt8183-willow-support-second-sour.patch +rdma-srp-fix-error-handling-in-srp_add_port.patch +arm64-dts-mediatek-mt8195-remove-suspend-breaking-re.patch +arm-dts-stm32-deduplicate-serial-aliases-and-chosen-.patch +arm-dts-stm32-swap-usart3-and-uart8-alias-on-stm32mp.patch +memory-tegra20-emc-fix-an-of-node-reference-bug-in-t.patch +arm64-dts-mediatek-mt8183-kukui-jacuzzi-drop-pp3300_.patch +arm64-dts-qcom-msm8996-xiaomi-gemini-fix-lp5562-led1.patch +arm64-dts-qcom-sa8775p-ride-describe-sgmii_phy0-irq.patch +arm64-dts-qcom-sa8775p-ride-describe-sgmii_phy1-irq.patch +arm64-dts-qcom-sa8775p-ride-enable-pmm8654au_0_pon_r.patch +arm64-dts-qcom-move-common-parts-for-sa8775p-ride-va.patch +arm64-dts-qcom-sa8775p-update-sleep_clk-frequency.patch +arm64-dts-qcom-msm8996-fix-up-usb3-interrupts.patch +arm64-dts-qcom-msm8994-describe-usb-interrupts.patch +arm64-dts-qcom-sm7225-fairphone-fp4-drop-extra-qcom-.patch +arm64-dts-qcom-msm8916-correct-sleep-clock-frequency.patch +arm64-dts-qcom-msm8939-correct-sleep-clock-frequency.patch +arm64-dts-qcom-msm8994-correct-sleep-clock-frequency.patch +arm64-dts-qcom-qcs404-correct-sleep-clock-frequency.patch +arm64-dts-qcom-q-dr-u1000-correct-sleep-clock-freque.patch +arm64-dts-qcom-qrb4210-rb2-correct-sleep-clock-frequ.patch +arm64-dts-qcom-sc7280-correct-sleep-clock-frequency.patch +arm64-dts-qcom-sdx75-correct-sleep-clock-frequency.patch +arm64-dts-qcom-sm4450-correct-sleep-clock-frequency.patch +arm64-dts-qcom-sm6125-correct-sleep-clock-frequency.patch +arm64-dts-qcom-sm6375-correct-sleep-clock-frequency.patch +arm64-dts-qcom-sm8250-correct-sleep-clock-frequency.patch +arm64-dts-qcom-sm8350-correct-sleep-clock-frequency.patch +arm64-dts-qcom-sm8450-correct-sleep-clock-frequency.patch +arm-dts-microchip-sama5d27_wlsom1_ek-remove-mmc-ddr-.patch +arm-dts-microchip-sama5d27_wlsom1_ek-add-no-1-8-v-pr.patch +arm64-dts-ti-k3-am62-remove-duplicate-gicr-reg.patch +arm64-dts-ti-k3-am62a-remove-duplicate-gicr-reg.patch +arm64-dts-allwinner-a64-explicitly-assign-clock-pare.patch +rdma-bnxt_re-fix-to-drop-reference-to-the-mmap-entry.patch +rdma-hns-add-debugfs-to-hns-roce.patch +rdma-hns-clean-up-the-legacy-config_infiniband_hns.patch +arm-omap1-fix-up-the-retu-irq-on-nokia-770.patch +arm64-dts-qcom-sdm845-db845c-navigation-mezzanine-co.patch +arm64-dts-qcom-sdm845-db845c-navigation-mezzanine-re.patch +arm64-dts-qcom-sc7180-trogdor-quackingstick-add-miss.patch +arm64-dts-qcom-sc7180-remove-thermal-zone-polling-de.patch +arm64-dts-qcom-sc7180-trogdor-pompom-rename-5v-choke.patch +arm64-dts-qcom-add-sm7125-device-tree.patch +arm64-dts-qcom-sc7180-change-labels-to-lower-case.patch +arm64-dts-qcom-sc7180-fix-psci-power-domain-node-nam.patch +arm64-dts-qcom-sm8150-microsoft-surface-duo-fix-typo.patch +arm64-dts-qcom-sc8280xp-fix-up-remoteproc-register-s.patch +dts-arm64-mediatek-mt8195-remove-mt8183-compatible-f.patch +arm64-dts-mediatek-add-per-soc-compatibles-for-keypa.patch +arm64-dts-qcom-sdm845-fix-interrupt-types-of-camss-i.patch +arm64-dts-qcom-sm8250-fix-interrupt-types-of-camss-i.patch +arm-dts-mediatek-mt7623-fix-ir-nodename.patch +fbdev-omapfb-fix-an-of-node-leak-in-dss_of_port_get_.patch +arm64-tegra-fix-dma-id-for-spi2.patch +i3c-dw-add-hot-join-support.patch +i3c-dw-fix-use-after-free-in-dw_i3c_master-driver-du.patch +rdma-mlx5-fix-indirect-mkey-odp-page-count.patch +of-reserved-memory-do-not-make-kmemleak-ignore-freed.patch +efi-sysfb_efi-fix-w-1-warnings-when-efi-is-not-set.patch +rdma-rxe-fix-the-warning-__rxe_cleanup-0x12c-0x170-r.patch +iommufd-iova_bitmap-fix-shift-out-of-bounds-in-iova_.patch +spi-omap2-mcspi-correctly-handle-devm_clk_get_option.patch +media-rc-iguanair-handle-timeouts.patch +media-lmedm04-handle-errors-for-lme2510_int_read.patch +pci-endpoint-destroy-the-epc-device-in-devm_pci_epc_.patch +media-marvell-add-check-for-clk_enable.patch +media-i2c-imx290-register-0x3011-varies-between-imx3.patch +media-i2c-imx412-add-missing-newline-to-prints.patch +media-i2c-ov9282-correct-the-exposure-offset.patch +media-mipi-csis-add-check-for-clk_enable.patch +media-camif-core-add-check-for-clk_enable.patch +media-uvcvideo-propagate-buf-error-to-userspace.patch +mtd-rawnand-brcmnand-fix-status-read-of-brcmnand_wai.patch +mtd-hyperbus-hbmc-am654-convert-to-platform-remove-c.patch +mtd-hyperbus-hbmc-am654-fix-an-of-node-reference-lea.patch +media-nxp-imx8-isi-fix-v4l2-compliance-test-errors.patch +watchdog-rti_wdt-fix-an-of-node-leak-in-rti_wdt_prob.patch +staging-media-imx-fix-of-node-leak-in-imx_media_add_.patch +media-dvb-usb-v2-af9035-fix-iso-c90-compilation-erro.patch +pci-rcar-ep-fix-incorrect-variable-used-when-calling.patch +pci-imx6-simplify-clock-handling-by-using-clk_bulk-f.patch +pci-imx6-skip-controller_id-generation-logic-for-i.m.patch +pci-endpoint-pci-epf-test-set-dma_chan_rx-pointer-to.patch +pci-endpoint-pci-epf-test-fix-check-for-dma-memcpy-t.patch +scsi-mpt3sas-set-ioc-manu_pg11.eedptagmode-directly-.patch +scsi-ufs-bsg-delete-bsg_dev-when-setting-up-bsg-fail.patch +ocfs2-mark-dquot-as-inactive-if-failed-to-start-tran.patch +buffer-make-folio_create_empty_buffers-return-a-buff.patch +nilfs2-convert-nilfs_lookup_dirty_data_buffers-to-us.patch +nilfs2-protect-access-to-buffers-with-no-active-refe.patch +module-extend-the-preempt-disabled-section-in-derefe.patch +driver-core-class-fix-wild-pointer-dereferences-in-a.patch +serial-8250-adjust-the-timeout-for-fifo-mode.patch +nfsv4.2-fix-copy_notify-xdr-buf-size-calculation.patch +nfsv4.2-mark-offload_cancel-moveable.patch +loongarch-fix-warnings-during-s3-suspend.patch +tools-bootconfig-fix-the-wrong-format-specifier.patch +xfrm-replay-fix-the-update-of-replay_esn-oseq_hi-for.patch +dmaengine-ti-edma-fix-of-node-reference-leaks-in-edm.patch +xfrm-delete-intermediate-secpath-entry-in-packet-off.patch +rtc-pcf85063-fix-potential-oob-write-in-pcf85063-nvm.patch +rtc-loongson-clear-toy_match0_reg-in-loongson_rtc_is.patch +ubifs-skip-dumping-tnc-tree-when-zroot-is-null.patch +regulator-core-add-missing-newline-character.patch +net-hns3-fix-oops-when-unload-drivers-paralleling.patch +gpio-mxc-remove-dead-code-after-switch-to-dt-only.patch +net-fec-implement-tso-descriptor-cleanup.patch +ipmr-do-not-call-mr_mfc_uses_dev-for-unres-entries.patch +pm-hibernate-add-error-handling-for-syscore_suspend.patch +iavf-allow-changing-vlan-state-without-calling-pf.patch +net-rose-fix-timer-races-against-user-threads.patch +net-netdevsim-try-to-close-udp-port-harness-races.patch +vxlan-fix-uninit-value-in-vxlan_vnifilter_dump.patch +net-davicom-fix-uaf-in-dm9000_drv_remove.patch +posix-clock-introduce-posix_clock_context-concept.patch +ptp-replace-timestamp-event-queue-with-linked-list.patch +ptp-support-multiple-timestamp-event-readers.patch +ptp-support-event-queue-reader-channel-masks.patch +ptp-properly-handle-compat-ioctls.patch +net-stmmac-limit-the-number-of-mtl-queues-to-hardwar.patch +net-stmmac-limit-fifo-size-by-hardware-capability.patch +perf-trace-fix-runtime-error-of-index-out-of-bounds.patch +pm-sleep-restore-asynchronous-device-resume-optimiza.patch +pm-sleep-use-bool-for-all-1-bit-fields-in-struct-dev.patch +pm-sleep-core-synchronize-runtime-pm-status-of-paren.patch +bluetooth-btnxpuart-fix-glitches-seen-in-dual-a2dp-s.patch +vsock-keep-the-binding-until-socket-destruction.patch +vsock-allow-retrying-on-connect-failure.patch +bgmac-reduce-max-frame-size-to-support-just-mtu-1500.patch +tcp-correct-handling-of-extreme-memory-squeeze.patch +net-xdp-disallow-attaching-device-bound-programs-in-.patch +net-sh_eth-fix-missing-rtnl-lock-in-suspend-resume-p.patch +net-hsr-fix-fill_frame_info-regression-vs-vlan-packe.patch diff --git a/queue-6.6/smb-client-fix-oops-due-to-unset-link-speed.patch b/queue-6.6/smb-client-fix-oops-due-to-unset-link-speed.patch new file mode 100644 index 0000000000..9a0c1ca884 --- /dev/null +++ b/queue-6.6/smb-client-fix-oops-due-to-unset-link-speed.patch @@ -0,0 +1,104 @@ +From b63570155b3fd906b177a9f82cd2479d8db604bc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 16 Jan 2025 14:29:03 -0300 +Subject: smb: client: fix oops due to unset link speed + +From: Paulo Alcantara + +[ Upstream commit be7a6a77669588bfa5022a470989702bbbb11e7f ] + +It isn't guaranteed that NETWORK_INTERFACE_INFO::LinkSpeed will always +be set by the server, so the client must handle any values and then +prevent oopses like below from happening: + +Oops: divide error: 0000 [#1] PREEMPT SMP KASAN NOPTI +CPU: 0 UID: 0 PID: 1323 Comm: cat Not tainted 6.13.0-rc7 #2 +Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-3.fc41 +04/01/2014 +RIP: 0010:cifs_debug_data_proc_show+0xa45/0x1460 [cifs] Code: 00 00 48 +89 df e8 3b cd 1b c1 41 f6 44 24 2c 04 0f 84 50 01 00 00 48 89 ef e8 +e7 d0 1b c1 49 8b 44 24 18 31 d2 49 8d 7c 24 28 <48> f7 74 24 18 48 89 +c3 e8 6e cf 1b c1 41 8b 6c 24 28 49 8d 7c 24 +RSP: 0018:ffffc90001817be0 EFLAGS: 00010246 +RAX: 0000000000000000 RBX: ffff88811230022c RCX: ffffffffc041bd99 +RDX: 0000000000000000 RSI: 0000000000000567 RDI: ffff888112300228 +RBP: ffff888112300218 R08: fffff52000302f5f R09: ffffed1022fa58ac +R10: ffff888117d2c566 R11: 00000000fffffffe R12: ffff888112300200 +R13: 000000012a15343f R14: 0000000000000001 R15: ffff888113f2db58 +FS: 00007fe27119e740(0000) GS:ffff888148600000(0000) +knlGS:0000000000000000 +CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 +CR2: 00007fe2633c5000 CR3: 0000000124da0000 CR4: 0000000000750ef0 +PKRU: 55555554 +Call Trace: + + ? __die_body.cold+0x19/0x27 + ? die+0x2e/0x50 + ? do_trap+0x159/0x1b0 + ? cifs_debug_data_proc_show+0xa45/0x1460 [cifs] + ? do_error_trap+0x90/0x130 + ? cifs_debug_data_proc_show+0xa45/0x1460 [cifs] + ? exc_divide_error+0x39/0x50 + ? cifs_debug_data_proc_show+0xa45/0x1460 [cifs] + ? asm_exc_divide_error+0x1a/0x20 + ? cifs_debug_data_proc_show+0xa39/0x1460 [cifs] + ? cifs_debug_data_proc_show+0xa45/0x1460 [cifs] + ? seq_read_iter+0x42e/0x790 + seq_read_iter+0x19a/0x790 + proc_reg_read_iter+0xbe/0x110 + ? __pfx_proc_reg_read_iter+0x10/0x10 + vfs_read+0x469/0x570 + ? do_user_addr_fault+0x398/0x760 + ? __pfx_vfs_read+0x10/0x10 + ? find_held_lock+0x8a/0xa0 + ? __pfx_lock_release+0x10/0x10 + ksys_read+0xd3/0x170 + ? __pfx_ksys_read+0x10/0x10 + ? __rcu_read_unlock+0x50/0x270 + ? mark_held_locks+0x1a/0x90 + do_syscall_64+0xbb/0x1d0 + entry_SYSCALL_64_after_hwframe+0x77/0x7f +RIP: 0033:0x7fe271288911 +Code: 00 48 8b 15 01 25 10 00 f7 d8 64 89 02 b8 ff ff ff ff eb bd e8 +20 ad 01 00 f3 0f 1e fa 80 3d b5 a7 10 00 00 74 13 31 c0 0f 05 <48> 3d +00 f0 ff ff 77 4f c3 66 0f 1f 44 00 00 55 48 89 e5 48 83 ec +RSP: 002b:00007ffe87c079d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 +RAX: ffffffffffffffda RBX: 0000000000040000 RCX: 00007fe271288911 +RDX: 0000000000040000 RSI: 00007fe2633c6000 RDI: 0000000000000003 +RBP: 00007ffe87c07a00 R08: 0000000000000000 R09: 00007fe2713e6380 +R10: 0000000000000022 R11: 0000000000000246 R12: 0000000000040000 +R13: 00007fe2633c6000 R14: 0000000000000003 R15: 0000000000000000 + + +Fix this by setting cifs_server_iface::speed to a sane value (1Gbps) +by default when link speed is unset. + +Cc: Shyam Prasad N +Cc: Tom Talpey +Fixes: a6d8fb54a515 ("cifs: distribute channels across interfaces based on speed") +Reported-by: Frank Sorenson +Reported-by: Jay Shin +Signed-off-by: Paulo Alcantara (Red Hat) +Signed-off-by: Steve French +Signed-off-by: Sasha Levin +--- + fs/smb/client/smb2ops.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/fs/smb/client/smb2ops.c b/fs/smb/client/smb2ops.c +index fc6d00344c50e..d4be915bcb70c 100644 +--- a/fs/smb/client/smb2ops.c ++++ b/fs/smb/client/smb2ops.c +@@ -622,7 +622,8 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, + + while (bytes_left >= (ssize_t)sizeof(*p)) { + memset(&tmp_iface, 0, sizeof(tmp_iface)); +- tmp_iface.speed = le64_to_cpu(p->LinkSpeed); ++ /* default to 1Gbps when link speed is unset */ ++ tmp_iface.speed = le64_to_cpu(p->LinkSpeed) ?: 1000000000; + tmp_iface.rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE) ? 1 : 0; + tmp_iface.rss_capable = le32_to_cpu(p->Capability & RSS_CAPABLE) ? 1 : 0; + +-- +2.39.5 + diff --git a/queue-6.6/soc-atmel-fix-device_node-release-in-atmel_soc_devic.patch b/queue-6.6/soc-atmel-fix-device_node-release-in-atmel_soc_devic.patch new file mode 100644 index 0000000000..ff55ea8ffb --- /dev/null +++ b/queue-6.6/soc-atmel-fix-device_node-release-in-atmel_soc_devic.patch @@ -0,0 +1,43 @@ +From 35cb6b9eccd65d265fb81e675abee4db9ee88300 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 31 Oct 2024 13:33:36 +0100 +Subject: soc: atmel: fix device_node release in atmel_soc_device_init() + +From: Javier Carrasco + +[ Upstream commit d3455ab798100f40af77123e7c2443ec979c546b ] + +A device_node acquired via of_find_node_by_path() requires explicit +calls to of_node_put() when it is no longer needed to avoid leaking the +resource. + +Instead of adding the missing calls to of_node_put() in all execution +paths, use the cleanup attribute for 'np' by means of the __free() +macro, which automatically calls of_node_put() when the variable goes +out of scope. + +Fixes: 960ddf70cc11 ("drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs") +Signed-off-by: Javier Carrasco +Link: https://lore.kernel.org/r/20241031-soc-atmel-soc-cleanup-v2-1-73f2d235fd98@gmail.com +Signed-off-by: Claudiu Beznea +Signed-off-by: Sasha Levin +--- + drivers/soc/atmel/soc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/soc/atmel/soc.c b/drivers/soc/atmel/soc.c +index cc9a3e107479a..c892c7083ecc9 100644 +--- a/drivers/soc/atmel/soc.c ++++ b/drivers/soc/atmel/soc.c +@@ -376,7 +376,7 @@ static const struct of_device_id at91_soc_allowed_list[] __initconst = { + + static int __init atmel_soc_device_init(void) + { +- struct device_node *np = of_find_node_by_path("/"); ++ struct device_node *np __free(device_node) = of_find_node_by_path("/"); + + if (!of_match_node(at91_soc_allowed_list, np)) + return 0; +-- +2.39.5 + diff --git a/queue-6.6/spi-omap2-mcspi-correctly-handle-devm_clk_get_option.patch b/queue-6.6/spi-omap2-mcspi-correctly-handle-devm_clk_get_option.patch new file mode 100644 index 0000000000..5d17b9d82d --- /dev/null +++ b/queue-6.6/spi-omap2-mcspi-correctly-handle-devm_clk_get_option.patch @@ -0,0 +1,53 @@ +From c1774fe9ff1465d2b042c818b838b4b74a1d1461 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Jan 2025 16:16:03 +0000 +Subject: spi: omap2-mcspi: Correctly handle devm_clk_get_optional() errors + +From: Mark Brown + +[ Upstream commit a07eb4f67ed085f32002a1af2b6073546d67de3f ] + +devm_clk_get_optional() returns NULL for missing clocks and a PTR_ERR() +if there is a clock but we fail to get it, but currently we only handle +the latter case and do so as though the clock was missing. If we get an +error back we should handle that as an error since the clock exists but +we failed to get it, if we get NULL then the clock doesn't exist and we +should handle that. + +Fixes: 4c6ac5446d06 ("spi: omap2-mcspi: Fix the IS_ERR() bug for devm_clk_get_optional_enabled()") +Reported-by: Lars Pedersen +Link: https://patch.msgid.link/20250117-spi-fix-omap2-optional-v1-1-e77d4ac6db6e@kernel.org +Signed-off-by: Mark Brown +Tested-by: Lars Pedersen +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-omap2-mcspi.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c +index 3cfd262c1abc2..35ca8fda45aae 100644 +--- a/drivers/spi/spi-omap2-mcspi.c ++++ b/drivers/spi/spi-omap2-mcspi.c +@@ -1521,10 +1521,15 @@ static int omap2_mcspi_probe(struct platform_device *pdev) + } + + mcspi->ref_clk = devm_clk_get_optional_enabled(&pdev->dev, NULL); +- if (IS_ERR(mcspi->ref_clk)) +- mcspi->ref_clk_hz = OMAP2_MCSPI_MAX_FREQ; +- else ++ if (IS_ERR(mcspi->ref_clk)) { ++ status = PTR_ERR(mcspi->ref_clk); ++ dev_err_probe(&pdev->dev, status, "Failed to get ref_clk"); ++ goto free_ctlr; ++ } ++ if (mcspi->ref_clk) + mcspi->ref_clk_hz = clk_get_rate(mcspi->ref_clk); ++ else ++ mcspi->ref_clk_hz = OMAP2_MCSPI_MAX_FREQ; + ctlr->max_speed_hz = mcspi->ref_clk_hz; + ctlr->min_speed_hz = mcspi->ref_clk_hz >> 15; + +-- +2.39.5 + diff --git a/queue-6.6/spi-zynq-qspi-add-check-for-clk_enable.patch b/queue-6.6/spi-zynq-qspi-add-check-for-clk_enable.patch new file mode 100644 index 0000000000..a072329b21 --- /dev/null +++ b/queue-6.6/spi-zynq-qspi-add-check-for-clk_enable.patch @@ -0,0 +1,53 @@ +From b0c73918352b53219f36fc94834b8fdcfa44216a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Dec 2024 20:52:06 -0500 +Subject: spi: zynq-qspi: Add check for clk_enable() + +From: Mingwei Zheng + +[ Upstream commit 8332e667099712e05ec87ba2058af394b51ebdc9 ] + +Add check for the return value of clk_enable() to catch the potential +error. + +Fixes: c618a90dcaf3 ("spi: zynq-qspi: Drop GPIO header") +Signed-off-by: Mingwei Zheng +Signed-off-by: Jiasheng Jiang +Link: https://patch.msgid.link/20241207015206.3689364-1-zmw12306@gmail.com +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + drivers/spi/spi-zynq-qspi.c | 13 +++++++++++-- + 1 file changed, 11 insertions(+), 2 deletions(-) + +diff --git a/drivers/spi/spi-zynq-qspi.c b/drivers/spi/spi-zynq-qspi.c +index 0db69a2a72ffc..9358c75a30f44 100644 +--- a/drivers/spi/spi-zynq-qspi.c ++++ b/drivers/spi/spi-zynq-qspi.c +@@ -379,12 +379,21 @@ static int zynq_qspi_setup_op(struct spi_device *spi) + { + struct spi_controller *ctlr = spi->master; + struct zynq_qspi *qspi = spi_controller_get_devdata(ctlr); ++ int ret; + + if (ctlr->busy) + return -EBUSY; + +- clk_enable(qspi->refclk); +- clk_enable(qspi->pclk); ++ ret = clk_enable(qspi->refclk); ++ if (ret) ++ return ret; ++ ++ ret = clk_enable(qspi->pclk); ++ if (ret) { ++ clk_disable(qspi->refclk); ++ return ret; ++ } ++ + zynq_qspi_write(qspi, ZYNQ_QSPI_ENABLE_OFFSET, + ZYNQ_QSPI_ENABLE_ENABLE_MASK); + +-- +2.39.5 + diff --git a/queue-6.6/staging-media-imx-fix-of-node-leak-in-imx_media_add_.patch b/queue-6.6/staging-media-imx-fix-of-node-leak-in-imx_media_add_.patch new file mode 100644 index 0000000000..cfe07fdf85 --- /dev/null +++ b/queue-6.6/staging-media-imx-fix-of-node-leak-in-imx_media_add_.patch @@ -0,0 +1,58 @@ +From f7116f1a36540855436aa52c6de261313bbdea68 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 12:54:11 +0900 +Subject: staging: media: imx: fix OF node leak in imx_media_add_of_subdevs() + +From: Joe Hattori + +[ Upstream commit 094f5c315f756b19198e6c401aa821ac0e868750 ] + +imx_media_add_of_subdevs() calls of_parse_phandle() and passes the +obtained node to imx_media_of_add_csi(). The passed node is used in +v4l2_async_nf_add_fwnode(), which increments the refcount of the node. +Therefore, while the current implementation only releases the node when +imx_media_of_add_csi() fails, but should always release it. Call +of_node_put() right after imx_media_of_add_csi(). + +Fixes: dee747f88167 ("media: imx: Don't register IPU subdevs/links if CSI port missing") +Signed-off-by: Joe Hattori +Reviewed-by: Vladimir Zapolskiy +Reviewed-by: Philipp Zabel +Signed-off-by: Hans Verkuil +Signed-off-by: Sasha Levin +--- + drivers/staging/media/imx/imx-media-of.c | 8 ++------ + 1 file changed, 2 insertions(+), 6 deletions(-) + +diff --git a/drivers/staging/media/imx/imx-media-of.c b/drivers/staging/media/imx/imx-media-of.c +index 118bff988bc7e..bb28daa4d7133 100644 +--- a/drivers/staging/media/imx/imx-media-of.c ++++ b/drivers/staging/media/imx/imx-media-of.c +@@ -54,22 +54,18 @@ int imx_media_add_of_subdevs(struct imx_media_dev *imxmd, + break; + + ret = imx_media_of_add_csi(imxmd, csi_np); ++ of_node_put(csi_np); + if (ret) { + /* unavailable or already added is not an error */ + if (ret == -ENODEV || ret == -EEXIST) { +- of_node_put(csi_np); + continue; + } + + /* other error, can't continue */ +- goto err_out; ++ return ret; + } + } + + return 0; +- +-err_out: +- of_node_put(csi_np); +- return ret; + } + EXPORT_SYMBOL_GPL(imx_media_add_of_subdevs); +-- +2.39.5 + diff --git a/queue-6.6/tcp-correct-handling-of-extreme-memory-squeeze.patch b/queue-6.6/tcp-correct-handling-of-extreme-memory-squeeze.patch new file mode 100644 index 0000000000..9d01285a98 --- /dev/null +++ b/queue-6.6/tcp-correct-handling-of-extreme-memory-squeeze.patch @@ -0,0 +1,167 @@ +From b042b935efcbdeadf1ab263d75cfb333550eaab8 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 27 Jan 2025 18:13:04 -0500 +Subject: tcp: correct handling of extreme memory squeeze +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Jon Maloy + +[ Upstream commit 8c670bdfa58e48abad1d5b6ca1ee843ca91f7303 ] + +Testing with iperf3 using the "pasta" protocol splicer has revealed +a problem in the way tcp handles window advertising in extreme memory +squeeze situations. + +Under memory pressure, a socket endpoint may temporarily advertise +a zero-sized window, but this is not stored as part of the socket data. +The reasoning behind this is that it is considered a temporary setting +which shouldn't influence any further calculations. + +However, if we happen to stall at an unfortunate value of the current +window size, the algorithm selecting a new value will consistently fail +to advertise a non-zero window once we have freed up enough memory. +This means that this side's notion of the current window size is +different from the one last advertised to the peer, causing the latter +to not send any data to resolve the sitution. + +The problem occurs on the iperf3 server side, and the socket in question +is a completely regular socket with the default settings for the +fedora40 kernel. We do not use SO_PEEK or SO_RCVBUF on the socket. + +The following excerpt of a logging session, with own comments added, +shows more in detail what is happening: + +// tcp_v4_rcv(->) +// tcp_rcv_established(->) +[5201<->39222]: ==== Activating log @ net/ipv4/tcp_input.c/tcp_data_queue()/5257 ==== +[5201<->39222]: tcp_data_queue(->) +[5201<->39222]: DROPPING skb [265600160..265665640], reason: SKB_DROP_REASON_PROTO_MEM + [rcv_nxt 265600160, rcv_wnd 262144, snt_ack 265469200, win_now 131184] + [copied_seq 259909392->260034360 (124968), unread 5565800, qlen 85, ofoq 0] + [OFO queue: gap: 65480, len: 0] +[5201<->39222]: tcp_data_queue(<-) +[5201<->39222]: __tcp_transmit_skb(->) + [tp->rcv_wup: 265469200, tp->rcv_wnd: 262144, tp->rcv_nxt 265600160] +[5201<->39222]: tcp_select_window(->) +[5201<->39222]: (inet_csk(sk)->icsk_ack.pending & ICSK_ACK_NOMEM) ? --> TRUE + [tp->rcv_wup: 265469200, tp->rcv_wnd: 262144, tp->rcv_nxt 265600160] + returning 0 +[5201<->39222]: tcp_select_window(<-) +[5201<->39222]: ADVERTISING WIN 0, ACK_SEQ: 265600160 +[5201<->39222]: [__tcp_transmit_skb(<-) +[5201<->39222]: tcp_rcv_established(<-) +[5201<->39222]: tcp_v4_rcv(<-) + +// Receive queue is at 85 buffers and we are out of memory. +// We drop the incoming buffer, although it is in sequence, and decide +// to send an advertisement with a window of zero. +// We don't update tp->rcv_wnd and tp->rcv_wup accordingly, which means +// we unconditionally shrink the window. + +[5201<->39222]: tcp_recvmsg_locked(->) +[5201<->39222]: __tcp_cleanup_rbuf(->) tp->rcv_wup: 265469200, tp->rcv_wnd: 262144, tp->rcv_nxt 265600160 +[5201<->39222]: [new_win = 0, win_now = 131184, 2 * win_now = 262368] +[5201<->39222]: [new_win >= (2 * win_now) ? --> time_to_ack = 0] +[5201<->39222]: NOT calling tcp_send_ack() + [tp->rcv_wup: 265469200, tp->rcv_wnd: 262144, tp->rcv_nxt 265600160] +[5201<->39222]: __tcp_cleanup_rbuf(<-) + [rcv_nxt 265600160, rcv_wnd 262144, snt_ack 265469200, win_now 131184] + [copied_seq 260040464->260040464 (0), unread 5559696, qlen 85, ofoq 0] + returning 6104 bytes +[5201<->39222]: tcp_recvmsg_locked(<-) + +// After each read, the algorithm for calculating the new receive +// window in __tcp_cleanup_rbuf() finds it is too small to advertise +// or to update tp->rcv_wnd. +// Meanwhile, the peer thinks the window is zero, and will not send +// any more data to trigger an update from the interrupt mode side. + +[5201<->39222]: tcp_recvmsg_locked(->) +[5201<->39222]: __tcp_cleanup_rbuf(->) tp->rcv_wup: 265469200, tp->rcv_wnd: 262144, tp->rcv_nxt 265600160 +[5201<->39222]: [new_win = 262144, win_now = 131184, 2 * win_now = 262368] +[5201<->39222]: [new_win >= (2 * win_now) ? --> time_to_ack = 0] +[5201<->39222]: NOT calling tcp_send_ack() + [tp->rcv_wup: 265469200, tp->rcv_wnd: 262144, tp->rcv_nxt 265600160] +[5201<->39222]: __tcp_cleanup_rbuf(<-) + [rcv_nxt 265600160, rcv_wnd 262144, snt_ack 265469200, win_now 131184] + [copied_seq 260099840->260171536 (71696), unread 5428624, qlen 83, ofoq 0] + returning 131072 bytes +[5201<->39222]: tcp_recvmsg_locked(<-) + +// The above pattern repeats again and again, since nothing changes +// between the reads. + +[...] + +[5201<->39222]: tcp_recvmsg_locked(->) +[5201<->39222]: __tcp_cleanup_rbuf(->) tp->rcv_wup: 265469200, tp->rcv_wnd: 262144, tp->rcv_nxt 265600160 +[5201<->39222]: [new_win = 262144, win_now = 131184, 2 * win_now = 262368] +[5201<->39222]: [new_win >= (2 * win_now) ? --> time_to_ack = 0] +[5201<->39222]: NOT calling tcp_send_ack() + [tp->rcv_wup: 265469200, tp->rcv_wnd: 262144, tp->rcv_nxt 265600160] +[5201<->39222]: __tcp_cleanup_rbuf(<-) + [rcv_nxt 265600160, rcv_wnd 262144, snt_ack 265469200, win_now 131184] + [copied_seq 265600160->265600160 (0), unread 0, qlen 0, ofoq 0] + returning 54672 bytes +[5201<->39222]: tcp_recvmsg_locked(<-) + +// The receive queue is empty, but no new advertisement has been sent. +// The peer still thinks the receive window is zero, and sends nothing. +// We have ended up in a deadlock situation. + +Note that well behaved endpoints will send win0 probes, so the problem +will not occur. + +Furthermore, we have observed that in these situations this side may +send out an updated 'th->ack_seq´ which is not stored in tp->rcv_wup +as it should be. Backing ack_seq seems to be harmless, but is of +course still wrong from a protocol viewpoint. + +We fix this by updating the socket state correctly when a packet has +been dropped because of memory exhaustion and we have to advertize +a zero window. + +Further testing shows that the connection recovers neatly from the +squeeze situation, and traffic can continue indefinitely. + +Fixes: e2142825c120 ("net: tcp: send zero-window ACK when no memory") +Cc: Menglong Dong +Reviewed-by: Stefano Brivio +Signed-off-by: Jon Maloy +Reviewed-by: Jason Xing +Reviewed-by: Eric Dumazet +Reviewed-by: Neal Cardwell +Link: https://patch.msgid.link/20250127231304.1465565-1-jmaloy@redhat.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/ipv4/tcp_output.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c +index cfddc94508f0b..3771ed22c2f56 100644 +--- a/net/ipv4/tcp_output.c ++++ b/net/ipv4/tcp_output.c +@@ -263,11 +263,14 @@ static u16 tcp_select_window(struct sock *sk) + u32 cur_win, new_win; + + /* Make the window 0 if we failed to queue the data because we +- * are out of memory. The window is temporary, so we don't store +- * it on the socket. ++ * are out of memory. + */ +- if (unlikely(inet_csk(sk)->icsk_ack.pending & ICSK_ACK_NOMEM)) ++ if (unlikely(inet_csk(sk)->icsk_ack.pending & ICSK_ACK_NOMEM)) { ++ tp->pred_flags = 0; ++ tp->rcv_wnd = 0; ++ tp->rcv_wup = tp->rcv_nxt; + return 0; ++ } + + cur_win = tcp_receive_window(tp); + new_win = __tcp_select_window(sk); +-- +2.39.5 + diff --git a/queue-6.6/tcp_cubic-fix-incorrect-hystart-round-start-detectio.patch b/queue-6.6/tcp_cubic-fix-incorrect-hystart-round-start-detectio.patch new file mode 100644 index 0000000000..899ee6e0ce --- /dev/null +++ b/queue-6.6/tcp_cubic-fix-incorrect-hystart-round-start-detectio.patch @@ -0,0 +1,83 @@ +From 83b1d5e57e36072d4591e704b77f8248531354b0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 17 Jan 2025 21:37:51 +0000 +Subject: tcp_cubic: fix incorrect HyStart round start detection + +From: Mahdi Arghavani + +[ Upstream commit 25c1a9ca53db5780757e7f53e688b8f916821baa ] + +I noticed that HyStart incorrectly marks the start of rounds, +leading to inaccurate measurements of ACK train lengths and +resetting the `ca->sample_cnt` variable. This inaccuracy can impact +HyStart's functionality in terminating exponential cwnd growth during +Slow-Start, potentially degrading TCP performance. + +The issue arises because the changes introduced in commit 4e1fddc98d25 +("tcp_cubic: fix spurious Hystart ACK train detections for not-cwnd-limited flows") +moved the caller of the `bictcp_hystart_reset` function inside the `hystart_update` function. +This modification added an additional condition for triggering the caller, +requiring that (tcp_snd_cwnd(tp) >= hystart_low_window) must also +be satisfied before invoking `bictcp_hystart_reset`. + +This fix ensures that `bictcp_hystart_reset` is correctly called +at the start of a new round, regardless of the congestion window size. +This is achieved by moving the condition +(tcp_snd_cwnd(tp) >= hystart_low_window) +from before calling `bictcp_hystart_reset` to after it. + +I tested with a client and a server connected through two Linux software routers. +In this setup, the minimum RTT was 150 ms, the bottleneck bandwidth was 50 Mbps, +and the bottleneck buffer size was 1 BDP, calculated as (50M / 1514 / 8) * 0.150 = 619 packets. +I conducted the test twice, transferring data from the server to the client for 1.5 seconds. +Before the patch was applied, HYSTART-DELAY stopped the exponential growth of cwnd when +cwnd = 516, and the bottleneck link was not yet saturated (516 < 619). +After the patch was applied, HYSTART-ACK-TRAIN stopped the exponential growth of cwnd when +cwnd = 632, and the bottleneck link was saturated (632 > 619). +In this test, applying the patch resulted in 300 KB more data delivered. + +Fixes: 4e1fddc98d25 ("tcp_cubic: fix spurious Hystart ACK train detections for not-cwnd-limited flows") +Signed-off-by: Mahdi Arghavani +Reviewed-by: Jason Xing +Cc: Neal Cardwell +Cc: Eric Dumazet +Cc: Haibo Zhang +Cc: David Eyers +Cc: Abbas Arghavani +Reviewed-by: Neal Cardwell +Tested-by: Neal Cardwell +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/ipv4/tcp_cubic.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c +index 0fd78ecb67e75..5ff7be13deb6b 100644 +--- a/net/ipv4/tcp_cubic.c ++++ b/net/ipv4/tcp_cubic.c +@@ -392,6 +392,10 @@ static void hystart_update(struct sock *sk, u32 delay) + if (after(tp->snd_una, ca->end_seq)) + bictcp_hystart_reset(sk); + ++ /* hystart triggers when cwnd is larger than some threshold */ ++ if (tcp_snd_cwnd(tp) < hystart_low_window) ++ return; ++ + if (hystart_detect & HYSTART_ACK_TRAIN) { + u32 now = bictcp_clock_us(sk); + +@@ -467,9 +471,7 @@ __bpf_kfunc static void cubictcp_acked(struct sock *sk, const struct ack_sample + if (ca->delay_min == 0 || ca->delay_min > delay) + ca->delay_min = delay; + +- /* hystart triggers when cwnd is larger than some threshold */ +- if (!ca->found && tcp_in_slow_start(tp) && hystart && +- tcp_snd_cwnd(tp) >= hystart_low_window) ++ if (!ca->found && tcp_in_slow_start(tp) && hystart) + hystart_update(sk, delay); + } + +-- +2.39.5 + diff --git a/queue-6.6/team-prevent-adding-a-device-which-is-already-a-team.patch b/queue-6.6/team-prevent-adding-a-device-which-is-already-a-team.patch new file mode 100644 index 0000000000..9e0a0de249 --- /dev/null +++ b/queue-6.6/team-prevent-adding-a-device-which-is-already-a-team.patch @@ -0,0 +1,118 @@ +From 38a7b46f269e51858ac83477f79a9589739630ae Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Dec 2024 12:56:47 -0800 +Subject: team: prevent adding a device which is already a team device lower + +From: Octavian Purdila + +[ Upstream commit 3fff5da4ca2164bb4d0f1e6cd33f6eb8a0e73e50 ] + +Prevent adding a device which is already a team device lower, +e.g. adding veth0 if vlan1 was already added and veth0 is a lower of +vlan1. + +This is not useful in practice and can lead to recursive locking: + +$ ip link add veth0 type veth peer name veth1 +$ ip link set veth0 up +$ ip link set veth1 up +$ ip link add link veth0 name veth0.1 type vlan protocol 802.1Q id 1 +$ ip link add team0 type team +$ ip link set veth0.1 down +$ ip link set veth0.1 master team0 +team0: Port device veth0.1 added +$ ip link set veth0 down +$ ip link set veth0 master team0 + +============================================ +WARNING: possible recursive locking detected +6.13.0-rc2-virtme-00441-ga14a429069bb #46 Not tainted +-------------------------------------------- +ip/7684 is trying to acquire lock: +ffff888016848e00 (team->team_lock_key){+.+.}-{4:4}, at: team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) + +but task is already holding lock: +ffff888016848e00 (team->team_lock_key){+.+.}-{4:4}, at: team_add_slave (drivers/net/team/team_core.c:1147 drivers/net/team/team_core.c:1977) + +other info that might help us debug this: +Possible unsafe locking scenario: + +CPU0 +---- +lock(team->team_lock_key); +lock(team->team_lock_key); + +*** DEADLOCK *** + +May be due to missing lock nesting notation + +2 locks held by ip/7684: + +stack backtrace: +CPU: 3 UID: 0 PID: 7684 Comm: ip Not tainted 6.13.0-rc2-virtme-00441-ga14a429069bb #46 +Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-debian-1.16.3-2 04/01/2014 +Call Trace: + +dump_stack_lvl (lib/dump_stack.c:122) +print_deadlock_bug.cold (kernel/locking/lockdep.c:3040) +__lock_acquire (kernel/locking/lockdep.c:3893 kernel/locking/lockdep.c:5226) +? netlink_broadcast_filtered (net/netlink/af_netlink.c:1548) +lock_acquire.part.0 (kernel/locking/lockdep.c:467 kernel/locking/lockdep.c:5851) +? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) +? trace_lock_acquire (./include/trace/events/lock.h:24 (discriminator 2)) +? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) +? lock_acquire (kernel/locking/lockdep.c:5822) +? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) +__mutex_lock (kernel/locking/mutex.c:587 kernel/locking/mutex.c:735) +? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) +? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) +? fib_sync_up (net/ipv4/fib_semantics.c:2167) +? team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) +team_device_event (drivers/net/team/team_core.c:2928 drivers/net/team/team_core.c:2951 drivers/net/team/team_core.c:2973) +notifier_call_chain (kernel/notifier.c:85) +call_netdevice_notifiers_info (net/core/dev.c:1996) +__dev_notify_flags (net/core/dev.c:8993) +? __dev_change_flags (net/core/dev.c:8975) +dev_change_flags (net/core/dev.c:9027) +vlan_device_event (net/8021q/vlan.c:85 net/8021q/vlan.c:470) +? br_device_event (net/bridge/br.c:143) +notifier_call_chain (kernel/notifier.c:85) +call_netdevice_notifiers_info (net/core/dev.c:1996) +dev_open (net/core/dev.c:1519 net/core/dev.c:1505) +team_add_slave (drivers/net/team/team_core.c:1219 drivers/net/team/team_core.c:1977) +? __pfx_team_add_slave (drivers/net/team/team_core.c:1972) +do_set_master (net/core/rtnetlink.c:2917) +do_setlink.isra.0 (net/core/rtnetlink.c:3117) + +Reported-by: syzbot+3c47b5843403a45aef57@syzkaller.appspotmail.com +Closes: https://syzkaller.appspot.com/bug?extid=3c47b5843403a45aef57 +Fixes: 3d249d4ca7d0 ("net: introduce ethernet teaming device") +Signed-off-by: Octavian Purdila +Reviewed-by: Hangbin Liu +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + drivers/net/team/team.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c +index ae257fa43d87a..46a7c9fb6300e 100644 +--- a/drivers/net/team/team.c ++++ b/drivers/net/team/team.c +@@ -1169,6 +1169,13 @@ static int team_port_add(struct team *team, struct net_device *port_dev, + return -EBUSY; + } + ++ if (netdev_has_upper_dev(port_dev, dev)) { ++ NL_SET_ERR_MSG(extack, "Device is already a lower device of the team interface"); ++ netdev_err(dev, "Device %s is already a lower device of the team interface\n", ++ portname); ++ return -EBUSY; ++ } ++ + if (port_dev->features & NETIF_F_VLAN_CHALLENGED && + vlan_uses_dev(dev)) { + NL_SET_ERR_MSG(extack, "Device is VLAN challenged and team device has VLAN set up"); +-- +2.39.5 + diff --git a/queue-6.6/tools-bootconfig-fix-the-wrong-format-specifier.patch b/queue-6.6/tools-bootconfig-fix-the-wrong-format-specifier.patch new file mode 100644 index 0000000000..8cd58b0d30 --- /dev/null +++ b/queue-6.6/tools-bootconfig-fix-the-wrong-format-specifier.patch @@ -0,0 +1,46 @@ +From bb90328558c031d81e58943bd99bc507a205fe0e Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 28 Jan 2025 23:27:01 +0900 +Subject: tools/bootconfig: Fix the wrong format specifier + +From: Luo Yifan + +[ Upstream commit f6ab7384d554ba80ff4793259d75535874b366f5 ] + +Use '%u' instead of '%d' for unsigned int. + +Link: https://lore.kernel.org/all/20241105011048.201629-1-luoyifan@cmss.chinamobile.com/ + +Fixes: 973780011106 ("tools/bootconfig: Suppress non-error messages") +Signed-off-by: Luo Yifan +Signed-off-by: Masami Hiramatsu (Google) +Signed-off-by: Sasha Levin +--- + tools/bootconfig/main.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c +index 156b62a163c5a..8a48cc2536f56 100644 +--- a/tools/bootconfig/main.c ++++ b/tools/bootconfig/main.c +@@ -226,7 +226,7 @@ static int load_xbc_from_initrd(int fd, char **buf) + /* Wrong Checksum */ + rcsum = xbc_calc_checksum(*buf, size); + if (csum != rcsum) { +- pr_err("checksum error: %d != %d\n", csum, rcsum); ++ pr_err("checksum error: %u != %u\n", csum, rcsum); + return -EINVAL; + } + +@@ -395,7 +395,7 @@ static int apply_xbc(const char *path, const char *xbc_path) + xbc_get_info(&ret, NULL); + printf("\tNumber of nodes: %d\n", ret); + printf("\tSize: %u bytes\n", (unsigned int)size); +- printf("\tChecksum: %d\n", (unsigned int)csum); ++ printf("\tChecksum: %u\n", (unsigned int)csum); + + /* TODO: Check the options by schema */ + xbc_exit(); +-- +2.39.5 + diff --git a/queue-6.6/tools-testing-selftests-bpf-test_tc_tunnel.sh-fix-wa.patch b/queue-6.6/tools-testing-selftests-bpf-test_tc_tunnel.sh-fix-wa.patch new file mode 100644 index 0000000000..72f8bbc664 --- /dev/null +++ b/queue-6.6/tools-testing-selftests-bpf-test_tc_tunnel.sh-fix-wa.patch @@ -0,0 +1,43 @@ +From cc5fe2c79fb3d10e4946b34c95d03269774f4d87 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Dec 2024 12:45:30 -0800 +Subject: tools/testing/selftests/bpf/test_tc_tunnel.sh: Fix wait for server + bind + +From: Marco Leogrande + +[ Upstream commit e2f0791124a1b6ca8d570110cbd487969d9d41ef ] + +Commit f803bcf9208a ("selftests/bpf: Prevent client connect before +server bind in test_tc_tunnel.sh") added code that waits for the +netcat server to start before the netcat client attempts to connect to +it. However, not all calls to 'server_listen' were guarded. + +This patch adds the existing 'wait_for_port' guard after the remaining +call to 'server_listen'. + +Fixes: f803bcf9208a ("selftests/bpf: Prevent client connect before server bind in test_tc_tunnel.sh") +Signed-off-by: Marco Leogrande +Acked-by: Stanislav Fomichev +Link: https://lore.kernel.org/r/20241202204530.1143448-1-leogrande@google.com +Signed-off-by: Alexei Starovoitov +Signed-off-by: Sasha Levin +--- + tools/testing/selftests/bpf/test_tc_tunnel.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/testing/selftests/bpf/test_tc_tunnel.sh b/tools/testing/selftests/bpf/test_tc_tunnel.sh +index 7989ec6084545..cb55a908bb0d7 100755 +--- a/tools/testing/selftests/bpf/test_tc_tunnel.sh ++++ b/tools/testing/selftests/bpf/test_tc_tunnel.sh +@@ -305,6 +305,7 @@ else + client_connect + verify_data + server_listen ++ wait_for_port ${port} ${netcat_opt} + fi + + # serverside, use BPF for decap +-- +2.39.5 + diff --git a/queue-6.6/ubifs-skip-dumping-tnc-tree-when-zroot-is-null.patch b/queue-6.6/ubifs-skip-dumping-tnc-tree-when-zroot-is-null.patch new file mode 100644 index 0000000000..dbe65889be --- /dev/null +++ b/queue-6.6/ubifs-skip-dumping-tnc-tree-when-zroot-is-null.patch @@ -0,0 +1,60 @@ +From 8e0f4b8ad960f70d11c88d84a62a011ef907e134 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 24 Dec 2024 16:18:23 +0800 +Subject: ubifs: skip dumping tnc tree when zroot is null + +From: pangliyuan + +[ Upstream commit bdb0ca39e0acccf6771db49c3f94ed787d05f2d7 ] + +Clearing slab cache will free all znode in memory and make +c->zroot.znode = NULL, then dumping tnc tree will access +c->zroot.znode which cause null pointer dereference. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=219624#c0 +Fixes: 1e51764a3c2a ("UBIFS: add new flash file system") +Signed-off-by: pangliyuan +Reviewed-by: Zhihao Cheng +Signed-off-by: Richard Weinberger +Signed-off-by: Sasha Levin +--- + fs/ubifs/debug.c | 22 +++++++++++++--------- + 1 file changed, 13 insertions(+), 9 deletions(-) + +diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c +index eef9e527d9ff9..ff9e574c07a87 100644 +--- a/fs/ubifs/debug.c ++++ b/fs/ubifs/debug.c +@@ -946,16 +946,20 @@ void ubifs_dump_tnc(struct ubifs_info *c) + + pr_err("\n"); + pr_err("(pid %d) start dumping TNC tree\n", current->pid); +- znode = ubifs_tnc_levelorder_next(c, c->zroot.znode, NULL); +- level = znode->level; +- pr_err("== Level %d ==\n", level); +- while (znode) { +- if (level != znode->level) { +- level = znode->level; +- pr_err("== Level %d ==\n", level); ++ if (c->zroot.znode) { ++ znode = ubifs_tnc_levelorder_next(c, c->zroot.znode, NULL); ++ level = znode->level; ++ pr_err("== Level %d ==\n", level); ++ while (znode) { ++ if (level != znode->level) { ++ level = znode->level; ++ pr_err("== Level %d ==\n", level); ++ } ++ ubifs_dump_znode(c, znode); ++ znode = ubifs_tnc_levelorder_next(c, c->zroot.znode, znode); + } +- ubifs_dump_znode(c, znode); +- znode = ubifs_tnc_levelorder_next(c, c->zroot.znode, znode); ++ } else { ++ pr_err("empty TNC tree in memory\n"); + } + pr_err("(pid %d) finish dumping TNC tree\n", current->pid); + } +-- +2.39.5 + diff --git a/queue-6.6/udp-deal-with-race-between-udp-socket-address-change.patch b/queue-6.6/udp-deal-with-race-between-udp-socket-address-change.patch new file mode 100644 index 0000000000..e87ed8131b --- /dev/null +++ b/queue-6.6/udp-deal-with-race-between-udp-socket-address-change.patch @@ -0,0 +1,301 @@ +From 9d7d54c6596f7510b5c28b803f7f99967b9ca9e1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 18 Dec 2024 17:21:16 +0100 +Subject: udp: Deal with race between UDP socket address change and rehash + +From: Stefano Brivio + +[ Upstream commit a502ea6fa94b1f7be72a24bcf9e3f5f6b7e6e90c ] + +If a UDP socket changes its local address while it's receiving +datagrams, as a result of connect(), there is a period during which +a lookup operation might fail to find it, after the address is changed +but before the secondary hash (port and address) and the four-tuple +hash (local and remote ports and addresses) are updated. + +Secondary hash chains were introduced by commit 30fff9231fad ("udp: +bind() optimisation") and, as a result, a rehash operation became +needed to make a bound socket reachable again after a connect(). + +This operation was introduced by commit 719f835853a9 ("udp: add +rehash on connect()") which isn't however a complete fix: the +socket will be found once the rehashing completes, but not while +it's pending. + +This is noticeable with a socat(1) server in UDP4-LISTEN mode, and a +client sending datagrams to it. After the server receives the first +datagram (cf. _xioopen_ipdgram_listen()), it issues a connect() to +the address of the sender, in order to set up a directed flow. + +Now, if the client, running on a different CPU thread, happens to +send a (subsequent) datagram while the server's socket changes its +address, but is not rehashed yet, this will result in a failed +lookup and a port unreachable error delivered to the client, as +apparent from the following reproducer: + + LEN=$(($(cat /proc/sys/net/core/wmem_default) / 4)) + dd if=/dev/urandom bs=1 count=${LEN} of=tmp.in + + while :; do + taskset -c 1 socat UDP4-LISTEN:1337,null-eof OPEN:tmp.out,create,trunc & + sleep 0.1 || sleep 1 + taskset -c 2 socat OPEN:tmp.in UDP4:localhost:1337,shut-null + wait + done + +where the client will eventually get ECONNREFUSED on a write() +(typically the second or third one of a given iteration): + + 2024/11/13 21:28:23 socat[46901] E write(6, 0x556db2e3c000, 8192): Connection refused + +This issue was first observed as a seldom failure in Podman's tests +checking UDP functionality while using pasta(1) to connect the +container's network namespace, which leads us to a reproducer with +the lookup error resulting in an ICMP packet on a tap device: + + LOCAL_ADDR="$(ip -j -4 addr show|jq -rM '.[] | .addr_info[0] | select(.scope == "global").local')" + + while :; do + ./pasta --config-net -p pasta.pcap -u 1337 socat UDP4-LISTEN:1337,null-eof OPEN:tmp.out,create,trunc & + sleep 0.2 || sleep 1 + socat OPEN:tmp.in UDP4:${LOCAL_ADDR}:1337,shut-null + wait + cmp tmp.in tmp.out + done + +Once this fails: + + tmp.in tmp.out differ: char 8193, line 29 + +we can finally have a look at what's going on: + + $ tshark -r pasta.pcap + 1 0.000000 :: ? ff02::16 ICMPv6 110 Multicast Listener Report Message v2 + 2 0.168690 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192 + 3 0.168767 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192 + 4 0.168806 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192 + 5 0.168827 c6:47:05:8d:dc:04 ? Broadcast ARP 42 Who has 88.198.0.161? Tell 88.198.0.164 + 6 0.168851 9a:55:9a:55:9a:55 ? c6:47:05:8d:dc:04 ARP 42 88.198.0.161 is at 9a:55:9a:55:9a:55 + 7 0.168875 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192 + 8 0.168896 88.198.0.164 ? 88.198.0.161 ICMP 590 Destination unreachable (Port unreachable) + 9 0.168926 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192 + 10 0.168959 88.198.0.161 ? 88.198.0.164 UDP 8234 60260 ? 1337 Len=8192 + 11 0.168989 88.198.0.161 ? 88.198.0.164 UDP 4138 60260 ? 1337 Len=4096 + 12 0.169010 88.198.0.161 ? 88.198.0.164 UDP 42 60260 ? 1337 Len=0 + +On the third datagram received, the network namespace of the container +initiates an ARP lookup to deliver the ICMP message. + +In another variant of this reproducer, starting the client with: + + strace -f pasta --config-net -u 1337 socat UDP4-LISTEN:1337,null-eof OPEN:tmp.out,create,trunc 2>strace.log & + +and connecting to the socat server using a loopback address: + + socat OPEN:tmp.in UDP4:localhost:1337,shut-null + +we can more clearly observe a sendmmsg() call failing after the +first datagram is delivered: + + [pid 278012] connect(173, 0x7fff96c95fc0, 16) = 0 + [...] + [pid 278012] recvmmsg(173, 0x7fff96c96020, 1024, MSG_DONTWAIT, NULL) = -1 EAGAIN (Resource temporarily unavailable) + [pid 278012] sendmmsg(173, 0x561c5ad0a720, 1, MSG_NOSIGNAL) = 1 + [...] + [pid 278012] sendmmsg(173, 0x561c5ad0a720, 1, MSG_NOSIGNAL) = -1 ECONNREFUSED (Connection refused) + +and, somewhat confusingly, after a connect() on the same socket +succeeded. + +Until commit 4cdeeee9252a ("net: udp: prefer listeners bound to an +address"), the race between receive address change and lookup didn't +actually cause visible issues, because, once the lookup based on the +secondary hash chain failed, we would still attempt a lookup based on +the primary hash (destination port only), and find the socket with the +outdated secondary hash. + +That change, however, dropped port-only lookups altogether, as side +effect, making the race visible. + +To fix this, while avoiding the need to make address changes and +rehash atomic against lookups, reintroduce primary hash lookups as +fallback, if lookups based on four-tuple and secondary hashes fail. + +To this end, introduce a simplified lookup implementation, which +doesn't take care of SO_REUSEPORT groups: if we have one, there are +multiple sockets that would match the four-tuple or secondary hash, +meaning that we can't run into this race at all. + +v2: + - instead of synchronising lookup operations against address change + plus rehash, reintroduce a simplified version of the original + primary hash lookup as fallback + +v1: + - fix build with CONFIG_IPV6=n: add ifdef around sk_v6_rcv_saddr + usage (Kuniyuki Iwashima) + - directly use sk_rcv_saddr for IPv4 receive addresses instead of + fetching inet_rcv_saddr (Kuniyuki Iwashima) + - move inet_update_saddr() to inet_hashtables.h and use that + to set IPv4/IPv6 addresses as suitable (Kuniyuki Iwashima) + - rebase onto net-next, update commit message accordingly + +Reported-by: Ed Santiago +Link: https://github.com/containers/podman/issues/24147 +Analysed-by: David Gibson +Fixes: 30fff9231fad ("udp: bind() optimisation") +Signed-off-by: Stefano Brivio +Reviewed-by: Eric Dumazet +Reviewed-by: Willem de Bruijn +Signed-off-by: David S. Miller +Signed-off-by: Sasha Levin +--- + net/ipv4/udp.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++ + net/ipv6/udp.c | 50 ++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 106 insertions(+) + +diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c +index 2e4e535603948..fd379a973a9eb 100644 +--- a/net/ipv4/udp.c ++++ b/net/ipv4/udp.c +@@ -421,6 +421,49 @@ u32 udp_ehashfn(const struct net *net, const __be32 laddr, const __u16 lport, + udp_ehash_secret + net_hash_mix(net)); + } + ++/** ++ * udp4_lib_lookup1() - Simplified lookup using primary hash (destination port) ++ * @net: Network namespace ++ * @saddr: Source address, network order ++ * @sport: Source port, network order ++ * @daddr: Destination address, network order ++ * @hnum: Destination port, host order ++ * @dif: Destination interface index ++ * @sdif: Destination bridge port index, if relevant ++ * @udptable: Set of UDP hash tables ++ * ++ * Simplified lookup to be used as fallback if no sockets are found due to a ++ * potential race between (receive) address change, and lookup happening before ++ * the rehash operation. This function ignores SO_REUSEPORT groups while scoring ++ * result sockets, because if we have one, we don't need the fallback at all. ++ * ++ * Called under rcu_read_lock(). ++ * ++ * Return: socket with highest matching score if any, NULL if none ++ */ ++static struct sock *udp4_lib_lookup1(const struct net *net, ++ __be32 saddr, __be16 sport, ++ __be32 daddr, unsigned int hnum, ++ int dif, int sdif, ++ const struct udp_table *udptable) ++{ ++ unsigned int slot = udp_hashfn(net, hnum, udptable->mask); ++ struct udp_hslot *hslot = &udptable->hash[slot]; ++ struct sock *sk, *result = NULL; ++ int score, badness = 0; ++ ++ sk_for_each_rcu(sk, &hslot->head) { ++ score = compute_score(sk, net, ++ saddr, sport, daddr, hnum, dif, sdif); ++ if (score > badness) { ++ result = sk; ++ badness = score; ++ } ++ } ++ ++ return result; ++} ++ + /* called with rcu_read_lock() */ + static struct sock *udp4_lib_lookup2(struct net *net, + __be32 saddr, __be16 sport, +@@ -526,6 +569,19 @@ struct sock *__udp4_lib_lookup(struct net *net, __be32 saddr, + result = udp4_lib_lookup2(net, saddr, sport, + htonl(INADDR_ANY), hnum, dif, sdif, + hslot2, skb); ++ if (!IS_ERR_OR_NULL(result)) ++ goto done; ++ ++ /* Primary hash (destination port) lookup as fallback for this race: ++ * 1. __ip4_datagram_connect() sets sk_rcv_saddr ++ * 2. lookup (this function): new sk_rcv_saddr, hashes not updated yet ++ * 3. rehash operation updating _secondary and four-tuple_ hashes ++ * The primary hash doesn't need an update after 1., so, thanks to this ++ * further step, 1. and 3. don't need to be atomic against the lookup. ++ */ ++ result = udp4_lib_lookup1(net, saddr, sport, daddr, hnum, dif, sdif, ++ udptable); ++ + done: + if (IS_ERR(result)) + return NULL; +diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c +index 954afe6ba883e..b0d9636bf330f 100644 +--- a/net/ipv6/udp.c ++++ b/net/ipv6/udp.c +@@ -162,6 +162,49 @@ static int compute_score(struct sock *sk, struct net *net, + return score; + } + ++/** ++ * udp6_lib_lookup1() - Simplified lookup using primary hash (destination port) ++ * @net: Network namespace ++ * @saddr: Source address, network order ++ * @sport: Source port, network order ++ * @daddr: Destination address, network order ++ * @hnum: Destination port, host order ++ * @dif: Destination interface index ++ * @sdif: Destination bridge port index, if relevant ++ * @udptable: Set of UDP hash tables ++ * ++ * Simplified lookup to be used as fallback if no sockets are found due to a ++ * potential race between (receive) address change, and lookup happening before ++ * the rehash operation. This function ignores SO_REUSEPORT groups while scoring ++ * result sockets, because if we have one, we don't need the fallback at all. ++ * ++ * Called under rcu_read_lock(). ++ * ++ * Return: socket with highest matching score if any, NULL if none ++ */ ++static struct sock *udp6_lib_lookup1(const struct net *net, ++ const struct in6_addr *saddr, __be16 sport, ++ const struct in6_addr *daddr, ++ unsigned int hnum, int dif, int sdif, ++ const struct udp_table *udptable) ++{ ++ unsigned int slot = udp_hashfn(net, hnum, udptable->mask); ++ struct udp_hslot *hslot = &udptable->hash[slot]; ++ struct sock *sk, *result = NULL; ++ int score, badness = 0; ++ ++ sk_for_each_rcu(sk, &hslot->head) { ++ score = compute_score(sk, net, ++ saddr, sport, daddr, hnum, dif, sdif); ++ if (score > badness) { ++ result = sk; ++ badness = score; ++ } ++ } ++ ++ return result; ++} ++ + /* called with rcu_read_lock() */ + static struct sock *udp6_lib_lookup2(struct net *net, + const struct in6_addr *saddr, __be16 sport, +@@ -266,6 +309,13 @@ struct sock *__udp6_lib_lookup(struct net *net, + result = udp6_lib_lookup2(net, saddr, sport, + &in6addr_any, hnum, dif, sdif, + hslot2, skb); ++ if (!IS_ERR_OR_NULL(result)) ++ goto done; ++ ++ /* Cover address change/lookup/rehash race: see __udp4_lib_lookup() */ ++ result = udp6_lib_lookup1(net, saddr, sport, daddr, hnum, dif, sdif, ++ udptable); ++ + done: + if (IS_ERR(result)) + return NULL; +-- +2.39.5 + diff --git a/queue-6.6/vsock-allow-retrying-on-connect-failure.patch b/queue-6.6/vsock-allow-retrying-on-connect-failure.patch new file mode 100644 index 0000000000..2729673f91 --- /dev/null +++ b/queue-6.6/vsock-allow-retrying-on-connect-failure.patch @@ -0,0 +1,45 @@ +From 3377debb7b0ae892bd7e3f33cbb936735d971afa Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 28 Jan 2025 14:15:28 +0100 +Subject: vsock: Allow retrying on connect() failure + +From: Michal Luczaj + +[ Upstream commit aa388c72113b7458127b709bdd7d3628af26e9b4 ] + +sk_err is set when a (connectible) connect() fails. Effectively, this makes +an otherwise still healthy SS_UNCONNECTED socket impossible to use for any +subsequent connection attempts. + +Clear sk_err upon trying to establish a connection. + +Fixes: d021c344051a ("VSOCK: Introduce VM Sockets") +Reviewed-by: Stefano Garzarella +Reviewed-by: Luigi Leonardi +Signed-off-by: Michal Luczaj +Link: https://patch.msgid.link/20250128-vsock-transport-vs-autobind-v3-2-1cf57065b770@rbox.co +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/vmw_vsock/af_vsock.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c +index ea857ed57d046..df7d95b404d99 100644 +--- a/net/vmw_vsock/af_vsock.c ++++ b/net/vmw_vsock/af_vsock.c +@@ -1457,6 +1457,11 @@ static int vsock_connect(struct socket *sock, struct sockaddr *addr, + if (err < 0) + goto out; + ++ /* sk_err might have been set as a result of an earlier ++ * (failed) connect attempt. ++ */ ++ sk->sk_err = 0; ++ + /* Mark sock as connecting and set the error code to in + * progress in case this is a non-blocking connect. + */ +-- +2.39.5 + diff --git a/queue-6.6/vsock-keep-the-binding-until-socket-destruction.patch b/queue-6.6/vsock-keep-the-binding-until-socket-destruction.patch new file mode 100644 index 0000000000..d4e983c7d6 --- /dev/null +++ b/queue-6.6/vsock-keep-the-binding-until-socket-destruction.patch @@ -0,0 +1,136 @@ +From 41cc051e6272bcd02bad6ded24968eee5f7d65a5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 28 Jan 2025 14:15:27 +0100 +Subject: vsock: Keep the binding until socket destruction + +From: Michal Luczaj + +[ Upstream commit fcdd2242c0231032fc84e1404315c245ae56322a ] + +Preserve sockets bindings; this includes both resulting from an explicit +bind() and those implicitly bound through autobind during connect(). + +Prevents socket unbinding during a transport reassignment, which fixes a +use-after-free: + + 1. vsock_create() (refcnt=1) calls vsock_insert_unbound() (refcnt=2) + 2. transport->release() calls vsock_remove_bound() without checking if + sk was bound and moved to bound list (refcnt=1) + 3. vsock_bind() assumes sk is in unbound list and before + __vsock_insert_bound(vsock_bound_sockets()) calls + __vsock_remove_bound() which does: + list_del_init(&vsk->bound_table); // nop + sock_put(&vsk->sk); // refcnt=0 + +BUG: KASAN: slab-use-after-free in __vsock_bind+0x62e/0x730 +Read of size 4 at addr ffff88816b46a74c by task a.out/2057 + dump_stack_lvl+0x68/0x90 + print_report+0x174/0x4f6 + kasan_report+0xb9/0x190 + __vsock_bind+0x62e/0x730 + vsock_bind+0x97/0xe0 + __sys_bind+0x154/0x1f0 + __x64_sys_bind+0x6e/0xb0 + do_syscall_64+0x93/0x1b0 + entry_SYSCALL_64_after_hwframe+0x76/0x7e + +Allocated by task 2057: + kasan_save_stack+0x1e/0x40 + kasan_save_track+0x10/0x30 + __kasan_slab_alloc+0x85/0x90 + kmem_cache_alloc_noprof+0x131/0x450 + sk_prot_alloc+0x5b/0x220 + sk_alloc+0x2c/0x870 + __vsock_create.constprop.0+0x2e/0xb60 + vsock_create+0xe4/0x420 + __sock_create+0x241/0x650 + __sys_socket+0xf2/0x1a0 + __x64_sys_socket+0x6e/0xb0 + do_syscall_64+0x93/0x1b0 + entry_SYSCALL_64_after_hwframe+0x76/0x7e + +Freed by task 2057: + kasan_save_stack+0x1e/0x40 + kasan_save_track+0x10/0x30 + kasan_save_free_info+0x37/0x60 + __kasan_slab_free+0x4b/0x70 + kmem_cache_free+0x1a1/0x590 + __sk_destruct+0x388/0x5a0 + __vsock_bind+0x5e1/0x730 + vsock_bind+0x97/0xe0 + __sys_bind+0x154/0x1f0 + __x64_sys_bind+0x6e/0xb0 + do_syscall_64+0x93/0x1b0 + entry_SYSCALL_64_after_hwframe+0x76/0x7e + +refcount_t: addition on 0; use-after-free. +WARNING: CPU: 7 PID: 2057 at lib/refcount.c:25 refcount_warn_saturate+0xce/0x150 +RIP: 0010:refcount_warn_saturate+0xce/0x150 + __vsock_bind+0x66d/0x730 + vsock_bind+0x97/0xe0 + __sys_bind+0x154/0x1f0 + __x64_sys_bind+0x6e/0xb0 + do_syscall_64+0x93/0x1b0 + entry_SYSCALL_64_after_hwframe+0x76/0x7e + +refcount_t: underflow; use-after-free. +WARNING: CPU: 7 PID: 2057 at lib/refcount.c:28 refcount_warn_saturate+0xee/0x150 +RIP: 0010:refcount_warn_saturate+0xee/0x150 + vsock_remove_bound+0x187/0x1e0 + __vsock_release+0x383/0x4a0 + vsock_release+0x90/0x120 + __sock_release+0xa3/0x250 + sock_close+0x14/0x20 + __fput+0x359/0xa80 + task_work_run+0x107/0x1d0 + do_exit+0x847/0x2560 + do_group_exit+0xb8/0x250 + __x64_sys_exit_group+0x3a/0x50 + x64_sys_call+0xfec/0x14f0 + do_syscall_64+0x93/0x1b0 + entry_SYSCALL_64_after_hwframe+0x76/0x7e + +Fixes: c0cfa2d8a788 ("vsock: add multi-transports support") +Reviewed-by: Stefano Garzarella +Signed-off-by: Michal Luczaj +Link: https://patch.msgid.link/20250128-vsock-transport-vs-autobind-v3-1-1cf57065b770@rbox.co +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + net/vmw_vsock/af_vsock.c | 8 ++++++-- + 1 file changed, 6 insertions(+), 2 deletions(-) + +diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c +index 2050d888df2ae..ea857ed57d046 100644 +--- a/net/vmw_vsock/af_vsock.c ++++ b/net/vmw_vsock/af_vsock.c +@@ -336,7 +336,10 @@ EXPORT_SYMBOL_GPL(vsock_find_connected_socket); + + void vsock_remove_sock(struct vsock_sock *vsk) + { +- vsock_remove_bound(vsk); ++ /* Transport reassignment must not remove the binding. */ ++ if (sock_flag(sk_vsock(vsk), SOCK_DEAD)) ++ vsock_remove_bound(vsk); ++ + vsock_remove_connected(vsk); + } + EXPORT_SYMBOL_GPL(vsock_remove_sock); +@@ -820,12 +823,13 @@ static void __vsock_release(struct sock *sk, int level) + */ + lock_sock_nested(sk, level); + ++ sock_orphan(sk); ++ + if (vsk->transport) + vsk->transport->release(vsk); + else if (sock_type_connectible(sk->sk_type)) + vsock_remove_sock(vsk); + +- sock_orphan(sk); + sk->sk_shutdown = SHUTDOWN_MASK; + + skb_queue_purge(&sk->sk_receive_queue); +-- +2.39.5 + diff --git a/queue-6.6/vxlan-fix-uninit-value-in-vxlan_vnifilter_dump.patch b/queue-6.6/vxlan-fix-uninit-value-in-vxlan_vnifilter_dump.patch new file mode 100644 index 0000000000..cd6b3c5914 --- /dev/null +++ b/queue-6.6/vxlan-fix-uninit-value-in-vxlan_vnifilter_dump.patch @@ -0,0 +1,98 @@ +From 1d6f668d0844b3a6369d923ccb26ae7ea1ac0654 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 23 Jan 2025 23:57:46 +0900 +Subject: vxlan: Fix uninit-value in vxlan_vnifilter_dump() + +From: Shigeru Yoshida + +[ Upstream commit 5066293b9b7046a906eff60e3949a887ae185a43 ] + +KMSAN reported an uninit-value access in vxlan_vnifilter_dump() [1]. + +If the length of the netlink message payload is less than +sizeof(struct tunnel_msg), vxlan_vnifilter_dump() accesses bytes +beyond the message. This can lead to uninit-value access. Fix this by +returning an error in such situations. + +[1] +BUG: KMSAN: uninit-value in vxlan_vnifilter_dump+0x328/0x920 drivers/net/vxlan/vxlan_vnifilter.c:422 + vxlan_vnifilter_dump+0x328/0x920 drivers/net/vxlan/vxlan_vnifilter.c:422 + rtnl_dumpit+0xd5/0x2f0 net/core/rtnetlink.c:6786 + netlink_dump+0x93e/0x15f0 net/netlink/af_netlink.c:2317 + __netlink_dump_start+0x716/0xd60 net/netlink/af_netlink.c:2432 + netlink_dump_start include/linux/netlink.h:340 [inline] + rtnetlink_dump_start net/core/rtnetlink.c:6815 [inline] + rtnetlink_rcv_msg+0x1256/0x14a0 net/core/rtnetlink.c:6882 + netlink_rcv_skb+0x467/0x660 net/netlink/af_netlink.c:2542 + rtnetlink_rcv+0x35/0x40 net/core/rtnetlink.c:6944 + netlink_unicast_kernel net/netlink/af_netlink.c:1321 [inline] + netlink_unicast+0xed6/0x1290 net/netlink/af_netlink.c:1347 + netlink_sendmsg+0x1092/0x1230 net/netlink/af_netlink.c:1891 + sock_sendmsg_nosec net/socket.c:711 [inline] + __sock_sendmsg+0x330/0x3d0 net/socket.c:726 + ____sys_sendmsg+0x7f4/0xb50 net/socket.c:2583 + ___sys_sendmsg+0x271/0x3b0 net/socket.c:2637 + __sys_sendmsg net/socket.c:2669 [inline] + __do_sys_sendmsg net/socket.c:2674 [inline] + __se_sys_sendmsg net/socket.c:2672 [inline] + __x64_sys_sendmsg+0x211/0x3e0 net/socket.c:2672 + x64_sys_call+0x3878/0x3d90 arch/x86/include/generated/asm/syscalls_64.h:47 + do_syscall_x64 arch/x86/entry/common.c:52 [inline] + do_syscall_64+0xd9/0x1d0 arch/x86/entry/common.c:83 + entry_SYSCALL_64_after_hwframe+0x77/0x7f + +Uninit was created at: + slab_post_alloc_hook mm/slub.c:4110 [inline] + slab_alloc_node mm/slub.c:4153 [inline] + kmem_cache_alloc_node_noprof+0x800/0xe80 mm/slub.c:4205 + kmalloc_reserve+0x13b/0x4b0 net/core/skbuff.c:587 + __alloc_skb+0x347/0x7d0 net/core/skbuff.c:678 + alloc_skb include/linux/skbuff.h:1323 [inline] + netlink_alloc_large_skb+0xa5/0x280 net/netlink/af_netlink.c:1196 + netlink_sendmsg+0xac9/0x1230 net/netlink/af_netlink.c:1866 + sock_sendmsg_nosec net/socket.c:711 [inline] + __sock_sendmsg+0x330/0x3d0 net/socket.c:726 + ____sys_sendmsg+0x7f4/0xb50 net/socket.c:2583 + ___sys_sendmsg+0x271/0x3b0 net/socket.c:2637 + __sys_sendmsg net/socket.c:2669 [inline] + __do_sys_sendmsg net/socket.c:2674 [inline] + __se_sys_sendmsg net/socket.c:2672 [inline] + __x64_sys_sendmsg+0x211/0x3e0 net/socket.c:2672 + x64_sys_call+0x3878/0x3d90 arch/x86/include/generated/asm/syscalls_64.h:47 + do_syscall_x64 arch/x86/entry/common.c:52 [inline] + do_syscall_64+0xd9/0x1d0 arch/x86/entry/common.c:83 + entry_SYSCALL_64_after_hwframe+0x77/0x7f + +CPU: 0 UID: 0 PID: 30991 Comm: syz.4.10630 Not tainted 6.12.0-10694-gc44daa7e3c73 #29 +Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-3.fc41 04/01/2014 + +Fixes: f9c4bb0b245c ("vxlan: vni filtering support on collect metadata device") +Reported-by: syzkaller +Signed-off-by: Shigeru Yoshida +Reviewed-by: Ido Schimmel +Link: https://patch.msgid.link/20250123145746.785768-1-syoshida@redhat.com +Signed-off-by: Jakub Kicinski +Signed-off-by: Sasha Levin +--- + drivers/net/vxlan/vxlan_vnifilter.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/net/vxlan/vxlan_vnifilter.c b/drivers/net/vxlan/vxlan_vnifilter.c +index d2023e7131bd4..6e6e9f05509ab 100644 +--- a/drivers/net/vxlan/vxlan_vnifilter.c ++++ b/drivers/net/vxlan/vxlan_vnifilter.c +@@ -411,6 +411,11 @@ static int vxlan_vnifilter_dump(struct sk_buff *skb, struct netlink_callback *cb + struct tunnel_msg *tmsg; + struct net_device *dev; + ++ if (cb->nlh->nlmsg_len < nlmsg_msg_size(sizeof(struct tunnel_msg))) { ++ NL_SET_ERR_MSG(cb->extack, "Invalid msg length"); ++ return -EINVAL; ++ } ++ + tmsg = nlmsg_data(cb->nlh); + + if (tmsg->flags & ~TUNNEL_MSG_VALID_USER_FLAGS) { +-- +2.39.5 + diff --git a/queue-6.6/watchdog-rti_wdt-fix-an-of-node-leak-in-rti_wdt_prob.patch b/queue-6.6/watchdog-rti_wdt-fix-an-of-node-leak-in-rti_wdt_prob.patch new file mode 100644 index 0000000000..7fab7067d0 --- /dev/null +++ b/queue-6.6/watchdog-rti_wdt-fix-an-of-node-leak-in-rti_wdt_prob.patch @@ -0,0 +1,42 @@ +From f3467953ef9963c215251697eb3c86ceb755c924 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sun, 5 Jan 2025 20:17:18 +0900 +Subject: watchdog: rti_wdt: Fix an OF node leak in rti_wdt_probe() + +From: Joe Hattori + +[ Upstream commit 143981aa63f33d469a55a55fd9fb81cd90109672 ] + +rti_wdt_probe() does not release the OF node reference obtained by +of_parse_phandle(). Add a of_node_put() call. + +This was found by an experimental verification tool that I am +developing. Due to the lack of the actual device, no runtime test was +able to be performed. + +Fixes: f20ca595ae23 ("watchdog:rit_wdt: Add support for WDIOF_CARDRESET") +Signed-off-by: Joe Hattori +Reviewed-by: Guenter Roeck +Link: https://lore.kernel.org/r/20250105111718.4184192-1-joe@pf.is.s.u-tokyo.ac.jp +Signed-off-by: Guenter Roeck +Signed-off-by: Wim Van Sebroeck +Signed-off-by: Sasha Levin +--- + drivers/watchdog/rti_wdt.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/watchdog/rti_wdt.c b/drivers/watchdog/rti_wdt.c +index 563d842014dfb..cc239251e1938 100644 +--- a/drivers/watchdog/rti_wdt.c ++++ b/drivers/watchdog/rti_wdt.c +@@ -301,6 +301,7 @@ static int rti_wdt_probe(struct platform_device *pdev) + node = of_parse_phandle(pdev->dev.of_node, "memory-region", 0); + if (node) { + ret = of_address_to_resource(node, 0, &res); ++ of_node_put(node); + if (ret) { + dev_err(dev, "No memory address assigned to the region.\n"); + goto err_iomap; +-- +2.39.5 + diff --git a/queue-6.6/wifi-ath11k-fix-unexpected-return-buffer-manager-err.patch b/queue-6.6/wifi-ath11k-fix-unexpected-return-buffer-manager-err.patch new file mode 100644 index 0000000000..3525a2929b --- /dev/null +++ b/queue-6.6/wifi-ath11k-fix-unexpected-return-buffer-manager-err.patch @@ -0,0 +1,69 @@ +From d471d70d5a8ffb3d01dae34336a139b5fc77762b Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 30 Oct 2024 17:16:25 +0530 +Subject: wifi: ath11k: Fix unexpected return buffer manager error for + WCN6750/WCN6855 + +From: Balaji Pothunoori + +[ Upstream commit 78e154d42f2c72905fe66a400847e1b2b101b7b2 ] + +The following error messages were encountered while parsing fragmented RX +packets for WCN6750/WCN6855: + +ath11k 17a10040.wifi: invalid return buffer manager 4 + +This issue arose due to a hardcoded check for HAL_RX_BUF_RBM_SW3_BM +introduced in 'commit 71c748b5e01e ("ath11k: Fix unexpected return buffer +manager error for QCA6390")' + +For WCN6750 and WCN6855, the return buffer manager ID should be +HAL_RX_BUF_RBM_SW1_BM. The incorrect conditional check caused fragmented +packets to be dropped, resulting in the above error log. + +Fix this by adding a check for HAL_RX_BUF_RBM_SW1_BM. + +Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.2.0.c2-00258-QCAMSLSWPL-1 +Tested-on: WCN6855 hw2.1 WLAN.HSP.1.1-04479-QCAHSPSWPL_V1_V2_SILICONZ_IOE-1 + +Fixes: 71c748b5e01e ("ath11k: Fix unexpected return buffer manager error for QCA6390") +Signed-off-by: Balaji Pothunoori +Acked-by: Jeff Johnson +Acked-by: Kalle Valo +Link: https://patch.msgid.link/20241030114625.2416942-1-quic_bpothuno@quicinc.com +Signed-off-by: Jeff Johnson +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/ath/ath11k/dp_rx.c | 1 + + drivers/net/wireless/ath/ath11k/hal_rx.c | 3 ++- + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c +index fb426195a3f01..4c70366ac56eb 100644 +--- a/drivers/net/wireless/ath/ath11k/dp_rx.c ++++ b/drivers/net/wireless/ath/ath11k/dp_rx.c +@@ -3811,6 +3811,7 @@ int ath11k_dp_process_rx_err(struct ath11k_base *ab, struct napi_struct *napi, + ath11k_hal_rx_msdu_link_info_get(link_desc_va, &num_msdus, msdu_cookies, + &rbm); + if (rbm != HAL_RX_BUF_RBM_WBM_IDLE_DESC_LIST && ++ rbm != HAL_RX_BUF_RBM_SW1_BM && + rbm != HAL_RX_BUF_RBM_SW3_BM) { + ab->soc_stats.invalid_rbm++; + ath11k_warn(ab, "invalid return buffer manager %d\n", rbm); +diff --git a/drivers/net/wireless/ath/ath11k/hal_rx.c b/drivers/net/wireless/ath/ath11k/hal_rx.c +index 363adac84a870..2bc95026335e3 100644 +--- a/drivers/net/wireless/ath/ath11k/hal_rx.c ++++ b/drivers/net/wireless/ath/ath11k/hal_rx.c +@@ -372,7 +372,8 @@ int ath11k_hal_wbm_desc_parse_err(struct ath11k_base *ab, void *desc, + + ret_buf_mgr = FIELD_GET(BUFFER_ADDR_INFO1_RET_BUF_MGR, + wbm_desc->buf_addr_info.info1); +- if (ret_buf_mgr != HAL_RX_BUF_RBM_SW3_BM) { ++ if (ret_buf_mgr != HAL_RX_BUF_RBM_SW1_BM && ++ ret_buf_mgr != HAL_RX_BUF_RBM_SW3_BM) { + ab->soc_stats.invalid_rbm++; + return -EINVAL; + } +-- +2.39.5 + diff --git a/queue-6.6/wifi-ath12k-fix-tx-power-max-reg-power-update-to-fir.patch b/queue-6.6/wifi-ath12k-fix-tx-power-max-reg-power-update-to-fir.patch new file mode 100644 index 0000000000..19737e6491 --- /dev/null +++ b/queue-6.6/wifi-ath12k-fix-tx-power-max-reg-power-update-to-fir.patch @@ -0,0 +1,56 @@ +From d7370b31c0757b0a4ad18344f078a2be16eba155 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 9 Sep 2024 13:00:49 +0530 +Subject: wifi: ath12k: fix tx power, max reg power update to firmware + +From: Sathishkumar Muruganandam + +[ Upstream commit 3540bba855b4b422e8b977d11aa8173ccb4f089d ] + +Currently, when the vdev start WMI cmd is sent from host, vdev related +parameters such as max_reg_power, max_power, and max_antenna_gain are +multiplied by 2 before being sent to the firmware. This is incorrect +because the firmware uses 1 dBm steps for power calculations. + +This leads to incorrect power values being used in the firmware and +radio, potentially causing incorrect behavior. + +Fix the update of max_reg_power, max_power, and max_antenna_gain values +in the ath12k_mac_vdev_start_restart function, ensuring accurate +power settings in the firmware by sending these values as-is, +without multiplication. + +Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.1.1-00214-QCAHKSWPL_SILICONZ-1 +Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 + +Signed-off-by: Sathishkumar Muruganandam +Signed-off-by: Santhosh Ramesh +Fixes: d889913205cf ("wifi: ath12k: driver for Qualcomm Wi-Fi 7 devices") +Acked-by: Kalle Valo +Link: https://patch.msgid.link/20240909073049.3423035-1-quic_santrame@quicinc.com +Signed-off-by: Jeff Johnson +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/ath/ath12k/mac.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c +index 713899735ccc5..e1db6e69d2207 100644 +--- a/drivers/net/wireless/ath/ath12k/mac.c ++++ b/drivers/net/wireless/ath/ath12k/mac.c +@@ -5823,9 +5823,9 @@ ath12k_mac_vdev_start_restart(struct ath12k_vif *arvif, + arg.mode = ath12k_phymodes[chandef->chan->band][chandef->width]; + + arg.min_power = 0; +- arg.max_power = chandef->chan->max_power * 2; +- arg.max_reg_power = chandef->chan->max_reg_power * 2; +- arg.max_antenna_gain = chandef->chan->max_antenna_gain * 2; ++ arg.max_power = chandef->chan->max_power; ++ arg.max_reg_power = chandef->chan->max_reg_power; ++ arg.max_antenna_gain = chandef->chan->max_antenna_gain; + + arg.pref_tx_streams = ar->num_tx_chains; + arg.pref_rx_streams = ar->num_rx_chains; +-- +2.39.5 + diff --git a/queue-6.6/wifi-brcmfmac-add-missing-header-include-for-brcmf_d.patch b/queue-6.6/wifi-brcmfmac-add-missing-header-include-for-brcmf_d.patch new file mode 100644 index 0000000000..b495f32e3c --- /dev/null +++ b/queue-6.6/wifi-brcmfmac-add-missing-header-include-for-brcmf_d.patch @@ -0,0 +1,53 @@ +From abb55550bce7910469a5e40fe4c8c89d841fc55c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 11 Dec 2024 14:36:18 +0100 +Subject: wifi: brcmfmac: add missing header include for brcmf_dbg +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Marcel Hamer + +[ Upstream commit b05d30c2b6df7e2172b18bf1baee9b202f9c6b53 ] + +Including the fwil.h header file can lead to a build error: + +drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h: \ + In function ‘brcmf_fil_cmd_int_set’: +drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h:90:9: error: implicit \ + declaration of function ‘brcmf_dbg’ [-Werror=implicit-function-declaration] + 90 | brcmf_dbg(FIL, "ifidx=%d, cmd=%d, value=%d\n", ifp->ifidx, cmd, data); + | ^~~~~~~~~ + +The error is often avoided because the debug.h header file is included +before the fwil.h header file. + +This makes sure the header include order is irrelevant by explicitly adding the +debug.h header. + +Fixes: 31343230abb1 ("wifi: brcmfmac: export firmware interface functions") +Signed-off-by: Marcel Hamer +Acked-by: Arend van Spriel +Signed-off-by: Kalle Valo +Link: https://patch.msgid.link/20241211133618.2014083-1-marcel.hamer@windriver.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h +index 31e080e4da669..ab3d6cfcb02bd 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/fwil.h +@@ -6,6 +6,8 @@ + #ifndef _fwil_h_ + #define _fwil_h_ + ++#include "debug.h" ++ + /******************************************************************************* + * Dongle command codes that are interpreted by firmware + ******************************************************************************/ +-- +2.39.5 + diff --git a/queue-6.6/wifi-cfg80211-adjust-allocation-of-colocated-ap-data.patch b/queue-6.6/wifi-cfg80211-adjust-allocation-of-colocated-ap-data.patch new file mode 100644 index 0000000000..7dd9f705e1 --- /dev/null +++ b/queue-6.6/wifi-cfg80211-adjust-allocation-of-colocated-ap-data.patch @@ -0,0 +1,41 @@ +From 6fc938439037944b45be3200269b86558bc66b5c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Jan 2025 18:54:17 +0300 +Subject: wifi: cfg80211: adjust allocation of colocated AP data + +From: Dmitry Antipov + +[ Upstream commit 1a0d24775cdee2b8dc14bfa4f4418c930ab1ac57 ] + +In 'cfg80211_scan_6ghz()', an instances of 'struct cfg80211_colocated_ap' +are allocated as if they would have 'ssid' as trailing VLA member. Since +this is not so, extra IEEE80211_MAX_SSID_LEN bytes are not needed. +Briefly tested with KUnit. + +Fixes: c8cb5b854b40 ("nl80211/cfg80211: support 6 GHz scanning") +Signed-off-by: Dmitry Antipov +Link: https://patch.msgid.link/20250113155417.552587-1-dmantipov@yandex.ru +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/wireless/scan.c | 4 +--- + 1 file changed, 1 insertion(+), 3 deletions(-) + +diff --git a/net/wireless/scan.c b/net/wireless/scan.c +index c76ac1959fe8d..ce622a287abc6 100644 +--- a/net/wireless/scan.c ++++ b/net/wireless/scan.c +@@ -856,9 +856,7 @@ static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev) + if (ret) + continue; + +- entry = kzalloc(sizeof(*entry) + IEEE80211_MAX_SSID_LEN, +- GFP_ATOMIC); +- ++ entry = kzalloc(sizeof(*entry), GFP_ATOMIC); + if (!entry) + continue; + +-- +2.39.5 + diff --git a/queue-6.6/wifi-cfg80211-handle-specific-bssid-in-6ghz-scanning.patch b/queue-6.6/wifi-cfg80211-handle-specific-bssid-in-6ghz-scanning.patch new file mode 100644 index 0000000000..354327dae5 --- /dev/null +++ b/queue-6.6/wifi-cfg80211-handle-specific-bssid-in-6ghz-scanning.patch @@ -0,0 +1,84 @@ +From d2db94c0a97cdd76b9ecc7b9f53cfd5d6ba58660 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 28 Sep 2023 17:35:30 +0300 +Subject: wifi: cfg80211: Handle specific BSSID in 6GHz scanning + +From: Ilan Peer + +[ Upstream commit 0fca7784b7a14d4ede64f479662afb98876ec7f8 ] + +When the scan parameters for a 6GHz scan specify a unicast +BSSID address, and the corresponding AP is found in the scan +list, add a corresponding entry in the collocated AP list, +so this AP would be directly probed even if it was not +advertised as a collocated AP. + +This is needed for handling a scan request that is intended +for a ML probe flow, where user space can requests a scan +to retrieve information for other links in the AP MLD. + +Signed-off-by: Ilan Peer +Signed-off-by: Gregory Greenman +Link: https://lore.kernel.org/r/20230928172905.54b954bc02ad.I1c072793d3d77a4c8fbbc64b4db5cce1bbb00382@changeid +Signed-off-by: Johannes Berg +Stable-dep-of: 1a0d24775cde ("wifi: cfg80211: adjust allocation of colocated AP data") +Signed-off-by: Sasha Levin +--- + net/wireless/scan.c | 37 +++++++++++++++++++++++++++++++++++++ + 1 file changed, 37 insertions(+) + +diff --git a/net/wireless/scan.c b/net/wireless/scan.c +index 4fc6279750ea1..c76ac1959fe8d 100644 +--- a/net/wireless/scan.c ++++ b/net/wireless/scan.c +@@ -831,10 +831,47 @@ static int cfg80211_scan_6ghz(struct cfg80211_registered_device *rdev) + list_for_each_entry(intbss, &rdev->bss_list, list) { + struct cfg80211_bss *res = &intbss->pub; + const struct cfg80211_bss_ies *ies; ++ const struct element *ssid_elem; ++ struct cfg80211_colocated_ap *entry; ++ u32 s_ssid_tmp; ++ int ret; + + ies = rcu_access_pointer(res->ies); + count += cfg80211_parse_colocated_ap(ies, + &coloc_ap_list); ++ ++ /* In case the scan request specified a specific BSSID ++ * and the BSS is found and operating on 6GHz band then ++ * add this AP to the collocated APs list. ++ * This is relevant for ML probe requests when the lower ++ * band APs have not been discovered. ++ */ ++ if (is_broadcast_ether_addr(rdev_req->bssid) || ++ !ether_addr_equal(rdev_req->bssid, res->bssid) || ++ res->channel->band != NL80211_BAND_6GHZ) ++ continue; ++ ++ ret = cfg80211_calc_short_ssid(ies, &ssid_elem, ++ &s_ssid_tmp); ++ if (ret) ++ continue; ++ ++ entry = kzalloc(sizeof(*entry) + IEEE80211_MAX_SSID_LEN, ++ GFP_ATOMIC); ++ ++ if (!entry) ++ continue; ++ ++ memcpy(entry->bssid, res->bssid, ETH_ALEN); ++ entry->short_ssid = s_ssid_tmp; ++ memcpy(entry->ssid, ssid_elem->data, ++ ssid_elem->datalen); ++ entry->ssid_len = ssid_elem->datalen; ++ entry->short_ssid_valid = true; ++ entry->center_freq = res->channel->center_freq; ++ ++ list_add_tail(&entry->list, &coloc_ap_list); ++ count++; + } + spin_unlock_bh(&rdev->bss_lock); + } +-- +2.39.5 + diff --git a/queue-6.6/wifi-mac80211-don-t-flush-non-uploaded-stas.patch b/queue-6.6/wifi-mac80211-don-t-flush-non-uploaded-stas.patch new file mode 100644 index 0000000000..575a42f1e6 --- /dev/null +++ b/queue-6.6/wifi-mac80211-don-t-flush-non-uploaded-stas.patch @@ -0,0 +1,44 @@ +From 8e50dd5c725b5df796d6b1ce8a64a5a24e579d16 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Jan 2025 16:20:06 +0200 +Subject: wifi: mac80211: don't flush non-uploaded STAs + +From: Johannes Berg + +[ Upstream commit aa3ce3f8fafa0b8fb062f28024855ea8cb3f3450 ] + +If STA state is pre-moved to AUTHORIZED (such as in IBSS +scenarios) and insertion fails, the station is freed. +In this case, the driver never knew about the station, +so trying to flush it is unexpected and may crash. + +Check if the sta was uploaded to the driver before and +fix this. + +Fixes: d00800a289c9 ("wifi: mac80211: add flush_sta method") +Signed-off-by: Johannes Berg +Signed-off-by: Miri Korenblit +Link: https://patch.msgid.link/20250102161730.e3d10970a7c7.I491bbcccc46f835ade07df0640a75f6ed92f20a3@changeid +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/mac80211/driver-ops.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h +index 2bc2fbe58f944..78aa3bc51586e 100644 +--- a/net/mac80211/driver-ops.h ++++ b/net/mac80211/driver-ops.h +@@ -665,6 +665,9 @@ static inline void drv_flush_sta(struct ieee80211_local *local, + if (sdata && !check_sdata_in_driver(sdata)) + return; + ++ if (!sta->uploaded) ++ return; ++ + trace_drv_flush_sta(local, sdata, &sta->sta); + if (local->ops->flush_sta) + local->ops->flush_sta(&local->hw, &sdata->vif, &sta->sta); +-- +2.39.5 + diff --git a/queue-6.6/wifi-mac80211-fix-common-size-calculation-for-ml-ele.patch b/queue-6.6/wifi-mac80211-fix-common-size-calculation-for-ml-ele.patch new file mode 100644 index 0000000000..e3b43deceb --- /dev/null +++ b/queue-6.6/wifi-mac80211-fix-common-size-calculation-for-ml-ele.patch @@ -0,0 +1,71 @@ +From 612e6682d3e8510c37d15f6313b982a55fd1a5e5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Jan 2025 16:20:00 +0200 +Subject: wifi: mac80211: Fix common size calculation for ML element + +From: Ilan Peer + +[ Upstream commit 19aa842dcbb5860509b7e1b7745dbae0b791f6c4 ] + +When the ML type is EPCS the control bitmap is reserved, the length +is always 7 and is captured by the 1st octet after the control. + +Fixes: 0f48b8b88aa9 ("wifi: ieee80211: add definitions for multi-link element") +Signed-off-by: Ilan Peer +Reviewed-by: Johannes Berg +Signed-off-by: Miri Korenblit +Link: https://patch.msgid.link/20250102161730.5790376754a7.I381208cbb72b1be2a88239509294099e9337e254@changeid +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + include/linux/ieee80211.h | 11 +++-------- + 1 file changed, 3 insertions(+), 8 deletions(-) + +diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h +index 5f1e5a16d7b2c..0ff10007eb1a5 100644 +--- a/include/linux/ieee80211.h ++++ b/include/linux/ieee80211.h +@@ -4826,28 +4826,24 @@ static inline u8 ieee80211_mle_common_size(const u8 *data) + { + const struct ieee80211_multi_link_elem *mle = (const void *)data; + u16 control = le16_to_cpu(mle->control); +- u8 common = 0; + + switch (u16_get_bits(control, IEEE80211_ML_CONTROL_TYPE)) { + case IEEE80211_ML_CONTROL_TYPE_BASIC: + case IEEE80211_ML_CONTROL_TYPE_PREQ: + case IEEE80211_ML_CONTROL_TYPE_TDLS: + case IEEE80211_ML_CONTROL_TYPE_RECONF: ++ case IEEE80211_ML_CONTROL_TYPE_PRIO_ACCESS: + /* + * The length is the first octet pointed by mle->variable so no + * need to add anything + */ + break; +- case IEEE80211_ML_CONTROL_TYPE_PRIO_ACCESS: +- if (control & IEEE80211_MLC_PRIO_ACCESS_PRES_AP_MLD_MAC_ADDR) +- common += ETH_ALEN; +- return common; + default: + WARN_ON(1); + return 0; + } + +- return sizeof(*mle) + common + mle->variable[0]; ++ return sizeof(*mle) + mle->variable[0]; + } + + /** +@@ -4989,8 +4985,7 @@ static inline bool ieee80211_mle_size_ok(const u8 *data, size_t len) + check_common_len = true; + break; + case IEEE80211_ML_CONTROL_TYPE_PRIO_ACCESS: +- if (control & IEEE80211_MLC_PRIO_ACCESS_PRES_AP_MLD_MAC_ADDR) +- common += ETH_ALEN; ++ common = ETH_ALEN + 1; + break; + default: + /* we don't know this type */ +-- +2.39.5 + diff --git a/queue-6.6/wifi-mac80211-fix-tid-removal-during-mesh-forwarding.patch b/queue-6.6/wifi-mac80211-fix-tid-removal-during-mesh-forwarding.patch new file mode 100644 index 0000000000..5647f8ef5f --- /dev/null +++ b/queue-6.6/wifi-mac80211-fix-tid-removal-during-mesh-forwarding.patch @@ -0,0 +1,78 @@ +From 3bd3f50b25fe11704a4a9d171ed6c6a604bfcba3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 7 Jan 2025 10:44:31 +0000 +Subject: wifi: mac80211: fix tid removal during mesh forwarding + +From: Andy Strohman + +[ Upstream commit 3aaa1a5a9a2ceeb32afa6ea4110a92338a863c33 ] + +With change (wifi: mac80211: fix receiving A-MSDU +frames on mesh interfaces), a non-zero TID assignment +is lost during slow path mesh forwarding. + +Prior to this change, ieee80211_rx_h_mesh_fwding() +left the TID intact in the header. + +As a result of this header corruption, packets belonging +to non-zero TIDs will get treating as belonging +TID 0 by functions such as ieee80211_get_tid(). +While this miscategorization by itself is an +issue, there are additional ramifications +due to the fact that skb->priority still reflects +the mesh forwarded packet's ingress (correct) TID. + +The mt7915 driver inspects the TID recorded within +skb->priority and relays this to the +hardware/radio during TX. The radio firmware appears to +react to this by changing the sequence control +header, but it does not also ensure/correct the TID in +the QoS control header. As a result, the receiver +will see packets with sequence numbers corresponding +to the wrong TID. The receiver of the forwarded +packet will see TID 0 in QoS control but a sequence number +corresponding to the correct (different) TID in sequence +control. This causes data stalls for TID 0 until +the TID 0 sequence number advances past what the receiver +believes it should be due to this bug. + +Mesh routing mpath changes cause a brief transition +from fast path forwarding to slow path forwarding. +Since this bug only affects the slow path forwarding, +mpath changes bring opportunity for the bug to be triggered. +In the author's case, he was experiencing TID 0 data stalls +after mpath changes on an intermediate mesh node. + +These observed stalls may be specific +to mediatek radios. But the inconsistency between +the packet header and skb->priority may cause problems +for other drivers as well. Regardless if this causes +connectivity issues on other radios, this change is +necessary in order transmit (forward) the packet on the +correct TID and to have a consistent view a packet's TID +within mac80211. + +Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces") +Signed-off-by: Andy Strohman +Link: https://patch.msgid.link/20250107104431.446775-1-andrew@andrewstrohman.com +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/mac80211/rx.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c +index 604863cebc198..5eb233f619817 100644 +--- a/net/mac80211/rx.c ++++ b/net/mac80211/rx.c +@@ -2957,6 +2957,7 @@ ieee80211_rx_mesh_data(struct ieee80211_sub_if_data *sdata, struct sta_info *sta + } + + IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, fwded_frames); ++ ieee80211_set_qos_hdr(sdata, fwd_skb); + ieee80211_add_pending_skb(local, fwd_skb); + + rx_accept: +-- +2.39.5 + diff --git a/queue-6.6/wifi-mac80211-prohibit-deactivating-all-links.patch b/queue-6.6/wifi-mac80211-prohibit-deactivating-all-links.patch new file mode 100644 index 0000000000..66b9e67fb1 --- /dev/null +++ b/queue-6.6/wifi-mac80211-prohibit-deactivating-all-links.patch @@ -0,0 +1,40 @@ +From 0e70b5fd34fe6d9e1651c3cffa97e1216b313302 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Dec 2024 09:14:07 +0100 +Subject: wifi: mac80211: prohibit deactivating all links + +From: Johannes Berg + +[ Upstream commit 7553477cbfd784b128297f9ed43751688415bbaa ] + +In the internal API this calls this is a WARN_ON, but that +should remain since internally we want to know about bugs +that may cause this. Prevent deactivating all links in the +debugfs write directly. + +Reported-by: syzbot+0c5d8e65f23569a8ffec@syzkaller.appspotmail.com +Fixes: 3d9011029227 ("wifi: mac80211: implement link switching") +Signed-off-by: Johannes Berg +Link: https://patch.msgid.link/20241230091408.505bd125c35a.Ic3c1f9572b980a952a444cad62b09b9c6721732b@changeid +Signed-off-by: Johannes Berg +Signed-off-by: Sasha Levin +--- + net/mac80211/debugfs_netdev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c +index 63250286dc8b7..d6938ffd764ca 100644 +--- a/net/mac80211/debugfs_netdev.c ++++ b/net/mac80211/debugfs_netdev.c +@@ -616,7 +616,7 @@ static ssize_t ieee80211_if_parse_active_links(struct ieee80211_sub_if_data *sda + { + u16 active_links; + +- if (kstrtou16(buf, 0, &active_links)) ++ if (kstrtou16(buf, 0, &active_links) || !active_links) + return -EINVAL; + + return ieee80211_set_active_links(&sdata->vif, active_links) ?: buflen; +-- +2.39.5 + diff --git a/queue-6.6/wifi-mt76-connac-move-mt7615_mcu_del_wtbl_all-to-con.patch b/queue-6.6/wifi-mt76-connac-move-mt7615_mcu_del_wtbl_all-to-con.patch new file mode 100644 index 0000000000..1bc19259cb --- /dev/null +++ b/queue-6.6/wifi-mt76-connac-move-mt7615_mcu_del_wtbl_all-to-con.patch @@ -0,0 +1,106 @@ +From 3e4f0e0b4ac9728873e8b32d8036b783810f02e7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 27 Aug 2024 11:30:05 +0200 +Subject: wifi: mt76: connac: move mt7615_mcu_del_wtbl_all to connac + +From: Felix Fietkau + +[ Upstream commit b2141eadf8be6285ff8980cab153079231cab4fd ] + +Preparation for reusing it in mt7915 + +Link: https://patch.msgid.link/20240827093011.18621-18-nbd@nbd.name +Signed-off-by: Felix Fietkau +Stable-dep-of: cd043bbba6f9 ("wifi: mt76: mt7915: fix omac index assignment after hardware reset") +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/mediatek/mt76/mt7615/init.c | 2 +- + drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 10 ---------- + drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h | 1 - + drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c | 11 +++++++++++ + drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h | 1 + + 5 files changed, 13 insertions(+), 12 deletions(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/init.c b/drivers/net/wireless/mediatek/mt76/mt7615/init.c +index f22a1aa885052..129350186d5d5 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7615/init.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7615/init.c +@@ -325,7 +325,7 @@ void mt7615_init_work(struct mt7615_dev *dev) + mt7615_mcu_set_eeprom(dev); + mt7615_mac_init(dev); + mt7615_phy_init(dev); +- mt7615_mcu_del_wtbl_all(dev); ++ mt76_connac_mcu_del_wtbl_all(&dev->mt76); + mt7615_check_offload_capability(dev); + } + EXPORT_SYMBOL_GPL(mt7615_init_work); +diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +index 955974a82180f..e92040616a1f3 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +@@ -1876,16 +1876,6 @@ int mt7615_mcu_set_dbdc(struct mt7615_dev *dev) + sizeof(req), true); + } + +-int mt7615_mcu_del_wtbl_all(struct mt7615_dev *dev) +-{ +- struct wtbl_req_hdr req = { +- .operation = WTBL_RESET_ALL, +- }; +- +- return mt76_mcu_send_msg(&dev->mt76, MCU_EXT_CMD(WTBL_UPDATE), +- &req, sizeof(req), true); +-} +- + int mt7615_mcu_set_fcc5_lpn(struct mt7615_dev *dev, int val) + { + struct { +diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h +index a20322aae9672..fa83b255e180c 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h ++++ b/drivers/net/wireless/mediatek/mt76/mt7615/mt7615.h +@@ -399,7 +399,6 @@ void mt7615_mac_set_rates(struct mt7615_phy *phy, struct mt7615_sta *sta, + struct ieee80211_tx_rate *rates); + void mt7615_pm_wake_work(struct work_struct *work); + void mt7615_pm_power_save_work(struct work_struct *work); +-int mt7615_mcu_del_wtbl_all(struct mt7615_dev *dev); + int mt7615_mcu_set_chan_info(struct mt7615_phy *phy, int cmd); + int mt7615_mcu_set_wmm(struct mt7615_dev *dev, u8 queue, + const struct ieee80211_tx_queue_params *params); +diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +index 998cfd73764a9..7420d91bef0de 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c ++++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.c +@@ -2926,6 +2926,17 @@ int mt76_connac_mcu_restart(struct mt76_dev *dev) + } + EXPORT_SYMBOL_GPL(mt76_connac_mcu_restart); + ++int mt76_connac_mcu_del_wtbl_all(struct mt76_dev *dev) ++{ ++ struct wtbl_req_hdr req = { ++ .operation = WTBL_RESET_ALL, ++ }; ++ ++ return mt76_mcu_send_msg(dev, MCU_EXT_CMD(WTBL_UPDATE), ++ &req, sizeof(req), true); ++} ++EXPORT_SYMBOL_GPL(mt76_connac_mcu_del_wtbl_all); ++ + int mt76_connac_mcu_rdd_cmd(struct mt76_dev *dev, int cmd, u8 index, + u8 rx_sel, u8 val) + { +diff --git a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +index 4543e5bf0482d..27391ee3564a1 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h ++++ b/drivers/net/wireless/mediatek/mt76/mt76_connac_mcu.h +@@ -1914,6 +1914,7 @@ void mt76_connac_mcu_wtbl_smps_tlv(struct sk_buff *skb, + void *sta_wtbl, void *wtbl_tlv); + int mt76_connac_mcu_set_pm(struct mt76_dev *dev, int band, int enter); + int mt76_connac_mcu_restart(struct mt76_dev *dev); ++int mt76_connac_mcu_del_wtbl_all(struct mt76_dev *dev); + int mt76_connac_mcu_rdd_cmd(struct mt76_dev *dev, int cmd, u8 index, + u8 rx_sel, u8 val); + int mt76_connac_mcu_sta_wed_update(struct mt76_dev *dev, struct sk_buff *skb); +-- +2.39.5 + diff --git a/queue-6.6/wifi-mt76-mt76u_vendor_request-do-not-print-error-me.patch b/queue-6.6/wifi-mt76-mt76u_vendor_request-do-not-print-error-me.patch new file mode 100644 index 0000000000..742542a3ab --- /dev/null +++ b/queue-6.6/wifi-mt76-mt76u_vendor_request-do-not-print-error-me.patch @@ -0,0 +1,72 @@ +From 21a0f9b670448a5b06940e762a6b496d82df1bb4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 13 Jan 2025 15:02:41 +0800 +Subject: wifi: mt76: mt76u_vendor_request: Do not print error messages when + -EPROTO +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: WangYuli + +[ Upstream commit f1b1e133a770fcdbd89551651232b034d2f7a27a ] + +When initializing the network card, unplugging the device will +trigger an -EPROTO error, resulting in a flood of error messages +being printed frantically. + +The exception is printed as follows: + + mt76x2u 2-2.4:1.0: vendor request req:47 off:9018 failed:-71 + mt76x2u 2-2.4:1.0: vendor request req:47 off:9018 failed:-71 + ... + +It will continue to print more than 2000 times for about 5 minutes, +causing the usb device to be unable to be disconnected. During this +period, the usb port cannot recognize the new device because the old +device has not disconnected. + +There may be other operating methods that cause -EPROTO, but -EPROTO is +a low-level hardware error. It is unwise to repeat vendor requests +expecting to read correct data. It is a better choice to treat -EPROTO +and -ENODEV the same way. + +Similar to commit 9b0f100c1970 ("mt76: usb: process URBs with status +EPROTO properly") do no schedule rx_worker for urb marked with status +set -EPROTO. I also reproduced this situation when plugging and +unplugging the device, and this patch is effective. + +Just do not vendor request again for urb marked with status set -EPROTO. + +Link: https://lore.kernel.org/all/531681bd-30f5-4a70-a156-bf8754b8e072@intel.com/ +Link: https://lore.kernel.org/all/D4B9CC1FFC0CBAC3+20250105040607.154706-1-wangyuli@uniontech.com/ +Fixes: b40b15e1521f ("mt76: add usb support to mt76 layer") +Co-developed-by: Xu Rao +Signed-off-by: Xu Rao +Signed-off-by: WangYuli +Link: https://patch.msgid.link/9DD7DE7AAB497CB7+20250113070241.63590-1-wangyuli@uniontech.com +Signed-off-by: Felix Fietkau +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/mediatek/mt76/usb.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/usb.c b/drivers/net/wireless/mediatek/mt76/usb.c +index 1584665fe3cb6..a8f26583b51b2 100644 +--- a/drivers/net/wireless/mediatek/mt76/usb.c ++++ b/drivers/net/wireless/mediatek/mt76/usb.c +@@ -33,9 +33,9 @@ int __mt76u_vendor_request(struct mt76_dev *dev, u8 req, u8 req_type, + + ret = usb_control_msg(udev, pipe, req, req_type, val, + offset, buf, len, MT_VEND_REQ_TOUT_MS); +- if (ret == -ENODEV) ++ if (ret == -ENODEV || ret == -EPROTO) + set_bit(MT76_REMOVED, &dev->phy.state); +- if (ret >= 0 || ret == -ENODEV) ++ if (ret >= 0 || ret == -ENODEV || ret == -EPROTO) + return ret; + usleep_range(5000, 10000); + } +-- +2.39.5 + diff --git a/queue-6.6/wifi-mt76-mt7915-firmware-restart-on-devices-with-a-.patch b/queue-6.6/wifi-mt76-mt7915-firmware-restart-on-devices-with-a-.patch new file mode 100644 index 0000000000..ae80f80ff5 --- /dev/null +++ b/queue-6.6/wifi-mt76-mt7915-firmware-restart-on-devices-with-a-.patch @@ -0,0 +1,65 @@ +From d6bd981b573ee541c37b0a0fd6afea070e964aec Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Dec 2024 20:41:59 +0100 +Subject: wifi: mt76: mt7915: firmware restart on devices with a second pcie + link + +From: Felix Fietkau + +[ Upstream commit 9b60e2ae511c959024ecf6578b3fbe85cd06d7cc ] + +It seems that the firmware checks the register used for detecting matching +PCIe links in order to figure out if a secondary PCIe link is enabled. +Write the register again just before starting the firmware on hw reset, +in order to fix an issue that left the second band unusable after restart. + +Fixes: 9093cfff72e3 ("mt76: mt7915: add support for using a secondary PCIe link for gen1") +Link: https://patch.msgid.link/20241230194202.95065-11-nbd@nbd.name +Signed-off-by: Felix Fietkau +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 2 ++ + drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h | 1 + + drivers/net/wireless/mediatek/mt76/mt7915/pci.c | 1 + + 3 files changed, 4 insertions(+) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +index 38d27f8721733..675fbf40ecf75 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +@@ -1383,6 +1383,8 @@ mt7915_mac_restart(struct mt7915_dev *dev) + if (dev_is_pci(mdev->dev)) { + mt76_wr(dev, MT_PCIE_MAC_INT_ENABLE, 0xff); + if (dev->hif2) { ++ mt76_wr(dev, MT_PCIE_RECOG_ID, ++ dev->hif2->index | MT_PCIE_RECOG_ID_SEM); + if (is_mt7915(mdev)) + mt76_wr(dev, MT_PCIE1_MAC_INT_ENABLE, 0xff); + else +diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +index e192211d4b23e..14d4bbeae9d63 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h ++++ b/drivers/net/wireless/mediatek/mt76/mt7915/mt7915.h +@@ -191,6 +191,7 @@ struct mt7915_hif { + struct device *dev; + void __iomem *regs; + int irq; ++ u32 index; + }; + + struct mt7915_phy { +diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/pci.c b/drivers/net/wireless/mediatek/mt76/mt7915/pci.c +index 39132894e8ea2..07b0a5766eab7 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7915/pci.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7915/pci.c +@@ -42,6 +42,7 @@ static struct mt7915_hif *mt7915_pci_get_hif2(u32 idx) + continue; + + get_device(hif->dev); ++ hif->index = idx; + goto out; + } + hif = NULL; +-- +2.39.5 + diff --git a/queue-6.6/wifi-mt76-mt7915-fix-mesh-scan-on-mt7916-dbdc.patch b/queue-6.6/wifi-mt76-mt7915-fix-mesh-scan-on-mt7916-dbdc.patch new file mode 100644 index 0000000000..d58f1c10b9 --- /dev/null +++ b/queue-6.6/wifi-mt76-mt7915-fix-mesh-scan-on-mt7916-dbdc.patch @@ -0,0 +1,46 @@ +From 170d50528034ee3ec9baa349fe5931a746f887b7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 27 Sep 2024 10:53:17 +0200 +Subject: wifi: mt76: mt7915: Fix mesh scan on MT7916 DBDC + +From: Nicolas Cavallari + +[ Upstream commit f21b77cb556296116b1cce1d62295d13e35da574 ] + +commit c4f075582304 ("wifi: mt76: mt7915: fix command timeout in AP stop +period") changes the behavior of mt7915_bss_info_changed() in mesh mode +when enable_beacon becomes false: it calls mt7915_mcu_add_bss_info(..., +false) and mt7915_mcu_add_sta(..., false) while the previous code +didn't. These sends mcu commands that apparently confuse the firmware. + +This breaks scanning while in mesh mode on AsiaRF MT7916 DBDC-based cards: +scanning works but no mesh frames get sent afterwards and the firmware +seems to be hosed. It breaks on MT7916 DBDC but not on MT7915 DBDC. + +Fixes: c4f075582304 ("wifi: mt76: mt7915: fix command timeout in AP stop period") +Signed-off-by: Nicolas Cavallari +Link: https://patch.msgid.link/20240927085350.4594-1-nicolas.cavallari@green-communications.fr +Signed-off-by: Felix Fietkau +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/mediatek/mt76/mt7915/main.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c +index 4fd5fd555191a..d2429247c3b66 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c +@@ -614,8 +614,9 @@ static void mt7915_bss_info_changed(struct ieee80211_hw *hw, + if (changed & BSS_CHANGED_ASSOC) + set_bss_info = vif->cfg.assoc; + if (changed & BSS_CHANGED_BEACON_ENABLED && ++ info->enable_beacon && + vif->type != NL80211_IFTYPE_AP) +- set_bss_info = set_sta = info->enable_beacon; ++ set_bss_info = set_sta = 1; + + if (set_bss_info == 1) + mt7915_mcu_add_bss_info(phy, vif, true); +-- +2.39.5 + diff --git a/queue-6.6/wifi-mt76-mt7915-fix-omac-index-assignment-after-har.patch b/queue-6.6/wifi-mt76-mt7915-fix-omac-index-assignment-after-har.patch new file mode 100644 index 0000000000..8ab19ec651 --- /dev/null +++ b/queue-6.6/wifi-mt76-mt7915-fix-omac-index-assignment-after-har.patch @@ -0,0 +1,48 @@ +From 526f1a1132a3f68f03811a2c557e6f908e33eae1 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Dec 2024 20:42:00 +0100 +Subject: wifi: mt76: mt7915: fix omac index assignment after hardware reset + +From: Felix Fietkau + +[ Upstream commit cd043bbba6f9b71ebe0781d1bd2107565363c4b9 ] + +Reset per-phy mac address slot mask in order to avoid leaking entries. + +Fixes: 8a55712d124f ("wifi: mt76: mt7915: enable full system reset support") +Link: https://patch.msgid.link/20241230194202.95065-12-nbd@nbd.name +Signed-off-by: Felix Fietkau +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 5 +++++ + 1 file changed, 5 insertions(+) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +index 55c52c2d97b09..92d7dc8e3cc55 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +@@ -1439,9 +1439,11 @@ static void + mt7915_mac_full_reset(struct mt7915_dev *dev) + { + struct mt76_phy *ext_phy; ++ struct mt7915_phy *phy2; + int i; + + ext_phy = dev->mt76.phys[MT_BAND1]; ++ phy2 = ext_phy ? ext_phy->priv : NULL; + + dev->recovery.hw_full_reset = true; + +@@ -1470,6 +1472,9 @@ mt7915_mac_full_reset(struct mt7915_dev *dev) + + memset(dev->mt76.wcid_mask, 0, sizeof(dev->mt76.wcid_mask)); + dev->mt76.vif_mask = 0; ++ dev->phy.omac_mask = 0; ++ if (phy2) ++ phy2->omac_mask = 0; + + i = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA); + dev->mt76.global_wcid.idx = i; +-- +2.39.5 + diff --git a/queue-6.6/wifi-mt76-mt7915-fix-overflows-seen-when-writing-lim.patch b/queue-6.6/wifi-mt76-mt7915-fix-overflows-seen-when-writing-lim.patch new file mode 100644 index 0000000000..c47b7a9247 --- /dev/null +++ b/queue-6.6/wifi-mt76-mt7915-fix-overflows-seen-when-writing-lim.patch @@ -0,0 +1,39 @@ +From 44be600764c0d3885b8692db8e0e0e393bef943c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 2 Dec 2024 11:19:17 +0800 +Subject: wifi: mt76: mt7915: fix overflows seen when writing limit attributes + +From: xueqin Luo + +[ Upstream commit 64d571742b0ae44eee5efd51e2d4a09d7f6782fc ] + +DIV_ROUND_CLOSEST() after kstrtoul() results in an overflow if a large +number such as 18446744073709551615 is provided by the user. +Fix it by reordering clamp_val() and DIV_ROUND_CLOSEST() operations. +This commit was inspired by commit: 57ee12b6c514. + +Fixes: 02ee68b95d81 ("mt76: mt7915: add control knobs for thermal throttling") +Signed-off-by: xueqin Luo +Link: https://patch.msgid.link/20241202031917.23741-3-luoxueqin@kylinos.cn +Signed-off-by: Felix Fietkau +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/mediatek/mt76/mt7915/init.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net/wireless/mediatek/mt76/mt7915/init.c +index 5ff260319282c..28f84220d50f0 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c +@@ -82,7 +82,7 @@ static ssize_t mt7915_thermal_temp_store(struct device *dev, + return ret; + + mutex_lock(&phy->dev->mt76.mutex); +- val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), 60, 130); ++ val = DIV_ROUND_CLOSEST(clamp_val(val, 60 * 1000, 130 * 1000), 1000); + + if ((i - 1 == MT7915_CRIT_TEMP_IDX && + val > phy->throttle_temp[MT7915_MAX_TEMP_IDX]) || +-- +2.39.5 + diff --git a/queue-6.6/wifi-mt76-mt7915-fix-register-mapping.patch b/queue-6.6/wifi-mt76-mt7915-fix-register-mapping.patch new file mode 100644 index 0000000000..147f29a0bc --- /dev/null +++ b/queue-6.6/wifi-mt76-mt7915-fix-register-mapping.patch @@ -0,0 +1,39 @@ +From f7f0b7416b4fdf20607a1ef8b9bd263c6997aa77 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Jan 2025 19:04:35 +0800 +Subject: wifi: mt76: mt7915: fix register mapping + +From: Peter Chiu + +[ Upstream commit dd1649ef966bb87053c17385ea2cfd1758f5385b ] + +Bypass the entry when ofs is equal to dev->reg.map[i].size. +Without this patch, it would get incorrect register mapping when the CR +address is located at the boundary of an entry. + +Fixes: cd4c314a65d3 ("mt76: mt7915: refine register definition") +Signed-off-by: Peter Chiu +Signed-off-by: Shengyu Qu +Link: https://patch.msgid.link/OSZPR01MB843401EAA1DA6BD7AEF356F298132@OSZPR01MB8434.jpnprd01.prod.outlook.com +Signed-off-by: Felix Fietkau +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/mediatek/mt76/mt7915/mmio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c b/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c +index a306a42777d78..7db436d908a39 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7915/mmio.c +@@ -484,7 +484,7 @@ static u32 __mt7915_reg_addr(struct mt7915_dev *dev, u32 addr) + continue; + + ofs = addr - dev->reg.map[i].phys; +- if (ofs > dev->reg.map[i].size) ++ if (ofs >= dev->reg.map[i].size) + continue; + + return dev->reg.map[i].maps + ofs; +-- +2.39.5 + diff --git a/queue-6.6/wifi-mt76-mt7915-improve-hardware-restart-reliabilit.patch b/queue-6.6/wifi-mt76-mt7915-improve-hardware-restart-reliabilit.patch new file mode 100644 index 0000000000..a2b27d6188 --- /dev/null +++ b/queue-6.6/wifi-mt76-mt7915-improve-hardware-restart-reliabilit.patch @@ -0,0 +1,112 @@ +From bc4bbdf33d31950d3d808789ec8777237fa2ae83 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 27 Aug 2024 11:30:06 +0200 +Subject: wifi: mt76: mt7915: improve hardware restart reliability + +From: Felix Fietkau + +[ Upstream commit 328e35c7bfc673cde5a3a453318d044f8f83b505 ] + +- use reconfig_complete to restart mac_work / queues +- reset full wtbl after firmware init +- clear wcid and vif mask to avoid leak +- fix sta poll list corruption + +Link: https://patch.msgid.link/20240827093011.18621-19-nbd@nbd.name +Signed-off-by: Felix Fietkau +Stable-dep-of: cd043bbba6f9 ("wifi: mt76: mt7915: fix omac index assignment after hardware reset") +Signed-off-by: Sasha Levin +--- + .../net/wireless/mediatek/mt76/mt7915/mac.c | 25 ++++++++++--------- + .../net/wireless/mediatek/mt76/mt7915/main.c | 12 +++++++++ + .../net/wireless/mediatek/mt76/mt7915/mcu.c | 2 ++ + 3 files changed, 27 insertions(+), 12 deletions(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +index 675fbf40ecf75..55c52c2d97b09 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7915/mac.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7915/mac.c +@@ -1459,26 +1459,27 @@ mt7915_mac_full_reset(struct mt7915_dev *dev) + if (!mt7915_mac_restart(dev)) + break; + } +- mutex_unlock(&dev->mt76.mutex); + + if (i == 10) + dev_err(dev->mt76.dev, "chip full reset failed\n"); + +- ieee80211_restart_hw(mt76_hw(dev)); +- if (ext_phy) +- ieee80211_restart_hw(ext_phy->hw); ++ spin_lock_bh(&dev->mt76.sta_poll_lock); ++ while (!list_empty(&dev->mt76.sta_poll_list)) ++ list_del_init(dev->mt76.sta_poll_list.next); ++ spin_unlock_bh(&dev->mt76.sta_poll_lock); + +- ieee80211_wake_queues(mt76_hw(dev)); +- if (ext_phy) +- ieee80211_wake_queues(ext_phy->hw); ++ memset(dev->mt76.wcid_mask, 0, sizeof(dev->mt76.wcid_mask)); ++ dev->mt76.vif_mask = 0; + ++ i = mt76_wcid_alloc(dev->mt76.wcid_mask, MT7915_WTBL_STA); ++ dev->mt76.global_wcid.idx = i; + dev->recovery.hw_full_reset = false; +- ieee80211_queue_delayed_work(mt76_hw(dev), &dev->mphy.mac_work, +- MT7915_WATCHDOG_TIME); ++ ++ mutex_unlock(&dev->mt76.mutex); ++ ++ ieee80211_restart_hw(mt76_hw(dev)); + if (ext_phy) +- ieee80211_queue_delayed_work(ext_phy->hw, +- &ext_phy->mac_work, +- MT7915_WATCHDOG_TIME); ++ ieee80211_restart_hw(ext_phy->hw); + } + + /* system error recovery */ +diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/main.c b/drivers/net/wireless/mediatek/mt76/mt7915/main.c +index d2429247c3b66..c312a0fa199ae 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7915/main.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7915/main.c +@@ -1650,6 +1650,17 @@ mt7915_net_fill_forward_path(struct ieee80211_hw *hw, + } + #endif + ++static void ++mt7915_reconfig_complete(struct ieee80211_hw *hw, ++ enum ieee80211_reconfig_type reconfig_type) ++{ ++ struct mt7915_phy *phy = mt7915_hw_phy(hw); ++ ++ ieee80211_wake_queues(hw); ++ ieee80211_queue_delayed_work(hw, &phy->mt76->mac_work, ++ MT7915_WATCHDOG_TIME); ++} ++ + const struct ieee80211_ops mt7915_ops = { + .tx = mt7915_tx, + .start = mt7915_start, +@@ -1704,4 +1715,5 @@ const struct ieee80211_ops mt7915_ops = { + #ifdef CONFIG_NET_MEDIATEK_SOC_WED + .net_fill_forward_path = mt7915_net_fill_forward_path, + #endif ++ .reconfig_complete = mt7915_reconfig_complete, + }; +diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +index 5fba103bfd65d..f0226db2e57c7 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +@@ -2351,6 +2351,8 @@ int mt7915_mcu_init_firmware(struct mt7915_dev *dev) + if (ret) + return ret; + ++ mt76_connac_mcu_del_wtbl_all(&dev->mt76); ++ + if ((mtk_wed_device_active(&dev->mt76.mmio.wed) && + is_mt7915(&dev->mt76)) || + !mtk_wed_get_rx_capa(&dev->mt76.mmio.wed)) +-- +2.39.5 + diff --git a/queue-6.6/wifi-mt76-mt7921-fix-using-incorrect-group-cipher-af.patch b/queue-6.6/wifi-mt76-mt7921-fix-using-incorrect-group-cipher-af.patch new file mode 100644 index 0000000000..1d718acf99 --- /dev/null +++ b/queue-6.6/wifi-mt76-mt7921-fix-using-incorrect-group-cipher-af.patch @@ -0,0 +1,47 @@ +From 7b40feec63695b674c978c67a73ec5da454356c0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 1 Aug 2024 10:43:35 +0800 +Subject: wifi: mt76: mt7921: fix using incorrect group cipher after + disconnection. + +From: Michael Lo + +[ Upstream commit aa566ac6b7272e7ea5359cb682bdca36d2fc7e73 ] + +To avoid incorrect cipher after disconnection, we should +do the key deletion process in this case. + +Fixes: e6db67fa871d ("wifi: mt76: ignore key disable commands") +Signed-off-by: Michael Lo +Signed-off-by: Ming Yen Hsieh +Tested-by: David Ruth +Reviewed-by: David Ruth +Link: https://patch.msgid.link/20240801024335.12981-1-mingyen.hsieh@mediatek.com +Signed-off-by: Felix Fietkau +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/mediatek/mt76/mt7921/main.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/main.c b/drivers/net/wireless/mediatek/mt76/mt7921/main.c +index 6dec54431312a..31ef58e2a3d2a 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7921/main.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7921/main.c +@@ -519,7 +519,13 @@ static int mt7921_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, + } else { + if (idx == *wcid_keyidx) + *wcid_keyidx = -1; +- goto out; ++ ++ /* For security issue we don't trigger the key deletion when ++ * reassociating. But we should trigger the deletion process ++ * to avoid using incorrect cipher after disconnection, ++ */ ++ if (vif->type != NL80211_IFTYPE_STATION || vif->cfg.assoc) ++ goto out; + } + + mt76_wcid_key_setup(&dev->mt76, wcid, key); +-- +2.39.5 + diff --git a/queue-6.6/wifi-mt76-mt7996-add-max-mpdu-len-capability.patch b/queue-6.6/wifi-mt76-mt7996-add-max-mpdu-len-capability.patch new file mode 100644 index 0000000000..ba011888f2 --- /dev/null +++ b/queue-6.6/wifi-mt76-mt7996-add-max-mpdu-len-capability.patch @@ -0,0 +1,41 @@ +From 10553382255b034c48ffdec7e888182da00eb3fc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Jan 2025 18:10:18 +0800 +Subject: wifi: mt76: mt7996: add max mpdu len capability + +From: Peter Chiu + +[ Upstream commit 1816ad9381e0c150e4c44ce6dd6ee2c52008a052 ] + +Set max mpdu len to 11454 according to hardware capability. +Without this patch, the max ampdu length would be 3895 and count not get +expected performance. + +Fixes: 348533eb968d ("wifi: mt76: mt7996: add EHT capability init") +Signed-off-by: Peter Chiu +Signed-off-by: Shayne Chen +Link: https://patch.msgid.link/20250114101026.3587702-1-shayne.chen@mediatek.com +Signed-off-by: Felix Fietkau +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/mediatek/mt76/mt7996/init.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/init.c b/drivers/net/wireless/mediatek/mt76/mt7996/init.c +index aee531cab46f6..7931e43e8b6df 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7996/init.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7996/init.c +@@ -729,7 +729,9 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band, + + eht_cap_elem->mac_cap_info[0] = + IEEE80211_EHT_MAC_CAP0_EPCS_PRIO_ACCESS | +- IEEE80211_EHT_MAC_CAP0_OM_CONTROL; ++ IEEE80211_EHT_MAC_CAP0_OM_CONTROL | ++ u8_encode_bits(IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_11454, ++ IEEE80211_EHT_MAC_CAP0_MAX_MPDU_LEN_MASK); + + eht_cap_elem->phy_cap_info[0] = + IEEE80211_EHT_PHY_CAP0_NDP_4_EHT_LFT_32_GI | +-- +2.39.5 + diff --git a/queue-6.6/wifi-mt76-mt7996-fix-he-phy-capability.patch b/queue-6.6/wifi-mt76-mt7996-fix-he-phy-capability.patch new file mode 100644 index 0000000000..4d1c3976e4 --- /dev/null +++ b/queue-6.6/wifi-mt76-mt7996-fix-he-phy-capability.patch @@ -0,0 +1,49 @@ +From c746b1efce2288cf5cafba9c983ca5729aa1c2bc Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Jan 2025 18:10:20 +0800 +Subject: wifi: mt76: mt7996: fix HE Phy capability + +From: Howard Hsu + +[ Upstream commit 7e3aef59a403ade5dd4ea02edc2d7138a66d74b6 ] + +Set HE SU PPDU And HE MU PPDU With 4x HE-LTF And 0.8 us GI within HE PHY +Capabilities element as 1 since hardware can support. + +Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices") +Signed-off-by: Howard Hsu +Signed-off-by: Shayne Chen +Link: https://patch.msgid.link/20250114101026.3587702-3-shayne.chen@mediatek.com +Signed-off-by: Felix Fietkau +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/mediatek/mt76/mt7996/init.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/init.c b/drivers/net/wireless/mediatek/mt76/mt7996/init.c +index 855f2d35523d7..0a701dcb8a92c 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7996/init.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7996/init.c +@@ -619,6 +619,9 @@ mt7996_init_he_caps(struct mt7996_phy *phy, enum nl80211_band band, + he_cap_elem->phy_cap_info[2] = IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ | + IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ; + ++ he_cap_elem->phy_cap_info[7] = ++ IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI; ++ + switch (iftype) { + case NL80211_IFTYPE_AP: + he_cap_elem->mac_cap_info[0] |= IEEE80211_HE_MAC_CAP0_TWT_RES; +@@ -658,8 +661,7 @@ mt7996_init_he_caps(struct mt7996_phy *phy, enum nl80211_band band, + IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE | + IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT; + he_cap_elem->phy_cap_info[7] |= +- IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP | +- IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI; ++ IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP; + he_cap_elem->phy_cap_info[8] |= + IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G | + IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU | +-- +2.39.5 + diff --git a/queue-6.6/wifi-mt76-mt7996-fix-incorrect-indexing-of-mib-fw-ev.patch b/queue-6.6/wifi-mt76-mt7996-fix-incorrect-indexing-of-mib-fw-ev.patch new file mode 100644 index 0000000000..94c2a74e99 --- /dev/null +++ b/queue-6.6/wifi-mt76-mt7996-fix-incorrect-indexing-of-mib-fw-ev.patch @@ -0,0 +1,108 @@ +From a1ee11b989df6b34db066f0625d31537b0bd4ca3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Jan 2025 18:10:21 +0800 +Subject: wifi: mt76: mt7996: fix incorrect indexing of MIB FW event + +From: Benjamin Lin + +[ Upstream commit 5c2a25a1ab76a2976dddc5ffd58498866f3ef7c2 ] + +Fix wrong calculation of the channel times due to incorrect +interpretation from the FW event. + +Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices") +Signed-off-by: Benjamin Lin +Signed-off-by: Shayne Chen +Link: https://patch.msgid.link/20250114101026.3587702-4-shayne.chen@mediatek.com +Signed-off-by: Felix Fietkau +Signed-off-by: Sasha Levin +--- + .../net/wireless/mediatek/mt76/mt7996/mcu.c | 45 ++++++++++++------- + 1 file changed, 29 insertions(+), 16 deletions(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +index 302171e103597..19afe89fce785 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +@@ -3189,6 +3189,13 @@ int mt7996_mcu_get_chip_config(struct mt7996_dev *dev, u32 *cap) + + int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch) + { ++ enum { ++ IDX_TX_TIME, ++ IDX_RX_TIME, ++ IDX_OBSS_AIRTIME, ++ IDX_NON_WIFI_TIME, ++ IDX_NUM ++ }; + struct { + struct { + u8 band; +@@ -3198,16 +3205,15 @@ int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch) + __le16 tag; + __le16 len; + __le32 offs; +- } data[4]; ++ } data[IDX_NUM]; + } __packed req = { + .hdr.band = phy->mt76->band_idx, + }; +- /* strict order */ + static const u32 offs[] = { +- UNI_MIB_TX_TIME, +- UNI_MIB_RX_TIME, +- UNI_MIB_OBSS_AIRTIME, +- UNI_MIB_NON_WIFI_TIME, ++ [IDX_TX_TIME] = UNI_MIB_TX_TIME, ++ [IDX_RX_TIME] = UNI_MIB_RX_TIME, ++ [IDX_OBSS_AIRTIME] = UNI_MIB_OBSS_AIRTIME, ++ [IDX_NON_WIFI_TIME] = UNI_MIB_NON_WIFI_TIME, + }; + struct mt76_channel_state *state = phy->mt76->chan_state; + struct mt76_channel_state *state_ts = &phy->state_ts; +@@ -3216,7 +3222,7 @@ int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch) + struct sk_buff *skb; + int i, ret; + +- for (i = 0; i < 4; i++) { ++ for (i = 0; i < IDX_NUM; i++) { + req.data[i].tag = cpu_to_le16(UNI_CMD_MIB_DATA); + req.data[i].len = cpu_to_le16(sizeof(req.data[i])); + req.data[i].offs = cpu_to_le32(offs[i]); +@@ -3235,17 +3241,24 @@ int mt7996_mcu_get_chan_mib_info(struct mt7996_phy *phy, bool chan_switch) + goto out; + + #define __res_u64(s) le64_to_cpu(res[s].data) +- state->cc_tx += __res_u64(1) - state_ts->cc_tx; +- state->cc_bss_rx += __res_u64(2) - state_ts->cc_bss_rx; +- state->cc_rx += __res_u64(2) + __res_u64(3) - state_ts->cc_rx; +- state->cc_busy += __res_u64(0) + __res_u64(1) + __res_u64(2) + __res_u64(3) - ++ state->cc_tx += __res_u64(IDX_TX_TIME) - state_ts->cc_tx; ++ state->cc_bss_rx += __res_u64(IDX_RX_TIME) - state_ts->cc_bss_rx; ++ state->cc_rx += __res_u64(IDX_RX_TIME) + ++ __res_u64(IDX_OBSS_AIRTIME) - ++ state_ts->cc_rx; ++ state->cc_busy += __res_u64(IDX_TX_TIME) + ++ __res_u64(IDX_RX_TIME) + ++ __res_u64(IDX_OBSS_AIRTIME) + ++ __res_u64(IDX_NON_WIFI_TIME) - + state_ts->cc_busy; +- + out: +- state_ts->cc_tx = __res_u64(1); +- state_ts->cc_bss_rx = __res_u64(2); +- state_ts->cc_rx = __res_u64(2) + __res_u64(3); +- state_ts->cc_busy = __res_u64(0) + __res_u64(1) + __res_u64(2) + __res_u64(3); ++ state_ts->cc_tx = __res_u64(IDX_TX_TIME); ++ state_ts->cc_bss_rx = __res_u64(IDX_RX_TIME); ++ state_ts->cc_rx = __res_u64(IDX_RX_TIME) + __res_u64(IDX_OBSS_AIRTIME); ++ state_ts->cc_busy = __res_u64(IDX_TX_TIME) + ++ __res_u64(IDX_RX_TIME) + ++ __res_u64(IDX_OBSS_AIRTIME) + ++ __res_u64(IDX_NON_WIFI_TIME); + #undef __res_u64 + + dev_kfree_skb(skb); +-- +2.39.5 + diff --git a/queue-6.6/wifi-mt76-mt7996-fix-ldpc-setting.patch b/queue-6.6/wifi-mt76-mt7996-fix-ldpc-setting.patch new file mode 100644 index 0000000000..9818ceefe7 --- /dev/null +++ b/queue-6.6/wifi-mt76-mt7996-fix-ldpc-setting.patch @@ -0,0 +1,41 @@ +From 297458c8c56ec50b78459dbcee8fa04ac209ab31 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Jan 2025 18:10:24 +0800 +Subject: wifi: mt76: mt7996: fix ldpc setting + +From: Peter Chiu + +[ Upstream commit da8352da1e4f476fdbf549a4efce4f3c618fde3b ] + +The non-AP interfaces would not use conf->vht_ldpc so they never set +STA_CAP_VHT_LDPC even if peer-station support LDPC. +Check conf->vht_ldpc only for AP interface. + +Without this patch, station only uses BCC to transmit packet in VHT mode. + +Fixes: dda423dd65c3 ("wifi: mt76: mt7996: remove mt7996_mcu_beacon_check_caps()") +Signed-off-by: Peter Chiu +Signed-off-by: Shayne Chen +Link: https://patch.msgid.link/20250114101026.3587702-7-shayne.chen@mediatek.com +Signed-off-by: Felix Fietkau +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +index 19afe89fce785..65a5f24e53136 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +@@ -1723,7 +1723,7 @@ mt7996_mcu_sta_rate_ctrl_tlv(struct sk_buff *skb, struct mt7996_dev *dev, + cap |= STA_CAP_VHT_TX_STBC; + if (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXSTBC_1) + cap |= STA_CAP_VHT_RX_STBC; +- if (vif->bss_conf.vht_ldpc && ++ if ((vif->type != NL80211_IFTYPE_AP || vif->bss_conf.vht_ldpc) && + (sta->deflink.vht_cap.cap & IEEE80211_VHT_CAP_RXLDPC)) + cap |= STA_CAP_VHT_LDPC; + +-- +2.39.5 + diff --git a/queue-6.6/wifi-mt76-mt7996-fix-register-mapping.patch b/queue-6.6/wifi-mt76-mt7996-fix-register-mapping.patch new file mode 100644 index 0000000000..fc9e6c1319 --- /dev/null +++ b/queue-6.6/wifi-mt76-mt7996-fix-register-mapping.patch @@ -0,0 +1,39 @@ +From 1b0d83607a9dd4a7347514aa460d766f881d1868 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 9 Jan 2025 19:04:36 +0800 +Subject: wifi: mt76: mt7996: fix register mapping + +From: Peter Chiu + +[ Upstream commit d07ecb4f7070e84de49e8fa4e5a83dd52716d805 ] + +Bypass the entry when ofs is equal to dev->reg.map[i].size. +Without this patch, it would get incorrect register mapping when the CR +address is located at the boundary of an entry. + +Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices") +Signed-off-by: Peter Chiu +Signed-off-by: Shengyu Qu +Link: https://patch.msgid.link/OSZPR01MB84344FEFF53004B5CF40BCC198132@OSZPR01MB8434.jpnprd01.prod.outlook.com +Signed-off-by: Felix Fietkau +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/mediatek/mt76/mt7996/mmio.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c b/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c +index e75becadc2e54..f0fa0f513be90 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7996/mmio.c +@@ -119,7 +119,7 @@ static u32 __mt7996_reg_addr(struct mt7996_dev *dev, u32 addr) + continue; + + ofs = addr - dev->reg.map[i].phys; +- if (ofs > dev->reg.map[i].size) ++ if (ofs >= dev->reg.map[i].size) + continue; + + return dev->reg.map[i].mapped + ofs; +-- +2.39.5 + diff --git a/queue-6.6/wifi-mt76-mt7996-fix-rx-filter-setting-for-bfee-func.patch b/queue-6.6/wifi-mt76-mt7996-fix-rx-filter-setting-for-bfee-func.patch new file mode 100644 index 0000000000..54947836f3 --- /dev/null +++ b/queue-6.6/wifi-mt76-mt7996-fix-rx-filter-setting-for-bfee-func.patch @@ -0,0 +1,37 @@ +From d56fc446bf0dd6710becf6fe67b28e94b7dfb8e6 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 30 Dec 2024 20:41:53 +0100 +Subject: wifi: mt76: mt7996: fix rx filter setting for bfee functionality + +From: Felix Fietkau + +[ Upstream commit 858fd2a53877b2e8b1d991a5a861ac34a0f55ef8 ] + +Fix rx filter setting to prevent dropping NDPA frames. Without this +change, bfee functionality may behave abnormally. + +Fixes: 98686cd21624 ("wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices") +Link: https://patch.msgid.link/20241230194202.95065-5-nbd@nbd.name +Signed-off-by: Felix Fietkau +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/mediatek/mt76/mt7996/main.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/main.c b/drivers/net/wireless/mediatek/mt76/mt7996/main.c +index 0e69f0a508616..c559212ea86a7 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7996/main.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7996/main.c +@@ -474,8 +474,7 @@ static void mt7996_configure_filter(struct ieee80211_hw *hw, + + MT76_FILTER(CONTROL, MT_WF_RFCR_DROP_CTS | + MT_WF_RFCR_DROP_RTS | +- MT_WF_RFCR_DROP_CTL_RSV | +- MT_WF_RFCR_DROP_NDPA); ++ MT_WF_RFCR_DROP_CTL_RSV); + + *total_flags = flags; + mt76_wr(dev, MT_WF_RFCR(phy->mt76->band_idx), phy->rxfilter); +-- +2.39.5 + diff --git a/queue-6.6/wifi-mt76-mt7996-fix-the-capability-of-reception-of-.patch b/queue-6.6/wifi-mt76-mt7996-fix-the-capability-of-reception-of-.patch new file mode 100644 index 0000000000..c954d0ba38 --- /dev/null +++ b/queue-6.6/wifi-mt76-mt7996-fix-the-capability-of-reception-of-.patch @@ -0,0 +1,56 @@ +From 3735d7e9215ac309cfc65b1136455b948c6ee025 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 14 Jan 2025 18:10:19 +0800 +Subject: wifi: mt76: mt7996: fix the capability of reception of EHT MU PPDU + +From: Howard Hsu + +[ Upstream commit 2ffbdfc1bd78ba944c5754791c84f32232b513c6 ] + +This commit includes two changes. First, enable "EHT MU PPDU With 4x +EHT-LTF And 0.8us GI" in EHT Phy capabilities element since hardware +can support. Second, fix the value of "Maximum number of supported +EHT LTFs" in the same element, where the previous setting of 3 in +Bit 3-4 was incorrect. + +Fixes: 348533eb968d ("wifi: mt76: mt7996: add EHT capability init") +Signed-off-by: Howard Hsu +Signed-off-by: Shayne Chen +Link: https://patch.msgid.link/20250114101026.3587702-2-shayne.chen@mediatek.com +Signed-off-by: Felix Fietkau +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/mediatek/mt76/mt7996/init.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/wireless/mediatek/mt76/mt7996/init.c b/drivers/net/wireless/mediatek/mt76/mt7996/init.c +index 7931e43e8b6df..855f2d35523d7 100644 +--- a/drivers/net/wireless/mediatek/mt76/mt7996/init.c ++++ b/drivers/net/wireless/mediatek/mt76/mt7996/init.c +@@ -773,21 +773,20 @@ mt7996_init_eht_caps(struct mt7996_phy *phy, enum nl80211_band band, + IEEE80211_EHT_PHY_CAP3_CODEBOOK_7_5_MU_FDBK; + + eht_cap_elem->phy_cap_info[4] = ++ IEEE80211_EHT_PHY_CAP4_EHT_MU_PPDU_4_EHT_LTF_08_GI | + u8_encode_bits(min_t(int, sts - 1, 2), + IEEE80211_EHT_PHY_CAP4_MAX_NC_MASK); + + eht_cap_elem->phy_cap_info[5] = + u8_encode_bits(IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_16US, + IEEE80211_EHT_PHY_CAP5_COMMON_NOMINAL_PKT_PAD_MASK) | +- u8_encode_bits(u8_get_bits(0x11, GENMASK(1, 0)), ++ u8_encode_bits(u8_get_bits(1, GENMASK(1, 0)), + IEEE80211_EHT_PHY_CAP5_MAX_NUM_SUPP_EHT_LTF_MASK); + + val = width == NL80211_CHAN_WIDTH_320 ? 0xf : + width == NL80211_CHAN_WIDTH_160 ? 0x7 : + width == NL80211_CHAN_WIDTH_80 ? 0x3 : 0x1; + eht_cap_elem->phy_cap_info[6] = +- u8_encode_bits(u8_get_bits(0x11, GENMASK(4, 2)), +- IEEE80211_EHT_PHY_CAP6_MAX_NUM_SUPP_EHT_LTF_MASK) | + u8_encode_bits(val, IEEE80211_EHT_PHY_CAP6_MCS15_SUPP_MASK); + + val = u8_encode_bits(nss, IEEE80211_EHT_MCS_NSS_RX) | +-- +2.39.5 + diff --git a/queue-6.6/wifi-rtlwifi-destroy-workqueue-at-rtl_deinit_core.patch b/queue-6.6/wifi-rtlwifi-destroy-workqueue-at-rtl_deinit_core.patch new file mode 100644 index 0000000000..a2808e02f8 --- /dev/null +++ b/queue-6.6/wifi-rtlwifi-destroy-workqueue-at-rtl_deinit_core.patch @@ -0,0 +1,88 @@ +From 4b067532a58019430cc744e4ba9cb7bdf453759f Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Dec 2024 14:37:11 -0300 +Subject: wifi: rtlwifi: destroy workqueue at rtl_deinit_core + +From: Thadeu Lima de Souza Cascardo + +[ Upstream commit d8ece6fc3694657e4886191b32ca1690af11adda ] + +rtl_wq is allocated at rtl_init_core, so it makes more sense to destroy it +at rtl_deinit_core. In the case of USB, where _rtl_usb_init does not +require anything to be undone, that is fine. But for PCI, rtl_pci_init, +which is called after rtl_init_core, needs to deallocate data, but only if +it has been called. + +That means that destroying the workqueue needs to be done whether +rtl_pci_init has been called or not. And since rtl_pci_deinit was doing it, +it has to be moved out of there. + +It makes more sense to move it to rtl_deinit_core and have it done in both +cases, USB and PCI. + +Since this is a requirement for a followup memory leak fix, mark this as +fixing such memory leak. + +Fixes: 0c8173385e54 ("rtl8192ce: Add new driver") +Signed-off-by: Thadeu Lima de Souza Cascardo +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/20241206173713.3222187-3-cascardo@igalia.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/realtek/rtlwifi/base.c | 6 ++++++ + drivers/net/wireless/realtek/rtlwifi/pci.c | 2 -- + drivers/net/wireless/realtek/rtlwifi/usb.c | 5 ----- + 3 files changed, 6 insertions(+), 7 deletions(-) + +diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c +index c7d5b20039ca0..c981739f70773 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/base.c ++++ b/drivers/net/wireless/realtek/rtlwifi/base.c +@@ -575,9 +575,15 @@ static void rtl_free_entries_from_ack_queue(struct ieee80211_hw *hw, + + void rtl_deinit_core(struct ieee80211_hw *hw) + { ++ struct rtl_priv *rtlpriv = rtl_priv(hw); ++ + rtl_c2hcmd_launcher(hw, 0); + rtl_free_entries_from_scan_list(hw); + rtl_free_entries_from_ack_queue(hw, false); ++ if (rtlpriv->works.rtl_wq) { ++ destroy_workqueue(rtlpriv->works.rtl_wq); ++ rtlpriv->works.rtl_wq = NULL; ++ } + } + EXPORT_SYMBOL_GPL(rtl_deinit_core); + +diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c +index 8ee3a11e8dc73..67004ce2f6d9c 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/pci.c ++++ b/drivers/net/wireless/realtek/rtlwifi/pci.c +@@ -1657,8 +1657,6 @@ static void rtl_pci_deinit(struct ieee80211_hw *hw) + synchronize_irq(rtlpci->pdev->irq); + tasklet_kill(&rtlpriv->works.irq_tasklet); + cancel_work_sync(&rtlpriv->works.lps_change_work); +- +- destroy_workqueue(rtlpriv->works.rtl_wq); + } + + static int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev) +diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c +index cf70793b1e905..e2e1e568bdb36 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/usb.c ++++ b/drivers/net/wireless/realtek/rtlwifi/usb.c +@@ -660,11 +660,6 @@ static void _rtl_usb_cleanup_rx(struct ieee80211_hw *hw) + tasklet_kill(&rtlusb->rx_work_tasklet); + cancel_work_sync(&rtlpriv->works.lps_change_work); + +- if (rtlpriv->works.rtl_wq) { +- destroy_workqueue(rtlpriv->works.rtl_wq); +- rtlpriv->works.rtl_wq = NULL; +- } +- + skb_queue_purge(&rtlusb->rx_queue); + + while ((urb = usb_get_from_anchor(&rtlusb->rx_cleanup_urbs))) { +-- +2.39.5 + diff --git a/queue-6.6/wifi-rtlwifi-do-not-complete-firmware-loading-needle.patch b/queue-6.6/wifi-rtlwifi-do-not-complete-firmware-loading-needle.patch new file mode 100644 index 0000000000..8ae0e83caf --- /dev/null +++ b/queue-6.6/wifi-rtlwifi-do-not-complete-firmware-loading-needle.patch @@ -0,0 +1,50 @@ +From 2e9d6fc40bd7e19fd4b8179219ed7134e36598d5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Nov 2024 10:33:18 -0300 +Subject: wifi: rtlwifi: do not complete firmware loading needlessly + +From: Thadeu Lima de Souza Cascardo + +[ Upstream commit e73e11d303940119e41850a0452a0deda2cc4eb5 ] + +The only code waiting for completion is driver removal, which will not be +called when probe returns a failure. So this completion is unnecessary. + +Fixes: b0302aba812b ("rtlwifi: Convert to asynchronous firmware load") +Signed-off-by: Thadeu Lima de Souza Cascardo +Acked-by: Ping-Ke Shih +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/20241107133322.855112-2-cascardo@igalia.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/realtek/rtlwifi/pci.c | 1 - + drivers/net/wireless/realtek/rtlwifi/usb.c | 1 - + 2 files changed, 2 deletions(-) + +diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c +index b118df035243c..766e43f13d3f5 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/pci.c ++++ b/drivers/net/wireless/realtek/rtlwifi/pci.c +@@ -2268,7 +2268,6 @@ int rtl_pci_probe(struct pci_dev *pdev, + pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start); + + pci_release_regions(pdev); +- complete(&rtlpriv->firmware_loading_complete); + + fail1: + if (hw) +diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c +index 30bf2775a335b..427547de61678 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/usb.c ++++ b/drivers/net/wireless/realtek/rtlwifi/usb.c +@@ -1066,7 +1066,6 @@ int rtl_usb_probe(struct usb_interface *intf, + error_out2: + _rtl_usb_io_handler_release(hw); + usb_put_dev(udev); +- complete(&rtlpriv->firmware_loading_complete); + kfree(rtlpriv->usb_data); + ieee80211_free_hw(hw); + return -ENODEV; +-- +2.39.5 + diff --git a/queue-6.6/wifi-rtlwifi-fix-init_sw_vars-leak-when-probe-fails.patch b/queue-6.6/wifi-rtlwifi-fix-init_sw_vars-leak-when-probe-fails.patch new file mode 100644 index 0000000000..723ba09707 --- /dev/null +++ b/queue-6.6/wifi-rtlwifi-fix-init_sw_vars-leak-when-probe-fails.patch @@ -0,0 +1,37 @@ +From 807394c95702f148b56125d6376bcaa2c6d8bfda Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Nov 2024 10:33:21 -0300 +Subject: wifi: rtlwifi: fix init_sw_vars leak when probe fails + +From: Thadeu Lima de Souza Cascardo + +[ Upstream commit 00260350aed80c002df270c805ca443ec9a719a6 ] + +If ieee80211_register_hw fails, the memory allocated for the firmware will +not be released. Call deinit_sw_vars as the function that undoes the +allocationes done by init_sw_vars. + +Fixes: cefe3dfdb9f5 ("rtl8192cu: Call ieee80211_register_hw from rtl_usb_probe") +Signed-off-by: Thadeu Lima de Souza Cascardo +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/20241107133322.855112-5-cascardo@igalia.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/realtek/rtlwifi/usb.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c +index e2948732a16cb..0a934adcef012 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/usb.c ++++ b/drivers/net/wireless/realtek/rtlwifi/usb.c +@@ -1063,6 +1063,7 @@ int rtl_usb_probe(struct usb_interface *intf, + + error_init_vars: + wait_for_completion(&rtlpriv->firmware_loading_complete); ++ rtlpriv->cfg->ops->deinit_sw_vars(hw); + error_out: + rtl_deinit_core(hw); + error_out2: +-- +2.39.5 + diff --git a/queue-6.6/wifi-rtlwifi-fix-memory-leaks-and-invalid-access-at-.patch b/queue-6.6/wifi-rtlwifi-fix-memory-leaks-and-invalid-access-at-.patch new file mode 100644 index 0000000000..8edc5c4783 --- /dev/null +++ b/queue-6.6/wifi-rtlwifi-fix-memory-leaks-and-invalid-access-at-.patch @@ -0,0 +1,80 @@ +From c59527a99ed0dcccc2156c4c06203f660b5945c7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Dec 2024 14:37:12 -0300 +Subject: wifi: rtlwifi: fix memory leaks and invalid access at probe error + path + +From: Thadeu Lima de Souza Cascardo + +[ Upstream commit e7ceefbfd8d447abc8aca8ab993a942803522c06 ] + +Deinitialize at reverse order when probe fails. + +When init_sw_vars fails, rtl_deinit_core should not be called, specially +now that it destroys the rtl_wq workqueue. + +And call rtl_pci_deinit and deinit_sw_vars, otherwise, memory will be +leaked. + +Remove pci_set_drvdata call as it will already be cleaned up by the core +driver code and could lead to memory leaks too. cf. commit 8d450935ae7f +("wireless: rtlwifi: remove unnecessary pci_set_drvdata()") and +commit 3d86b93064c7 ("rtlwifi: Fix PCI probe error path orphaned memory"). + +Fixes: 0c8173385e54 ("rtl8192ce: Add new driver") +Signed-off-by: Thadeu Lima de Souza Cascardo +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/20241206173713.3222187-4-cascardo@igalia.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/realtek/rtlwifi/pci.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c +index 67004ce2f6d9c..711f75ce7690a 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/pci.c ++++ b/drivers/net/wireless/realtek/rtlwifi/pci.c +@@ -2167,7 +2167,7 @@ int rtl_pci_probe(struct pci_dev *pdev, + if (rtlpriv->cfg->ops->init_sw_vars(hw)) { + pr_err("Can't init_sw_vars\n"); + err = -ENODEV; +- goto fail3; ++ goto fail2; + } + rtl_init_sw_leds(hw); + +@@ -2185,14 +2185,14 @@ int rtl_pci_probe(struct pci_dev *pdev, + err = rtl_pci_init(hw, pdev); + if (err) { + pr_err("Failed to init PCI\n"); +- goto fail3; ++ goto fail4; + } + + err = ieee80211_register_hw(hw); + if (err) { + pr_err("Can't register mac80211 hw.\n"); + err = -ENODEV; +- goto fail3; ++ goto fail5; + } + rtlpriv->mac80211.mac80211_registered = 1; + +@@ -2215,9 +2215,12 @@ int rtl_pci_probe(struct pci_dev *pdev, + set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status); + return 0; + +-fail3: +- pci_set_drvdata(pdev, NULL); ++fail5: ++ rtl_pci_deinit(hw); ++fail4: + rtl_deinit_core(hw); ++fail3: ++ rtlpriv->cfg->ops->deinit_sw_vars(hw); + + fail2: + if (rtlpriv->io.pci_mem_start != 0) +-- +2.39.5 + diff --git a/queue-6.6/wifi-rtlwifi-pci-wait-for-firmware-loading-before-re.patch b/queue-6.6/wifi-rtlwifi-pci-wait-for-firmware-loading-before-re.patch new file mode 100644 index 0000000000..8fd880fd4d --- /dev/null +++ b/queue-6.6/wifi-rtlwifi-pci-wait-for-firmware-loading-before-re.patch @@ -0,0 +1,38 @@ +From 099678267439597d607776f5803d686e6d47f73a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Dec 2024 14:37:13 -0300 +Subject: wifi: rtlwifi: pci: wait for firmware loading before releasing memory + +From: Thadeu Lima de Souza Cascardo + +[ Upstream commit b59b86c5d08be7d761c04affcbcec8184738c200 ] + +At probe error path, the firmware loading work may have already been +queued. In such a case, it will try to access memory allocated by the probe +function, which is about to be released. In such paths, wait for the +firmware worker to finish before releasing memory. + +Fixes: 3d86b93064c7 ("rtlwifi: Fix PCI probe error path orphaned memory") +Signed-off-by: Thadeu Lima de Souza Cascardo +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/20241206173713.3222187-5-cascardo@igalia.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/realtek/rtlwifi/pci.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c +index 711f75ce7690a..3abd0c4c954bc 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/pci.c ++++ b/drivers/net/wireless/realtek/rtlwifi/pci.c +@@ -2220,6 +2220,7 @@ int rtl_pci_probe(struct pci_dev *pdev, + fail4: + rtl_deinit_core(hw); + fail3: ++ wait_for_completion(&rtlpriv->firmware_loading_complete); + rtlpriv->cfg->ops->deinit_sw_vars(hw); + + fail2: +-- +2.39.5 + diff --git a/queue-6.6/wifi-rtlwifi-remove-unused-check_buddy_priv.patch b/queue-6.6/wifi-rtlwifi-remove-unused-check_buddy_priv.patch new file mode 100644 index 0000000000..b9d94f7c09 --- /dev/null +++ b/queue-6.6/wifi-rtlwifi-remove-unused-check_buddy_priv.patch @@ -0,0 +1,200 @@ +From ddb5cbb6d0985cbe2cefd8243dc58c775f53805c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Dec 2024 14:37:10 -0300 +Subject: wifi: rtlwifi: remove unused check_buddy_priv + +From: Thadeu Lima de Souza Cascardo + +[ Upstream commit 2fdac64c3c35858aa8ac5caa70b232e03456e120 ] + +Commit 2461c7d60f9f ("rtlwifi: Update header file") introduced a global +list of private data structures. + +Later on, commit 26634c4b1868 ("rtlwifi Modify existing bits to match +vendor version 2013.02.07") started adding the private data to that list at +probe time and added a hook, check_buddy_priv to find the private data from +a similar device. + +However, that function was never used. + +Besides, though there is a lock for that list, it is never used. And when +the probe fails, the private data is never removed from the list. This +would cause a second probe to access freed memory. + +Remove the unused hook, structures and members, which will prevent the +potential race condition on the list and its corruption during a second +probe when probe fails. + +Fixes: 26634c4b1868 ("rtlwifi Modify existing bits to match vendor version 2013.02.07") +Signed-off-by: Thadeu Lima de Souza Cascardo +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/20241206173713.3222187-2-cascardo@igalia.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/realtek/rtlwifi/base.c | 7 ---- + drivers/net/wireless/realtek/rtlwifi/base.h | 1 - + drivers/net/wireless/realtek/rtlwifi/pci.c | 44 --------------------- + drivers/net/wireless/realtek/rtlwifi/wifi.h | 12 ------ + 4 files changed, 64 deletions(-) + +diff --git a/drivers/net/wireless/realtek/rtlwifi/base.c b/drivers/net/wireless/realtek/rtlwifi/base.c +index 807a53a97325b..c7d5b20039ca0 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/base.c ++++ b/drivers/net/wireless/realtek/rtlwifi/base.c +@@ -2710,9 +2710,6 @@ MODULE_AUTHOR("Larry Finger "); + MODULE_LICENSE("GPL"); + MODULE_DESCRIPTION("Realtek 802.11n PCI wireless core"); + +-struct rtl_global_var rtl_global_var = {}; +-EXPORT_SYMBOL_GPL(rtl_global_var); +- + static int __init rtl_core_module_init(void) + { + BUILD_BUG_ON(TX_PWR_BY_RATE_NUM_RATE < TX_PWR_BY_RATE_NUM_SECTION); +@@ -2726,10 +2723,6 @@ static int __init rtl_core_module_init(void) + /* add debugfs */ + rtl_debugfs_add_topdir(); + +- /* init some global vars */ +- INIT_LIST_HEAD(&rtl_global_var.glb_priv_list); +- spin_lock_init(&rtl_global_var.glb_list_lock); +- + return 0; + } + +diff --git a/drivers/net/wireless/realtek/rtlwifi/base.h b/drivers/net/wireless/realtek/rtlwifi/base.h +index f081a9a90563f..f3a6a43a42eca 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/base.h ++++ b/drivers/net/wireless/realtek/rtlwifi/base.h +@@ -124,7 +124,6 @@ int rtl_send_smps_action(struct ieee80211_hw *hw, + u8 *rtl_find_ie(u8 *data, unsigned int len, u8 ie); + void rtl_recognize_peer(struct ieee80211_hw *hw, u8 *data, unsigned int len); + u8 rtl_tid_to_ac(u8 tid); +-extern struct rtl_global_var rtl_global_var; + void rtl_phy_scan_operation_backup(struct ieee80211_hw *hw, u8 operation); + + #endif +diff --git a/drivers/net/wireless/realtek/rtlwifi/pci.c b/drivers/net/wireless/realtek/rtlwifi/pci.c +index 766e43f13d3f5..8ee3a11e8dc73 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/pci.c ++++ b/drivers/net/wireless/realtek/rtlwifi/pci.c +@@ -295,46 +295,6 @@ static bool rtl_pci_get_amd_l1_patch(struct ieee80211_hw *hw) + return status; + } + +-static bool rtl_pci_check_buddy_priv(struct ieee80211_hw *hw, +- struct rtl_priv **buddy_priv) +-{ +- struct rtl_priv *rtlpriv = rtl_priv(hw); +- struct rtl_pci_priv *pcipriv = rtl_pcipriv(hw); +- struct rtl_priv *tpriv = NULL, *iter; +- struct rtl_pci_priv *tpcipriv = NULL; +- +- if (!list_empty(&rtlpriv->glb_var->glb_priv_list)) { +- list_for_each_entry(iter, &rtlpriv->glb_var->glb_priv_list, +- list) { +- tpcipriv = (struct rtl_pci_priv *)iter->priv; +- rtl_dbg(rtlpriv, COMP_INIT, DBG_LOUD, +- "pcipriv->ndis_adapter.funcnumber %x\n", +- pcipriv->ndis_adapter.funcnumber); +- rtl_dbg(rtlpriv, COMP_INIT, DBG_LOUD, +- "tpcipriv->ndis_adapter.funcnumber %x\n", +- tpcipriv->ndis_adapter.funcnumber); +- +- if (pcipriv->ndis_adapter.busnumber == +- tpcipriv->ndis_adapter.busnumber && +- pcipriv->ndis_adapter.devnumber == +- tpcipriv->ndis_adapter.devnumber && +- pcipriv->ndis_adapter.funcnumber != +- tpcipriv->ndis_adapter.funcnumber) { +- tpriv = iter; +- break; +- } +- } +- } +- +- rtl_dbg(rtlpriv, COMP_INIT, DBG_LOUD, +- "find_buddy_priv %d\n", tpriv != NULL); +- +- if (tpriv) +- *buddy_priv = tpriv; +- +- return tpriv != NULL; +-} +- + static void rtl_pci_parse_configuration(struct pci_dev *pdev, + struct ieee80211_hw *hw) + { +@@ -2013,7 +1973,6 @@ static bool _rtl_pci_find_adapter(struct pci_dev *pdev, + pcipriv->ndis_adapter.amd_l1_patch); + + rtl_pci_parse_configuration(pdev, hw); +- list_add_tail(&rtlpriv->list, &rtlpriv->glb_var->glb_priv_list); + + return true; + } +@@ -2160,7 +2119,6 @@ int rtl_pci_probe(struct pci_dev *pdev, + rtlpriv->rtlhal.interface = INTF_PCI; + rtlpriv->cfg = (struct rtl_hal_cfg *)(id->driver_data); + rtlpriv->intf_ops = &rtl_pci_ops; +- rtlpriv->glb_var = &rtl_global_var; + rtl_efuse_ops_init(hw); + + /* MEM map */ +@@ -2318,7 +2276,6 @@ void rtl_pci_disconnect(struct pci_dev *pdev) + if (rtlpci->using_msi) + pci_disable_msi(rtlpci->pdev); + +- list_del(&rtlpriv->list); + if (rtlpriv->io.pci_mem_start != 0) { + pci_iounmap(pdev, (void __iomem *)rtlpriv->io.pci_mem_start); + pci_release_regions(pdev); +@@ -2378,7 +2335,6 @@ const struct rtl_intf_ops rtl_pci_ops = { + .read_efuse_byte = read_efuse_byte, + .adapter_start = rtl_pci_start, + .adapter_stop = rtl_pci_stop, +- .check_buddy_priv = rtl_pci_check_buddy_priv, + .adapter_tx = rtl_pci_tx, + .flush = rtl_pci_flush, + .reset_trx_ring = rtl_pci_reset_trx_ring, +diff --git a/drivers/net/wireless/realtek/rtlwifi/wifi.h b/drivers/net/wireless/realtek/rtlwifi/wifi.h +index 8cbf3fb388539..2106d7763bada 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/wifi.h ++++ b/drivers/net/wireless/realtek/rtlwifi/wifi.h +@@ -2321,8 +2321,6 @@ struct rtl_intf_ops { + void (*read_efuse_byte)(struct ieee80211_hw *hw, u16 _offset, u8 *pbuf); + int (*adapter_start)(struct ieee80211_hw *hw); + void (*adapter_stop)(struct ieee80211_hw *hw); +- bool (*check_buddy_priv)(struct ieee80211_hw *hw, +- struct rtl_priv **buddy_priv); + + int (*adapter_tx)(struct ieee80211_hw *hw, + struct ieee80211_sta *sta, +@@ -2566,14 +2564,6 @@ struct dig_t { + u32 rssi_max; + }; + +-struct rtl_global_var { +- /* from this list we can get +- * other adapter's rtl_priv +- */ +- struct list_head glb_priv_list; +- spinlock_t glb_list_lock; +-}; +- + #define IN_4WAY_TIMEOUT_TIME (30 * MSEC_PER_SEC) /* 30 seconds */ + + struct rtl_btc_info { +@@ -2719,9 +2709,7 @@ struct rtl_scan_list { + struct rtl_priv { + struct ieee80211_hw *hw; + struct completion firmware_loading_complete; +- struct list_head list; + struct rtl_priv *buddy_priv; +- struct rtl_global_var *glb_var; + struct rtl_dmsp_ctl dmsp_ctl; + struct rtl_locks locks; + struct rtl_works works; +-- +2.39.5 + diff --git a/queue-6.6/wifi-rtlwifi-rtl8192se-rise-completion-of-firmware-l.patch b/queue-6.6/wifi-rtlwifi-rtl8192se-rise-completion-of-firmware-l.patch new file mode 100644 index 0000000000..bb4f482713 --- /dev/null +++ b/queue-6.6/wifi-rtlwifi-rtl8192se-rise-completion-of-firmware-l.patch @@ -0,0 +1,59 @@ +From 184cc7b77be683ae4430035f3cac70afdfea47c5 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Nov 2024 10:33:19 -0300 +Subject: wifi: rtlwifi: rtl8192se: rise completion of firmware loading as last + step + +From: Thadeu Lima de Souza Cascardo + +[ Upstream commit 8559a9e0c457729fe3edb3176bbf7c7874f482b0 ] + +Just like in commit 4dfde294b979 ("rtlwifi: rise completion at the last +step of firmware callback"), only signal completion once the function is +finished. Otherwise, the module removal waiting for the completion could +free the memory that the callback will still use before returning. + +Fixes: b0302aba812b ("rtlwifi: Convert to asynchronous firmware load") +Signed-off-by: Thadeu Lima de Souza Cascardo +Acked-by: Ping-Ke Shih +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/20241107133322.855112-3-cascardo@igalia.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c +index 30bce381c3bb7..d7dae4488f69b 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c ++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c +@@ -67,22 +67,23 @@ static void rtl92se_fw_cb(const struct firmware *firmware, void *context) + + rtl_dbg(rtlpriv, COMP_ERR, DBG_LOUD, + "Firmware callback routine entered!\n"); +- complete(&rtlpriv->firmware_loading_complete); + if (!firmware) { + pr_err("Firmware %s not available\n", fw_name); + rtlpriv->max_fw_size = 0; +- return; ++ goto exit; + } + if (firmware->size > rtlpriv->max_fw_size) { + pr_err("Firmware is too big!\n"); + rtlpriv->max_fw_size = 0; + release_firmware(firmware); +- return; ++ goto exit; + } + pfirmware = (struct rt_firmware *)rtlpriv->rtlhal.pfirmware; + memcpy(pfirmware->sz_fw_tmpbuffer, firmware->data, firmware->size); + pfirmware->sz_fw_tmpbufferlen = firmware->size; + release_firmware(firmware); ++exit: ++ complete(&rtlpriv->firmware_loading_complete); + } + + static int rtl92s_init_sw_vars(struct ieee80211_hw *hw) +-- +2.39.5 + diff --git a/queue-6.6/wifi-rtlwifi-usb-fix-workqueue-leak-when-probe-fails.patch b/queue-6.6/wifi-rtlwifi-usb-fix-workqueue-leak-when-probe-fails.patch new file mode 100644 index 0000000000..f405cd7e50 --- /dev/null +++ b/queue-6.6/wifi-rtlwifi-usb-fix-workqueue-leak-when-probe-fails.patch @@ -0,0 +1,38 @@ +From 3df9338864ae06ec1198422d3ffacef9a8890e16 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Nov 2024 10:33:22 -0300 +Subject: wifi: rtlwifi: usb: fix workqueue leak when probe fails + +From: Thadeu Lima de Souza Cascardo + +[ Upstream commit f79bc5c67867c19ce2762e7934c20dbb835ed82c ] + +rtl_init_core creates a workqueue that is then assigned to rtl_wq. +rtl_deinit_core does not destroy it. It is left to rtl_usb_deinit, which +must be called in the probe error path. + +Fixes: 2ca20f79e0d8 ("rtlwifi: Add usb driver") +Fixes: 851639fdaeac ("rtlwifi: Modify some USB de-initialize code.") +Signed-off-by: Thadeu Lima de Souza Cascardo +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/20241107133322.855112-6-cascardo@igalia.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/realtek/rtlwifi/usb.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c +index 0a934adcef012..cf70793b1e905 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/usb.c ++++ b/drivers/net/wireless/realtek/rtlwifi/usb.c +@@ -1065,6 +1065,7 @@ int rtl_usb_probe(struct usb_interface *intf, + wait_for_completion(&rtlpriv->firmware_loading_complete); + rtlpriv->cfg->ops->deinit_sw_vars(hw); + error_out: ++ rtl_usb_deinit(hw); + rtl_deinit_core(hw); + error_out2: + _rtl_usb_io_handler_release(hw); +-- +2.39.5 + diff --git a/queue-6.6/wifi-rtlwifi-wait-for-firmware-loading-before-releas.patch b/queue-6.6/wifi-rtlwifi-wait-for-firmware-loading-before-releas.patch new file mode 100644 index 0000000000..5c058640b3 --- /dev/null +++ b/queue-6.6/wifi-rtlwifi-wait-for-firmware-loading-before-releas.patch @@ -0,0 +1,47 @@ +From 5c9ec317738a4a237f0d53a1e47f6b7569f343b0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 7 Nov 2024 10:33:20 -0300 +Subject: wifi: rtlwifi: wait for firmware loading before releasing memory + +From: Thadeu Lima de Souza Cascardo + +[ Upstream commit b4b26642b31ef282df6ff7ea8531985edfdef12a ] + +At probe error path, the firmware loading work may have already been +queued. In such a case, it will try to access memory allocated by the probe +function, which is about to be released. In such paths, wait for the +firmware worker to finish before releasing memory. + +Fixes: a7f7c15e945a ("rtlwifi: rtl8192cu: Free ieee80211_hw if probing fails") +Signed-off-by: Thadeu Lima de Souza Cascardo +Signed-off-by: Ping-Ke Shih +Link: https://patch.msgid.link/20241107133322.855112-4-cascardo@igalia.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/realtek/rtlwifi/usb.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/realtek/rtlwifi/usb.c b/drivers/net/wireless/realtek/rtlwifi/usb.c +index 427547de61678..e2948732a16cb 100644 +--- a/drivers/net/wireless/realtek/rtlwifi/usb.c ++++ b/drivers/net/wireless/realtek/rtlwifi/usb.c +@@ -1054,13 +1054,15 @@ int rtl_usb_probe(struct usb_interface *intf, + err = ieee80211_register_hw(hw); + if (err) { + pr_err("Can't register mac80211 hw.\n"); +- goto error_out; ++ goto error_init_vars; + } + rtlpriv->mac80211.mac80211_registered = 1; + + set_bit(RTL_STATUS_INTERFACE_START, &rtlpriv->status); + return 0; + ++error_init_vars: ++ wait_for_completion(&rtlpriv->firmware_loading_complete); + error_out: + rtl_deinit_core(hw); + error_out2: +-- +2.39.5 + diff --git a/queue-6.6/wifi-wcn36xx-fix-channel-survey-memory-allocation-si.patch b/queue-6.6/wifi-wcn36xx-fix-channel-survey-memory-allocation-si.patch new file mode 100644 index 0000000000..96342a20bd --- /dev/null +++ b/queue-6.6/wifi-wcn36xx-fix-channel-survey-memory-allocation-si.patch @@ -0,0 +1,48 @@ +From 48a1935994c01d62214f96020c6f5a35ded2b296 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 4 Nov 2024 21:00:35 +0100 +Subject: wifi: wcn36xx: fix channel survey memory allocation size +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Barnabás Czémán + +[ Upstream commit 6200d947f050efdba4090dfefd8a01981363d954 ] + +KASAN reported a memory allocation issue in wcn->chan_survey +due to incorrect size calculation. +This commit uses kcalloc to allocate memory for wcn->chan_survey, +ensuring proper initialization and preventing the use of uninitialized +values when there are no frames on the channel. + +Fixes: 29696e0aa413 ("wcn36xx: Track SNR and RSSI for each RX frame") +Signed-off-by: Barnabás Czémán +Acked-by: Loic Poulain +Reviewed-by: Bryan O'Donoghue +Link: https://patch.msgid.link/20241104-wcn36xx-memory-allocation-v1-1-5ec901cf37b6@mainlining.org +Signed-off-by: Jeff Johnson +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/ath/wcn36xx/main.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/ath/wcn36xx/main.c b/drivers/net/wireless/ath/wcn36xx/main.c +index 2bd1163177f08..9bbbc86fd2d93 100644 +--- a/drivers/net/wireless/ath/wcn36xx/main.c ++++ b/drivers/net/wireless/ath/wcn36xx/main.c +@@ -1586,7 +1586,10 @@ static int wcn36xx_probe(struct platform_device *pdev) + } + + n_channels = wcn_band_2ghz.n_channels + wcn_band_5ghz.n_channels; +- wcn->chan_survey = devm_kmalloc(wcn->dev, n_channels, GFP_KERNEL); ++ wcn->chan_survey = devm_kcalloc(wcn->dev, ++ n_channels, ++ sizeof(struct wcn36xx_chan_survey), ++ GFP_KERNEL); + if (!wcn->chan_survey) { + ret = -ENOMEM; + goto out_wq; +-- +2.39.5 + diff --git a/queue-6.6/wifi-wlcore-fix-unbalanced-pm_runtime-calls.patch b/queue-6.6/wifi-wlcore-fix-unbalanced-pm_runtime-calls.patch new file mode 100644 index 0000000000..614d67ea12 --- /dev/null +++ b/queue-6.6/wifi-wlcore-fix-unbalanced-pm_runtime-calls.patch @@ -0,0 +1,70 @@ +From 2ae3531cdc0490a4248f45919bcd76f95400addf Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Sat, 4 Jan 2025 20:55:07 +0100 +Subject: wifi: wlcore: fix unbalanced pm_runtime calls + +From: Andreas Kemnade + +[ Upstream commit 996c934c8c196144af386c4385f61fcd5349af28 ] + +If firmware boot failes, runtime pm is put too often: +[12092.708099] wlcore: ERROR firmware boot failed despite 3 retries +[12092.708099] wl18xx_driver wl18xx.1.auto: Runtime PM usage count underflow! +Fix that by redirecting all error gotos before runtime_get so that runtime is +not put. + +Fixes: c40aad28a3cf ("wlcore: Make sure firmware is initialized in wl1271_op_add_interface()") +Signed-off-by: Andreas Kemnade +Reviewed-by: Michael Nemanov +Signed-off-by: Kalle Valo +Link: https://patch.msgid.link/20250104195507.402673-1-akemnade@kernel.org +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/ti/wlcore/main.c | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/wireless/ti/wlcore/main.c b/drivers/net/wireless/ti/wlcore/main.c +index bf21611872a3c..9706240ddd416 100644 +--- a/drivers/net/wireless/ti/wlcore/main.c ++++ b/drivers/net/wireless/ti/wlcore/main.c +@@ -2533,24 +2533,24 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, + if (test_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags) || + test_bit(WLVIF_FLAG_INITIALIZED, &wlvif->flags)) { + ret = -EBUSY; +- goto out; ++ goto out_unlock; + } + + + ret = wl12xx_init_vif_data(wl, vif); + if (ret < 0) +- goto out; ++ goto out_unlock; + + wlvif->wl = wl; + role_type = wl12xx_get_role_type(wl, wlvif); + if (role_type == WL12XX_INVALID_ROLE_TYPE) { + ret = -EINVAL; +- goto out; ++ goto out_unlock; + } + + ret = wlcore_allocate_hw_queue_base(wl, wlvif); + if (ret < 0) +- goto out; ++ goto out_unlock; + + /* + * TODO: after the nvs issue will be solved, move this block +@@ -2565,7 +2565,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, + + ret = wl12xx_init_fw(wl); + if (ret < 0) +- goto out; ++ goto out_unlock; + } + + /* +-- +2.39.5 + diff --git a/queue-6.6/x86-cpu-enable-sd_asym_packing-for-pkg-domain-on-amd.patch b/queue-6.6/x86-cpu-enable-sd_asym_packing-for-pkg-domain-on-amd.patch new file mode 100644 index 0000000000..6319e4c202 --- /dev/null +++ b/queue-6.6/x86-cpu-enable-sd_asym_packing-for-pkg-domain-on-amd.patch @@ -0,0 +1,44 @@ +From d04d93f89e8b85fdf8b34e478197fdc9665d72a9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 25 Oct 2024 12:14:57 -0500 +Subject: x86/cpu: Enable SD_ASYM_PACKING for PKG domain on AMD + +From: Perry Yuan + +[ Upstream commit b0979e53645825a38f814ca5d3d09aed2745911d ] + +Enable the SD_ASYM_PACKING domain flag for the PKG domain on AMD heterogeneous +processors. This flag is beneficial for processors with one or more CCDs and +relies on x86_sched_itmt_flags(). + +Signed-off-by: Perry Yuan +Co-developed-by: Mario Limonciello +Signed-off-by: Mario Limonciello +Signed-off-by: Borislav Petkov (AMD) +Reviewed-by: Gautham R. Shenoy +Link: https://lore.kernel.org/r/20241025171459.1093-4-mario.limonciello@amd.com +Stable-dep-of: e1bc02646527 ("x86/topology: Use x86_sched_itmt_flags for PKG domain unconditionally") +Signed-off-by: Sasha Levin +--- + arch/x86/kernel/smpboot.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c +index e4781e7496f6f..9150bd5147d01 100644 +--- a/arch/x86/kernel/smpboot.c ++++ b/arch/x86/kernel/smpboot.c +@@ -606,8 +606,9 @@ static int x86_cluster_flags(void) + + static int x86_die_flags(void) + { +- if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU)) +- return x86_sched_itmt_flags(); ++ if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU) || ++ cpu_feature_enabled(X86_FEATURE_AMD_HETEROGENEOUS_CORES)) ++ return x86_sched_itmt_flags(); + + return 0; + } +-- +2.39.5 + diff --git a/queue-6.6/x86-topology-use-x86_sched_itmt_flags-for-pkg-domain.patch b/queue-6.6/x86-topology-use-x86_sched_itmt_flags-for-pkg-domain.patch new file mode 100644 index 0000000000..4c949c6df6 --- /dev/null +++ b/queue-6.6/x86-topology-use-x86_sched_itmt_flags-for-pkg-domain.patch @@ -0,0 +1,106 @@ +From ee7ba23e170feafd68647ad620644eab6e283c48 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Dec 2024 04:34:04 +0000 +Subject: x86/topology: Use x86_sched_itmt_flags for PKG domain unconditionally + +From: K Prateek Nayak + +[ Upstream commit e1bc02646527fc1ed74f00eb599b2b74d49671c7 ] + +x86_sched_itmt_flags() returns SD_ASYM_PACKING if ITMT support is +enabled by the system. Without ITMT support being enabled, it returns 0 +similar to current x86_die_flags() on non-Hybrid systems +(!X86_HYBRID_CPU and !X86_FEATURE_AMD_HETEROGENEOUS_CORES) + +On Intel systems that enable ITMT support, either the MC domain +coincides with the PKG domain, or in case of multiple MC groups +within a PKG domain, either Sub-NUMA Cluster (SNC) is enabled or the +processor features Hybrid core layout (X86_HYBRID_CPU) which leads to +three distinct possibilities: + +o If PKG and MC domains coincide, PKG domain is degenerated by + sd_parent_degenerate() when building sched domain topology. + +o If SNC is enabled, PKG domain is never added since + "x86_has_numa_in_package" is set and the topology will instead contain + NODE and NUMA domains. + +o On X86_HYBRID_CPU which contains multiple MC groups within the PKG, + the PKG domain requires x86_sched_itmt_flags(). + +Thus, on Intel systems that contains multiple MC groups within the PKG +and enables ITMT support, the PKG domain requires +x86_sched_itmt_flags(). In all other cases PKG domain is either never +added or is degenerated. Thus, returning x86_sched_itmt_flags() +unconditionally at PKG domain on Intel systems should not lead to any +functional changes. + +On AMD systems with multiple LLCs (MC groups) within a PKG domain, +enabling ITMT support requires setting SD_ASYM_PACKING to the PKG domain +since the core rankings are assigned PKG-wide. + +Core rankings on AMD processors is currently set by the amd-pstate +driver when Preferred Core feature is supported. A subset of systems that +support Preferred Core feature can be detected using +X86_FEATURE_AMD_HETEROGENEOUS_CORES however, this does not cover all the +systems that support Preferred Core ranking. + +Detecting Preferred Core support on AMD systems requires inspecting CPPC +Highest Perf on all present CPUs and checking if it differs on at least +one CPU. Previous suggestion to use a synthetic feature to detect +Preferred Core support [1] was found to be non-trivial to implement +since BSP alone cannot detect if Preferred Core is supported and by the +time AP comes up, alternatives are patched and setting a X86_FEATURE_* +then is not possible. + +Since x86 processors enabling ITMT support that consists multiple +non-NUMA MC groups within a PKG requires SD_ASYM_PACKING flag set at the +PKG domain, return x86_sched_itmt_flags unconditionally for the PKG +domain. + +Since x86_die_flags() would have just returned x86_sched_itmt_flags() +after the change, remove the unnecessary wrapper and pass +x86_sched_itmt_flags() directly as the flags function. + +Fixes: f3a052391822 ("cpufreq: amd-pstate: Enable amd-pstate preferred core support") +Signed-off-by: K Prateek Nayak +Signed-off-by: Peter Zijlstra (Intel) +Reviewed-by: Tim Chen +Link: https://lore.kernel.org/r/20241223043407.1611-6-kprateek.nayak@amd.com +Signed-off-by: Sasha Levin +--- + arch/x86/kernel/smpboot.c | 11 +---------- + 1 file changed, 1 insertion(+), 10 deletions(-) + +diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c +index 9150bd5147d01..a8f2ab816d5ae 100644 +--- a/arch/x86/kernel/smpboot.c ++++ b/arch/x86/kernel/smpboot.c +@@ -604,15 +604,6 @@ static int x86_cluster_flags(void) + } + #endif + +-static int x86_die_flags(void) +-{ +- if (cpu_feature_enabled(X86_FEATURE_HYBRID_CPU) || +- cpu_feature_enabled(X86_FEATURE_AMD_HETEROGENEOUS_CORES)) +- return x86_sched_itmt_flags(); +- +- return 0; +-} +- + /* + * Set if a package/die has multiple NUMA nodes inside. + * AMD Magny-Cours, Intel Cluster-on-Die, and Intel +@@ -648,7 +639,7 @@ static void __init build_sched_topology(void) + */ + if (!x86_has_numa_in_package) { + x86_topology[i++] = (struct sched_domain_topology_level){ +- cpu_cpu_mask, x86_die_flags, SD_INIT_NAME(PKG) ++ cpu_cpu_mask, x86_sched_itmt_flags, SD_INIT_NAME(PKG) + }; + } + +-- +2.39.5 + diff --git a/queue-6.6/xfrm-delete-intermediate-secpath-entry-in-packet-off.patch b/queue-6.6/xfrm-delete-intermediate-secpath-entry-in-packet-off.patch new file mode 100644 index 0000000000..1e122b16d6 --- /dev/null +++ b/queue-6.6/xfrm-delete-intermediate-secpath-entry-in-packet-off.patch @@ -0,0 +1,169 @@ +From 65a8a39569e23580fd208433853ff973367a8914 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 2 Jan 2025 12:11:11 +0200 +Subject: xfrm: delete intermediate secpath entry in packet offload mode + +From: Alexandre Cassen + +[ Upstream commit 600258d555f0710b9c47fb78d2d80a4aecd608cc ] + +Packets handled by hardware have added secpath as a way to inform XFRM +core code that this path was already handled. That secpath is not needed +at all after policy is checked and it is removed later in the stack. + +However, in the case of IP forwarding is enabled (/proc/sys/net/ipv4/ip_forward), +that secpath is not removed and packets which already were handled are reentered +to the driver TX path with xfrm_offload set. + +The following kernel panic is observed in mlx5 in such case: + + mlx5_core 0000:04:00.0 enp4s0f0np0: Link up + mlx5_core 0000:04:00.1 enp4s0f1np1: Link up + Initializing XFRM netlink socket + IPsec XFRM device driver + BUG: kernel NULL pointer dereference, address: 0000000000000000 + #PF: supervisor instruction fetch in kernel mode + #PF: error_code(0x0010) - not-present page + PGD 0 P4D 0 + Oops: Oops: 0010 [#1] PREEMPT SMP + CPU: 0 UID: 0 PID: 0 Comm: swapper/0 Not tainted 6.13.0-rc1-alex #3 + Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.13.0-1ubuntu1.1 04/01/2014 + RIP: 0010:0x0 + Code: Unable to access opcode bytes at 0xffffffffffffffd6. + RSP: 0018:ffffb87380003800 EFLAGS: 00010206 + RAX: ffff8df004e02600 RBX: ffffb873800038d8 RCX: 00000000ffff98cf + RDX: ffff8df00733e108 RSI: ffff8df00521fb80 RDI: ffff8df001661f00 + RBP: ffffb87380003850 R08: ffff8df013980000 R09: 0000000000000010 + R10: 0000000000000002 R11: 0000000000000002 R12: ffff8df001661f00 + R13: ffff8df00521fb80 R14: ffff8df00733e108 R15: ffff8df011faf04e + FS: 0000000000000000(0000) GS:ffff8df46b800000(0000) knlGS:0000000000000000 + CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 + CR2: ffffffffffffffd6 CR3: 0000000106384000 CR4: 0000000000350ef0 + Call Trace: + + ? show_regs+0x63/0x70 + ? __die_body+0x20/0x60 + ? __die+0x2b/0x40 + ? page_fault_oops+0x15c/0x550 + ? do_user_addr_fault+0x3ed/0x870 + ? exc_page_fault+0x7f/0x190 + ? asm_exc_page_fault+0x27/0x30 + mlx5e_ipsec_handle_tx_skb+0xe7/0x2f0 [mlx5_core] + mlx5e_xmit+0x58e/0x1980 [mlx5_core] + ? __fib_lookup+0x6a/0xb0 + dev_hard_start_xmit+0x82/0x1d0 + sch_direct_xmit+0xfe/0x390 + __dev_queue_xmit+0x6d8/0xee0 + ? __fib_lookup+0x6a/0xb0 + ? internal_add_timer+0x48/0x70 + ? mod_timer+0xe2/0x2b0 + neigh_resolve_output+0x115/0x1b0 + __neigh_update+0x26a/0xc50 + neigh_update+0x14/0x20 + arp_process+0x2cb/0x8e0 + ? __napi_build_skb+0x5e/0x70 + arp_rcv+0x11e/0x1c0 + ? dev_gro_receive+0x574/0x820 + __netif_receive_skb_list_core+0x1cf/0x1f0 + netif_receive_skb_list_internal+0x183/0x2a0 + napi_complete_done+0x76/0x1c0 + mlx5e_napi_poll+0x234/0x7a0 [mlx5_core] + __napi_poll+0x2d/0x1f0 + net_rx_action+0x1a6/0x370 + ? atomic_notifier_call_chain+0x3b/0x50 + ? irq_int_handler+0x15/0x20 [mlx5_core] + handle_softirqs+0xb9/0x2f0 + ? handle_irq_event+0x44/0x60 + irq_exit_rcu+0xdb/0x100 + common_interrupt+0x98/0xc0 + + + asm_common_interrupt+0x27/0x40 + RIP: 0010:pv_native_safe_halt+0xb/0x10 + Code: 09 c3 66 66 2e 0f 1f 84 00 00 00 00 00 66 90 0f 22 + 0f 1f 84 00 00 00 00 00 90 eb 07 0f 00 2d 7f e9 36 00 fb +40 00 83 ff 07 77 21 89 ff ff 24 fd 88 3d a1 bd 0f 21 f8 + RSP: 0018:ffffffffbe603de8 EFLAGS: 00000202 + RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000f92f46680 + RDX: 0000000000000037 RSI: 00000000ffffffff RDI: 00000000000518d4 + RBP: ffffffffbe603df0 R08: 000000cd42e4dffb R09: ffffffffbe603d70 + R10: 0000004d80d62680 R11: 0000000000000001 R12: ffffffffbe60bf40 + R13: 0000000000000000 R14: 0000000000000000 R15: ffffffffbe60aff8 + ? default_idle+0x9/0x20 + arch_cpu_idle+0x9/0x10 + default_idle_call+0x29/0xf0 + do_idle+0x1f2/0x240 + cpu_startup_entry+0x2c/0x30 + rest_init+0xe7/0x100 + start_kernel+0x76b/0xb90 + x86_64_start_reservations+0x18/0x30 + x86_64_start_kernel+0xc0/0x110 + ? setup_ghcb+0xe/0x130 + common_startup_64+0x13e/0x141 + + Modules linked in: esp4_offload esp4 xfrm_interface +xfrm6_tunnel tunnel4 tunnel6 xfrm_user xfrm_algo binfmt_misc +intel_rapl_msr intel_rapl_common kvm_amd ccp kvm input_leds serio_raw +qemu_fw_cfg sch_fq_codel dm_multipath scsi_dh_rdac scsi_dh_emc +scsi_dh_alua efi_pstore ip_tables x_tables autofs4 raid10 raid456 +async_raid6_recov async_memcpy async_pq raid6_pq async_xor xor async_tx +libcrc32c raid1 raid0 mlx5_core crct10dif_pclmul crc32_pclmul +polyval_clmulni polyval_generic ghash_clmulni_intel sha256_ssse3 +sha1_ssse3 ahci mlxfw i2c_i801 libahci i2c_mux i2c_smbus psample +virtio_rng pci_hyperv_intf aesni_intel crypto_simd cryptd + CR2: 0000000000000000 + ---[ end trace 0000000000000000 ]--- + RIP: 0010:0x0 + Code: Unable to access opcode bytes at 0xffffffffffffffd6. + RSP: 0018:ffffb87380003800 EFLAGS: 00010206 + RAX: ffff8df004e02600 RBX: ffffb873800038d8 RCX: 00000000ffff98cf + RDX: ffff8df00733e108 RSI: ffff8df00521fb80 RDI: ffff8df001661f00 + RBP: ffffb87380003850 R08: ffff8df013980000 R09: 0000000000000010 + R10: 0000000000000002 R11: 0000000000000002 R12: ffff8df001661f00 + R13: ffff8df00521fb80 R14: ffff8df00733e108 R15: ffff8df011faf04e + FS: 0000000000000000(0000) GS:ffff8df46b800000(0000) knlGS:0000000000000000 + CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 + CR2: ffffffffffffffd6 CR3: 0000000106384000 CR4: 0000000000350ef0 + Kernel panic - not syncing: Fatal exception in interrupt + Kernel Offset: 0x3b800000 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffffbfffffff) + ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]--- + +Fixes: 5958372ddf62 ("xfrm: add RX datapath protection for IPsec packet offload mode") +Signed-off-by: Alexandre Cassen +Signed-off-by: Leon Romanovsky +Signed-off-by: Steffen Klassert +Signed-off-by: Sasha Levin +--- + include/net/xfrm.h | 16 +++++++++++++--- + 1 file changed, 13 insertions(+), 3 deletions(-) + +diff --git a/include/net/xfrm.h b/include/net/xfrm.h +index 93a9866ee481f..b33d27e42cff3 100644 +--- a/include/net/xfrm.h ++++ b/include/net/xfrm.h +@@ -1181,9 +1181,19 @@ static inline int __xfrm_policy_check2(struct sock *sk, int dir, + + if (xo) { + x = xfrm_input_state(skb); +- if (x->xso.type == XFRM_DEV_OFFLOAD_PACKET) +- return (xo->flags & CRYPTO_DONE) && +- (xo->status & CRYPTO_SUCCESS); ++ if (x->xso.type == XFRM_DEV_OFFLOAD_PACKET) { ++ bool check = (xo->flags & CRYPTO_DONE) && ++ (xo->status & CRYPTO_SUCCESS); ++ ++ /* The packets here are plain ones and secpath was ++ * needed to indicate that hardware already handled ++ * them and there is no need to do nothing in addition. ++ * ++ * Consume secpath which was set by drivers. ++ */ ++ secpath_reset(skb); ++ return check; ++ } + } + + return __xfrm_check_nopolicy(net, skb, dir) || +-- +2.39.5 + diff --git a/queue-6.6/xfrm-replay-fix-the-update-of-replay_esn-oseq_hi-for.patch b/queue-6.6/xfrm-replay-fix-the-update-of-replay_esn-oseq_hi-for.patch new file mode 100644 index 0000000000..d708626d53 --- /dev/null +++ b/queue-6.6/xfrm-replay-fix-the-update-of-replay_esn-oseq_hi-for.patch @@ -0,0 +1,61 @@ +From ff2fff199a07a969b6930d127d2d9120230a35a2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 12 Nov 2024 14:10:31 +0200 +Subject: xfrm: replay: Fix the update of replay_esn->oseq_hi for GSO + +From: Jianbo Liu + +[ Upstream commit c05c5e5aa163f4682ca97a2f0536575fc7dbdecb ] + +When skb needs GSO and wrap around happens, if xo->seq.low (seqno of +the first skb segment) is before the last seq number but oseq (seqno +of the last segment) is after it, xo->seq.low is still bigger than +replay_esn->oseq while oseq is smaller than it, so the update of +replay_esn->oseq_hi is missed for this case wrap around because of +the change in the cited commit. + +For example, if sending a packet with gso_segs=3 while old +replay_esn->oseq=0xfffffffe, we calculate: + xo->seq.low = 0xfffffffe + 1 = 0x0xffffffff + oseq = 0xfffffffe + 3 = 0x1 +(oseq < replay_esn->oseq) is true, but (xo->seq.low < +replay_esn->oseq) is false, so replay_esn->oseq_hi is not incremented. + +To fix this issue, change the outer checking back for the update of +replay_esn->oseq_hi. And add new checking inside for the update of +packet's oseq_hi. + +Fixes: 4b549ccce941 ("xfrm: replay: Fix ESN wrap around for GSO") +Signed-off-by: Jianbo Liu +Reviewed-by: Patrisious Haddad +Signed-off-by: Leon Romanovsky +Signed-off-by: Steffen Klassert +Signed-off-by: Sasha Levin +--- + net/xfrm/xfrm_replay.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/net/xfrm/xfrm_replay.c b/net/xfrm/xfrm_replay.c +index ce56d659c55a6..7f52bb2e14c13 100644 +--- a/net/xfrm/xfrm_replay.c ++++ b/net/xfrm/xfrm_replay.c +@@ -714,10 +714,12 @@ static int xfrm_replay_overflow_offload_esn(struct xfrm_state *x, struct sk_buff + oseq += skb_shinfo(skb)->gso_segs; + } + +- if (unlikely(xo->seq.low < replay_esn->oseq)) { +- XFRM_SKB_CB(skb)->seq.output.hi = ++oseq_hi; +- xo->seq.hi = oseq_hi; +- replay_esn->oseq_hi = oseq_hi; ++ if (unlikely(oseq < replay_esn->oseq)) { ++ replay_esn->oseq_hi = ++oseq_hi; ++ if (xo->seq.low < replay_esn->oseq) { ++ XFRM_SKB_CB(skb)->seq.output.hi = oseq_hi; ++ xo->seq.hi = oseq_hi; ++ } + if (replay_esn->oseq_hi == 0) { + replay_esn->oseq--; + replay_esn->oseq_hi--; +-- +2.39.5 +