6.8.12-rc1 review
Subsystems (4)
Greg Kroah-Hartman
maintainerPATCH 277/493 wifi: rtw89: wow: refine WoWLAN flows of HCI interrupts and low power mode
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chih-Kang Chang <[email protected]>
[ Upstream commit baaf806e4632a259cc959fd1c516c2d9ed48df6d ]
After enabling packet offload, the TX will be stuck after resume from WoWLAN mode. And the 8852c gets error messages like
rtw89_8852ce 0000:04:00.0: No busy txwd pages available rtw89_8852ce 0000:04:00.0: queue 0 txwd 100 is not idle rtw89_8852ce 0000:04:00.0: queue 0 txwd 101 is not idle rtw89_8852ce 0000:04:00.0: queue 0 txwd 102 is not idle rtw89_8852ce 0000:04:00.0: queue 0 txwd 103 is not idle
If suspend/resume many times that firmware will download failed and disconnection.
To fix these issues, We removed the rtw89_hci_disable_intr() and rtw89_hci_enable_intr() during rtw89_wow_swap_fw() to prevent add packet offload can't receive c2h back due to interrupt disable. Only 8852C and 8922A needs to disable interrupt before downloading fw.
Furthermore, we avoid using low power HCI mode on WoWLAN mode, to prevent interrupt enabled, then get interrupt and calculate RXBD mismatched due to software RXBD index already reset but hardware RXBD index not yet.
--- drivers/net/wireless/realtek/rtw89/ps.c | 3 ++- drivers/net/wireless/realtek/rtw89/wow.c | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/net/wireless/realtek/rtw89/ps.c +2 -1
@@ -54,7 +54,8 @@ static void rtw89_ps_power_mode_change_with_hci(struct rtw89_dev *rtwdev,static void rtw89_ps_power_mode_change (struct rtw89_dev *rtwdev,bool enter) { -if (rtwdev->chip->low_power_hci_modes &BIT (rtwdev->ps_mode)) +if (rtwdev->chip->low_power_hci_modes &BIT (rtwdev->ps_mode) && + !test_bit (RTW89_FLAG_WOWLAN , rtwdev->flags))rtw89_ps_power_mode_change_with_hci (rtwdev, enter);else rtw89_mac_power_mode_change (rtwdev, enter);
drivers/net/wireless/realtek/rtw89/wow.c +10 -2
@@ -489,14 +489,17 @@ static int rtw89_wow_swap_fw(struct rtw89_dev *rtwdev, bool wow)struct rtw89_wow_param *rtw_wow = &rtwdev->wow;struct ieee80211_vif *wow_vif = rtw_wow->wow_vif;struct rtw89_vif *rtwvif = (struct rtw89_vif *)wow_vif->drv_priv; +enum rtw89_core_chip_id chip_id = rtwdev->chip->chip_id;const struct rtw89_chip_info *chip = rtwdev->chip;bool include_bb = !!chip->bbmcu_nr; +bool disable_intr_for_dlfw = false;struct ieee80211_sta *wow_sta;struct rtw89_sta *rtwsta =NULL ;bool is_conn = true;int ret; -rtw89_hci_disable_intr (rtwdev); +if (chip_id ==RTL8852C || chip_id ==RTL8922A ) + disable_intr_for_dlfw = true; wow_sta =ieee80211_find_sta (wow_vif, rtwvif->bssid);if (wow_sta)
@@ -504,12 +507,18 @@ static int rtw89_wow_swap_fw(struct rtw89_dev *rtwdev, bool wow)else is_conn = false; +if (disable_intr_for_dlfw) +rtw89_hci_disable_intr (rtwdev); + ret =rtw89_fw_download (rtwdev, fw_type, include_bb);if (ret) {rtw89_warn (rtwdev,"download fw failed\n" );return ret; } +if (disable_intr_for_dlfw) +rtw89_hci_enable_intr (rtwdev); +rtw89_phy_init_rf_reg (rtwdev, true); ret = rtw89_fw_h2c_role_maintain(rtwdev, rtwvif, rtwsta,
@@ -552,7 +561,6 @@ static int rtw89_wow_swap_fw(struct rtw89_dev *rtwdev, bool wow) }rtw89_mac_hw_mgnt_sec (rtwdev, wow); -rtw89_hci_enable_intr (rtwdev);return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 278/493 selftests/binderfs: use the Makefiles rules, not Makes implicit rules
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Hubbard <[email protected]>
[ Upstream commit 019baf635eb6ffe8d6c1343f81788f02a7e0ed98 ]
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via:
make LLVM=1 -C tools/testing/selftests
...the following error occurs:
clang: error: cannot specify -o when generating multiple output files
This is because clang, unlike gcc, won't accept invocations of this form:
clang file1.c header2.h
While trying to fix this, I noticed that:
a) selftests/lib.mk already avoids the problem, and
b) The binderfs Makefile indavertently bypasses the selftests/lib.mk build system, and quitely uses Make's implicit build rules for .c files instead.
The Makefile attempts to set up both a dependency and a source file, neither of which was needed, because lib.mk is able to automatically handle both. This line:
binderfs_test: binderfs_test.c
...causes Make's implicit rules to run, which builds binderfs_test without ever looking at lib.mk.
Fix this by simply deleting the "binderfs_test:" Makefile target and letting lib.mk handle it instead.
[1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/
--- tools/testing/selftests/filesystems/binderfs/Makefile | 2 -- 1 file changed, 2 deletions(-)
tools/testing/selftests/filesystems/binderfs/Makefile +0 -2
@@ -3,6 +3,4 @@ CFLAGS += $(KHDR_INCLUDES) -pthread TEST_GEN_PROGS := binderfs_test -binderfs_test: binderfs_test.c ../../kselftest.h ../../kselftest_harness.h - include ../../lib.mk
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 279/493 selftests/resctrl: fix clang build failure: use LOCAL_HDRS
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Hubbard <[email protected]>
[ Upstream commit d8171aa4ca72f1a67bf3c14c59441d63c1d2585f ]
First of all, in order to build with clang at all, one must first apply Valentin Obst's build fix for LLVM [1]. Once that is done, then when building with clang, via:
make LLVM=1 -C tools/testing/selftests
...the following error occurs:
clang: error: cannot specify -o when generating multiple output files
This is because clang, unlike gcc, won't accept invocations of this form:
clang file1.c header2.h
Fix this by using selftests/lib.mk facilities for tracking local header file dependencies: add them to LOCAL_HDRS, leaving only the .c files to be passed to the compiler.
[1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/
--- tools/testing/selftests/resctrl/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
tools/testing/selftests/resctrl/Makefile +3 -1
@@ -5,6 +5,8 @@ CFLAGS += $(KHDR_INCLUDES) TEST_GEN_PROGS := resctrl_tests +LOCAL_HDRS += $(wildcard *.h) + include ../lib.mk -$(OUTPUT)/resctrl_tests: $(wildcard *.[ch]) +$(OUTPUT)/resctrl_tests: $(wildcard *.c)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 280/493 selftests: default to host arch for LLVM builds
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Valentin Obst <[email protected]>
[ Upstream commit d4e6fbd245c48b272cc591d1c5e7c07aedd7f071 ]
Align the behavior for gcc and clang builds by interpreting unset ARCH and CROSS_COMPILE variables in LLVM builds as a sign that the user wants to build for the host architecture.
This patch preserves the properties that setting the ARCH variable to an unknown value will trigger an error that complains about insufficient information, and that a set CROSS_COMPILE variable will override the target triple that is determined based on presence/absence of ARCH.
When compiling with clang, i.e., LLVM is set, an unset ARCH variable in combination with an unset CROSS_COMPILE variable, i.e., compiling for the host architecture, leads to compilation failures since lib.mk can not determine the clang target triple. In this case, the following error message is displayed for each subsystem that does not set ARCH in its own Makefile before including lib.mk (lines wrapped at 75 chrs):
make[1]: Entering directory '/mnt/build/linux/tools/testing/selftests/
sysctl'
../lib.mk:33: *** Specify CROSS_COMPILE or add '--target=' option to
lib.mk. Stop.
make[1]: Leaving directory '/mnt/build/linux/tools/testing/selftests/
sysctl'
In the same scenario a gcc build would default to the host architecture, i.e., it would use plain gcc.
--- tools/testing/selftests/lib.mk | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
tools/testing/selftests/lib.mk +10 -2
@@ -7,6 +7,8 @@ else ifneq ($(filter -%,$(LLVM)),) LLVM_SUFFIX := $(LLVM) endif +CLANG := $(LLVM_PREFIX)clang$(LLVM_SUFFIX) + CLANG_TARGET_FLAGS_arm := arm-linux-gnueabi CLANG_TARGET_FLAGS_arm64 := aarch64-linux-gnu CLANG_TARGET_FLAGS_hexagon := hexagon-linux-musl
@@ -18,7 +20,13 @@ CLANG_TARGET_FLAGS_riscv := riscv64-linux-gnu CLANG_TARGET_FLAGS_s390 := s390x-linux-gnu CLANG_TARGET_FLAGS_x86 := x86_64-linux-gnu CLANG_TARGET_FLAGS_x86_64 := x86_64-linux-gnu -CLANG_TARGET_FLAGS := $(CLANG_TARGET_FLAGS_$(ARCH)) + +# Default to host architecture if ARCH is not explicitly given. +ifeq ($(ARCH),) +CLANG_TARGET_FLAGS := $(shell $(CLANG) -print-target-triple) +else +CLANG_TARGET_FLAGS := $(CLANG_TARGET_FLAGS_$(ARCH)) +endif ifeq ($(CROSS_COMPILE),) ifeq ($(CLANG_TARGET_FLAGS),)
@@ -30,7 +38,7 @@ else CLANG_FLAGS += --target=$(notdir $(CROSS_COMPILE:%-=%)) endif # CROSS_COMPILE -CC := $(LLVM_PREFIX)clang$(LLVM_SUFFIX) $(CLANG_FLAGS) -fintegrated-as +CC := $(CLANG) $(CLANG_FLAGS) -fintegrated-as else CC := $(CROSS_COMPILE)gcc endif # LLVM
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 281/493 kunit: Fix kthread reference
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mickaël Salaün <[email protected]>
[ Upstream commit f8aa1b98ce40184521ed95ec26cc115a255183b2 ]
There is a race condition when a kthread finishes after the deadline and before the call to kthread_stop(), which may lead to use after free.
--- lib/kunit/try-catch.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
lib/kunit/try-catch.c +6 -3
@@ -11,6 +11,7 @@#include <linux/completion.h> #include <linux/kernel.h> #include <linux/kthread.h> +#include <linux/sched/task.h> #include "try-catch-impl.h"
@@ -65,13 +66,14 @@ void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context) try_catch->context = context; try_catch->try_completion = &try_completion; try_catch->try_result =0 ; - task_struct =kthread_run (kunit_generic_run_threadfn_adapter, - try_catch, -"kunit_try_catch_thread" ); + task_struct =kthread_create (kunit_generic_run_threadfn_adapter, + try_catch,"kunit_try_catch_thread" );if (IS_ERR (task_struct)) { try_catch->catch (try_catch->context);return ; } +get_task_struct (task_struct); +wake_up_process (task_struct); time_remaining =wait_for_completion_timeout (&try_completion,kunit_test_timeout ());
@@ -81,6 +83,7 @@ void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context)kthread_stop (task_struct); } +put_task_struct (task_struct); exit_code = try_catch->try_result;if (!exit_code)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 282/493 kunit: unregister the device on error
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wander Lairson Costa <[email protected]>
[ Upstream commit fabd480b721eb30aa4e2c89507b53933069f9f6e ]
kunit_init_device() should unregister the device on bus register error, but mistakenly it tries to unregister the bus.
Unregister the device instead of the bus.
--- lib/kunit/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/kunit/device.c +1 -1
@@ -51,7 +51,7 @@ int kunit_bus_init(void) error =bus_register (&kunit_bus_type);if (error) -bus_unregister (&kunit_bus_type); +root_device_unregister (kunit_bus_device);return error; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 283/493 kunit: bail out early in __kunit_test_suites_init() if there are no suites to test
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Scott Mayhew <[email protected]>
[ Upstream commit 5496b9b77d7420652202b73cf036e69760be5deb ]
Commit c72a870926c2 added a mutex to prevent kunit tests from running concurrently. Unfortunately that mutex gets locked during module load regardless of whether the module actually has any kunit tests. This causes a problem for kunit tests that might need to load other kernel modules (e.g. gss_krb5_test loading the camellia module).
So check to see if there are actually any tests to run before locking the kunit_run_lock mutex.
--- lib/kunit/test.c | 3 +++ 1 file changed, 3 insertions(+)
lib/kunit/test.c +3 -0
@@ -712,6 +712,9 @@ int __kunit_test_suites_init(struct kunit_suite * const * const suites, int num_ {unsigned int i; +if (num_suites ==0 ) +return 0 ; +if (!kunit_enabled () && num_suites >0 ) {pr_info ("kunit: disabled\n" );return 0 ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 284/493 selftests/bpf: Fix pointer arithmetic in test_xdp_do_redirect
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michal Schmidt <[email protected]>
[ Upstream commit e549b39a0ab8880d7ae6c6495b00fc1cb8f36174 ]
Cast operation has a higher precedence than addition. The code here wants to zero the 2nd half of the 64-bit metadata, but due to a pointer arithmetic mistake, it writes the zero at offset 16 instead.
Just adding parentheses around "data + 4" would fix this, but I think this will be slightly better readable with array syntax.
I was unable to test this with tools/testing/selftests/bpf/vmtest.sh, because my glibc is newer than glibc in the provided VM image. So I just checked the difference in the compiled code. objdump -S tools/testing/selftests/bpf/xdp_do_redirect.test.o:
- *((__u32 *)data) = 0x42; /* metadata test value */
+ ((__u32 *)data)[0] = 0x42; /* metadata test value */
be7: 48 8d 85 30 fc ff ff lea -0x3d0(%rbp),%rax
bee: c7 00 42 00 00 00 movl $0x42,(%rax)
- *((__u32 *)data + 4) = 0;
+ ((__u32 *)data)[1] = 0;
bf4: 48 8d 85 30 fc ff ff lea -0x3d0(%rbp),%rax
- bfb: 48 83 c0 10 add $0x10,%rax
+ bfb: 48 83 c0 04 add $0x4,%rax
bff: c7 00 00 00 00 00 movl $0x0,(%rax)--- tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/bpf/prog_tests/xdp_do_redirect.c +2 -2
@@ -107,8 +107,8 @@ void test_xdp_do_redirect(void) .attach_point = BPF_TC_INGRESS);memcpy (&data[sizeof (__u64)], &pkt_udp,sizeof (pkt_udp)); - *((__u32 *)data) =0x42 ;/* metadata test value */ - *((__u32 *)data +4 ) =0 ; + ((__u32 *)data)[0 ] =0x42 ;/* metadata test value */ + ((__u32 *)data)[1 ] =0 ; skel =test_xdp_do_redirect__open ();if (!ASSERT_OK_PTR (skel,"skel" ))
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 285/493 HID: intel-ish-hid: ipc: Add check for pci_alloc_irq_vectors
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit 6baa4524027fd64d7ca524e1717c88c91a354b93 ]
Add a check for the return value of pci_alloc_irq_vectors() and return error if it fails.
--- drivers/hid/intel-ish-hid/ipc/pci-ish.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hid/intel-ish-hid/ipc/pci-ish.c +5 -0
@@ -172,6 +172,11 @@ static int ish_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/* request and enable interrupt */ ret =pci_alloc_irq_vectors (pdev,1 ,1 ,PCI_IRQ_ALL_TYPES ); +if (ret <0 ) { +dev_err (dev,"ISH: Failed to allocate IRQ vectors\n" ); +return ret; + } +if (!pdev->msi_enabled && !pdev->msix_enabled) irq_flag =IRQF_SHARED ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 286/493 scsi: bfa: Ensure the copied buf is NUL terminated
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bui Quang Minh <[email protected]>
[ Upstream commit 13d0cecb4626fae67c00c84d3c7851f6b62f7df3 ]
Currently, we allocate a nbytes-sized kernel buffer and copy nbytes from userspace to that buffer. Later, we use sscanf on this buffer but we don't ensure that the string is terminated inside the buffer, this can lead to OOB read when using sscanf. Fix this issue by using memdup_user_nul instead of memdup_user.
--- drivers/scsi/bfa/bfad_debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/bfa/bfad_debugfs.c +2 -2
@@ -250,7 +250,7 @@ bfad_debugfs_write_regrd(struct file *file, const char __user *buf,unsigned long flags;void *kern_buf; - kern_buf =memdup_user (buf, nbytes); + kern_buf =memdup_user_nul (buf, nbytes);if (IS_ERR (kern_buf))return PTR_ERR (kern_buf);
@@ -317,7 +317,7 @@ bfad_debugfs_write_regwr(struct file *file, const char __user *buf,unsigned long flags;void *kern_buf; - kern_buf =memdup_user (buf, nbytes); + kern_buf =memdup_user_nul (buf, nbytes);if (IS_ERR (kern_buf))return PTR_ERR (kern_buf);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 287/493 scsi: qedf: Ensure the copied buf is NUL terminated
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bui Quang Minh <[email protected]>
[ Upstream commit d0184a375ee797eb657d74861ba0935b6e405c62 ]
Currently, we allocate a count-sized kernel buffer and copy count from userspace to that buffer. Later, we use kstrtouint on this buffer but we don't ensure that the string is terminated inside the buffer, this can lead to OOB read when using kstrtouint. Fix this issue by using memdup_user_nul instead of memdup_user.
--- drivers/scsi/qedf/qedf_debugfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qedf/qedf_debugfs.c +1 -1
@@ -170,7 +170,7 @@ qedf_dbg_debug_cmd_write(struct file *filp, const char __user *buffer,if (!count || *ppos)return 0 ; - kern_buf =memdup_user (buffer, count); + kern_buf =memdup_user_nul (buffer, count);if (IS_ERR (kern_buf))return PTR_ERR (kern_buf);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 288/493 scsi: qla2xxx: Fix debugfs output for fw_resource_count
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Himanshu Madhani <[email protected]>
[ Upstream commit 998d09c5ef6183bd8137d1a892ba255b15978bb4 ]
DebugFS output for fw_resource_count shows:
estimate exchange used[0] high water limit [1945] n estimate iocb2 used [0] high water limit [5141]
estimate exchange2 used[0] high water limit [1945]
Which shows incorrect display due to missing newline in seq_print().
[mkp: fix checkpatch warning about space before newline]
--- drivers/scsi/qla2xxx/qla_dfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_dfs.c +1 -1
@@ -274,7 +274,7 @@ qla_dfs_fw_resource_cnt_show(struct seq_file *s, void *unused)seq_printf (s,"Driver: estimate iocb used [%d] high water limit [%d]\n" , iocbs_used, ha->base_qpair->fwres.iocbs_limit); -seq_printf (s,"estimate exchange used[%d] high water limit [%d] n" , +seq_printf (s,"estimate exchange used[%d] high water limit [%d]\n" , exch_used, ha->base_qpair->fwres.exch_limit);if (ql2xenforce_iocb_limit ==2 ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 289/493 gpio: nuvoton: Fix sgpio irq handle error
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jim Liu <[email protected]>
[ Upstream commit 7f45fe2ea3b8c85787976293126a4a7133b107de ]
The generic_handle_domain_irq() function calls irq_resolve_mapping(). Thus delete a duplicative irq_find_mapping() call
so that a stack trace and an RCU stall will be avoided.
--- drivers/gpio/gpio-npcm-sgpio.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpio/gpio-npcm-sgpio.c +4 -6
@@ -434,7 +434,7 @@ static void npcm_sgpio_irq_handler(struct irq_desc *desc)struct gpio_chip *gc =irq_desc_get_handler_data (desc);struct irq_chip *ic =irq_desc_get_chip (desc);struct npcm_sgpio *gpio =gpiochip_get_data (gc); -unsigned int i, j, girq; +unsigned int i, j;unsigned long reg;chained_irq_enter (ic, desc);
@@ -443,11 +443,9 @@ static void npcm_sgpio_irq_handler(struct irq_desc *desc)const struct npcm_sgpio_bank *bank = &npcm_sgpio_banks[i]; reg =ioread8 (bank_reg (gpio, bank,EVENT_STS )); -for_each_set_bit (j, ®,8 ) { - girq =irq_find_mapping (gc->irq.domain, - i *8 + gpio->nout_sgpio + j); -generic_handle_domain_irq (gc->irq.domain, girq); - } +for_each_set_bit (j, ®,8 ) +generic_handle_domain_irq (gc->irq.domain, + i *8 + gpio->nout_sgpio + j); }chained_irq_exit (ic, desc);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 290/493 x86/numa: Fix SRAT lookup of CFMWS ranges with numa_fill_memblks()
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Robert Richter <[email protected]>
[ Upstream commit f9f67e5adc8dc2e1cc51ab2d3d6382fa97f074d4 ]
For configurations that have the kconfig option NUMA_KEEP_MEMINFO disabled, numa_fill_memblks() only returns with NUMA_NO_MEMBLK (-1). SRAT lookup fails then because an existing SRAT memory range cannot be found for a CFMWS address range. This causes the addition of a duplicate numa_memblk with a different node id and a subsequent page fault and kernel crash during boot.
Fix this by making numa_fill_memblks() always available regardless of NUMA_KEEP_MEMINFO.
As Dan suggested, the fix is implemented to remove numa_fill_memblks() from sparsemem.h and alos using __weak for the function.
Note that the issue was initially introduced with [1]. But since phys_to_target_node() was originally used that returned the valid node 0, an additional numa_memblk was not added. Though, the node id was wrong too, a message is seen then in the logs:
kernel/numa.c: pr_info_once("Unknown target node for memory at 0x%llx, assuming node 0\n",
[1] commit fd49f99c1809 ("ACPI: NUMA: Add a node and memblk for each CFMWS not in SRAT")
--- arch/x86/include/asm/sparsemem.h | 2 -- arch/x86/mm/numa.c | 4 ++-- drivers/acpi/numa/srat.c | 5 +++++ include/linux/numa.h | 7 +------ 4 files changed, 8 insertions(+), 10 deletions(-)
arch/x86/include/asm/sparsemem.h +0 -2
@@ -37,8 +37,6 @@ extern int phys_to_target_node(phys_addr_t start);#define phys_to_target_node phys_to_target_nodeextern int memory_add_physaddr_to_nid (u64 start);#define memory_add_physaddr_to_nid memory_add_physaddr_to_nid -extern int numa_fill_memblks (u64 start,u64 end); -#define numa_fill_memblks numa_fill_memblks#endif #endif /* __ASSEMBLY__ */
arch/x86/mm/numa.c +2 -2
@@ -929,6 +929,8 @@ int memory_add_physaddr_to_nid(u64 start) }EXPORT_SYMBOL_GPL (memory_add_physaddr_to_nid); +#endif +static int __init cmp_memblk (const void *a,const void *b) {const struct numa_memblk *ma = *(const struct numa_memblk **)a;
@@ -1001,5 +1003,3 @@ int __init numa_fill_memblks(u64 start, u64 end) }return 0 ; } - -#endif
drivers/acpi/numa/srat.c +5 -0
@@ -206,6 +206,11 @@ int __init srat_disabled(void)return acpi_numa <0 ; } +__weak int __init numa_fill_memblks (u64 start,u64 end) +{ +return NUMA_NO_MEMBLK ; +} +#if defined(CONFIG_X86 ) || defined(CONFIG_ARM64 ) || defined(CONFIG_LOONGARCH )/* * Callback for SLIT parsing. pxm_to_node() returns NUMA_NO_NODE for
include/linux/numa.h +1 -6
@@ -36,12 +36,7 @@ int memory_add_physaddr_to_nid(u64 start);int phys_to_target_node (u64 start);#endif -#ifndef numa_fill_memblks -static inline int __init numa_fill_memblks (u64 start,u64 end) -{ -return NUMA_NO_MEMBLK ; -} -#endif +int numa_fill_memblks (u64 start,u64 end);#else /* !CONFIG_NUMA */ static inline int numa_nearest_node (int node,unsigned int state)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 291/493 wifi: mwl8k: initialize cmd->addr[] properly
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 1d60eabb82694e58543e2b6366dae3e7465892a5 ]
This loop is supposed to copy the mac address to cmd->addr but the i++ increment is missing so it copies everything to cmd->addr[0] and only the last address is recorded.
--- drivers/net/wireless/marvell/mwl8k.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/marvell/mwl8k.c +1 -1
@@ -2718,7 +2718,7 @@ __mwl8k_cmd_mac_multicast_adr(struct ieee80211_hw *hw, int allmulti, cmd->action |=cpu_to_le16 (MWL8K_ENABLE_RX_MULTICAST ); cmd->numaddr =cpu_to_le16 (mc_count);netdev_hw_addr_list_for_each (ha, mc_list) { -memcpy (cmd->addr[i], ha->addr,ETH_ALEN ); +memcpy (cmd->addr[i++], ha->addr,ETH_ALEN ); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 292/493 HID: amd_sfh: Handle "no sensors" in PM operations
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Basavaraj Natikar <[email protected]>
[ Upstream commit 077e3e3bc84a51891e732507bbbd9acf6e0e4c8b ]
Resume or suspend each sensor device based on the num_hid_devices. Therefore, add a check to handle the special case where no sensors are present.
--- drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/hid/amd-sfh-hid/sfh1_1/amd_sfh_init.c +10 -0
@@ -227,6 +227,11 @@ static void amd_sfh_resume(struct amd_mp2_dev *mp2)struct amd_mp2_sensor_info info;int i, status; +if (!cl_data->is_any_sensor_enabled) { +amd_sfh_clear_intr (mp2); +return ; + } +for (i =0 ; i < cl_data->num_hid_devices; i++) {if (cl_data->sensor_sts[i] ==SENSOR_DISABLED ) { info.sensor_idx = cl_data->sensor_idx[i];
@@ -252,6 +257,11 @@ static void amd_sfh_suspend(struct amd_mp2_dev *mp2)struct amdtp_cl_data *cl_data = mp2->cl_data;int i, status; +if (!cl_data->is_any_sensor_enabled) { +amd_sfh_clear_intr (mp2); +return ; + } +for (i =0 ; i < cl_data->num_hid_devices; i++) {if (cl_data->sensor_idx[i] !=HPD_IDX && cl_data->sensor_sts[i] ==SENSOR_ENABLED ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 293/493 usb: aqc111: stop lying about skb->truesize
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 9aad6e45c4e7d16b2bb7c3794154b828fb4384b4 ]
Some usb drivers try to set small skb->truesize and break core networking stacks.
I replace one skb_clone() by an allocation of a fresh and small skb, to get minimally sized skbs, like we did in commit 1e2c61172342 ("net: cdc_ncm: reduce skb truesize in rx path") and 4ce62d5b2f7a ("net: usb: ax88179_178a:
stop lying about skb->truesize")
--- drivers/net/usb/aqc111.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/net/usb/aqc111.c +3 -5
@@ -1141,17 +1141,15 @@ static int aqc111_rx_fixup(struct usbnet *dev, struct sk_buff *skb)continue ; } -/* Clone SKB */ - new_skb =skb_clone (skb,GFP_ATOMIC ); + new_skb =netdev_alloc_skb_ip_align (dev->net, pkt_len);if (!new_skb) goto err; - new_skb->len = pkt_len; +skb_put (new_skb, pkt_len); +memcpy (new_skb->data, skb->data, pkt_len);skb_pull (new_skb,AQ_RX_HW_PAD ); -skb_set_tail_pointer (new_skb, new_skb->len); - new_skb->truesize =SKB_TRUESIZE (new_skb->len);if (aqc111_data->rx_checksum)aqc111_rx_checksum (new_skb, pkt_desc);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 294/493 net: usb: sr9700: stop lying about skb->truesize
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 05417aa9c0c038da2464a0c504b9d4f99814a23b ]
Some usb drivers set small skb->truesize and break core networking stacks.
In this patch, I removed one of the skb->truesize override.
I also replaced one skb_clone() by an allocation of a fresh and small skb, to get minimally sized skbs, like we did in commit 1e2c61172342 ("net: cdc_ncm: reduce skb truesize in rx path") and 4ce62d5b2f7a ("net: usb: ax88179_178a:
stop lying about skb->truesize")
--- drivers/net/usb/sr9700.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/net/usb/sr9700.c +3 -7
@@ -421,19 +421,15 @@ static int sr9700_rx_fixup(struct usbnet *dev, struct sk_buff *skb)skb_pull (skb,3 ); skb->len = len;skb_set_tail_pointer (skb, len); - skb->truesize = len +sizeof (struct sk_buff );return 2 ; } -/* skb_clone is used for address align */ - sr_skb =skb_clone (skb,GFP_ATOMIC ); + sr_skb =netdev_alloc_skb_ip_align (dev->net, len);if (!sr_skb)return 0 ; - sr_skb->len = len; - sr_skb->data = skb->data +3 ; -skb_set_tail_pointer (sr_skb, len); - sr_skb->truesize = len +sizeof (struct sk_buff ); +skb_put (sr_skb, len); +memcpy (sr_skb->data, skb->data +3 , len);usbnet_skb_return (dev, sr_skb);skb_pull (skb, len +SR_RX_OVERHEAD );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 295/493 m68k: Fix spinlock race in kernel thread creation
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Schmitz <[email protected]>
[ Upstream commit da89ce46f02470ef08f0f580755d14d547da59ed ]
Context switching does take care to retain the correct lock owner across the switch from 'prev' to 'next' tasks. This does rely on interrupts remaining disabled for the entire duration of the switch.
This condition is guaranteed for normal process creation and context switching between already running processes, because both 'prev' and 'next' already have interrupts disabled in their saved copies of the status register.
The situation is different for newly created kernel threads. The status register is set to PS_S in copy_thread(), which does leave the IPL at 0. Upon restoring the 'next' thread's status register in switch_to() aka resume(), interrupts then become enabled prematurely. resume() then returns via ret_from_kernel_thread() and schedule_tail() where run queue lock is released (see finish_task_switch() and finish_lock_switch()).
A timer interrupt calling scheduler_tick() before the lock is released in finish_task_switch() will find the lock already taken, with the current task as lock owner. This causes a spinlock recursion warning as reported by Guenter Roeck.
As far as I can ascertain, this race has been opened in commit 533e6903bea0 ("m68k: split ret_from_fork(), simplify kernel_thread()") but I haven't done a detailed study of kernel history so it may well predate that commit.
Interrupts cannot be disabled in the saved status register copy for kernel threads (init will complain about interrupts disabled when finally starting user space). Disable interrupts temporarily when switching the tasks' register sets in resume().
Note that a simple oriw 0x700,%sr after restoring sr is not enough here
- this leaves enough of a race for the 'spinlock recursion' warning to still be observed.
Tested on ARAnyM and qemu (Quadra 800 emulation).
--- arch/m68k/kernel/entry.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/m68k/kernel/entry.S +3 -1
@@ -430,7 +430,9 @@ resume: movec %a0,%dfc /* restore status register */ - movew %a1@(TASK_THREAD+THREAD_SR),%sr + movew %a1@(TASK_THREAD+THREAD_SR),%d0 + oriw #0x0700,%d0 + movew %d0,%sr rts
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 296/493 m68k: mac: Fix reboot hang on Mac IIci
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Finn Thain <[email protected]>
[ Upstream commit 265a3b322df9a973ff1fc63da70af456ab6ae1d6 ]
Calling mac_reset() on a Mac IIci does reset the system, but what follows is a POST failure that requires a manual reset to resolve. Avoid that by using the 68030 asm implementation instead of the C implementation.
Apparently the SE/30 has a similar problem as it has used the asm implementation since before git. This patch extends that solution to other systems with a similar ROM.
After this patch, the only systems still using the C implementation are 68040 systems where adb_type is either MAC_ADB_IOP or MAC_ADB_II. This implies a 1 MiB Quadra ROM.
This now includes the Quadra 900/950, which previously fell through to the "should never get here" catch-all.
--- arch/m68k/mac/misc.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-)
arch/m68k/mac/misc.c +18 -18
@@ -453,30 +453,18 @@ void mac_poweroff(void)void mac_reset (void ) { -if (macintosh_config->adb_type ==MAC_ADB_II && - macintosh_config->ident !=MAC_MODEL_SE30 ) { -/* need ROMBASE in booter */ -/* indeed, plus need to MAP THE ROM !! */ - -if (mac_bi_data.rombase ==0 ) - mac_bi_data.rombase =0x40800000 ; - -/* works on some */ - rom_reset = (void *) (mac_bi_data.rombase +0xa ); - -local_irq_disable (); -rom_reset ();#ifdef CONFIG_ADB_CUDA - }else if (macintosh_config->adb_type ==MAC_ADB_EGRET || - macintosh_config->adb_type ==MAC_ADB_CUDA ) { +if (macintosh_config->adb_type ==MAC_ADB_EGRET || + macintosh_config->adb_type ==MAC_ADB_CUDA ) {cuda_restart (); + } else#endif #ifdef CONFIG_ADB_PMU - }else if (macintosh_config->adb_type ==MAC_ADB_PB2 ) { +if (macintosh_config->adb_type ==MAC_ADB_PB2 ) {pmu_restart (); + } else#endif - }else if (CPU_IS_030 ) { - +if (CPU_IS_030 ) {/* 030-specific reset routine. The idea is general, but the * specific registers to reset are '030-specific. Until I * have a non-030 machine, I can't test anything else.
@@ -524,6 +512,18 @@ void mac_reset(void) "jmp %/a0@\n\t" /* jump to the reset vector */ ".chip 68k" : : "r" (offset), "a" (rombase) : "a0"); + }else { +/* need ROMBASE in booter */ +/* indeed, plus need to MAP THE ROM !! */ + +if (mac_bi_data.rombase ==0 ) + mac_bi_data.rombase =0x40800000 ; + +/* works on some */ + rom_reset = (void *)(mac_bi_data.rombase +0xa ); + +local_irq_disable (); +rom_reset (); }/* should never get here */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 297/493 dm-delay: fix workqueue delay_timer race
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Marzinski <[email protected]>
[ Upstream commit 8d24790ed08ab4e619ce58ed4a1b353ab77ffdc5 ]
delay_timer could be pending when delay_dtr() is called. It needs to be shut down before kdelayd_wq is destroyed, so it won't try queueing more work to kdelayd_wq while that's getting destroyed.
Also the del_timer_sync() call in delay_presuspend() doesn't protect against the timer getting immediately rearmed by the queued call to flush_delayed_bios(), but there's no real harm if that does happen. timer_delete() is less work, and is basically just as likely to stop a pointless call to flush_delayed_bios().
--- drivers/md/dm-delay.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/md/dm-delay.c +4 -2
@@ -154,8 +154,10 @@ static void delay_dtr(struct dm_target *ti) {struct delay_c *dc = ti->private; -if (dc->kdelayd_wq) +if (dc->kdelayd_wq) { +timer_shutdown_sync (&dc->delay_timer);destroy_workqueue (dc->kdelayd_wq); + }if (dc->read.dev)dm_put_device (ti, dc->read.dev);
@@ -335,7 +337,7 @@ static void delay_presuspend(struct dm_target *ti)mutex_unlock (&delayed_bios_lock);if (!delay_is_fast (dc)) -del_timer_sync (&dc->delay_timer); +timer_delete (&dc->delay_timer);flush_delayed_bios (dc, true); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 298/493 dm-delay: fix hung task introduced by kthread mode
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joel Colledge <[email protected]>
[ Upstream commit d14646f23300a5fc85be867bafdc0702c2002789 ]
If the worker thread is not woken due to a bio, then it is not woken at all. This causes the hung task check to trigger. This occurs, for instance, when no bios are submitted. Also when a delay of 0 is configured, delay_bio() returns without waking the worker.
Prevent the hung task check from triggering by creating the thread with kthread_run() instead of using kthread_create() directly.
--- drivers/md/dm-delay.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/md/dm-delay.c +1 -2
@@ -269,8 +269,7 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv)* In case of small requested delays, use kthread instead of * timers and workqueue to achieve better latency. */ - dc->worker =kthread_create (&flush_worker_fn, dc, -"dm-delay-flush-worker" ); + dc->worker =kthread_run (&flush_worker_fn, dc,"dm-delay-flush-worker" );if (IS_ERR (dc->worker)) { ret =PTR_ERR (dc->worker); dc->worker =NULL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 299/493 dm-delay: fix max_delay calculations
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Marzinski <[email protected]>
[ Upstream commit 64eb88d6caee2c8eb806a68dab3f184f14f818a4 ]
delay_ctr() pointlessly compared max_delay in cases where multiple delay classes were initialized identically. Also, when write delays were configured different than read delays, delay_ctr() never compared their value against max_delay. Fix these issues.
--- drivers/md/dm-delay.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/md/dm-delay.c +2 -3
@@ -242,19 +242,18 @@ static int delay_ctr(struct dm_target *ti, unsigned int argc, char **argv) ret =delay_class_ctr (ti, &dc->flush, argv);if (ret) goto bad; - max_delay =max (max_delay, dc->write.delay); - max_delay =max (max_delay, dc->flush.delay); goto out; } ret =delay_class_ctr (ti, &dc->write, argv +3 );if (ret) goto bad; + max_delay =max (max_delay, dc->write.delay); +if (argc ==6 ) { ret =delay_class_ctr (ti, &dc->flush, argv +3 );if (ret) goto bad; - max_delay =max (max_delay, dc->flush.delay); goto out; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 300/493 ptp: ocp: fix DPLL functions
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vadim Fedorenko <[email protected]>
[ Upstream commit a2c78977950da00aca83a3f8865d1f54e715770d ]
In ptp_ocp driver pin actions assume sma_nr starts with 1, but for DPLL subsystem callback 0-based index was used. Fix it providing proper index.
--- drivers/ptp/ptp_ocp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/ptp/ptp_ocp.c +3 -3
@@ -4277,7 +4277,7 @@ static int ptp_ocp_dpll_direction_set(const struct dpll_pin *pin,return -EOPNOTSUPP ; mode = direction ==DPLL_PIN_DIRECTION_INPUT ?SMA_MODE_IN :SMA_MODE_OUT ; -return ptp_ocp_sma_store_val (bp,0 , mode, sma_nr); +return ptp_ocp_sma_store_val (bp,0 , mode, sma_nr +1 ); } static int ptp_ocp_dpll_frequency_set(const struct dpll_pin *pin,
@@ -4298,7 +4298,7 @@ static int ptp_ocp_dpll_frequency_set(const struct dpll_pin *pin, tbl = bp->sma_op->tbl[sma->mode];for (i =0 ; tbl[i].name; i++)if (tbl[i].frequency == frequency) -return ptp_ocp_sma_store_val (bp, i, sma->mode, sma_nr); +return ptp_ocp_sma_store_val (bp, i, sma->mode, sma_nr +1 );return -EINVAL ; }
@@ -4315,7 +4315,7 @@ static int ptp_ocp_dpll_frequency_get(const struct dpll_pin *pin,u32 val;int i; - val = bp->sma_op->get (bp, sma_nr); + val = bp->sma_op->get (bp, sma_nr +1 ); tbl = bp->sma_op->tbl[sma->mode];for (i =0 ; tbl[i].name; i++)if (val == tbl[i].value) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 301/493 net: ipv6: fix wrong start position when receive hop-by-hop fragment
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: gaoxingwang <[email protected]>
[ Upstream commit 1cd354fe1e4864eeaff62f66ee513080ec946f20 ]
In IPv6, ipv6_rcv_core will parse the hop-by-hop type extension header and increase skb->transport_header by one extension header length. But if there are more other extension headers like fragment header at this time, the skb->transport_header points to the second extension header, not the transport layer header or the first extension header.
This will result in the start and nexthdrp variable not pointing to the same position in ipv6frag_thdr_trunced,
and ipv6_skip_exthdr returning incorrect offset and frag_off.Sometimes,the length of the last sharded packet is smaller than the calculated incorrect offset, resulting in packet loss. We can use network header to offset and calculate the correct position to solve this problem.
--- net/ipv6/reassembly.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/reassembly.c +1 -1
@@ -369,7 +369,7 @@ static int ipv6_frag_rcv(struct sk_buff *skb)* the source of the fragment, with the Pointer field set to zero. */ nexthdr = hdr->nexthdr; -if (ipv6frag_thdr_truncated (skb,skb_transport_offset (skb), &nexthdr)) { +if (ipv6frag_thdr_truncated (skb,skb_network_offset (skb) +sizeof (struct ipv6hdr ), &nexthdr)) {__IP6_INC_STATS (net,__in6_dev_get_safely (skb->dev),IPSTATS_MIB_INHDRERRORS );icmpv6_param_prob (skb,ICMPV6_HDR_INCOMP ,0 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 302/493 eth: sungem: remove .ndo_poll_controller to avoid deadlocks
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit ac0a230f719b02432d8c7eba7615ebd691da86f4 ]
Erhard reports netpoll warnings from sungem:
netpoll_send_skb_on_dev(): eth0 enabled interrupts in poll (gem_start_xmit+0x0/0x398)
WARNING: CPU: 1 PID: 1 at net/core/netpoll.c:370 netpoll_send_skb+0x1fc/0x20c
gem_poll_controller() disables interrupts, which may sleep. We can't sleep in netpoll, it has interrupts disabled completely. Strangely, gem_poll_controller() doesn't even poll the completions, and instead acts as if an interrupt has fired so it just schedules NAPI and exits. None of this has been necessary for years, since netpoll invokes NAPI directly.
--- drivers/net/ethernet/sun/sungem.c | 14 -------------- 1 file changed, 14 deletions(-)
drivers/net/ethernet/sun/sungem.c +0 -14
@@ -949,17 +949,6 @@ static irqreturn_t gem_interrupt(int irq, void *dev_id)return IRQ_HANDLED ; } -#ifdef CONFIG_NET_POLL_CONTROLLER -static void gem_poll_controller (struct net_device *dev) -{ -struct gem *gp =netdev_priv (dev); - -disable_irq (gp->pdev->irq); -gem_interrupt (gp->pdev->irq, dev); -enable_irq (gp->pdev->irq); -} -#endif -static void gem_tx_timeout (struct net_device *dev,unsigned int txqueue) {struct gem *gp =netdev_priv (dev);
@@ -2839,9 +2828,6 @@ static const struct net_device_ops gem_netdev_ops = { .ndo_change_mtu = gem_change_mtu, .ndo_validate_addr = eth_validate_addr, .ndo_set_mac_address = gem_set_mac_address, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = gem_poll_controller, -#endif };static int gem_init_one (struct pci_dev *pdev,const struct pci_device_id *ent)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 303/493 selftests: net: add missing config for amt.sh
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit c499fe96d3f75a5cf50de6089dd8f1cddd1301a9 ]
Test needs IPv6 multicast. smcroute currently crashes when trying to install a route in a kernel without IPv6 multicast.
--- tools/testing/selftests/net/config | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/net/config +1 -0
@@ -30,6 +30,7 @@ CONFIG_IP_GRE=m CONFIG_NETFILTER=y CONFIG_NETFILTER_ADVANCED=y CONFIG_NF_CONNTRACK=m +CONFIG_IPV6_MROUTE=y CONFIG_IPV6_SIT=y CONFIG_IP_DCCP=m CONFIG_NF_NAT=m
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 304/493 selftests: net: move amt to socat for better compatibility
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jakub Kicinski <[email protected]>
[ Upstream commit 4c639b6a7b9db236c0907aca8e92d1537076f2cd ]
The test seems to expect that nc will exit after the first received message. This is not the case with Ncat 7.94. There are multiple versions of nc out there, switch to socat for better compatibility.
Tell socat to exit after 128 bytes and pad the message.
Since the test sets -e make sure we don't set exit code (|| true) and print the pass / fail rather then silently moving over the test and just setting non-zero exit code with no output indicating what failed.
--- tools/testing/selftests/net/amt.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
tools/testing/selftests/net/amt.sh +6 -6
@@ -210,8 +210,8 @@ check_features() test_ipv4_forward() { - RESULT4=$(ip netns exec "${LISTENER}" nc -w 1 -l -u 239.0.0.1 4000) - if [ "$RESULT4" == "172.17.0.2" ]; then + RESULT4=$(ip netns exec "${LISTENER}" timeout 15 socat - UDP4-LISTEN:4000,readbytes=128 || true) + if echo "$RESULT4" | grep -q "172.17.0.2"; then printf "TEST: %-60s [ OK ]\n" "IPv4 amt multicast forwarding" exit 0 else
@@ -222,8 +222,8 @@ test_ipv4_forward() test_ipv6_forward() { - RESULT6=$(ip netns exec "${LISTENER}" nc -w 1 -l -u ff0e::5:6 6000) - if [ "$RESULT6" == "2001:db8:3::2" ]; then + RESULT6=$(ip netns exec "${LISTENER}" timeout 15 socat - UDP6-LISTEN:6000,readbytes=128 || true) + if echo "$RESULT6" | grep -q "2001:db8:3::2"; then printf "TEST: %-60s [ OK ]\n" "IPv6 amt multicast forwarding" exit 0 else
@@ -236,14 +236,14 @@ send_mcast4() { sleep 2 ip netns exec "${SOURCE}" bash -c \ - 'echo 172.17.0.2 | nc -w 1 -u 239.0.0.1 4000' & + 'printf "%s %128s" 172.17.0.2 | nc -w 1 -u 239.0.0.1 4000' & } send_mcast6() { sleep 2 ip netns exec "${SOURCE}" bash -c \ - 'echo 2001:db8:3::2 | nc -w 1 -u ff0e::5:6 6000' & + 'printf "%s %128s" 2001:db8:3::2 | nc -w 1 -u ff0e::5:6 6000' & } check_features
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 305/493 net: ethernet: mediatek: split tx and rx fields in mtk_soc_data struct
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lorenzo Bianconi <[email protected]>
[ Upstream commit ecb51fa37ee22f137a87fa140b1e9f1759949f9a ]
Split tx and rx fields in mtk_soc_data struct. This is a preliminary patch to roll back to ADMAv1 for MT7986 and MT7981 SoC in order to fix a hw hang if the device receives a corrupted packet when using ADMAv2.0.
--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 210 ++++++++++++-------- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 29 +-- 2 files changed, 139 insertions(+), 100 deletions(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +123 -87
@@ -1139,7 +1139,7 @@ static int mtk_init_fq_dma(struct mtk_eth *eth) eth->scratch_ring = eth->sram_base; else eth->scratch_ring = dma_alloc_coherent(eth->dma_dev, - cnt * soc->txrx.txd_size, + cnt * soc->tx.desc_size, ð->phy_scratch_ring,GFP_KERNEL );if (unlikely (!eth->scratch_ring))
@@ -1155,17 +1155,17 @@ static int mtk_init_fq_dma(struct mtk_eth *eth)if (unlikely (dma_mapping_error (eth->dma_dev, dma_addr)))return -ENOMEM ; - phy_ring_tail = eth->phy_scratch_ring + soc->txrx.txd_size * (cnt -1 ); + phy_ring_tail = eth->phy_scratch_ring + soc->tx.desc_size * (cnt -1 );for (i =0 ; i < cnt; i++) {dma_addr_t addr = dma_addr + i *MTK_QDMA_PAGE_SIZE ;struct mtk_tx_dma_v2 *txd; - txd = eth->scratch_ring + i * soc->txrx.txd_size; + txd = eth->scratch_ring + i * soc->tx.desc_size; txd->txd1 = addr;if (i < cnt -1 ) txd->txd2 = eth->phy_scratch_ring + - (i +1 ) * soc->txrx.txd_size; + (i +1 ) * soc->tx.desc_size; txd->txd3 =TX_DMA_PLEN0 (MTK_QDMA_PAGE_SIZE );if (MTK_HAS_CAPS (soc->caps,MTK_36BIT_DMA ))
@@ -1416,7 +1416,7 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,if (itxd == ring->last_free)return -ENOMEM ; - itx_buf =mtk_desc_to_tx_buf (ring, itxd, soc->txrx.txd_size); + itx_buf =mtk_desc_to_tx_buf (ring, itxd, soc->tx.desc_size);memset (itx_buf,0 ,sizeof (*itx_buf)); txd_info.addr = dma_map_single(eth->dma_dev, skb->data, txd_info.size,
@@ -1457,7 +1457,7 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,memset (&txd_info,0 ,sizeof (struct mtk_tx_dma_desc_info )); txd_info.size = min_t(unsigned int, frag_size, - soc->txrx.dma_max_len); + soc->tx.dma_max_len); txd_info.qid = queue; txd_info.last = i ==skb_shinfo (skb)->nr_frags -1 && !(frag_size - txd_info.size);
@@ -1470,7 +1470,7 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev,mtk_tx_set_dma_desc (dev, txd, &txd_info); tx_buf =mtk_desc_to_tx_buf (ring, txd, - soc->txrx.txd_size); + soc->tx.desc_size);if (new_desc)memset (tx_buf,0 ,sizeof (*tx_buf)); tx_buf->data = (void *)MTK_DMA_DUMMY_DESC ;
@@ -1513,7 +1513,7 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev, }else {int next_idx; - next_idx =NEXT_DESP_IDX (txd_to_idx (ring, txd, soc->txrx.txd_size), + next_idx =NEXT_DESP_IDX (txd_to_idx (ring, txd, soc->tx.desc_size), ring->dma_size);mtk_w32 (eth, next_idx,MT7628_TX_CTX_IDX0 ); }
@@ -1522,7 +1522,7 @@ static int mtk_tx_map(struct sk_buff *skb, struct net_device *dev, err_dma: do { - tx_buf = mtk_desc_to_tx_buf(ring, itxd, soc->txrx.txd_size); + tx_buf = mtk_desc_to_tx_buf(ring, itxd, soc->tx.desc_size); /* unmap dma */ mtk_tx_unmap(eth, tx_buf, NULL, false);
@@ -1547,7 +1547,7 @@ static int mtk_cal_txd_req(struct mtk_eth *eth, struct sk_buff *skb)for (i =0 ; i <skb_shinfo (skb)->nr_frags; i++) { frag = &skb_shinfo (skb)->frags[i]; nfrags +=DIV_ROUND_UP (skb_frag_size (frag), - eth->soc->txrx.dma_max_len); + eth->soc->tx.dma_max_len); } }else { nfrags +=skb_shinfo (skb)->nr_frags;
@@ -1654,7 +1654,7 @@ static struct mtk_rx_ring *mtk_get_rx_ring(struct mtk_eth *eth) ring = ð->rx_ring[i]; idx =NEXT_DESP_IDX (ring->calc_idx, ring->dma_size); - rxd = ring->dma + idx * eth->soc->txrx.rxd_size; + rxd = ring->dma + idx * eth->soc->rx.desc_size;if (rxd->rxd2 &RX_DMA_DONE ) { ring->calc_idx_update = true;return ring;
@@ -1822,7 +1822,7 @@ static int mtk_xdp_submit_frame(struct mtk_eth *eth, struct xdp_frame *xdpf, } htxd = txd; - tx_buf =mtk_desc_to_tx_buf (ring, txd, soc->txrx.txd_size); + tx_buf =mtk_desc_to_tx_buf (ring, txd, soc->tx.desc_size);memset (tx_buf,0 ,sizeof (*tx_buf)); htx_buf = tx_buf;
@@ -1841,7 +1841,7 @@ static int mtk_xdp_submit_frame(struct mtk_eth *eth, struct xdp_frame *xdpf, goto unmap; tx_buf =mtk_desc_to_tx_buf (ring, txd, - soc->txrx.txd_size); + soc->tx.desc_size);memset (tx_buf,0 ,sizeof (*tx_buf)); n_desc++; }
@@ -1879,7 +1879,7 @@ static int mtk_xdp_submit_frame(struct mtk_eth *eth, struct xdp_frame *xdpf, }else {int idx; - idx =txd_to_idx (ring, txd, soc->txrx.txd_size); + idx =txd_to_idx (ring, txd, soc->tx.desc_size);mtk_w32 (eth,NEXT_DESP_IDX (idx, ring->dma_size),MT7628_TX_CTX_IDX0 ); }
@@ -1890,7 +1890,7 @@ static int mtk_xdp_submit_frame(struct mtk_eth *eth, struct xdp_frame *xdpf, unmap:while (htxd != txd) { - tx_buf =mtk_desc_to_tx_buf (ring, htxd, soc->txrx.txd_size); + tx_buf =mtk_desc_to_tx_buf (ring, htxd, soc->tx.desc_size);mtk_tx_unmap (eth, tx_buf,NULL , false); htxd->txd3 =TX_DMA_LS0 |TX_DMA_OWNER_CPU ;
@@ -2021,7 +2021,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, goto rx_done; idx =NEXT_DESP_IDX (ring->calc_idx, ring->dma_size); - rxd = ring->dma + idx * eth->soc->txrx.rxd_size; + rxd = ring->dma + idx * eth->soc->rx.desc_size; data = ring->data[idx];if (!mtk_rx_get_desc (eth, &trxd, rxd))
@@ -2156,7 +2156,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, rxdcsum = &trxd.rxd4; } -if (*rxdcsum & eth->soc->txrx.rx_dma_l4_valid) +if (*rxdcsum & eth->soc->rx.dma_l4_valid) skb->ip_summed =CHECKSUM_UNNECESSARY ;else skb_checksum_none_assert (skb);
@@ -2280,7 +2280,7 @@ static int mtk_poll_tx_qdma(struct mtk_eth *eth, int budget,break ; tx_buf =mtk_desc_to_tx_buf (ring, desc, - eth->soc->txrx.txd_size); + eth->soc->tx.desc_size);if (!tx_buf->data)break ;
@@ -2331,7 +2331,7 @@ static int mtk_poll_tx_pdma(struct mtk_eth *eth, int budget, }mtk_tx_unmap (eth, tx_buf, &bq, true); - desc = ring->dma + cpu * eth->soc->txrx.txd_size; + desc = ring->dma + cpu * eth->soc->tx.desc_size; ring->last_free = desc;atomic_inc (&ring->free_count);
@@ -2421,7 +2421,7 @@ static int mtk_napi_rx(struct napi_struct *napi, int budget) do { int rx_done; - mtk_w32(eth, eth->soc->txrx.rx_irq_done_mask, + mtk_w32(eth, eth->soc->rx.irq_done_mask, reg_map->pdma.irq_status); rx_done = mtk_poll_rx(napi, budget - rx_done_total, eth); rx_done_total += rx_done;
@@ -2437,10 +2437,10 @@ static int mtk_napi_rx(struct napi_struct *napi, int budget)return budget; }while (mtk_r32 (eth, reg_map->pdma.irq_status) & - eth->soc->txrx.rx_irq_done_mask); + eth->soc->rx.irq_done_mask);if (napi_complete_done (napi, rx_done_total)) -mtk_rx_irq_enable (eth, eth->soc->txrx.rx_irq_done_mask); +mtk_rx_irq_enable (eth, eth->soc->rx.irq_done_mask);return rx_done_total; }
@@ -2449,7 +2449,7 @@ static int mtk_tx_alloc(struct mtk_eth *eth) {const struct mtk_soc_data *soc = eth->soc;struct mtk_tx_ring *ring = ð->tx_ring; -int i, sz = soc->txrx.txd_size; +int i, sz = soc->tx.desc_size;struct mtk_tx_dma_v2 *txd;int ring_size;u32 ofs, val;
@@ -2572,14 +2572,14 @@ static void mtk_tx_clean(struct mtk_eth *eth) }if (!MTK_HAS_CAPS (soc->caps,MTK_SRAM ) && ring->dma) {dma_free_coherent (eth->dma_dev, - ring->dma_size * soc->txrx.txd_size, + ring->dma_size * soc->tx.desc_size, ring->dma, ring->phys); ring->dma =NULL ; }if (ring->dma_pdma) {dma_free_coherent (eth->dma_dev, - ring->dma_size * soc->txrx.txd_size, + ring->dma_size * soc->tx.desc_size, ring->dma_pdma, ring->phys_pdma); ring->dma_pdma =NULL ; }
@@ -2634,15 +2634,15 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag)if (!MTK_HAS_CAPS (eth->soc->caps,MTK_SRAM ) || rx_flag !=MTK_RX_FLAGS_NORMAL ) { ring->dma =dma_alloc_coherent (eth->dma_dev, - rx_dma_size * eth->soc->txrx.rxd_size, - &ring->phys,GFP_KERNEL ); + rx_dma_size * eth->soc->rx.desc_size, + &ring->phys,GFP_KERNEL ); }else {struct mtk_tx_ring *tx_ring = ð->tx_ring; ring->dma = tx_ring->dma + tx_ring_size * - eth->soc->txrx.txd_size * (ring_no +1 ); + eth->soc->tx.desc_size * (ring_no +1 ); ring->phys = tx_ring->phys + tx_ring_size * - eth->soc->txrx.txd_size * (ring_no +1 ); + eth->soc->tx.desc_size * (ring_no +1 ); }if (!ring->dma)
@@ -2653,7 +2653,7 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag)dma_addr_t dma_addr;void *data; - rxd = ring->dma + i * eth->soc->txrx.rxd_size; + rxd = ring->dma + i * eth->soc->rx.desc_size;if (ring->page_pool) { data =mtk_page_pool_get_buff (ring->page_pool, &dma_addr,GFP_KERNEL );
@@ -2744,7 +2744,7 @@ static void mtk_rx_clean(struct mtk_eth *eth, struct mtk_rx_ring *ring, bool in_if (!ring->data[i])continue ; - rxd = ring->dma + i * eth->soc->txrx.rxd_size; + rxd = ring->dma + i * eth->soc->rx.desc_size;if (!rxd->rxd1)continue ;
@@ -2761,7 +2761,7 @@ static void mtk_rx_clean(struct mtk_eth *eth, struct mtk_rx_ring *ring, bool in_if (!in_sram && ring->dma) {dma_free_coherent (eth->dma_dev, - ring->dma_size * eth->soc->txrx.rxd_size, + ring->dma_size * eth->soc->rx.desc_size, ring->dma, ring->phys); ring->dma =NULL ; }
@@ -3124,7 +3124,7 @@ static void mtk_dma_free(struct mtk_eth *eth)netdev_reset_queue (eth->netdev[i]);if (!MTK_HAS_CAPS (soc->caps,MTK_SRAM ) && eth->scratch_ring) {dma_free_coherent (eth->dma_dev, -MTK_QDMA_RING_SIZE * soc->txrx.txd_size, +MTK_QDMA_RING_SIZE * soc->tx.desc_size, eth->scratch_ring, eth->phy_scratch_ring); eth->scratch_ring =NULL ; eth->phy_scratch_ring =0 ;
@@ -3174,7 +3174,7 @@ static irqreturn_t mtk_handle_irq_rx(int irq, void *_eth) eth->rx_events++;if (likely (napi_schedule_prep (ð->rx_napi))) { -mtk_rx_irq_disable (eth, eth->soc->txrx.rx_irq_done_mask); +mtk_rx_irq_disable (eth, eth->soc->rx.irq_done_mask);__napi_schedule (ð->rx_napi); }
@@ -3200,9 +3200,9 @@ static irqreturn_t mtk_handle_irq(int irq, void *_eth)const struct mtk_reg_map *reg_map = eth->soc->reg_map;if (mtk_r32 (eth, reg_map->pdma.irq_mask) & - eth->soc->txrx.rx_irq_done_mask) { + eth->soc->rx.irq_done_mask) {if (mtk_r32 (eth, reg_map->pdma.irq_status) & - eth->soc->txrx.rx_irq_done_mask) + eth->soc->rx.irq_done_mask)mtk_handle_irq_rx (irq, _eth); }if (mtk_r32 (eth, reg_map->tx_irq_mask) &MTK_TX_DONE_INT ) {
@@ -3220,10 +3220,10 @@ static void mtk_poll_controller(struct net_device *dev)struct mtk_eth *eth = mac->hw;mtk_tx_irq_disable (eth,MTK_TX_DONE_INT ); -mtk_rx_irq_disable (eth, eth->soc->txrx.rx_irq_done_mask); +mtk_rx_irq_disable (eth, eth->soc->rx.irq_done_mask);mtk_handle_irq_rx (eth->irq[2 ], dev);mtk_tx_irq_enable (eth,MTK_TX_DONE_INT ); - mtk_rx_irq_enable(eth, eth->soc->txrx.rx_irq_done_mask); + mtk_rx_irq_enable(eth, eth->soc->rx.irq_done_mask); }#endif
@@ -3387,7 +3387,7 @@ static int mtk_open(struct net_device *dev)napi_enable (ð->tx_napi);napi_enable (ð->rx_napi);mtk_tx_irq_enable (eth,MTK_TX_DONE_INT ); -mtk_rx_irq_enable (eth, soc->txrx.rx_irq_done_mask); +mtk_rx_irq_enable (eth, soc->rx.irq_done_mask);refcount_set (ð->dma_refcnt,1 ); }else
@@ -3471,7 +3471,7 @@ static int mtk_stop(struct net_device *dev)mtk_gdm_config (eth,MTK_GDMA_DROP_ALL );mtk_tx_irq_disable (eth,MTK_TX_DONE_INT ); -mtk_rx_irq_disable (eth, eth->soc->txrx.rx_irq_done_mask); +mtk_rx_irq_disable (eth, eth->soc->rx.irq_done_mask);napi_disable (ð->tx_napi);napi_disable (ð->rx_napi);
@@ -3947,9 +3947,9 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset)/* FE int grouping */ mtk_w32 (eth,MTK_TX_DONE_INT , reg_map->pdma.int_grp); -mtk_w32 (eth, eth->soc->txrx.rx_irq_done_mask, reg_map->pdma.int_grp +4 ); +mtk_w32 (eth, eth->soc->rx.irq_done_mask, reg_map->pdma.int_grp +4 );mtk_w32 (eth,MTK_TX_DONE_INT , reg_map->qdma.int_grp); -mtk_w32 (eth, eth->soc->txrx.rx_irq_done_mask, reg_map->qdma.int_grp +4 ); +mtk_w32 (eth, eth->soc->rx.irq_done_mask, reg_map->qdma.int_grp +4 );mtk_w32 (eth,0x21021000 ,MTK_FE_INT_GRP );if (mtk_is_netsys_v3_or_greater (eth)) {
@@ -5039,11 +5039,15 @@ static const struct mtk_soc_data mt2701_data = { .required_clks = MT7623_CLKS_BITMAP, .required_pctl = true, .version = 1, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma), - .rxd_size = sizeof(struct mtk_rx_dma), - .rx_irq_done_mask = MTK_RX_DONE_INT, - .rx_dma_l4_valid = RX_DMA_L4_VALID, + .tx = { + .desc_size = sizeof(struct mtk_tx_dma), + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, + .rx = { + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, + .dma_l4_valid = RX_DMA_L4_VALID, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, },
@@ -5059,11 +5063,15 @@ static const struct mtk_soc_data mt7621_data = { .offload_version = 1, .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma), - .rxd_size = sizeof(struct mtk_rx_dma), - .rx_irq_done_mask = MTK_RX_DONE_INT, - .rx_dma_l4_valid = RX_DMA_L4_VALID, + .tx = { + .desc_size = sizeof(struct mtk_tx_dma), + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, + .rx = { + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, + .dma_l4_valid = RX_DMA_L4_VALID, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, },
@@ -5081,11 +5089,15 @@ static const struct mtk_soc_data mt7622_data = { .hash_offset = 2, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma), - .rxd_size = sizeof(struct mtk_rx_dma), - .rx_irq_done_mask = MTK_RX_DONE_INT, - .rx_dma_l4_valid = RX_DMA_L4_VALID, + .tx = { + .desc_size = sizeof(struct mtk_tx_dma), + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, + .rx = { + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, + .dma_l4_valid = RX_DMA_L4_VALID, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, },
@@ -5102,11 +5114,15 @@ static const struct mtk_soc_data mt7623_data = { .hash_offset = 2, .foe_entry_size = MTK_FOE_ENTRY_V1_SIZE, .disable_pll_modes = true, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma), - .rxd_size = sizeof(struct mtk_rx_dma), - .rx_irq_done_mask = MTK_RX_DONE_INT, - .rx_dma_l4_valid = RX_DMA_L4_VALID, + .tx = { + .desc_size = sizeof(struct mtk_tx_dma), + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, + .rx = { + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, + .dma_l4_valid = RX_DMA_L4_VALID, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, },
@@ -5121,11 +5137,15 @@ static const struct mtk_soc_data mt7629_data = { .required_pctl = false, .has_accounting = true, .version = 1, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma), - .rxd_size = sizeof(struct mtk_rx_dma), - .rx_irq_done_mask = MTK_RX_DONE_INT, - .rx_dma_l4_valid = RX_DMA_L4_VALID, + .tx = { + .desc_size = sizeof(struct mtk_tx_dma), + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, + .rx = { + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, + .dma_l4_valid = RX_DMA_L4_VALID, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, },
@@ -5143,11 +5163,15 @@ static const struct mtk_soc_data mt7981_data = { .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma_v2), - .rxd_size = sizeof(struct mtk_rx_dma_v2), - .rx_irq_done_mask = MTK_RX_DONE_INT_V2, - .rx_dma_l4_valid = RX_DMA_L4_VALID_V2, + .tx = { + .desc_size = sizeof(struct mtk_tx_dma_v2), + .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, + .dma_len_offset = 8, + }, + .rx = { + .desc_size = sizeof(struct mtk_rx_dma_v2), + .irq_done_mask = MTK_RX_DONE_INT_V2, + .dma_l4_valid = RX_DMA_L4_VALID_V2, .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, },
@@ -5165,11 +5189,15 @@ static const struct mtk_soc_data mt7986_data = { .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V2_SIZE, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma_v2), - .rxd_size = sizeof(struct mtk_rx_dma_v2), - .rx_irq_done_mask = MTK_RX_DONE_INT_V2, - .rx_dma_l4_valid = RX_DMA_L4_VALID_V2, + .tx = { + .desc_size = sizeof(struct mtk_tx_dma_v2), + .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, + .dma_len_offset = 8, + }, + .rx = { + .desc_size = sizeof(struct mtk_rx_dma_v2), + .irq_done_mask = MTK_RX_DONE_INT_V2, + .dma_l4_valid = RX_DMA_L4_VALID_V2, .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, },
@@ -5187,11 +5215,15 @@ static const struct mtk_soc_data mt7988_data = { .hash_offset = 4, .has_accounting = true, .foe_entry_size = MTK_FOE_ENTRY_V3_SIZE, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma_v2), - .rxd_size = sizeof(struct mtk_rx_dma_v2), - .rx_irq_done_mask = MTK_RX_DONE_INT_V2, - .rx_dma_l4_valid = RX_DMA_L4_VALID_V2, + .tx = { + .desc_size = sizeof(struct mtk_tx_dma_v2), + .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, + .dma_len_offset = 8, + }, + .rx = { + .desc_size = sizeof(struct mtk_rx_dma_v2), + .irq_done_mask = MTK_RX_DONE_INT_V2, + .dma_l4_valid = RX_DMA_L4_VALID_V2, .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, .dma_len_offset = 8, },
@@ -5204,11 +5236,15 @@ static const struct mtk_soc_data rt5350_data = { .required_clks = MT7628_CLKS_BITMAP, .required_pctl = false, .version = 1, - .txrx = { - .txd_size = sizeof(struct mtk_tx_dma), - .rxd_size = sizeof(struct mtk_rx_dma), - .rx_irq_done_mask = MTK_RX_DONE_INT, - .rx_dma_l4_valid = RX_DMA_L4_VALID_PDMA, + .tx = { + .desc_size = sizeof(struct mtk_tx_dma), + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, + }, + .rx = { + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, + .dma_l4_valid = RX_DMA_L4_VALID_PDMA, .dma_max_len = MTK_TX_DMA_BUF_LEN, .dma_len_offset = 16, },
drivers/net/ethernet/mediatek/mtk_eth_soc.h +16 -13
@@ -327,8 +327,8 @@/* QDMA descriptor txd3 */ #define TX_DMA_OWNER_CPU BIT(31)#define TX_DMA_LS0 BIT(30) -#define TX_DMA_PLEN0 (x) (((x) & eth->soc->txrx.dma_max_len) << eth->soc->txrx.dma_len_offset) -#define TX_DMA_PLEN1 (x) ((x) & eth->soc->txrx.dma_max_len) +#define TX_DMA_PLEN0 (x) (((x) & eth->soc->tx.dma_max_len) << eth->soc->tx.dma_len_offset) +#define TX_DMA_PLEN1 (x) ((x) & eth->soc->tx.dma_max_len)#define TX_DMA_SWC BIT(14)#define TX_DMA_PQID GENMASK(3, 0)#define TX_DMA_ADDR64_MASK GENMASK(3, 0)
@@ -348,8 +348,8 @@/* QDMA descriptor rxd2 */ #define RX_DMA_DONE BIT(31)#define RX_DMA_LSO BIT(30) -#define RX_DMA_PREP_PLEN0 (x) (((x) & eth->soc->txrx.dma_max_len) << eth->soc->txrx.dma_len_offset) -#define RX_DMA_GET_PLEN0 (x) (((x) >> eth->soc->txrx.dma_len_offset) & eth->soc->txrx.dma_max_len) +#define RX_DMA_PREP_PLEN0 (x) (((x) & eth->soc->rx.dma_max_len) << eth->soc->rx.dma_len_offset) +#define RX_DMA_GET_PLEN0 (x) (((x) >> eth->soc->rx.dma_len_offset) & eth->soc->rx.dma_max_len)#define RX_DMA_VTAG BIT(15)#define RX_DMA_ADDR64_MASK GENMASK(3, 0)#if IS_ENABLED (CONFIG_64BIT )
@@ -1153,10 +1153,9 @@ struct mtk_reg_map {* @foe_entry_size Foe table entry size. * @has_accounting Bool indicating support for accounting of * offloaded flows. -* @txd_size Tx DMA descriptor size. -* @rxd_size Rx DMA descriptor size. -* @rx_irq_done_mask Rx irq done register mask. -* @rx_dma_l4_valid Rx DMA valid register mask. +* @desc_size Tx/Rx DMA descriptor size. +* @irq_done_mask Rx irq done register mask. +* @dma_l4_valid Rx DMA valid register mask. * @dma_max_len Max DMA tx/rx buffer length. * @dma_len_offset Tx/Rx DMA length field offset. */
@@ -1174,13 +1173,17 @@ struct mtk_soc_data {bool has_accounting;bool disable_pll_modes;struct { -u32 txd_size; -u32 rxd_size; -u32 rx_irq_done_mask; -u32 rx_dma_l4_valid; +u32 desc_size;u32 dma_max_len;u32 dma_len_offset; - } txrx; + } tx; +struct { +u32 desc_size; +u32 irq_done_mask; +u32 dma_l4_valid; +u32 dma_max_len; +u32 dma_len_offset; + } rx; };#define MTK_DMA_MONITOR_TIMEOUT msecs_to_jiffies(1000)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 306/493 net: ethernet: mediatek: use ADMAv1 instead of ADMAv2.0 on MT7981 and MT7986
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Golle <[email protected]>
[ Upstream commit 5e69ff84f3e6cc54502a902043847b37ed78afd4 ]
ADMAv2.0 is plagued by RX hangs which can't easily detected and happen upon receival of a corrupted Ethernet frame.
Use ADMAv1 instead which is also still present and usable, and doesn't suffer from that problem.
--- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 46 ++++++++++----------- 1 file changed, 23 insertions(+), 23 deletions(-)
drivers/net/ethernet/mediatek/mtk_eth_soc.c +23 -23
@@ -110,16 +110,16 @@ static const struct mtk_reg_map mt7986_reg_map = { .tx_irq_mask = 0x461c, .tx_irq_status = 0x4618, .pdma = { - .rx_ptr = 0x6100, - .rx_cnt_cfg = 0x6104, - .pcrx_ptr = 0x6108, - .glo_cfg = 0x6204, - .rst_idx = 0x6208, - .delay_irq = 0x620c, - .irq_status = 0x6220, - .irq_mask = 0x6228, - .adma_rx_dbg0 = 0x6238, - .int_grp = 0x6250, + .rx_ptr = 0x4100, + .rx_cnt_cfg = 0x4104, + .pcrx_ptr = 0x4108, + .glo_cfg = 0x4204, + .rst_idx = 0x4208, + .delay_irq = 0x420c, + .irq_status = 0x4220, + .irq_mask = 0x4228, + .adma_rx_dbg0 = 0x4238, + .int_grp = 0x4250, }, .qdma = { .qtx_cfg = 0x4400,
@@ -1107,7 +1107,7 @@ static bool mtk_rx_get_desc(struct mtk_eth *eth, struct mtk_rx_dma_v2 *rxd, rxd->rxd1 =READ_ONCE (dma_rxd->rxd1); rxd->rxd3 =READ_ONCE (dma_rxd->rxd3); rxd->rxd4 =READ_ONCE (dma_rxd->rxd4); -if (mtk_is_netsys_v2_or_greater (eth)) { +if (mtk_is_netsys_v3_or_greater (eth)) { rxd->rxd5 =READ_ONCE (dma_rxd->rxd5); rxd->rxd6 =READ_ONCE (dma_rxd->rxd6); }
@@ -2028,7 +2028,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget,break ;/* find out which mac the packet come from. values start at 1 */ -if (mtk_is_netsys_v2_or_greater (eth)) { +if (mtk_is_netsys_v3_or_greater (eth)) {u32 val =RX_DMA_GET_SPORT_V2 (trxd.rxd5);switch (val) {
@@ -2140,7 +2140,7 @@ static int mtk_poll_rx(struct napi_struct *napi, int budget, skb->dev = netdev; bytes += skb->len; -if (mtk_is_netsys_v2_or_greater (eth)) { +if (mtk_is_netsys_v3_or_greater (eth)) { reason =FIELD_GET (MTK_RXD5_PPE_CPU_REASON , trxd.rxd5); hash = trxd.rxd5 &MTK_RXD5_FOE_ENTRY ;if (hash !=MTK_RXD5_FOE_ENTRY )
@@ -2690,7 +2690,7 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int ring_no, int rx_flag) rxd->rxd3 =0 ; rxd->rxd4 =0 ; -if (mtk_is_netsys_v2_or_greater (eth)) { +if (mtk_is_netsys_v3_or_greater (eth)) { rxd->rxd5 =0 ; rxd->rxd6 =0 ; rxd->rxd7 =0 ;
@@ -3893,7 +3893,7 @@ static int mtk_hw_init(struct mtk_eth *eth, bool reset)else mtk_hw_reset (eth); -if (mtk_is_netsys_v2_or_greater (eth)) { +if (mtk_is_netsys_v3_or_greater (eth)) {/* Set FE to PDMAv2 if necessary */ val =mtk_r32 (eth,MTK_FE_GLO_MISC );mtk_w32 (eth, val |BIT (4 ),MTK_FE_GLO_MISC );
@@ -5169,11 +5169,11 @@ static const struct mtk_soc_data mt7981_data = { .dma_len_offset = 8, }, .rx = { - .desc_size = sizeof(struct mtk_rx_dma_v2), - .irq_done_mask = MTK_RX_DONE_INT_V2, + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID_V2, - .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, - .dma_len_offset = 8, + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, }, };
@@ -5195,11 +5195,11 @@ static const struct mtk_soc_data mt7986_data = { .dma_len_offset = 8, }, .rx = { - .desc_size = sizeof(struct mtk_rx_dma_v2), - .irq_done_mask = MTK_RX_DONE_INT_V2, + .desc_size = sizeof(struct mtk_rx_dma), + .irq_done_mask = MTK_RX_DONE_INT, .dma_l4_valid = RX_DMA_L4_VALID_V2, - .dma_max_len = MTK_TX_DMA_BUF_LEN_V2, - .dma_len_offset = 8, + .dma_max_len = MTK_TX_DMA_BUF_LEN, + .dma_len_offset = 16, }, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 307/493 ice: Fix package download algorithm
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Nowlin <[email protected]>
[ Upstream commit 6d51d44ecddb5c2962688ef06e55e4fbc949f04a ]
Previously, the driver assumed that all signature segments would contain one or more buffers to download. In the future, there will be signature segments that will contain no buffers to download.
Correct download flow to allow for signature segments that have zero download buffers and skip the download in this case.
--- drivers/net/ethernet/intel/ice/ice_ddp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/ice/ice_ddp.c +4 -4
@@ -1424,14 +1424,14 @@ ice_dwnld_sign_and_cfg_segs(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr, goto exit; } - conf_idx =le32_to_cpu (seg->signed_seg_idx); - start =le32_to_cpu (seg->signed_buf_start); count =le32_to_cpu (seg->signed_buf_count); - state =ice_download_pkg_sig_seg (hw, seg); -if (state) +if (state || !count) goto exit; + conf_idx =le32_to_cpu (seg->signed_seg_idx); + start =le32_to_cpu (seg->signed_buf_start); + state =ice_download_pkg_config_seg (hw, pkg_hdr, conf_idx, start, count);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 308/493 net: ethernet: cortina: Locking fixes
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
[ Upstream commit 812552808f7ff71133fc59768cdc253c5b8ca1bf ]
This fixes a probably long standing problem in the Cortina Gemini ethernet driver: there are some paths in the code where the IRQ registers are written without taking the proper locks.
--- drivers/net/ethernet/cortina/gemini.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/net/ethernet/cortina/gemini.c +10 -2
@@ -1107,10 +1107,13 @@ static void gmac_tx_irq_enable(struct net_device *netdev, {struct gemini_ethernet_port *port =netdev_priv (netdev);struct gemini_ethernet *geth = port->geth; +unsigned long flags;u32 val, mask;netdev_dbg (netdev,"%s device %d\n" , __func__, netdev->dev_id); +spin_lock_irqsave (&geth->irq_lock, flags); + mask =GMAC0_IRQ0_TXQ0_INTS << (6 * netdev->dev_id + txq);if (en)
@@ -1119,6 +1122,8 @@ static void gmac_tx_irq_enable(struct net_device *netdev, val =readl (geth->base +GLOBAL_INTERRUPT_ENABLE_0_REG ); val = en ? val | mask : val & ~mask;writel (val, geth->base +GLOBAL_INTERRUPT_ENABLE_0_REG ); + +spin_unlock_irqrestore (&geth->irq_lock, flags); }static void gmac_tx_irq (struct net_device *netdev,unsigned int txq_num)
@@ -1415,15 +1420,19 @@ static unsigned int gmac_rx(struct net_device *netdev, unsigned int budget)union gmac_rxdesc_3 word3;struct page *page =NULL ;unsigned int page_offs; +unsigned long flags;unsigned short r, w;union dma_rwptr rw;dma_addr_t mapping;int frag_nr =0 ; +spin_lock_irqsave (&geth->irq_lock, flags); rw.bits32 =readl (ptr_reg);/* Reset interrupt as all packages until here are taken into account */ writel (DEFAULT_Q0_INT_BIT << netdev->dev_id, geth->base +GLOBAL_INTERRUPT_STATUS_1_REG ); +spin_unlock_irqrestore (&geth->irq_lock, flags); + r = rw.bits.rptr; w = rw.bits.wptr;
@@ -1726,10 +1735,9 @@ static irqreturn_t gmac_irq(int irq, void *data)gmac_update_hw_stats (netdev);if (val & (GMAC0_RX_OVERRUN_INT_BIT << (netdev->dev_id *8 ))) { +spin_lock (&geth->irq_lock);writel (GMAC0_RXDERR_INT_BIT << (netdev->dev_id *8 ), geth->base +GLOBAL_INTERRUPT_STATUS_4_REG ); - -spin_lock (&geth->irq_lock);u64_stats_update_begin (&port->ir_stats_syncp); ++port->stats.rx_fifo_errors;u64_stats_update_end (&port->ir_stats_syncp);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 309/493 af_unix: Fix data races in unix_release_sock/unix_stream_sendmsg
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Breno Leitao <[email protected]>
[ Upstream commit 540bf24fba16b88c1b3b9353927204b4f1074e25 ]
A data-race condition has been identified in af_unix. In one data path, the write function unix_release_sock() atomically writes to sk->sk_shutdown using WRITE_ONCE. However, on the reader side, unix_stream_sendmsg() does not read it atomically. Consequently, this issue is causing the following KCSAN splat to occur:
BUG: KCSAN: data-race in unix_release_sock / unix_stream_sendmsg
write (marked) to 0xffff88867256ddbb of 1 bytes by task 7270 on cpu 28: unix_release_sock (net/unix/af_unix.c:640) unix_release (net/unix/af_unix.c:1050) sock_close (net/socket.c:659 net/socket.c:1421) __fput (fs/file_table.c:422) __fput_sync (fs/file_table.c:508) __se_sys_close (fs/open.c:1559 fs/open.c:1541) __x64_sys_close (fs/open.c:1541) x64_sys_call (arch/x86/entry/syscall_64.c:33) do_syscall_64 (arch/x86/entry/common.c:?) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) read to 0xffff88867256ddbb of 1 bytes by task 989 on cpu 14: unix_stream_sendmsg (net/unix/af_unix.c:2273) __sock_sendmsg (net/socket.c:730 net/socket.c:745) ____sys_sendmsg (net/socket.c:2584) __sys_sendmmsg (net/socket.c:2638 net/socket.c:2724) __x64_sys_sendmmsg (net/socket.c:2753 net/socket.c:2750 net/socket.c:2750) x64_sys_call (arch/x86/entry/syscall_64.c:33) do_syscall_64 (arch/x86/entry/common.c:?) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:130) value changed: 0x01 -> 0x03
The line numbers are related to commit dd5a440a31fa ("Linux 6.9-rc7").
Commit e1d09c2c2f57 ("af_unix: Fix data races around sk->sk_shutdown.") addressed a comparable issue in the past regarding sk->sk_shutdown. However, it overlooked resolving this particular data path. This patch only offending unix_stream_sendmsg() function, since the other reads seem to be protected by unix_state_lock() as discussed in
--- net/unix/af_unix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/unix/af_unix.c +1 -1
@@ -2209,7 +2209,7 @@ static int unix_stream_sendmsg(struct socket *sock, struct msghdr *msg, goto out_err; } -if (sk->sk_shutdown &SEND_SHUTDOWN ) +if (READ_ONCE (sk->sk_shutdown) &SEND_SHUTDOWN ) goto pipe_err;while (sent < len) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 310/493 net: usb: smsc95xx: stop lying about skb->truesize
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit d50729f1d60bca822ef6d9c1a5fb28d486bd7593 ]
Some usb drivers try to set small skb->truesize and break core networking stacks.
In this patch, I removed one of the skb->truesize override.
I also replaced one skb_clone() by an allocation of a fresh and small skb, to get minimally sized skbs, like we did in commit 1e2c61172342 ("net: cdc_ncm: reduce skb truesize in rx path") and 4ce62d5b2f7a ("net: usb: ax88179_178a:
stop lying about skb->truesize")
v3: also fix a sparse error ( https://lore.kernel.org/oe-kbuild-all/[email protected]/ )
v2: leave the skb_trim() game because smsc95xx_rx_csum_offload()
needs the csum part. (Jakub)
While we are it, use get_unaligned() in smsc95xx_rx_csum_offload().
--- drivers/net/usb/smsc95xx.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
drivers/net/usb/smsc95xx.c +7 -8
@@ -1810,9 +1810,11 @@ static int smsc95xx_reset_resume(struct usb_interface *intf)static void smsc95xx_rx_csum_offload (struct sk_buff *skb) { - skb->csum = *(u16 *)(skb_tail_pointer (skb) -2 ); +u16 *csum_ptr = (u16 *)(skb_tail_pointer (skb) -2 ); + + skb->csum = (__force __wsum )get_unaligned (csum_ptr); skb->ip_summed =CHECKSUM_COMPLETE ; -skb_trim (skb, skb->len -2 ); +skb_trim (skb, skb->len -2 );/* remove csum */ }static int smsc95xx_rx_fixup (struct usbnet *dev,struct sk_buff *skb)
@@ -1870,25 +1872,22 @@ static int smsc95xx_rx_fixup(struct usbnet *dev, struct sk_buff *skb)if (dev->net->features &NETIF_F_RXCSUM )smsc95xx_rx_csum_offload (skb);skb_trim (skb, skb->len -4 );/* remove fcs */ - skb->truesize = size +sizeof (struct sk_buff );return 1 ; } - ax_skb =skb_clone (skb,GFP_ATOMIC ); + ax_skb =netdev_alloc_skb_ip_align (dev->net, size);if (unlikely (!ax_skb)) {netdev_warn (dev->net,"Error allocating skb\n" );return 0 ; } - ax_skb->len = size; - ax_skb->data = packet; -skb_set_tail_pointer (ax_skb, size); +skb_put (ax_skb, size); +memcpy (ax_skb->data, packet, size);if (dev->net->features &NETIF_F_RXCSUM )smsc95xx_rx_csum_offload (ax_skb);skb_trim (ax_skb, ax_skb->len -4 );/* remove fcs */ - ax_skb->truesize = size +sizeof (struct sk_buff );usbnet_skb_return (dev, ax_skb); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 311/493 net: openvswitch: fix overwriting ct original tuple for ICMPv6
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Maximets <[email protected]>
[ Upstream commit 7c988176b6c16c516474f6fceebe0f055af5eb56 ]
OVS_PACKET_CMD_EXECUTE has 3 main attributes:
- OVS_PACKET_ATTR_KEY - Packet metadata in a netlink format.
- OVS_PACKET_ATTR_PACKET - Binary packet content.
- OVS_PACKET_ATTR_ACTIONS - Actions to execute on the packet.
OVS_PACKET_ATTR_KEY is parsed first to populate sw_flow_key structure with the metadata like conntrack state, input port, recirculation id, etc. Then the packet itself gets parsed to populate the rest of the keys from the packet headers.
Whenever the packet parsing code starts parsing the ICMPv6 header, it first zeroes out fields in the key corresponding to Neighbor Discovery information even if it is not an ND packet.
It is an 'ipv6.nd' field. However, the 'ipv6' is a union that shares the space between 'nd' and 'ct_orig' that holds the original tuple conntrack metadata parsed from the OVS_PACKET_ATTR_KEY.
ND packets should not normally have conntrack state, so it's fine to share the space, but normal ICMPv6 Echo packets or maybe other types of ICMPv6 can have the state attached and it should not be overwritten.
The issue results in all but the last 4 bytes of the destination address being wiped from the original conntrack tuple leading to incorrect packet matching and potentially executing wrong actions in case this packet recirculates within the datapath or goes back to userspace.
ND fields should not be accessed in non-ND packets, so not clearing them should be fine. Executing memset() only for actual ND packets to avoid the issue.
Initializing the whole thing before parsing is needed because ND packet may not contain all the options.
The issue only affects the OVS_PACKET_CMD_EXECUTE path and doesn't affect packets entering OVS datapath from network interfaces, because in this case CT metadata is populated from skb after the packet is already parsed.
--- net/openvswitch/flow.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/openvswitch/flow.c +2 -1
@@ -561,7 +561,6 @@ static int parse_icmpv6(struct sk_buff *skb, struct sw_flow_key *key,*/ key->tp.src =htons (icmp->icmp6_type); key->tp.dst =htons (icmp->icmp6_code); -memset (&key->ipv6.nd,0 ,sizeof (key->ipv6.nd)); if (icmp->icmp6_code == 0 && (icmp->icmp6_type == NDISC_NEIGHBOUR_SOLICITATION ||
@@ -570,6 +569,8 @@ static int parse_icmpv6(struct sk_buff *skb, struct sw_flow_key *key,struct nd_msg *nd;int offset; +memset (&key->ipv6.nd,0 ,sizeof (key->ipv6.nd)); +/* In order to process neighbor discovery options, we need the * entire packet. */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 312/493 ipv6: sr: add missing seg6_local_exit
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit 3321687e321307629c71b664225b861ebf3e5753 ]
Currently, we only call seg6_local_exit() in seg6_init() if seg6_local_init() failed. But forgot to call it in seg6_exit().
--- net/ipv6/seg6.c | 1 + 1 file changed, 1 insertion(+)
net/ipv6/seg6.c +1 -0
@@ -564,6 +564,7 @@ void seg6_exit(void)seg6_hmac_exit ();#endif #ifdef CONFIG_IPV6_SEG6_LWTUNNEL +seg6_local_exit ();seg6_iptunnel_exit ();#endif unregister_pernet_subsys (&ip6_segments_ops);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 313/493 ipv6: sr: fix incorrect unregister order
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit 6e370a771d2985107e82d0f6174381c1acb49c20 ]
Commit 5559cea2d5aa ("ipv6: sr: fix possible use-after-free and null-ptr-deref") changed the register order in seg6_init(). But the unregister order in seg6_exit() is not updated.
--- net/ipv6/seg6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/seg6.c +1 -1
@@ -567,6 +567,6 @@ void seg6_exit(void)seg6_local_exit ();seg6_iptunnel_exit ();#endif -unregister_pernet_subsys (&ip6_segments_ops);genl_unregister_family (&seg6_genl_family); +unregister_pernet_subsys (&ip6_segments_ops); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 314/493 ipv6: sr: fix invalid unregister error path
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit 160e9d2752181fcf18c662e74022d77d3164cd45 ]
The error path of seg6_init() is wrong in case CONFIG_IPV6_SEG6_LWTUNNEL is not defined. In that case if seg6_hmac_init() fails, the genl_unregister_family() isn't called.
This issue exist since commit 46738b1317e1 ("ipv6: sr: add option to control lwtunnel support"), and commit 5559cea2d5aa ("ipv6: sr: fix possible use-after-free and null-ptr-deref") replaced unregister_pernet_subsys() with genl_unregister_family() in this error path.
--- net/ipv6/seg6.c | 2 ++ 1 file changed, 2 insertions(+)
net/ipv6/seg6.c +2 -0
@@ -551,6 +551,8 @@ int __init seg6_init(void)#endif #ifdef CONFIG_IPV6_SEG6_LWTUNNEL out_unregister_genl: +#endif +#if IS_ENABLED (CONFIG_IPV6_SEG6_LWTUNNEL ) ||IS_ENABLED (CONFIG_IPV6_SEG6_HMAC )genl_unregister_family (&seg6_genl_family);#endif out_unregister_pernet:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 315/493 net/mlx5: Fix peer devlink set for SF representor devlink port
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shay Drory <[email protected]>
[ Upstream commit 3c453e8cc672de1f9c662948dba43176bc68d7f0 ]
The cited patch change register devlink flow, and neglect to reflect the changes for peer devlink set logic. Peer devlink set is triggering a call trace if done after devl_register.[1]
Hence, align peer devlink set logic with register devlink flow.
[1]
WARNING: CPU: 4 PID: 3394 at net/devlink/core.c:155 devlink_rel_nested_in_add+0x177/0x180 CPU: 4 PID: 3394 Comm: kworker/u40:1 Not tainted 6.9.0-rc4_for_linust_min_debug_2024_04_16_14_08 #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 Workqueue: mlx5_vhca_event0 mlx5_vhca_state_work_handler [mlx5_core] RIP: 0010:devlink_rel_nested_in_add+0x177/0x180 Call Trace: <TASK> ? __warn+0x78/0x120 ? devlink_rel_nested_in_add+0x177/0x180 ? report_bug+0x16d/0x180 ? handle_bug+0x3c/0x60 ? exc_invalid_op+0x14/0x70 ? asm_exc_invalid_op+0x16/0x20 ? devlink_port_init+0x30/0x30 ? devlink_port_type_clear+0x50/0x50 ? devlink_rel_nested_in_add+0x177/0x180 ? devlink_rel_nested_in_add+0xdd/0x180 mlx5_sf_mdev_event+0x74/0xb0 [mlx5_core] notifier_call_chain+0x35/0xb0 blocking_notifier_call_chain+0x3d/0x60 mlx5_blocking_notifier_call_chain+0x22/0x30 [mlx5_core] mlx5_sf_dev_probe+0x185/0x3e0 [mlx5_core] auxiliary_bus_probe+0x38/0x80 ? driver_sysfs_add+0x51/0x80 really_probe+0xc5/0x3a0 ? driver_probe_device+0x90/0x90 __driver_probe_device+0x80/0x160 driver_probe_device+0x1e/0x90 __device_attach_driver+0x7d/0x100 bus_for_each_drv+0x80/0xd0 __device_attach+0xbc/0x1f0 bus_probe_device+0x86/0xa0 device_add+0x64f/0x860 __auxiliary_device_add+0x3b/0xa0 mlx5_sf_dev_add+0x139/0x330 [mlx5_core] mlx5_sf_dev_state_change_handler+0x1e4/0x250 [mlx5_core] notifier_call_chain+0x35/0xb0 blocking_notifier_call_chain+0x3d/0x60 mlx5_vhca_state_work_handler+0x151/0x200 [mlx5_core] process_one_work+0x13f/0x2e0 worker_thread+0x2bd/0x3c0 ? rescuer_thread+0x410/0x410 kthread+0xc4/0xf0 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x2d/0x50 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork_asm+0x11/0x20 </TASK>
--- .../net/ethernet/mellanox/mlx5/core/main.c | 14 +++++--------- .../mellanox/mlx5/core/sf/dev/driver.c | 19 ++++++++----------- 2 files changed, 13 insertions(+), 20 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/main.c +5 -9
@@ -1680,6 +1680,8 @@ int mlx5_init_one_light(struct mlx5_core_dev *dev)struct devlink *devlink =priv_to_devlink (dev);int err; +devl_lock (devlink); +devl_register (devlink); dev->state =MLX5_DEVICE_STATE_UP ; err =mlx5_function_enable (dev, true,mlx5_tout_ms (dev,FW_PRE_INIT_TIMEOUT ));if (err) {
@@ -1693,27 +1695,21 @@ int mlx5_init_one_light(struct mlx5_core_dev *dev) goto query_hca_caps_err; } -devl_lock (devlink); -devl_register (devlink); - err =mlx5_devlink_params_register (priv_to_devlink (dev));if (err) {mlx5_core_warn (dev,"mlx5_devlink_param_reg err = %d\n" , err); - goto params_reg_err; + goto query_hca_caps_err; }devl_unlock (devlink);return 0 ; -params_reg_err: -devl_unregister (devlink); -devl_unlock (devlink); query_hca_caps_err: -devl_unregister (devlink); -devl_unlock (devlink);mlx5_function_disable (dev, true); out: dev->state =MLX5_DEVICE_STATE_INTERNAL_ERROR ; +devl_unregister (devlink); +devl_unlock (devlink);return err; }
drivers/net/ethernet/mellanox/mlx5/core/sf/dev/driver.c +8 -11
@@ -60,6 +60,13 @@ static int mlx5_sf_dev_probe(struct auxiliary_device *adev, const struct auxilia goto remap_err; } +/* Peer devlink logic expects to work on unregistered devlink instance. */ + err =mlx5_core_peer_devlink_set (sf_dev, devlink); +if (err) { +mlx5_core_warn (mdev,"mlx5_core_peer_devlink_set err=%d\n" , err); + goto peer_devlink_set_err; + } +if (MLX5_ESWITCH_MANAGER (sf_dev->parent_mdev)) err =mlx5_init_one_light (mdev);else
@@ -69,20 +76,10 @@ static int mlx5_sf_dev_probe(struct auxiliary_device *adev, const struct auxilia goto init_one_err; } - err =mlx5_core_peer_devlink_set (sf_dev, devlink); -if (err) { -mlx5_core_warn (mdev,"mlx5_core_peer_devlink_set err=%d\n" , err); - goto peer_devlink_set_err; - } -return 0 ; -peer_devlink_set_err: -if (mlx5_dev_is_lightweight (sf_dev->mdev)) -mlx5_uninit_one_light (sf_dev->mdev); -else -mlx5_uninit_one (sf_dev->mdev); init_one_err: +peer_devlink_set_err:iounmap (mdev->iseg); remap_err:mlx5_mdev_uninit (mdev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 316/493 net/mlx5: Reload only IB representors upon lag disable/enable
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maher Sanalla <[email protected]>
[ Upstream commit 0f06228d4a2dcc1fca5b3ddb0eefa09c05b102c4 ]
On lag disable, the bond IB device along with all of its representors are destroyed, and then the slaves' representors get reloaded.
In case the slave IB representor load fails, the eswitch error flow unloads all representors, including ethernet representors, where the netdevs get detached and removed from lag bond. Such flow is inaccurate as the lag driver is not responsible for loading/unloading ethernet representors. Furthermore, the flow described above begins by holding lag lock to prevent bond changes during disable flow. However, when reaching the ethernet representors detachment from lag, the lag lock is required again, triggering the following deadlock:
Call trace: __switch_to+0xf4/0x148 __schedule+0x2c8/0x7d0 schedule+0x50/0xe0 schedule_preempt_disabled+0x18/0x28 __mutex_lock.isra.13+0x2b8/0x570 __mutex_lock_slowpath+0x1c/0x28 mutex_lock+0x4c/0x68 mlx5_lag_remove_netdev+0x3c/0x1a0 [mlx5_core] mlx5e_uplink_rep_disable+0x70/0xa0 [mlx5_core] mlx5e_detach_netdev+0x6c/0xb0 [mlx5_core] mlx5e_netdev_change_profile+0x44/0x138 [mlx5_core] mlx5e_netdev_attach_nic_profile+0x28/0x38 [mlx5_core] mlx5e_vport_rep_unload+0x184/0x1b8 [mlx5_core] mlx5_esw_offloads_rep_load+0xd8/0xe0 [mlx5_core] mlx5_eswitch_reload_reps+0x74/0xd0 [mlx5_core] mlx5_disable_lag+0x130/0x138 [mlx5_core] mlx5_lag_disable_change+0x6c/0x70 [mlx5_core] // hold ldev->lock mlx5_devlink_eswitch_mode_set+0xc0/0x410 [mlx5_core] devlink_nl_cmd_eswitch_set_doit+0xdc/0x180 genl_family_rcv_msg_doit.isra.17+0xe8/0x138 genl_rcv_msg+0xe4/0x220 netlink_rcv_skb+0x44/0x108 genl_rcv+0x40/0x58 netlink_unicast+0x198/0x268 netlink_sendmsg+0x1d4/0x418 sock_sendmsg+0x54/0x60 __sys_sendto+0xf4/0x120 __arm64_sys_sendto+0x30/0x40 el0_svc_common+0x8c/0x120 do_el0_svc+0x30/0xa0 el0_svc+0x20/0x30 el0_sync_handler+0x90/0xb8 el0_sync+0x160/0x180
Thus, upon lag enable/disable, load and unload only the IB representors of the slaves preventing the deadlock mentioned above.
While at it, refactor the mlx5_esw_offloads_rep_load() function to have a static helper method for its internal logic, in symmetry with the representor unload design.
--- .../net/ethernet/mellanox/mlx5/core/eswitch.h | 4 +-- .../mellanox/mlx5/core/eswitch_offloads.c | 28 ++++++++++++------- .../net/ethernet/mellanox/mlx5/core/lag/lag.c | 6 ++-- .../ethernet/mellanox/mlx5/core/lag/mpesw.c | 4 +-- 4 files changed, 25 insertions(+), 17 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h +2 -2
@@ -833,7 +833,7 @@ int mlx5_eswitch_offloads_single_fdb_add_one(struct mlx5_eswitch *master_esw, struct mlx5_eswitch *slave_esw, int max_slaves);void mlx5_eswitch_offloads_single_fdb_del_one (struct mlx5_eswitch *master_esw,struct mlx5_eswitch *slave_esw); -int mlx5_eswitch_reload_reps (struct mlx5_eswitch *esw); +int mlx5_eswitch_reload_ib_reps (struct mlx5_eswitch *esw);bool mlx5_eswitch_block_encap (struct mlx5_core_dev *dev);void mlx5_eswitch_unblock_encap (struct mlx5_core_dev *dev);
@@ -925,7 +925,7 @@ mlx5_eswitch_offloads_single_fdb_del_one(struct mlx5_eswitch *master_esw,static inline int mlx5_eswitch_get_npeers (struct mlx5_eswitch *esw) {return 0 ; }static inline int -mlx5_eswitch_reload_reps (struct mlx5_eswitch *esw) +mlx5_eswitch_reload_ib_reps (struct mlx5_eswitch *esw) {return 0 ; }
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +18 -10
@@ -2501,6 +2501,16 @@ void esw_offloads_cleanup(struct mlx5_eswitch *esw)esw_offloads_cleanup_reps (esw); } +static int __esw_offloads_load_rep (struct mlx5_eswitch *esw, +struct mlx5_eswitch_rep *rep,u8 rep_type) +{ +if (atomic_cmpxchg (&rep->rep_data[rep_type].state, +REP_REGISTERED ,REP_LOADED ) ==REP_REGISTERED ) +return esw->offloads.rep_ops[rep_type]->load (esw->dev, rep); + +return 0 ; +} +static void __esw_offloads_unload_rep (struct mlx5_eswitch *esw,struct mlx5_eswitch_rep *rep,u8 rep_type) {
@@ -2525,13 +2535,11 @@ static int mlx5_esw_offloads_rep_load(struct mlx5_eswitch *esw, u16 vport_num)int err; rep =mlx5_eswitch_get_rep (esw, vport_num); -for (rep_type =0 ; rep_type <NUM_REP_TYPES ; rep_type++) -if (atomic_cmpxchg (&rep->rep_data[rep_type].state, -REP_REGISTERED ,REP_LOADED ) ==REP_REGISTERED ) { - err = esw->offloads.rep_ops[rep_type]->load (esw->dev, rep); -if (err) - goto err_reps; - } +for (rep_type =0 ; rep_type <NUM_REP_TYPES ; rep_type++) { + err =__esw_offloads_load_rep (esw, rep, rep_type); +if (err) + goto err_reps; + }return 0 ;
@@ -3276,7 +3284,7 @@ static void esw_destroy_offloads_acl_tables(struct mlx5_eswitch *esw)esw_vport_destroy_offloads_acl_tables (esw, vport); } -int mlx5_eswitch_reload_reps (struct mlx5_eswitch *esw) +int mlx5_eswitch_reload_ib_reps (struct mlx5_eswitch *esw) {struct mlx5_eswitch_rep *rep;unsigned long i;
@@ -3289,13 +3297,13 @@ int mlx5_eswitch_reload_reps(struct mlx5_eswitch *esw)if (atomic_read (&rep->rep_data[REP_ETH ].state) !=REP_LOADED )return 0 ; - ret =mlx5_esw_offloads_rep_load (esw,MLX5_VPORT_UPLINK ); + ret =__esw_offloads_load_rep (esw, rep,REP_IB );if (ret)return ret;mlx5_esw_for_each_rep (esw, i, rep) {if (atomic_read (&rep->rep_data[REP_ETH ].state) ==REP_LOADED ) -mlx5_esw_offloads_rep_load (esw, rep->vport); +__esw_offloads_load_rep (esw, rep,REP_IB ); }return 0 ;
drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +3 -3
@@ -814,7 +814,7 @@ void mlx5_disable_lag(struct mlx5_lag *ldev)if (shared_fdb)for (i =0 ; i < ldev->ports; i++)if (!(ldev->pf[i].dev->priv.flags &MLX5_PRIV_FLAGS_DISABLE_ALL_ADEV )) -mlx5_eswitch_reload_reps (ldev->pf[i].dev->priv.eswitch); +mlx5_eswitch_reload_ib_reps (ldev->pf[i].dev->priv.eswitch); }static bool mlx5_shared_fdb_supported (struct mlx5_lag *ldev)
@@ -922,7 +922,7 @@ static void mlx5_do_bond(struct mlx5_lag *ldev)mlx5_rescan_drivers_locked (dev0);for (i =0 ; i < ldev->ports; i++) { - err =mlx5_eswitch_reload_reps (ldev->pf[i].dev->priv.eswitch); + err =mlx5_eswitch_reload_ib_reps (ldev->pf[i].dev->priv.eswitch);if (err)break ; }
@@ -933,7 +933,7 @@ static void mlx5_do_bond(struct mlx5_lag *ldev)mlx5_deactivate_lag (ldev);mlx5_lag_add_devices (ldev);for (i =0 ; i < ldev->ports; i++) -mlx5_eswitch_reload_reps (ldev->pf[i].dev->priv.eswitch); +mlx5_eswitch_reload_ib_reps (ldev->pf[i].dev->priv.eswitch);mlx5_core_err (dev0,"Failed to enable lag\n" );return ; }
drivers/net/ethernet/mellanox/mlx5/core/lag/mpesw.c +2 -2
@@ -99,7 +99,7 @@ static int enable_mpesw(struct mlx5_lag *ldev) dev0->priv.flags &= ~MLX5_PRIV_FLAGS_DISABLE_IB_ADEV ;mlx5_rescan_drivers_locked (dev0);for (i =0 ; i < ldev->ports; i++) { - err =mlx5_eswitch_reload_reps (ldev->pf[i].dev->priv.eswitch); + err =mlx5_eswitch_reload_ib_reps (ldev->pf[i].dev->priv.eswitch);if (err) goto err_rescan_drivers; }
@@ -113,7 +113,7 @@ static int enable_mpesw(struct mlx5_lag *ldev) err_add_devices:mlx5_lag_add_devices (ldev);for (i =0 ; i < ldev->ports; i++) -mlx5_eswitch_reload_reps (ldev->pf[i].dev->priv.eswitch); +mlx5_eswitch_reload_ib_reps (ldev->pf[i].dev->priv.eswitch);mlx5_mpesw_metadata_cleanup (ldev);return err; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 317/493 net/mlx5: Add a timeout to acquire the command queue semaphore
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akiva Goldberger <[email protected]>
[ Upstream commit 485d65e1357123a697c591a5aeb773994b247ad7 ]
Prevent forced completion handling on an entry that has not yet been assigned an index, causing an out of bounds access on idx = -22. Instead of waiting indefinitely for the sem, blocking flow now waits for index to be allocated or a sem acquisition timeout before beginning the timer for FW completion.
Kernel log example:mlx5_core 0000:06:00.0: wait_func_handle_exec_timeout:1128:(pid 185911): cmd[-22]: CREATE_UCTX(0xa04) No done completion
--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 41 +++++++++++++++---- include/linux/mlx5/driver.h | 1 + 2 files changed, 33 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +32 -9
@@ -969,19 +969,32 @@ static void cmd_work_handler(struct work_struct *work)bool poll_cmd = ent->polling;struct mlx5_cmd_layout *lay;struct mlx5_core_dev *dev; -unsigned long cb_timeout; -struct semaphore *sem; +unsigned long timeout;unsigned long flags;int alloc_ret;int cmd_mode; +complete (&ent->handling); + dev = container_of(cmd, struct mlx5_core_dev, cmd); - cb_timeout =msecs_to_jiffies (mlx5_tout_ms (dev,CMD )); + timeout =msecs_to_jiffies (mlx5_tout_ms (dev,CMD )); -complete (&ent->handling); - sem = ent->page_queue ? &cmd->vars.pages_sem : &cmd->vars.sem; -down (sem);if (!ent->page_queue) { +if (down_timeout (&cmd->vars.sem, timeout)) { +mlx5_core_warn (dev,"%s(0x%x) timed out while waiting for a slot.\n" , +mlx5_command_str (ent->op), ent->op); +if (ent->callback) { + ent->callback (-EBUSY , ent->context); +mlx5_free_cmd_msg (dev, ent->out); +free_msg (dev, ent->in); +cmd_ent_put (ent); + }else { + ent->ret = -EBUSY ; +complete (&ent->done); + } +complete (&ent->slotted); +return ; + } alloc_ret =cmd_alloc_index (cmd, ent);if (alloc_ret <0 ) {mlx5_core_err_rl (dev,"failed to allocate command entry\n" );
@@ -994,10 +1007,11 @@ static void cmd_work_handler(struct work_struct *work) ent->ret = -EAGAIN ;complete (&ent->done); } -up (sem); +up (&cmd->vars.sem);return ; } }else { +down (&cmd->vars.pages_sem); ent->idx = cmd->vars.max_reg_cmds;spin_lock_irqsave (&cmd->alloc_lock, flags);clear_bit (ent->idx, &cmd->vars.bitmask);
@@ -1005,6 +1019,8 @@ static void cmd_work_handler(struct work_struct *work)spin_unlock_irqrestore (&cmd->alloc_lock, flags); } +complete (&ent->slotted); + lay =get_inst (cmd, ent->idx); ent->lay = lay;memset (lay,0 ,sizeof (*lay));
@@ -1023,7 +1039,7 @@ static void cmd_work_handler(struct work_struct *work) ent->ts1 =ktime_get_ns (); cmd_mode = cmd->mode; -if (ent->callback &&schedule_delayed_work (&ent->cb_timeout_work, cb_timeout)) +if (ent->callback &&schedule_delayed_work (&ent->cb_timeout_work, timeout))cmd_ent_get (ent);set_bit (MLX5_CMD_ENT_STATE_PENDING_COMP , &ent->state);
@@ -1143,6 +1159,9 @@ static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) ent->ret = -ECANCELED ; goto out_err; } + +wait_for_completion (&ent->slotted); +if (cmd->mode ==CMD_MODE_POLLING || ent->polling)wait_for_completion (&ent->done);else if (!wait_for_completion_timeout (&ent->done, timeout))
@@ -1157,6 +1176,9 @@ static int wait_func(struct mlx5_core_dev *dev, struct mlx5_cmd_work_ent *ent) }else if (err == -ECANCELED ) {mlx5_core_warn (dev,"%s(0x%x) canceled on out of queue timeout.\n" ,mlx5_command_str (ent->op), ent->op); + }else if (err == -EBUSY ) { +mlx5_core_warn (dev,"%s(0x%x) timeout while waiting for command semaphore.\n" , +mlx5_command_str (ent->op), ent->op); }mlx5_core_dbg (dev,"err %d, delivery status %s(%d)\n" , err,deliv_status_to_str (ent->status), ent->status);
@@ -1208,6 +1230,7 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in, ent->polling = force_polling;init_completion (&ent->handling); +init_completion (&ent->slotted);if (!callback)init_completion (&ent->done);
@@ -1225,7 +1248,7 @@ static int mlx5_cmd_invoke(struct mlx5_core_dev *dev, struct mlx5_cmd_msg *in,return 0 ;/* mlx5_cmd_comp_handler() will put(ent) */ err =wait_func (dev, ent); -if (err == -ETIMEDOUT || err == -ECANCELED ) +if (err == -ETIMEDOUT || err == -ECANCELED || err == -EBUSY ) goto out_free; ds = ent->ts2 - ent->ts1;
include/linux/mlx5/driver.h +1 -0
@@ -861,6 +861,7 @@ struct mlx5_cmd_work_ent {void *context;int idx;struct completion handling; +struct completion slotted;struct completion done;struct mlx5_cmd *cmd;struct work_struct work;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 318/493 net/mlx5: Discard command completions in internal error
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Akiva Goldberger <[email protected]>
[ Upstream commit db9b31aa9bc56ff0d15b78f7e827d61c4a096e40 ]
Fix use after free when FW completion arrives while device is in internal error state. Avoid calling completion handler in this case, since the device will flush the command interface and trigger all completions manually.
Kernel log:
------------[ cut here ]------------ refcount_t: underflow; use-after-free. ... RIP: 0010:refcount_warn_saturate+0xd8/0xe0 ... Call Trace: <IRQ> ? __warn+0x79/0x120 ? refcount_warn_saturate+0xd8/0xe0 ? report_bug+0x17c/0x190 ? handle_bug+0x3c/0x60 ? exc_invalid_op+0x14/0x70 ? asm_exc_invalid_op+0x16/0x20 ? refcount_warn_saturate+0xd8/0xe0 cmd_ent_put+0x13b/0x160 [mlx5_core] mlx5_cmd_comp_handler+0x5f9/0x670 [mlx5_core] cmd_comp_notifier+0x1f/0x30 [mlx5_core] notifier_call_chain+0x35/0xb0 atomic_notifier_call_chain+0x16/0x20 mlx5_eq_async_int+0xf6/0x290 [mlx5_core] notifier_call_chain+0x35/0xb0 atomic_notifier_call_chain+0x16/0x20 irq_int_handler+0x19/0x30 [mlx5_core] __handle_irq_event_percpu+0x4b/0x160 handle_irq_event+0x2e/0x80 handle_edge_irq+0x98/0x230 __common_interrupt+0x3b/0xa0 common_interrupt+0x7b/0xa0 </IRQ> <TASK> asm_common_interrupt+0x22/0x40
--- drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/cmd.c +3 -0
@@ -1634,6 +1634,9 @@ static int cmd_comp_notifier(struct notifier_block *nb, dev = container_of(cmd, struct mlx5_core_dev, cmd); eqe = data; +if (dev->state ==MLX5_DEVICE_STATE_INTERNAL_ERROR ) +return NOTIFY_DONE ; +mlx5_cmd_comp_handler (dev,be32_to_cpu (eqe->data.cmd.vector), false);return NOTIFY_OK ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 319/493 s390/bpf: Emit a barrier for BPF_FETCH instructions
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Leoshkevich <[email protected]>
[ Upstream commit 68378982f0b21de02ac3c6a11e2420badefcb4bc ]
BPF_ATOMIC_OP() macro documentation states that "BPF_ADD | BPF_FETCH" should be the same as atomic_fetch_add(), which is currently not the case on s390x: the serialization instruction "bcr 14,0" is missing. This applies to "and", "or" and "xor" variants too.
s390x is allowed to reorder stores with subsequent fetches from different addresses, so code relying on BPF_FETCH acting as a barrier, for example:
stw [%r0], 1
afadd [%r1], %r2
ldxw %r3, [%r4]
may be broken. Fix it by emitting "bcr 14,0".
Note that a separate serialization instruction is not needed for BPF_XCHG and BPF_CMPXCHG, because COMPARE AND SWAP performs serialization itself.
--- arch/s390/net/bpf_jit_comp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/s390/net/bpf_jit_comp.c +6 -2
@@ -1427,8 +1427,12 @@ static noinline int bpf_jit_insn(struct bpf_jit *jit, struct bpf_prog *fp,EMIT6_DISP_LH (0xeb000000 , is32 ? (op32) : (op64), \ (insn->imm &BPF_FETCH ) ? src_reg :REG_W0 , \ src_reg, dst_reg, off); \ -if (is32 && (insn->imm &BPF_FETCH )) \ -EMIT_ZERO (src_reg); \ +if (insn->imm &BPF_FETCH ) { \ +/* bcr 14,0 - see atomic_fetch_{add,and,or,xor}() */ \ +_EMIT2 (0x07e0 ); \ +if (is32) \ +EMIT_ZERO (src_reg); \ + } \ }while (0 )case BPF_ADD :case BPF_ADD |BPF_FETCH :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 320/493 riscv, bpf: make some atomic operations fully ordered
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Puranjay Mohan <[email protected]>
[ Upstream commit 20a759df3bba35bf5c3ddec0c02ad69b603b584c ]
The BPF atomic operations with the BPF_FETCH modifier along with BPF_XCHG and BPF_CMPXCHG are fully ordered but the RISC-V JIT implements all atomic operations except BPF_CMPXCHG with relaxed ordering.
Section 8.1 of the "The RISC-V Instruction Set Manual Volume I:
Unprivileged ISA" [1], titled, "Specifying Ordering of Atomic Instructions" says:
| To provide more efficient support for release consistency [5], each | atomic instruction has two bits, aq and rl, used to specify additional | memory ordering constraints as viewed by other RISC-V harts.
and
| If only the aq bit is set, the atomic memory operation is treated as | an acquire access. | If only the rl bit is set, the atomic memory operation is treated as a | release access. | | If both the aq and rl bits are set, the atomic memory operation is | sequentially consistent.
Fix this by setting both aq and rl bits as 1 for operations with BPF_FETCH and BPF_XCHG.
[1] https://riscv.org/wp-content/uploads/2017/05/riscv-spec-v2.2.pdf
--- arch/riscv/net/bpf_jit_comp64.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
arch/riscv/net/bpf_jit_comp64.c +10 -10
@@ -516,33 +516,33 @@ static void emit_atomic(u8 rd, u8 rs, s16 off, s32 imm, bool is64,break ;/* src_reg = atomic_fetch_<op>(dst_reg + off16, src_reg) */ case BPF_ADD |BPF_FETCH : -emit (is64 ?rv_amoadd_d (rs, rs, rd,0 ,0 ) : -rv_amoadd_w (rs, rs, rd,0 ,0 ), ctx); +emit (is64 ?rv_amoadd_d (rs, rs, rd,1 ,1 ) : +rv_amoadd_w (rs, rs, rd,1 ,1 ), ctx);if (!is64)emit_zext_32 (rs, ctx);break ;case BPF_AND |BPF_FETCH : -emit (is64 ?rv_amoand_d (rs, rs, rd,0 ,0 ) : -rv_amoand_w (rs, rs, rd,0 ,0 ), ctx); +emit (is64 ?rv_amoand_d (rs, rs, rd,1 ,1 ) : +rv_amoand_w (rs, rs, rd,1 ,1 ), ctx);if (!is64)emit_zext_32 (rs, ctx);break ;case BPF_OR |BPF_FETCH : -emit (is64 ?rv_amoor_d (rs, rs, rd,0 ,0 ) : -rv_amoor_w (rs, rs, rd,0 ,0 ), ctx); +emit (is64 ?rv_amoor_d (rs, rs, rd,1 ,1 ) : +rv_amoor_w (rs, rs, rd,1 ,1 ), ctx);if (!is64)emit_zext_32 (rs, ctx);break ;case BPF_XOR |BPF_FETCH : -emit (is64 ?rv_amoxor_d (rs, rs, rd,0 ,0 ) : -rv_amoxor_w (rs, rs, rd,0 ,0 ), ctx); +emit (is64 ?rv_amoxor_d (rs, rs, rd,1 ,1 ) : +rv_amoxor_w (rs, rs, rd,1 ,1 ), ctx);if (!is64)emit_zext_32 (rs, ctx);break ;/* src_reg = atomic_xchg(dst_reg + off16, src_reg); */ case BPF_XCHG : -emit (is64 ?rv_amoswap_d (rs, rs, rd,0 ,0 ) : -rv_amoswap_w (rs, rs, rd,0 ,0 ), ctx); +emit (is64 ?rv_amoswap_d (rs, rs, rd,1 ,1 ) : +rv_amoswap_w (rs, rs, rd,1 ,1 ), ctx);if (!is64)emit_zext_32 (rs, ctx);break ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 321/493 ax25: Use kernel universal linked list to implement ax25_dev_list
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Duoming Zhou <[email protected]>
[ Upstream commit a7d6e36b9ad052926ba2ecba3a59d8bb67dabcb4 ]
The origin ax25_dev_list implements its own single linked list, which is complicated and error-prone. For example, when deleting the node of ax25_dev_list in ax25_dev_device_down(), we have to operate on the head node and other nodes separately.
This patch uses kernel universal linked list to replace original ax25_dev_list, which make the operation of ax25_dev_list easier.
We should do "dev->ax25_ptr = ax25_dev;" and "dev->ax25_ptr = NULL;" while holding the spinlock, otherwise the ax25_dev_device_up() and ax25_dev_device_down() could race.
Stable-dep-of: b505e0319852 ("ax25: Fix reference count leak issues of ax25_dev")
--- include/net/ax25.h | 3 +-- net/ax25/ax25_dev.c | 40 +++++++++++++++------------------------- 2 files changed, 16 insertions(+), 27 deletions(-)
include/net/ax25.h +1 -2
@@ -216,7 +216,7 @@ typedef struct {struct ctl_table ; typedef struct ax25_dev { - struct ax25_dev *next; + struct list_head list; struct net_device *dev; netdevice_tracker dev_tracker;
@@ -330,7 +330,6 @@ int ax25_addr_size(const ax25_digi *);void ax25_digi_invert (const ax25_digi *,ax25_digi *);/* ax25_dev.c */ -extern ax25_dev *ax25_dev_list;extern spinlock_t ax25_dev_lock;#if IS_ENABLED (CONFIG_AX25 )
net/ax25/ax25_dev.c +15 -25
@@ -22,11 +22,12 @@#include <net/sock.h> #include <linux/uaccess.h> #include <linux/fcntl.h> +#include <linux/list.h> #include <linux/mm.h> #include <linux/interrupt.h> #include <linux/init.h> -ax25_dev *ax25_dev_list; +static LIST_HEAD (ax25_dev_list);DEFINE_SPINLOCK (ax25_dev_lock);ax25_dev *ax25_addr_ax25dev (ax25_address *addr)
@@ -34,7 +35,7 @@ ax25_dev *ax25_addr_ax25dev(ax25_address *addr)ax25_dev *ax25_dev, *res =NULL ;spin_lock_bh (&ax25_dev_lock); -for (ax25_dev = ax25_dev_list; ax25_dev !=NULL ; ax25_dev = ax25_dev->next) +list_for_each_entry (ax25_dev, &ax25_dev_list, list)if (ax25cmp (addr, (const ax25_address *)ax25_dev->dev->dev_addr) ==0 ) { res = ax25_dev;ax25_dev_hold (ax25_dev);
@@ -59,7 +60,6 @@ void ax25_dev_device_up(struct net_device *dev) }refcount_set (&ax25_dev->refcount,1 ); - dev->ax25_ptr = ax25_dev; ax25_dev->dev = dev;netdev_hold (dev, &ax25_dev->dev_tracker,GFP_KERNEL ); ax25_dev->forward =NULL ;
@@ -85,8 +85,8 @@ void ax25_dev_device_up(struct net_device *dev)#endif spin_lock_bh (&ax25_dev_lock); - ax25_dev->next = ax25_dev_list; - ax25_dev_list = ax25_dev; +list_add (&ax25_dev->list, &ax25_dev_list); + dev->ax25_ptr = ax25_dev;spin_unlock_bh (&ax25_dev_lock);ax25_dev_hold (ax25_dev);
@@ -111,32 +111,25 @@ void ax25_dev_device_down(struct net_device *dev)/* * Remove any packet forwarding that points to this device. */ -for (s = ax25_dev_list; s !=NULL ; s = s->next) +list_for_each_entry (s, &ax25_dev_list, list)if (s->forward == dev) s->forward =NULL ; -if ((s = ax25_dev_list) == ax25_dev) { - ax25_dev_list = s->next; - goto unlock_put; - } - -while (s !=NULL && s->next !=NULL ) { -if (s->next == ax25_dev) { - s->next = ax25_dev->next; +list_for_each_entry (s, &ax25_dev_list, list) { +if (s == ax25_dev) { +list_del (&s->list); goto unlock_put; } - - s = s->next; } -spin_unlock_bh (&ax25_dev_lock); dev->ax25_ptr =NULL ; +spin_unlock_bh (&ax25_dev_lock);ax25_dev_put (ax25_dev);return ; unlock_put: + dev->ax25_ptr =NULL ;spin_unlock_bh (&ax25_dev_lock);ax25_dev_put (ax25_dev); - dev->ax25_ptr =NULL ;netdev_put (dev, &ax25_dev->dev_tracker);ax25_dev_put (ax25_dev); }
@@ -200,16 +193,13 @@ struct net_device *ax25_fwd_dev(struct net_device *dev)*/ void __exit ax25_dev_free(void) { -ax25_dev *s, *ax25_dev; +ax25_dev *s, *n;spin_lock_bh (&ax25_dev_lock); - ax25_dev = ax25_dev_list; -while (ax25_dev !=NULL ) { - s = ax25_dev; -netdev_put (ax25_dev->dev, &ax25_dev->dev_tracker); - ax25_dev = ax25_dev->next; +list_for_each_entry_safe (s, n, &ax25_dev_list, list) { +netdev_put (s->dev, &s->dev_tracker); +list_del (&s->list);kfree (s); } - ax25_dev_list =NULL ;spin_unlock_bh (&ax25_dev_lock); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 322/493 ax25: Fix reference count leak issues of ax25_dev
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Duoming Zhou <[email protected]>
[ Upstream commit b505e0319852b08a3a716b64620168eab21f4ced ]
The ax25_addr_ax25dev() and ax25_dev_device_down() exist a reference count leak issue of the object "ax25_dev".
Memory leak issue in ax25_addr_ax25dev():
The reference count of the object "ax25_dev" can be increased multiple times in ax25_addr_ax25dev(). This will cause a memory leak.
Memory leak issues in ax25_dev_device_down():
The reference count of ax25_dev is set to 1 in ax25_dev_device_up() and then increase the reference count when ax25_dev is added to ax25_dev_list. As a result, the reference count of ax25_dev is 2. But when the device is shutting down. The ax25_dev_device_down() drops the reference count once or twice depending on if we goto unlock_put or not, which will cause memory leak.
As for the issue of ax25_addr_ax25dev(), it is impossible for one pointer to be on a list twice. So add a break in ax25_addr_ax25dev(). As for the issue of ax25_dev_device_down(), increase the reference count of ax25_dev once in ax25_dev_device_up() and decrease the reference count of ax25_dev after it is removed from the ax25_dev_list.
--- net/ax25/ax25_dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/ax25/ax25_dev.c +1 -2
@@ -39,6 +39,7 @@ ax25_dev *ax25_addr_ax25dev(ax25_address *addr)if (ax25cmp (addr, (const ax25_address *)ax25_dev->dev->dev_addr) ==0 ) { res = ax25_dev;ax25_dev_hold (ax25_dev); +break ; }spin_unlock_bh (&ax25_dev_lock);
@@ -88,7 +89,6 @@ void ax25_dev_device_up(struct net_device *dev)list_add (&ax25_dev->list, &ax25_dev_list); dev->ax25_ptr = ax25_dev;spin_unlock_bh (&ax25_dev_lock); -ax25_dev_hold (ax25_dev);ax25_register_dev_sysctl (ax25_dev); }
@@ -129,7 +129,6 @@ void ax25_dev_device_down(struct net_device *dev) unlock_put: dev->ax25_ptr =NULL ;spin_unlock_bh (&ax25_dev_lock); -ax25_dev_put (ax25_dev);netdev_put (dev, &ax25_dev->dev_tracker);ax25_dev_put (ax25_dev); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 323/493 ax25: Fix reference count leak issue of net_device
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Duoming Zhou <[email protected]>
[ Upstream commit 36e56b1b002bb26440403053f19f9e1a8bc075b2 ]
There is a reference count leak issue of the object "net_device" in ax25_dev_device_down(). When the ax25 device is shutting down, the ax25_dev_device_down() drops the reference count of net_device one or zero times depending on if we goto unlock_put or not, which will cause memory leak.
In order to solve the above issue, decrease the reference count of net_device after dev->ax25_ptr is set to null.
--- net/ax25/ax25_dev.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
net/ax25/ax25_dev.c +1 -6
@@ -118,15 +118,10 @@ void ax25_dev_device_down(struct net_device *dev)list_for_each_entry (s, &ax25_dev_list, list) {if (s == ax25_dev) {list_del (&s->list); - goto unlock_put; +break ; } } - dev->ax25_ptr =NULL ; -spin_unlock_bh (&ax25_dev_lock); -ax25_dev_put (ax25_dev); -return ; -unlock_put: dev->ax25_ptr =NULL ;spin_unlock_bh (&ax25_dev_lock);netdev_put (dev, &ax25_dev->dev_tracker);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 324/493 dpll: fix return value check for kmemdup
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen Ni <[email protected]>
[ Upstream commit ad506586cb69292b6ac59ab95468aadd54b19ab7 ]
The return value of kmemdup() is dst->freq_supported, not src->freq_supported. Update the check accordingly.
--- drivers/dpll/dpll_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dpll/dpll_core.c +1 -1
@@ -449,7 +449,7 @@ static int dpll_pin_prop_dup(const struct dpll_pin_properties *src,sizeof (*src->freq_supported); dst->freq_supported =kmemdup (src->freq_supported, freq_size,GFP_KERNEL ); -if (!src->freq_supported) +if (!dst->freq_supported)return -ENOMEM ; }if (src->board_label) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 325/493 net: fec: remove .ndo_poll_controller to avoid deadlocks
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Fang <[email protected]>
[ Upstream commit c2e0c58b25a0a0c37ec643255558c5af4450c9f5 ]
There is a deadlock issue found in sungem driver, please refer to the commit ac0a230f719b ("eth: sungem: remove .ndo_poll_controller to avoid deadlocks"). The root cause of the issue is that netpoll is in atomic context and disable_irq() is called by .ndo_poll_controller interface of sungem driver, however, disable_irq() might sleep. After analyzing the implementation of fec_poll_controller(), the fec driver should have the same issue. Due to the fec driver uses NAPI for TX completions, the .ndo_poll_controller is unnecessary to be implemented in the fec driver, so fec_poll_controller() can be safely removed.
--- drivers/net/ethernet/freescale/fec_main.c | 26 ----------------------- 1 file changed, 26 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +0 -26
@@ -3678,29 +3678,6 @@ fec_set_mac_address(struct net_device *ndev, void *p)return 0 ; } -#ifdef CONFIG_NET_POLL_CONTROLLER -/** -* fec_poll_controller - FEC Poll controller function -* @dev: The FEC network adapter -* -* Polled functionality used by netconsole and others in non interrupt mode -* -*/ -static void fec_poll_controller (struct net_device *dev) -{ -int i; -struct fec_enet_private *fep =netdev_priv (dev); - -for (i =0 ; i <FEC_IRQ_NUM ; i++) { -if (fep->irq[i] >0 ) { -disable_irq (fep->irq[i]); -fec_enet_interrupt (fep->irq[i], dev); -enable_irq (fep->irq[i]); - } - } -} -#endif -static inline void fec_enet_set_netdev_features (struct net_device *netdev,netdev_features_t features) {
@@ -4007,9 +3984,6 @@ static const struct net_device_ops fec_netdev_ops = { .ndo_tx_timeout = fec_timeout, .ndo_set_mac_address = fec_set_mac_address, .ndo_eth_ioctl = phy_do_ioctl_running, -#ifdef CONFIG_NET_POLL_CONTROLLER - .ndo_poll_controller = fec_poll_controller, -#endif .ndo_set_features = fec_set_features, .ndo_bpf = fec_enet_bpf, .ndo_xdp_xmit = fec_enet_xdp_xmit,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 326/493 mptcp: SO_KEEPALIVE: fix getsockopt support
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
[ Upstream commit a65198136eaa15b74ee0abf73f12ef83d469a334 ]
SO_KEEPALIVE support has to be set on each subflow: on each TCP socket, where sk_prot->keepalive is defined. Technically, nothing has to be done on the MPTCP socket. That's why mptcp_sol_socket_sync_intval() was called instead of mptcp_sol_socket_intval().
Except that when nothing is done on the MPTCP socket, the getsockopt(SO_KEEPALIVE), handled in net/core/sock.c:sk_getsockopt(), will not know if SO_KEEPALIVE has been set on the different subflows or not.
The fix is simple: simply call mptcp_sol_socket_intval() which will end up calling net/core/sock.c:sk_setsockopt() where the SOCK_KEEPOPEN flag will be set, the one used in sk_getsockopt().
So now, getsockopt(SO_KEEPALIVE) on an MPTCP socket will return the same value as the one previously set with setsockopt(SO_KEEPALIVE).
--- net/mptcp/sockopt.c | 2 -- 1 file changed, 2 deletions(-)
net/mptcp/sockopt.c +0 -2
@@ -181,8 +181,6 @@ static int mptcp_setsockopt_sol_socket_int(struct mptcp_sock *msk, int optname,switch (optname) {case SO_KEEPALIVE : -mptcp_sol_socket_sync_intval (msk, optname, val); -return 0 ;case SO_DEBUG :case SO_MARK :case SO_PRIORITY :
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 327/493 mptcp: cleanup writer wake-up
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 037db6ea57da7a134a8183dead92d64ef92babee ]
After commit 5cf92bbadc58 ("mptcp: re-enable sndbuf autotune"), the MPTCP_NOSPACE bit is redundant: it is always set and cleared together with SOCK_NOSPACE.
Let's drop the first and always relay on the latter, dropping a bunch of useless code.
Stable-dep-of: bd11dc4fb969 ("mptcp: fix full TCP keep-alive support")
--- net/mptcp/protocol.c | 15 +++------------ net/mptcp/protocol.h | 16 ++++++---------- 2 files changed, 9 insertions(+), 22 deletions(-)
net/mptcp/protocol.c +3 -12
@@ -1687,15 +1687,6 @@ static void __mptcp_subflow_push_pending(struct sock *sk, struct sock *ssk, bool } } -static void mptcp_set_nospace (struct sock *sk) -{ -/* enable autotune */ -set_bit (SOCK_NOSPACE , &sk->sk_socket->flags); - -/* will be cleared on avail space */ -set_bit (MPTCP_NOSPACE , &mptcp_sk (sk)->flags); -} -static int mptcp_disconnect (struct sock *sk,int flags); static int mptcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg,
@@ -1869,7 +1860,7 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)continue ; wait_for_memory: -mptcp_set_nospace (sk); +set_bit (SOCK_NOSPACE , &sk->sk_socket->flags);__mptcp_push_pending (sk, msg->msg_flags); ret =sk_stream_wait_memory (sk, &timeo);if (ret)
@@ -3944,8 +3935,8 @@ static __poll_t mptcp_check_writeable(struct mptcp_sock *msk)if (sk_stream_is_writeable (sk))return EPOLLOUT |EPOLLWRNORM ; -mptcp_set_nospace (sk); -smp_mb__after_atomic ();/* msk->flags is changed by write_space cb */ +set_bit (SOCK_NOSPACE , &sk->sk_socket->flags); +smp_mb__after_atomic ();/* NOSPACE is changed by mptcp_write_space() */ if (sk_stream_is_writeable (sk))return EPOLLOUT |EPOLLWRNORM ;
net/mptcp/protocol.h +6 -10
@@ -113,10 +113,9 @@#define MPTCP_RST_TRANSIENT BIT(0)/* MPTCP socket atomic flags */ -#define MPTCP_NOSPACE 1 -#define MPTCP_WORK_RTX 2 -#define MPTCP_FALLBACK_DONE 4 -#define MPTCP_WORK_CLOSE_SUBFLOW 5 +#define MPTCP_WORK_RTX 1 +#define MPTCP_FALLBACK_DONE 2 +#define MPTCP_WORK_CLOSE_SUBFLOW 3/* MPTCP socket release cb flags */ #define MPTCP_PUSH_PENDING 1
@@ -792,12 +791,9 @@ static inline bool mptcp_data_fin_enabled(const struct mptcp_sock *msk)static inline void mptcp_write_space (struct sock *sk) { -if (sk_stream_is_writeable (sk)) { -/* pairs with memory barrier in mptcp_poll */ -smp_mb (); -if (test_and_clear_bit (MPTCP_NOSPACE , &mptcp_sk (sk)->flags)) -sk_stream_write_space (sk); - } +/* pairs with memory barrier in mptcp_poll */ +smp_mb (); +sk_stream_write_space (sk); }static inline void __mptcp_sync_sndbuf (struct sock *sk)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 328/493 mptcp: avoid some duplicate code in socket option handling
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit a74762675f700a5473ebe54a671a0788a5b23cc9 ]
The mptcp_get_int_option() helper is needless open-coded in a couple of places, replace the duplicate code with the helper call.
Stable-dep-of: bd11dc4fb969 ("mptcp: fix full TCP keep-alive support")
--- net/mptcp/sockopt.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
net/mptcp/sockopt.c +8 -12
@@ -627,13 +627,11 @@ static int mptcp_setsockopt_sol_tcp_cork(struct mptcp_sock *msk, sockptr_t optva {struct mptcp_subflow_context *subflow;struct sock *sk = (struct sock *)msk; -int val; - -if (optlen <sizeof (int )) -return -EINVAL ; +int val, ret; -if (copy_from_sockptr (&val, optval,sizeof (val))) -return -EFAULT ; + ret =mptcp_get_int_option (msk, optval, optlen, &val); +if (ret) +return ret;lock_sock (sk);sockopt_seq_inc (msk);
@@ -657,13 +655,11 @@ static int mptcp_setsockopt_sol_tcp_nodelay(struct mptcp_sock *msk, sockptr_t op {struct mptcp_subflow_context *subflow;struct sock *sk = (struct sock *)msk; -int val; - -if (optlen <sizeof (int )) -return -EINVAL ; +int val, ret; -if (copy_from_sockptr (&val, optval,sizeof (val))) -return -EFAULT ; + ret =mptcp_get_int_option (msk, optval, optlen, &val); +if (ret) +return ret;lock_sock (sk);sockopt_seq_inc (msk);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 329/493 mptcp: implement TCP_NOTSENT_LOWAT support
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 29b5e5ef87397963ca38d3eec0d296ad1c979bbc ]
Add support for such socket option storing the user-space provided value in a new msk field, and using such data to implement the _mptcp_stream_memory_free() helper, similar to the TCP one.
To avoid adding more indirect calls in the fast path, open-code a variant of sk_stream_memory_free() in mptcp_sendmsg() and add direct calls to the mptcp stream memory free helper where possible.
Stable-dep-of: bd11dc4fb969 ("mptcp: fix full TCP keep-alive support")
--- net/mptcp/protocol.c | 39 ++++++++++++++++++++++++++++++++++----- net/mptcp/protocol.h | 28 +++++++++++++++++++++++++++- net/mptcp/sockopt.c | 12 ++++++++++++ 3 files changed, 73 insertions(+), 6 deletions(-)
net/mptcp/protocol.c +34 -5
@@ -1757,6 +1757,30 @@ static int do_copy_data_nocache(struct sock *sk, int copy,return 0 ; } +/* open-code sk_stream_memory_free() plus sent limit computation to +* avoid indirect calls in fast-path. +* Called under the msk socket lock, so we can avoid a bunch of ONCE +* annotations. +*/ +static u32 mptcp_send_limit (const struct sock *sk) +{ +const struct mptcp_sock *msk =mptcp_sk (sk); +u32 limit, not_sent; + +if (sk->sk_wmem_queued >=READ_ONCE (sk->sk_sndbuf)) +return 0 ; + + limit =mptcp_notsent_lowat (sk); +if (limit ==UINT_MAX ) +return UINT_MAX ; + + not_sent = msk->write_seq - msk->snd_nxt; +if (not_sent >= limit) +return 0 ; + +return limit - not_sent; +} +static int mptcp_sendmsg (struct sock *sk,struct msghdr *msg,size_t len) {struct mptcp_sock *msk =mptcp_sk (sk);
@@ -1801,6 +1825,12 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)struct mptcp_data_frag *dfrag;bool dfrag_collapsed;size_t psize, offset; +u32 copy_limit; + +/* ensure fitting the notsent_lowat() constraint */ + copy_limit =mptcp_send_limit (sk); +if (!copy_limit) + goto wait_for_memory;/* reuse tail pfrag, if possible, or carve a new one from the * page allocator
@@ -1808,9 +1838,6 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) dfrag =mptcp_pending_tail (sk); dfrag_collapsed =mptcp_frag_can_collapse_to (msk, pfrag, dfrag);if (!dfrag_collapsed) { -if (!sk_stream_memory_free (sk)) - goto wait_for_memory; -if (!mptcp_page_frag_refill (sk, pfrag)) goto wait_for_memory;
@@ -1825,6 +1852,7 @@ static int mptcp_sendmsg(struct sock *sk, struct msghdr *msg, size_t len) offset = dfrag->offset + dfrag->data_len; psize = pfrag->size - offset; psize =min_t (size_t, psize,msg_data_left (msg)); + psize =min_t (size_t, psize, copy_limit); total_ts = psize + frag_truesize;if (!sk_wmem_schedule (sk, total_ts))
@@ -3761,6 +3789,7 @@ static struct proto mptcp_prot = { .unhash = mptcp_unhash, .get_port = mptcp_get_port, .forward_alloc_get = mptcp_forward_alloc_get, + .stream_memory_free = mptcp_stream_memory_free, .sockets_allocated = &mptcp_sockets_allocated, .memory_allocated = &tcp_memory_allocated,
@@ -3932,12 +3961,12 @@ static __poll_t mptcp_check_writeable(struct mptcp_sock *msk) {struct sock *sk = (struct sock *)msk; -if (sk_stream_is_writeable (sk)) +if (__mptcp_stream_is_writeable (sk,1 ))return EPOLLOUT |EPOLLWRNORM ;set_bit (SOCK_NOSPACE , &sk->sk_socket->flags);smp_mb__after_atomic ();/* NOSPACE is changed by mptcp_write_space() */ -if (sk_stream_is_writeable (sk)) +if (__mptcp_stream_is_writeable (sk,1 ))return EPOLLOUT |EPOLLWRNORM ;return 0 ;
net/mptcp/protocol.h +27 -1
@@ -305,6 +305,7 @@ struct mptcp_sock { in_accept_queue:1, free_first:1, rcvspace_init:1; +u32 notsent_lowat;struct work_struct work;struct sk_buff *ooo_last_skb;struct rb_root out_of_order_queue;
@@ -789,11 +790,36 @@ static inline bool mptcp_data_fin_enabled(const struct mptcp_sock *msk)READ_ONCE (msk->write_seq) ==READ_ONCE (msk->snd_nxt); } +static inline u32 mptcp_notsent_lowat (const struct sock *sk) +{ +struct net *net =sock_net (sk); +u32 val; + + val =READ_ONCE (mptcp_sk (sk)->notsent_lowat); +return val ?:READ_ONCE (net->ipv4.sysctl_tcp_notsent_lowat); +} + +static inline bool mptcp_stream_memory_free (const struct sock *sk,int wake) +{ +const struct mptcp_sock *msk =mptcp_sk (sk); +u32 notsent_bytes; + + notsent_bytes =READ_ONCE (msk->write_seq) -READ_ONCE (msk->snd_nxt); +return (notsent_bytes << wake) <mptcp_notsent_lowat (sk); +} + +static inline bool __mptcp_stream_is_writeable (const struct sock *sk,int wake) +{ +return mptcp_stream_memory_free (sk, wake) && +__sk_stream_is_writeable (sk, wake); +} +static inline void mptcp_write_space (struct sock *sk) {/* pairs with memory barrier in mptcp_poll */ smp_mb (); -sk_stream_write_space (sk); +if (mptcp_stream_memory_free (sk,1 )) +sk_stream_write_space (sk); }static inline void __mptcp_sync_sndbuf (struct sock *sk)
net/mptcp/sockopt.c +12 -0
@@ -810,6 +810,16 @@ static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname,return 0 ;case TCP_ULP :return -EOPNOTSUPP ; +case TCP_NOTSENT_LOWAT : + ret =mptcp_get_int_option (msk, optval, optlen, &val); +if (ret) +return ret; + +lock_sock (sk); +WRITE_ONCE (msk->notsent_lowat, val); +mptcp_write_space (sk); +release_sock (sk); +return 0 ;case TCP_CONGESTION :return mptcp_setsockopt_sol_tcp_congestion (msk, optval, optlen);case TCP_CORK :
@@ -1343,6 +1353,8 @@ static int mptcp_getsockopt_sol_tcp(struct mptcp_sock *msk, int optname,return mptcp_put_int_option (msk, optval, optlen, msk->cork);case TCP_NODELAY :return mptcp_put_int_option (msk, optval, optlen, msk->nodelay); +case TCP_NOTSENT_LOWAT : +return mptcp_put_int_option (msk, optval, optlen, msk->notsent_lowat); }return -EOPNOTSUPP ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 330/493 mptcp: cleanup SOL_TCP handling
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 7f71a337b5152ea0e7bef408d1af53778a919316 ]
Most TCP-level socket options get an integer from user space, and set the corresponding field under the msk-level socket lock.
Reduce the code duplication moving such operations in the common code.
Stable-dep-of: bd11dc4fb969 ("mptcp: fix full TCP keep-alive support")
--- net/mptcp/sockopt.c | 75 ++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 45 deletions(-)
net/mptcp/sockopt.c +30 -45
@@ -622,18 +622,11 @@ static int mptcp_setsockopt_sol_tcp_congestion(struct mptcp_sock *msk, sockptr_treturn ret; } -static int mptcp_setsockopt_sol_tcp_cork (struct mptcp_sock *msk,sockptr_t optval, -unsigned int optlen) +static int __mptcp_setsockopt_sol_tcp_cork (struct mptcp_sock *msk,int val) {struct mptcp_subflow_context *subflow;struct sock *sk = (struct sock *)msk; -int val, ret; - ret =mptcp_get_int_option (msk, optval, optlen, &val); -if (ret) -return ret; - -lock_sock (sk);sockopt_seq_inc (msk); msk->cork = !!val;mptcp_for_each_subflow (msk, subflow) {
@@ -645,23 +638,15 @@ static int mptcp_setsockopt_sol_tcp_cork(struct mptcp_sock *msk, sockptr_t optva }if (!val)mptcp_check_and_set_pending (sk); -release_sock (sk);return 0 ; } -static int mptcp_setsockopt_sol_tcp_nodelay (struct mptcp_sock *msk,sockptr_t optval, -unsigned int optlen) +static int __mptcp_setsockopt_sol_tcp_nodelay (struct mptcp_sock *msk,int val) {struct mptcp_subflow_context *subflow;struct sock *sk = (struct sock *)msk; -int val, ret; - ret =mptcp_get_int_option (msk, optval, optlen, &val); -if (ret) -return ret; - -lock_sock (sk);sockopt_seq_inc (msk); msk->nodelay = !!val;mptcp_for_each_subflow (msk, subflow) {
@@ -673,8 +658,6 @@ static int mptcp_setsockopt_sol_tcp_nodelay(struct mptcp_sock *msk, sockptr_t op }if (val)mptcp_check_and_set_pending (sk); -release_sock (sk); -return 0 ; }
@@ -797,35 +780,10 @@ static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname,int ret, val;switch (optname) { -case TCP_INQ : - ret =mptcp_get_int_option (msk, optval, optlen, &val); -if (ret) -return ret; -if (val <0 || val >1 ) -return -EINVAL ; - -lock_sock (sk); - msk->recvmsg_inq = !!val; -release_sock (sk); -return 0 ;case TCP_ULP :return -EOPNOTSUPP ; -case TCP_NOTSENT_LOWAT : - ret =mptcp_get_int_option (msk, optval, optlen, &val); -if (ret) -return ret; - -lock_sock (sk); -WRITE_ONCE (msk->notsent_lowat, val); -mptcp_write_space (sk); -release_sock (sk); -return 0 ;case TCP_CONGESTION :return mptcp_setsockopt_sol_tcp_congestion (msk, optval, optlen); -case TCP_CORK : -return mptcp_setsockopt_sol_tcp_cork (msk, optval, optlen); -case TCP_NODELAY : -return mptcp_setsockopt_sol_tcp_nodelay (msk, optval, optlen);case TCP_DEFER_ACCEPT :/* See tcp.c: TCP_DEFER_ACCEPT does not fail */ mptcp_setsockopt_first_sf_only (msk,SOL_TCP , optname, optval, optlen);
@@ -838,7 +796,34 @@ static int mptcp_setsockopt_sol_tcp(struct mptcp_sock *msk, int optname, optval, optlen); } -return -EOPNOTSUPP ; + ret =mptcp_get_int_option (msk, optval, optlen, &val); +if (ret) +return ret; + +lock_sock (sk); +switch (optname) { +case TCP_INQ : +if (val <0 || val >1 ) + ret = -EINVAL ; +else + msk->recvmsg_inq = !!val; +break ; +case TCP_NOTSENT_LOWAT : +WRITE_ONCE (msk->notsent_lowat, val); +mptcp_write_space (sk); +break ; +case TCP_CORK : + ret =__mptcp_setsockopt_sol_tcp_cork (msk, val); +break ; +case TCP_NODELAY : + ret =__mptcp_setsockopt_sol_tcp_nodelay (msk, val); +break ; +default : + ret = -ENOPROTOOPT ; + } + +release_sock (sk); +return ret; } int mptcp_setsockopt(struct sock *sk, int level, int optname,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 331/493 mptcp: fix full TCP keep-alive support
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthieu Baerts (NGI0) <[email protected]>
[ Upstream commit bd11dc4fb969ec148e50cd87f88a78246dbc4d0b ]
SO_KEEPALIVE support has been added a while ago, as part of a series "adding SOL_SOCKET" support. To have a full control of this keep-alive feature, it is important to also support TCP_KEEP* socket options at the SOL_TCP level.
Supporting them on the setsockopt() part is easy, it is just a matter of remembering each value in the MPTCP sock structure, and calling tcp_sock_set_keep*() helpers on each subflow. If the value is not modified (0), calling these helpers will not do anything. For the getsockopt() part, the corresponding value from the MPTCP sock structure or the default one is simply returned. All of this is very similar to other TCP_* socket options supported by MPTCP.
It looks important for kernels supporting SO_KEEPALIVE, to also support TCP_KEEP* options as well: some apps seem to (wrongly) consider that if the former is supported, the latter ones will be supported as well. But also, not having this simple and isolated change is preventing MPTCP support in some apps, and libraries like GoLang [1]. This is why this patch is seen as a fix.
--- net/mptcp/protocol.h | 3 +++ net/mptcp/sockopt.c | 58 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+)
net/mptcp/protocol.h +3 -0
@@ -306,6 +306,9 @@ struct mptcp_sock { free_first:1 , rcvspace_init:1;u32 notsent_lowat; +int keepalive_cnt; +int keepalive_idle; +int keepalive_intvl;struct work_struct work;struct sk_buff *ooo_last_skb;struct rb_root out_of_order_queue;
net/mptcp/sockopt.c +58 -0
88 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 332/493 net: stmmac: Offload queueMaxSDU from tc-taprio
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rohan G Thomas <[email protected]>
[ Upstream commit c5c3e1bfc9e0ee72af528df8d773980f4855938a ]
Add support for configuring queueMaxSDU. As DWMAC IPs doesn't support queueMaxSDU table handle this in the SW. The maximum 802.3 frame size that is allowed to be transmitted by any queue is queueMaxSDU + 16 bytes (i.e. 6 bytes SA + 6 bytes DA + 4 bytes FCS).
Inspired from intel i225 driver.
Stable-dep-of: 36ac9e7f2e57 ("net: stmmac: move the EST lock to struct stmmac_priv")
--- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + .../net/ethernet/stmicro/stmmac/stmmac_main.c | 22 ++++++++++++++++ .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 25 +++++++++++++++++++ include/linux/stmmac.h | 1 + 4 files changed, 49 insertions(+)
drivers/net/ethernet/stmicro/stmmac/common.h +1 -0
@@ -225,6 +225,7 @@ struct stmmac_extra_stats {unsigned long mtl_est_hlbf;unsigned long mtl_est_btre;unsigned long mtl_est_btrlm; +unsigned long max_sdu_txq_drop[MTL_MAX_TX_QUEUES ];/* per queue statistics */ struct stmmac_txq_stats txq_stats[MTL_MAX_TX_QUEUES ];struct stmmac_rxq_stats rxq_stats[MTL_MAX_RX_QUEUES ];
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +22 -0
@@ -2491,6 +2491,13 @@ static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget)if (!xsk_tx_peek_desc (pool, &xdp_desc))break ; +if (priv->plat->est && priv->plat->est->enable && + priv->plat->est->max_sdu[queue] && + xdp_desc.len > priv->plat->est->max_sdu[queue]) { + priv->xstats.max_sdu_txq_drop[queue]++; +continue ; + } +if (likely (priv->extend_desc)) tx_desc = (struct dma_desc *)(tx_q->dma_etx + entry);else if (tx_q->tbs &STMMAC_TBS_AVAIL )
@@ -4485,6 +4492,13 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)return stmmac_tso_xmit (skb, dev); } +if (priv->plat->est && priv->plat->est->enable && + priv->plat->est->max_sdu[queue] && + skb->len > priv->plat->est->max_sdu[queue]){ + priv->xstats.max_sdu_txq_drop[queue]++; + goto max_sdu_err; + } +if (unlikely (stmmac_tx_avail (priv, queue) < nfrags +1 )) {if (!netif_tx_queue_stopped (netdev_get_tx_queue (dev, queue))) { netif_tx_stop_queue(netdev_get_tx_queue(priv->dev,
@@ -4702,6 +4716,7 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev) dma_map_err:netdev_err (priv->dev,"Tx DMA map failed\n" ); +max_sdu_err:dev_kfree_skb (skb); priv->xstats.tx_dropped++;return NETDEV_TX_OK ;
@@ -4858,6 +4873,13 @@ static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue,if (stmmac_tx_avail (priv, queue) <STMMAC_TX_THRESH (priv))return STMMAC_XDP_CONSUMED ; +if (priv->plat->est && priv->plat->est->enable && + priv->plat->est->max_sdu[queue] && + xdpf->len > priv->plat->est->max_sdu[queue]) { + priv->xstats.max_sdu_txq_drop[queue]++; +return STMMAC_XDP_CONSUMED ; + } +if (likely (priv->extend_desc)) tx_desc = (struct dma_desc *)(tx_q->dma_etx + entry);else if (tx_q->tbs &STMMAC_TBS_AVAIL )
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +25 -0
@@ -915,6 +915,28 @@ struct timespec64 stmmac_calc_tas_basetime(ktime_t old_base_time,return time; } +static void tc_taprio_map_maxsdu_txq (struct stmmac_priv *priv, +struct tc_taprio_qopt_offload *qopt) +{ +struct plat_stmmacenet_data *plat = priv->plat; +u32 num_tc = qopt->mqprio.qopt.num_tc; +u32 offset, count, i, j; + +/* QueueMaxSDU received from the driver corresponds to the Linux traffic +* class. Map queueMaxSDU per Linux traffic class to DWMAC Tx queues. +*/ +for (i =0 ; i < num_tc; i++) { +if (!qopt->max_sdu[i]) +continue ; + + offset = qopt->mqprio.qopt.offset[i]; + count = qopt->mqprio.qopt.count[i]; + +for (j = offset; j < offset + count; j++) + plat->est->max_sdu[j] = qopt->max_sdu[i] +ETH_HLEN -ETH_TLEN ; + } +} +static int tc_setup_taprio (struct stmmac_priv *priv,struct tc_taprio_qopt_offload *qopt) {
@@ -1045,6 +1067,8 @@ static int tc_setup_taprio(struct stmmac_priv *priv, priv->plat->est->ter = qopt->cycle_time_extension; +tc_taprio_map_maxsdu_txq (priv, qopt); +if (fpe && !priv->dma_cap.fpesel) {mutex_unlock (&priv->plat->est->lock);return -EOPNOTSUPP ;
@@ -1126,6 +1150,7 @@ static int tc_query_caps(struct stmmac_priv *priv,return -EOPNOTSUPP ; caps->gate_mask_per_txq = true; + caps->supports_queue_max_sdu = true;return 0 ; }
include/linux/stmmac.h +1 -0
@@ -127,6 +127,7 @@ struct stmmac_est {u32 gcl_unaligned[EST_GCL ];u32 gcl[EST_GCL ];u32 gcl_size; +u32 max_sdu[MTL_MAX_TX_QUEUES ]; };struct stmmac_rxq_cfg {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 333/493 net: stmmac: est: Per Tx-queue error count for HLBF
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rohan G Thomas <[email protected]>
[ Upstream commit fd5a6a71313e27c4f601526081b69d4e76f03dea ]
Keep per Tx-queue error count on Head-Of-Line Blocking due to frame size(HLBF) error. The MAC raises HLBF error on one or more queues when none of the time Intervals of open-gates in the GCL is greater than or equal to the duration needed for frame transmission and by default drops those packets that causes HLBF error. EST_FRM_SZ_ERR register provides the One Hot encoded Queue numbers that have the Frame Size related error.
Stable-dep-of: 36ac9e7f2e57 ("net: stmmac: move the EST lock to struct stmmac_priv")
--- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + drivers/net/ethernet/stmicro/stmmac/stmmac_est.c | 6 ++++++ 2 files changed, 7 insertions(+)
drivers/net/ethernet/stmicro/stmmac/common.h +1 -0
@@ -226,6 +226,7 @@ struct stmmac_extra_stats {unsigned long mtl_est_btre;unsigned long mtl_est_btrlm;unsigned long max_sdu_txq_drop[MTL_MAX_TX_QUEUES ]; +unsigned long mtl_est_txq_hlbf[MTL_MAX_TX_QUEUES ];/* per queue statistics */ struct stmmac_txq_stats txq_stats[MTL_MAX_TX_QUEUES ];struct stmmac_rxq_stats rxq_stats[MTL_MAX_RX_QUEUES ];
drivers/net/ethernet/stmicro/stmmac/stmmac_est.c +6 -0
@@ -81,6 +81,7 @@ static void est_irq_status(struct stmmac_priv *priv, struct net_device *dev,u32 status, value, feqn, hbfq, hbfs, btrl, btrl_max;void __iomem *est_addr = priv->estaddr;u32 txqcnt_mask =BIT (txqcnt) -1 ; +int i; status =readl (est_addr +EST_STATUS );
@@ -125,6 +126,11 @@ static void est_irq_status(struct stmmac_priv *priv, struct net_device *dev, x->mtl_est_hlbf++; +for (i =0 ; i < txqcnt; i++) { +if (feqn &BIT (i)) + x->mtl_est_txq_hlbf[i]++; + } +/* Clear Interrupt */ writel (feqn, est_addr +EST_FRM_SZ_ERR );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 334/493 net: stmmac: Report taprio offload status
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rohan G Thomas <[email protected]>
[ Upstream commit 5ca63ffdb94ba2bac4c23c8609aabd7edd03c312 ]
Report taprio offload status. This includes per txq and global counters of window_drops and tx_overruns.
Window_drops count include count of frames dropped because of queueMaxSDU setting and HLBF error. Transmission overrun counter inform the user application whether any packets are currently being transmitted on a particular queue during a gate-close event.DWMAC IPs takes care Transmission overrun won't happen hence this is always 0.
Stable-dep-of: 36ac9e7f2e57 ("net: stmmac: move the EST lock to struct stmmac_priv")
--- .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 62 +++++++++++++++++-- 1 file changed, 58 insertions(+), 4 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +58 -4
@@ -937,8 +937,8 @@ static void tc_taprio_map_maxsdu_txq(struct stmmac_priv *priv, } } -static int tc_setup_taprio (struct stmmac_priv *priv, -struct tc_taprio_qopt_offload *qopt) +static int tc_taprio_configure (struct stmmac_priv *priv, +struct tc_taprio_qopt_offload *qopt) {u32 size, wid = priv->dma_cap.estwid, dep = priv->dma_cap.estdep;struct plat_stmmacenet_data *plat = priv->plat;
@@ -990,8 +990,6 @@ static int tc_setup_taprio(struct stmmac_priv *priv,if (qopt->cmd ==TAPRIO_CMD_DESTROY ) goto disable; -else if (qopt->cmd !=TAPRIO_CMD_REPLACE ) -return -EOPNOTSUPP ;if (qopt->num_entries >= dep)return -EINVAL ;
@@ -1102,6 +1100,11 @@ static int tc_setup_taprio(struct stmmac_priv *priv, priv->plat->est->enable = false;stmmac_est_configure (priv, priv, priv->plat->est, priv->plat->clk_ptp_rate); +/* Reset taprio status */ +for (i =0 ; i < priv->plat->tx_queues_to_use; i++) { + priv->xstats.max_sdu_txq_drop[i] =0 ; + priv->xstats.mtl_est_txq_hlbf[i] =0 ; + }mutex_unlock (&priv->plat->est->lock); }
@@ -1119,6 +1122,57 @@ static int tc_setup_taprio(struct stmmac_priv *priv,return ret; } +static void tc_taprio_stats (struct stmmac_priv *priv, +struct tc_taprio_qopt_offload *qopt) +{ +u64 window_drops =0 ; +int i =0 ; + +for (i =0 ; i < priv->plat->tx_queues_to_use; i++) + window_drops += priv->xstats.max_sdu_txq_drop[i] + + priv->xstats.mtl_est_txq_hlbf[i]; + qopt->stats.window_drops = window_drops; + +/* Transmission overrun doesn't happen for stmmac, hence always 0 */ + qopt->stats.tx_overruns =0 ; +} + +static void tc_taprio_queue_stats (struct stmmac_priv *priv, +struct tc_taprio_qopt_offload *qopt) +{ +struct tc_taprio_qopt_queue_stats *q_stats = &qopt->queue_stats; +int queue = qopt->queue_stats.queue; + + q_stats->stats.window_drops = priv->xstats.max_sdu_txq_drop[queue] + + priv->xstats.mtl_est_txq_hlbf[queue]; + +/* Transmission overrun doesn't happen for stmmac, hence always 0 */ + q_stats->stats.tx_overruns =0 ; +} + +static int tc_setup_taprio (struct stmmac_priv *priv, +struct tc_taprio_qopt_offload *qopt) +{ +int err =0 ; + +switch (qopt->cmd) { +case TAPRIO_CMD_REPLACE : +case TAPRIO_CMD_DESTROY : + err =tc_taprio_configure (priv, qopt); +break ; +case TAPRIO_CMD_STATS : +tc_taprio_stats (priv, qopt); +break ; +case TAPRIO_CMD_QUEUE_STATS : +tc_taprio_queue_stats (priv, qopt); +break ; +default : + err = -EOPNOTSUPP ; + } + +return err; +} +static int tc_setup_etf (struct stmmac_priv *priv,struct tc_etf_qopt_offload *qopt) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 335/493 net: stmmac: move the EST lock to struct stmmac_priv
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xiaolei Wang <[email protected]>
[ Upstream commit 36ac9e7f2e5786bd37c5cd91132e1f39c29b8197 ]
Reinitialize the whole EST structure would also reset the mutex lock which is embedded in the EST structure, and then trigger the following warning. To address this, move the lock to struct stmmac_priv. We also need to reacquire the mutex lock when doing this initialization.
DEBUG_LOCKS_WARN_ON(lock->magic != lock)
WARNING: CPU: 3 PID: 505 at kernel/locking/mutex.c:587 __mutex_lock+0xd84/0x1068 Modules linked in: CPU: 3 PID: 505 Comm: tc Not tainted 6.9.0-rc6-00053-g0106679839f7-dirty #29 Hardware name: NXP i.MX8MPlus EVK board (DT) pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : __mutex_lock+0xd84/0x1068 lr : __mutex_lock+0xd84/0x1068 sp : ffffffc0864e3570 x29: ffffffc0864e3570 x28: ffffffc0817bdc78 x27: 0000000000000003 x26: ffffff80c54f1808 x25: ffffff80c9164080 x24: ffffffc080d723ac x23: 0000000000000000 x22: 0000000000000002 x21: 0000000000000000 x20: 0000000000000000 x19: ffffffc083bc3000 x18: ffffffffffffffff x17: ffffffc08117b080 x16: 0000000000000002 x15: ffffff80d2d40000 x14: 00000000000002da x13: ffffff80d2d404b8 x12: ffffffc082b5a5c8 x11: ffffffc082bca680 x10: ffffffc082bb2640 x9 : ffffffc082bb2698 x8 : 0000000000017fe8 x7 : c0000000ffffefff x6 : 0000000000000001 x5 : ffffff8178fe0d48 x4 : 0000000000000000 x3 : 0000000000000027 x2 : ffffff8178fe0d50 x1 : 0000000000000000 x0 : 0000000000000000 Call trace: __mutex_lock+0xd84/0x1068 mutex_lock_nested+0x28/0x34 tc_setup_taprio+0x118/0x68c stmmac_setup_tc+0x50/0xf0 taprio_change+0x868/0xc9c
--- drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 ++ .../net/ethernet/stmicro/stmmac/stmmac_ptp.c | 8 ++++---- .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 18 ++++++++++-------- include/linux/stmmac.h | 1 - 4 files changed, 16 insertions(+), 13 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac.h +2 -0
@@ -260,6 +260,8 @@ struct stmmac_priv {struct stmmac_extra_stats xstats____cacheline_aligned_in_smp ;struct stmmac_safety_stats sstats;struct plat_stmmacenet_data *plat; +/* Protect est parameters */ +struct mutex est_lock;struct dma_features dma_cap;struct stmmac_counters mmc;int hw_cap_support;
drivers/net/ethernet/stmicro/stmmac/stmmac_ptp.c +4 -4
@@ -70,11 +70,11 @@ static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta)/* If EST is enabled, disabled it before adjust ptp time. */ if (priv->plat->est && priv->plat->est->enable) { est_rst = true; -mutex_lock (&priv->plat->est->lock); +mutex_lock (&priv->est_lock); priv->plat->est->enable = false;stmmac_est_configure (priv, priv, priv->plat->est, priv->plat->clk_ptp_rate); -mutex_unlock (&priv->plat->est->lock); +mutex_unlock (&priv->est_lock); }write_lock_irqsave (&priv->ptp_lock, flags);
@@ -87,7 +87,7 @@ static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta)ktime_t current_time_ns, basetime;u64 cycle_time; -mutex_lock (&priv->plat->est->lock); +mutex_lock (&priv->est_lock); priv->ptp_clock_ops.gettime64 (&priv->ptp_clock_ops, ¤t_time); current_time_ns =timespec64_to_ktime (current_time); time.tv_nsec = priv->plat->est->btr_reserve[0 ];
@@ -104,7 +104,7 @@ static int stmmac_adjust_time(struct ptp_clock_info *ptp, s64 delta) priv->plat->est->enable = true; ret =stmmac_est_configure (priv, priv, priv->plat->est, priv->plat->clk_ptp_rate); -mutex_unlock (&priv->plat->est->lock); +mutex_unlock (&priv->est_lock);if (ret)netdev_err (priv->dev,"failed to configure EST\n" ); }
drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c +10 -8
@@ -1004,17 +1004,19 @@ static int tc_taprio_configure(struct stmmac_priv *priv,if (!plat->est)return -ENOMEM ; -mutex_init (&priv->plat->est->lock); +mutex_init (&priv->est_lock); }else { +mutex_lock (&priv->est_lock);memset (plat->est,0 ,sizeof (*plat->est)); +mutex_unlock (&priv->est_lock); } size = qopt->num_entries; -mutex_lock (&priv->plat->est->lock); +mutex_lock (&priv->est_lock); priv->plat->est->gcl_size = size; priv->plat->est->enable = qopt->cmd ==TAPRIO_CMD_REPLACE ; -mutex_unlock (&priv->plat->est->lock); +mutex_unlock (&priv->est_lock);for (i =0 ; i < size; i++) {s64 delta_ns = qopt->entries[i].interval;
@@ -1045,7 +1047,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv, priv->plat->est->gcl[i] = delta_ns | (gates << wid); } -mutex_lock (&priv->plat->est->lock); +mutex_lock (&priv->est_lock);/* Adjust for real system time */ priv->ptp_clock_ops.gettime64 (&priv->ptp_clock_ops, ¤t_time); current_time_ns =timespec64_to_ktime (current_time);
@@ -1068,7 +1070,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv,tc_taprio_map_maxsdu_txq (priv, qopt);if (fpe && !priv->dma_cap.fpesel) { -mutex_unlock (&priv->plat->est->lock); +mutex_unlock (&priv->est_lock);return -EOPNOTSUPP ; }
@@ -1079,7 +1081,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv, ret =stmmac_est_configure (priv, priv, priv->plat->est, priv->plat->clk_ptp_rate); -mutex_unlock (&priv->plat->est->lock); +mutex_unlock (&priv->est_lock);if (ret) {netdev_err (priv->dev,"failed to configure EST\n" ); goto disable;
@@ -1096,7 +1098,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv, disable:if (priv->plat->est) { -mutex_lock (&priv->plat->est->lock); +mutex_lock (&priv->est_lock); priv->plat->est->enable = false;stmmac_est_configure (priv, priv, priv->plat->est, priv->plat->clk_ptp_rate);
@@ -1105,7 +1107,7 @@ static int tc_taprio_configure(struct stmmac_priv *priv, priv->xstats.max_sdu_txq_drop[i] =0 ; priv->xstats.mtl_est_txq_hlbf[i] =0 ; } -mutex_unlock (&priv->plat->est->lock); +mutex_unlock (&priv->est_lock); } priv->plat->fpe_cfg->enable = false;
include/linux/stmmac.h +0 -1
@@ -117,7 +117,6 @@ struct stmmac_axi {#define EST_GCL 1024struct stmmac_est { -struct mutex lock;int enable;u32 btr_reserve[2 ];u32 btr_offset[2 ];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 336/493 net: micrel: Fix receiving the timestamp in the frame for lan8841
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Horatiu Vultur <[email protected]>
[ Upstream commit aea27a92a41dae14843f92c79e9e42d8f570105c ]
The blamed commit started to use the ptp workqueue to get the second part of the timestamp. And when the port was set down, then this workqueue is stopped. But if the config option NETWORK_PHY_TIMESTAMPING is not enabled, then the ptp_clock is not initialized so then it would crash when it would try to access the delayed work.
So then basically by setting up and then down the port, it would crash. The fix consists in checking if the ptp_clock is initialized and only then cancel the delayed work.
--- drivers/net/phy/micrel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/phy/micrel.c +2 -1
@@ -4635,7 +4635,8 @@ static int lan8841_suspend(struct phy_device *phydev)struct kszphy_priv *priv = phydev->priv;struct kszphy_ptp_priv *ptp_priv = &priv->ptp_priv; -ptp_cancel_worker_sync (ptp_priv->ptp_clock); +if (ptp_priv->ptp_clock) +ptp_cancel_worker_sync (ptp_priv->ptp_clock);return genphy_suspend (phydev); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 337/493 Bluetooth: compute LE flow credits based on recvbuf space
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Urban <[email protected]>
[ Upstream commit ce60b9231b66710b6ee24042ded26efee120ecfc ]
Previously LE flow credits were returned to the sender even if the socket's receive buffer was full. This meant that no back-pressure
was applied to the sender, thus it continued to send data, resulting in data loss without any error being reported. Furthermore, the amount of credits was essentially fixed to a small amount, leading to reduced performance.
This is fixed by computing the number of returned LE flow credits based on the estimated available space in the receive buffer of an L2CAP socket. Consequently, if the receive buffer is full, no credits are returned until the buffer is read and thus cleared by user-space.
Since the computation of available receive buffer space can only be performed approximately (due to sk_buff overhead) and the receive buffer size may be changed by user-space after flow credits have been sent, superfluous received data is temporary stored within l2cap_pinfo. This is necessary because Bluetooth LE provides no retransmission mechanism once the data has been acked by the physical layer.
If receive buffer space estimation is not possible at the moment, we fall back to providing credits for one full packet as before. This is currently the case during connection setup, when MPS is not yet available.
--- include/net/bluetooth/l2cap.h | 11 ++++- net/bluetooth/l2cap_core.c | 56 ++++++++++++++++++--- net/bluetooth/l2cap_sock.c | 91 ++++++++++++++++++++++++++++------- 3 files changed, 132 insertions(+), 26 deletions(-)
include/net/bluetooth/l2cap.h +10 -1
@@ -548,6 +548,9 @@ struct l2cap_chan {__u16 tx_credits;__u16 rx_credits; +/* estimated available receive buffer space or -1 if unknown */ +ssize_t rx_avail; +__u8 tx_state;__u8 rx_state;
@@ -682,10 +685,15 @@ struct l2cap_user {/* ----- L2CAP socket info ----- */ #define l2cap_pi (sk) ((struct l2cap_pinfo *) sk) +struct l2cap_rx_busy { +struct list_head list; +struct sk_buff *skb; +}; +struct l2cap_pinfo {struct bt_sock bt;struct l2cap_chan *chan; -struct sk_buff *rx_busy_skb; +struct list_head rx_busy; };enum {
@@ -943,6 +951,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,int l2cap_chan_reconfigure (struct l2cap_chan *chan,__u16 mtu);int l2cap_chan_send (struct l2cap_chan *chan,struct msghdr *msg,size_t len);void l2cap_chan_busy (struct l2cap_chan *chan,int busy); +void l2cap_chan_rx_avail (struct l2cap_chan *chan,ssize_t rx_avail);int l2cap_chan_check_security (struct l2cap_chan *chan,bool initiator);void l2cap_chan_set_defaults (struct l2cap_chan *chan);int l2cap_ertm_init (struct l2cap_chan *chan);
net/bluetooth/l2cap_core.c +49 -7
104 lines not on this page · raw message
net/bluetooth/l2cap_sock.c +73 -18
166 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 338/493 Bluetooth: qca: Fix error code in qca_read_fw_build_info()
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit a189f0ee6685457528db7a36ded3085e5d13ddc3 ]
Return -ENOMEM on allocation failure. Don't return success.
--- drivers/bluetooth/btqca.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/bluetooth/btqca.c +3 -1
@@ -148,8 +148,10 @@ static int qca_read_fw_build_info(struct hci_dev *hdev) } build_label =kstrndup (&edl->data[1 ], build_lbl_len,GFP_KERNEL ); -if (!build_label) +if (!build_label) { + err = -ENOMEM ; goto out; + }hci_set_fw_info (hdev,"%s" , build_label);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 339/493 Bluetooth: ISO: Add hcon for listening bis sk
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Iulia Tanasescu <[email protected]>
[ Upstream commit 02171da6e86a73e1b343b36722f5d9d5c04b3539 ]
This creates a hcon instance at bis listen, before the PA sync procedure is started.
Stable-dep-of: a5b862c6a221 ("Bluetooth: L2CAP: Fix div-by-zero in l2cap_le_flowctl_init()")
--- include/net/bluetooth/hci_core.h | 6 ++--- net/bluetooth/hci_conn.c | 32 ++++++++++++++++++++----- net/bluetooth/iso.c | 41 ++++++++++++++++++++++++-------- 3 files changed, 60 insertions(+), 19 deletions(-)
include/net/bluetooth/hci_core.h +3 -3
@@ -1,7 +1,7 @@/* BlueZ - Bluetooth protocol stack for Linux Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved. -Copyright 2023 NXP +Copyright 2023-2024 NXP Written 2000,2001 by Maxim Krasnyansky <[email protected]>
@@ -1533,8 +1533,8 @@ struct hci_conn *hci_connect_cis(struct hci_dev *hdev, bdaddr_t *dst,struct hci_conn *hci_connect_bis (struct hci_dev *hdev,bdaddr_t *dst,__u8 dst_type,struct bt_iso_qos *qos,__u8 data_len,__u8 *data); -int hci_pa_create_sync (struct hci_dev *hdev,bdaddr_t *dst,__u8 dst_type, -__u8 sid,struct bt_iso_qos *qos); +struct hci_conn *hci_pa_create_sync (struct hci_dev *hdev,bdaddr_t *dst, +__u8 dst_type,__u8 sid,struct bt_iso_qos *qos);int hci_le_big_create_sync (struct hci_dev *hdev,struct hci_conn *hcon,struct bt_iso_qos *qos,__u16 sync_handle,__u8 num_bis,__u8 bis[]);
net/bluetooth/hci_conn.c +26 -6
@@ -1,7 +1,7 @@/* BlueZ - Bluetooth protocol stack for Linux Copyright (c) 2000-2001, 2010, Code Aurora Forum. All rights reserved. -Copyright 2023 NXP +Copyright 2023-2024 NXP Written 2000,2001 by Maxim Krasnyansky <[email protected]>
@@ -2086,18 +2086,31 @@ static int create_pa_sync(struct hci_dev *hdev, void *data)return hci_update_passive_scan_sync (hdev); } -int hci_pa_create_sync (struct hci_dev *hdev,bdaddr_t *dst,__u8 dst_type, -__u8 sid,struct bt_iso_qos *qos) +struct hci_conn *hci_pa_create_sync (struct hci_dev *hdev,bdaddr_t *dst, +__u8 dst_type,__u8 sid, +struct bt_iso_qos *qos) {struct hci_cp_le_pa_create_sync *cp; +struct hci_conn *conn; +int err;if (hci_dev_test_and_set_flag (hdev,HCI_PA_SYNC )) -return -EBUSY ; +return ERR_PTR (-EBUSY ); + + conn =hci_conn_add_unset (hdev,ISO_LINK , dst,HCI_ROLE_SLAVE ); +if (!conn) +return ERR_PTR (-ENOMEM ); + + conn->iso_qos = *qos; + conn->state =BT_LISTEN ; + +hci_conn_hold (conn); cp =kzalloc (sizeof (*cp),GFP_KERNEL );if (!cp) {hci_dev_clear_flag (hdev,HCI_PA_SYNC ); -return -ENOMEM ; +hci_conn_drop (conn); +return ERR_PTR (-ENOMEM ); } cp->options = qos->bcast.options;
@@ -2109,7 +2122,14 @@ int hci_pa_create_sync(struct hci_dev *hdev, bdaddr_t *dst, __u8 dst_type, cp->sync_cte_type = qos->bcast.sync_cte_type;/* Queue start pa_create_sync and scan */ -return hci_cmd_sync_queue (hdev, create_pa_sync, cp, create_pa_complete); + err =hci_cmd_sync_queue (hdev, create_pa_sync, cp, create_pa_complete); +if (err <0 ) { +hci_conn_drop (conn); +kfree (cp); +return ERR_PTR (err); + } + +return conn; } int hci_le_big_create_sync(struct hci_dev *hdev, struct hci_conn *hcon,
net/bluetooth/iso.c +31 -10
73 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 340/493 Bluetooth: ISO: Clean up returns values in iso_connect_ind()
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit 18d88f0fd8c0fade7ae08c2778d6c6447b11f16a ]
This function either returns 0 or HCI_LM_ACCEPT. Make it clearer which returns are which and delete the "lm" variable because it is no longer required.
Stable-dep-of: a5b862c6a221 ("Bluetooth: L2CAP: Fix div-by-zero in l2cap_le_flowctl_init()")
--- net/bluetooth/iso.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
net/bluetooth/iso.c +3 -6
@@ -1904,7 +1904,6 @@ int iso_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags)struct hci_evt_le_big_info_adv_report *ev2;struct hci_ev_le_per_adv_report *ev3;struct sock *sk; -int lm =0 ;bt_dev_dbg (hdev,"bdaddr %pMR" , bdaddr);
@@ -1948,7 +1947,7 @@ int iso_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags)if (sk &&test_bit (BT_SK_PA_SYNC_TERM , &iso_pi (sk)->flags)) -return lm; +return 0 ; }if (sk) {
@@ -2035,16 +2034,14 @@ int iso_connect_ind(struct hci_dev *hdev, bdaddr_t *bdaddr, __u8 *flags) done:if (!sk) -return lm; - - lm |=HCI_LM_ACCEPT ; +return 0 ;if (test_bit (BT_SK_DEFER_SETUP , &bt_sk (sk)->flags)) *flags |=HCI_PROTO_DEFER ;sock_put (sk); -return lm; +return HCI_LM_ACCEPT ; }static void iso_connect_cfm (struct hci_conn *hcon,__u8 status)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 341/493 Bluetooth: ISO: Make iso_get_sock_listen generic
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Iulia Tanasescu <[email protected]>
[ Upstream commit 311527e9dafdcae0c5a20d62f4f84ad01b33b5f4 ]
This makes iso_get_sock_listen more generic, to return matching socket in the state provided as argument.
Stable-dep-of: a5b862c6a221 ("Bluetooth: L2CAP: Fix div-by-zero in l2cap_le_flowctl_init()")
--- include/net/bluetooth/bluetooth.h | 2 +- net/bluetooth/iso.c | 75 +++++++++++++++++-------------- 2 files changed, 43 insertions(+), 34 deletions(-)
include/net/bluetooth/bluetooth.h +1 -1
@@ -285,7 +285,7 @@ void bt_err_ratelimited(const char *fmt, ...); bt_err_ratelimited("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__) /* Connection and socket states */ -enum { +enum bt_sock_state {BT_CONNECTED =1 ,/* Equal to TCP_ESTABLISHED to make net code happy */ BT_OPEN ,BT_BOUND ,
net/bluetooth/iso.c +42 -33
149 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 342/493 Bluetooth: Remove usage of the deprecated ida_simple_xx() API
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
[ Upstream commit 9c16d0c8d93e3d2a95c5ed927b061f244db75579 ]
ida_alloc() and ida_free() should be preferred to the deprecated ida_simple_get() and ida_simple_remove().
Note that the upper limit of ida_simple_get() is exclusive, but the one of ida_alloc_max() is inclusive. So a -1 has been added when needed.
Stable-dep-of: 84a4bb6548a2 ("Bluetooth: HCI: Remove HCI_AMP support")
--- net/bluetooth/hci_core.c | 9 +++++---- net/bluetooth/hci_sock.c | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-)
net/bluetooth/hci_core.c +5 -4
@@ -2609,10 +2609,11 @@ int hci_register_dev(struct hci_dev *hdev)*/ switch (hdev->dev_type) {case HCI_PRIMARY : - id =ida_simple_get (&hci_index_ida,0 ,HCI_MAX_ID ,GFP_KERNEL ); + id =ida_alloc_max (&hci_index_ida,HCI_MAX_ID -1 ,GFP_KERNEL );break ;case HCI_AMP : - id =ida_simple_get (&hci_index_ida,1 ,HCI_MAX_ID ,GFP_KERNEL ); + id =ida_alloc_range (&hci_index_ida,1 ,HCI_MAX_ID -1 , +GFP_KERNEL );break ;default :return -EINVAL ;
@@ -2711,7 +2712,7 @@ int hci_register_dev(struct hci_dev *hdev)destroy_workqueue (hdev->workqueue);destroy_workqueue (hdev->req_workqueue); err: -ida_simple_remove (&hci_index_ida, hdev->id); +ida_free (&hci_index_ida, hdev->id);return error; }
@@ -2793,7 +2794,7 @@ void hci_release_dev(struct hci_dev *hdev)hci_dev_unlock (hdev);ida_destroy (&hdev->unset_handle_ida); -ida_simple_remove (&hci_index_ida, hdev->id); +ida_free (&hci_index_ida, hdev->id);kfree_skb (hdev->sent_cmd);kfree_skb (hdev->req_skb);kfree_skb (hdev->recv_event);
net/bluetooth/hci_sock.c +2 -2
@@ -101,7 +101,7 @@ static bool hci_sock_gen_cookie(struct sock *sk)int id =hci_pi (sk)->cookie;if (!id) { - id =ida_simple_get (&sock_cookie_ida,1 ,0 ,GFP_KERNEL ); + id =ida_alloc_min (&sock_cookie_ida,1 ,GFP_KERNEL );if (id <0 ) id =0xffffffff ;
@@ -119,7 +119,7 @@ static void hci_sock_free_cookie(struct sock *sk)if (id) {hci_pi (sk)->cookie =0xffffffff ; -ida_simple_remove (&sock_cookie_ida, id); +ida_free (&sock_cookie_ida, id); } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 343/493 Bluetooth: hci_event: Remove code to removed CONFIG_BT_HS
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lukas Bulwahn <[email protected]>
[ Upstream commit f4b0c2b4cd78b75acde56c2ee5aa732b6fb2a6a9 ]
Commit cec9f3c5561d ("Bluetooth: Remove BT_HS") removes config BT_HS, but misses two "ifdef BT_HS" blocks in hci_event.c.
Remove this dead code from this removed config option.
Stable-dep-of: 84a4bb6548a2 ("Bluetooth: HCI: Remove HCI_AMP support")
--- net/bluetooth/hci_event.c | 163 -------------------------------------- 1 file changed, 163 deletions(-)
net/bluetooth/hci_event.c +0 -163
@@ -5697,150 +5697,6 @@ static void hci_remote_oob_data_request_evt(struct hci_dev *hdev, void *edata,hci_dev_unlock (hdev); } -#if IS_ENABLED (CONFIG_BT_HS ) -static void hci_chan_selected_evt (struct hci_dev *hdev,void *data, -struct sk_buff *skb) -{ -struct hci_ev_channel_selected *ev = data; -struct hci_conn *hcon; - -bt_dev_dbg (hdev,"handle 0x%2.2x" , ev->phy_handle); - - hcon =hci_conn_hash_lookup_handle (hdev, ev->phy_handle); -if (!hcon) -return ; - -amp_read_loc_assoc_final_data (hdev, hcon); -} - -static void hci_phy_link_complete_evt (struct hci_dev *hdev,void *data, -struct sk_buff *skb) -{ -struct hci_ev_phy_link_complete *ev = data; -struct hci_conn *hcon, *bredr_hcon; - -bt_dev_dbg (hdev,"handle 0x%2.2x status 0x%2.2x" , ev->phy_handle, - ev->status); - -hci_dev_lock (hdev); - - hcon =hci_conn_hash_lookup_handle (hdev, ev->phy_handle); -if (!hcon) - goto unlock; - -if (!hcon->amp_mgr) - goto unlock; - -if (ev->status) { -hci_conn_del (hcon); - goto unlock; - } - - bredr_hcon = hcon->amp_mgr->l2cap_conn->hcon; - - hcon->state =BT_CONNECTED ; -bacpy (&hcon->dst, &bredr_hcon->dst); - -hci_conn_hold (hcon); - hcon->disc_timeout =HCI_DISCONN_TIMEOUT ; -hci_conn_drop (hcon); - -hci_debugfs_create_conn (hcon); -hci_conn_add_sysfs (hcon); - -amp_physical_cfm (bredr_hcon, hcon); - -unlock: -hci_dev_unlock (hdev); -} - -static void hci_loglink_complete_evt (struct hci_dev *hdev,void *data, -struct sk_buff *skb) -{ -struct hci_ev_logical_link_complete *ev = data; -struct hci_conn *hcon; -struct hci_chan *hchan; -struct amp_mgr *mgr; - -bt_dev_dbg (hdev,"log_handle 0x%4.4x phy_handle 0x%2.2x status 0x%2.2x" , -le16_to_cpu (ev->handle), ev->phy_handle, ev->status); - - hcon =hci_conn_hash_lookup_handle (hdev, ev->phy_handle); -if (!hcon) -return ; - -/* Create AMP hchan */ - hchan =hci_chan_create (hcon); -if (!hchan) -return ; - - hchan->handle =le16_to_cpu (ev->handle); - hchan->amp = true; - -BT_DBG ("hcon %p mgr %p hchan %p" , hcon, hcon->amp_mgr, hchan); - - mgr = hcon->amp_mgr; -if (mgr && mgr->bredr_chan) { -struct l2cap_chan *bredr_chan = mgr->bredr_chan; - -l2cap_chan_lock (bredr_chan); - - bredr_chan->conn->mtu = hdev->block_mtu; -l2cap_logical_cfm (bredr_chan, hchan,0 ); -hci_conn_hold (hcon); - -l2cap_chan_unlock (bredr_chan); - } -} - -static void hci_disconn_loglink_complete_evt (struct hci_dev *hdev,void *data, -struct sk_buff *skb) -{ -struct hci_ev_disconn_logical_link_complete *ev = data; -struct hci_chan *hchan; - -bt_dev_dbg (hdev,"handle 0x%4.4x status 0x%2.2x" , -le16_to_cpu (ev->handle), ev->status); - -if (ev->status) -return ; - -hci_dev_lock (hdev); - - hchan =hci_chan_lookup_handle (hdev,le16_to_cpu (ev->handle)); -if (!hchan || !hchan->amp) - goto unlock; - -amp_destroy_logical_link (hchan, ev->reason); - -unlock: -hci_dev_unlock (hdev); -} - -static void hci_disconn_phylink_complete_evt (struct hci_dev *hdev,void *data, -struct sk_buff *skb) -{ -struct hci_ev_disconn_phy_link_complete *ev = data; -struct hci_conn *hcon; - -bt_dev_dbg (hdev,"status 0x%2.2x" , ev->status); - -if (ev->status) -return ; - -hci_dev_lock (hdev); - - hcon =hci_conn_hash_lookup_handle (hdev, ev->phy_handle); -if (hcon && hcon->type ==AMP_LINK ) { - hcon->state =BT_CLOSED ; -hci_disconn_cfm (hcon, ev->reason); -hci_conn_del (hcon); - } - -hci_dev_unlock (hdev); -} -#endif -static void le_conn_update_addr (struct hci_conn *conn,bdaddr_t *bdaddr,u8 bdaddr_type,bdaddr_t *local_rpa) {
@@ -7656,25 +7512,6 @@ static const struct hci_ev {/* [0x3e = HCI_EV_LE_META] */ HCI_EV_REQ_VL (HCI_EV_LE_META , hci_le_meta_evt,sizeof (struct hci_ev_le_meta ),HCI_MAX_EVENT_SIZE ), -#if IS_ENABLED(CONFIG_BT_HS) -/* [0x40 = HCI_EV_PHY_LINK_COMPLETE] */ -HCI_EV (HCI_EV_PHY_LINK_COMPLETE , hci_phy_link_complete_evt, -sizeof (struct hci_ev_phy_link_complete )), -/* [0x41 = HCI_EV_CHANNEL_SELECTED] */ -HCI_EV (HCI_EV_CHANNEL_SELECTED , hci_chan_selected_evt, -sizeof (struct hci_ev_channel_selected )), -/* [0x42 = HCI_EV_DISCONN_PHY_LINK_COMPLETE] */ -HCI_EV (HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE , - hci_disconn_loglink_complete_evt, -sizeof (struct hci_ev_disconn_logical_link_complete )), -/* [0x45 = HCI_EV_LOGICAL_LINK_COMPLETE] */ -HCI_EV (HCI_EV_LOGICAL_LINK_COMPLETE , hci_loglink_complete_evt, -sizeof (struct hci_ev_logical_link_complete )), -/* [0x46 = HCI_EV_DISCONN_LOGICAL_LINK_COMPLETE] */ -HCI_EV (HCI_EV_DISCONN_PHY_LINK_COMPLETE , - hci_disconn_phylink_complete_evt, -sizeof (struct hci_ev_disconn_phy_link_complete )), -#endif/* [0x48 = HCI_EV_NUM_COMP_BLOCKS] */ HCI_EV (HCI_EV_NUM_COMP_BLOCKS , hci_num_comp_blocks_evt, sizeof(struct hci_ev_num_comp_blocks)),
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 344/493 Bluetooth: HCI: Remove HCI_AMP support
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 84a4bb6548a29326564f0e659fb8064503ecc1c7 ]
Since BT_HS has been remove HCI_AMP controllers no longer has any use so remove it along with the capability of creating AMP controllers.
Since we no longer need to differentiate between AMP and Primary controllers, as only HCI_PRIMARY is left, this also remove hdev->dev_type altogether.
--- drivers/bluetooth/btmrvl_main.c | 9 -- drivers/bluetooth/btrsi.c | 1 - drivers/bluetooth/btsdio.c | 8 -- drivers/bluetooth/btusb.c | 5 -- drivers/bluetooth/hci_bcm4377.c | 1 - drivers/bluetooth/hci_ldisc.c | 6 -- drivers/bluetooth/hci_serdev.c | 5 -- drivers/bluetooth/hci_uart.h | 1 - drivers/bluetooth/hci_vhci.c | 10 +-- drivers/bluetooth/virtio_bt.c | 2 - include/net/bluetooth/hci.h | 114 ------------------------ include/net/bluetooth/hci_core.h | 46 +--------- include/uapi/linux/virtio_bt.h | 1 - net/bluetooth/hci_conn.c | 3 +- net/bluetooth/hci_core.c | 132 +++------------------------ net/bluetooth/hci_event.c | 147 ------------------------------- net/bluetooth/hci_sock.c | 5 +- net/bluetooth/hci_sync.c | 112 +---------------------- net/bluetooth/l2cap_core.c | 21 +---- net/bluetooth/mgmt.c | 84 ++++++------------ 20 files changed, 49 insertions(+), 664 deletions(-)
drivers/bluetooth/btmrvl_main.c +0 -9
@@ -121,13 +121,6 @@ int btmrvl_process_event(struct btmrvl_private *priv, struct sk_buff *skb) ((event->data[2 ] ==MODULE_BROUGHT_UP ) || (event->data[2 ] ==MODULE_ALREADY_UP )) ? "Bring-up succeed" : "Bring-up failed"); - -if (event->length >3 && event->data[3 ]) - priv->btmrvl_dev.dev_type =HCI_AMP ; -else - priv->btmrvl_dev.dev_type =HCI_PRIMARY ; - -BT_DBG ("dev_type: %d" , priv->btmrvl_dev.dev_type); }else if (priv->btmrvl_dev.sendcmdflag && event->data[1 ] ==MODULE_SHUTDOWN_REQ ) { BT_DBG("EVENT:%s", (event->data[2]) ?
@@ -686,8 +679,6 @@ int btmrvl_register_hdev(struct btmrvl_private *priv) hdev->wakeup = btmrvl_wakeup;SET_HCIDEV_DEV (hdev, &card->func->dev); - hdev->dev_type = priv->btmrvl_dev.dev_type; - ret =hci_register_dev (hdev);if (ret <0 ) {BT_ERR ("Can not register HCI device" );
drivers/bluetooth/btrsi.c +0 -1
@@ -134,7 +134,6 @@ static int rsi_hci_attach(void *priv, struct rsi_proto_ops *ops) hdev->bus =HCI_USB ;hci_set_drvdata (hdev, h_adapter); - hdev->dev_type =HCI_PRIMARY ; hdev->open = rsi_hci_open; hdev->close = rsi_hci_close; hdev->flush = rsi_hci_flush;
drivers/bluetooth/btsdio.c +0 -8
@@ -32,9 +32,6 @@ static const struct sdio_device_id btsdio_table[] = {/* Generic Bluetooth Type-B SDIO device */ { SDIO_DEVICE_CLASS(SDIO_CLASS_BT_B) }, -/* Generic Bluetooth AMP controller */ - { SDIO_DEVICE_CLASS(SDIO_CLASS_BT_AMP) }, - { }/* Terminating entry */ };
@@ -319,11 +316,6 @@ static int btsdio_probe(struct sdio_func *func, hdev->bus =HCI_SDIO ;hci_set_drvdata (hdev, data); -if (id->class ==SDIO_CLASS_BT_AMP ) - hdev->dev_type =HCI_AMP ; -else - hdev->dev_type =HCI_PRIMARY ; - data->hdev = hdev;SET_HCIDEV_DEV (hdev, &func->dev);
drivers/bluetooth/btusb.c +0 -5
@@ -4314,11 +4314,6 @@ static int btusb_probe(struct usb_interface *intf, hdev->bus =HCI_USB ;hci_set_drvdata (hdev, data); -if (id->driver_info &BTUSB_AMP ) - hdev->dev_type =HCI_AMP ; -else - hdev->dev_type =HCI_PRIMARY ; - data->hdev = hdev;SET_HCIDEV_DEV (hdev, &intf->dev);
drivers/bluetooth/hci_bcm4377.c +0 -1
@@ -2361,7 +2361,6 @@ static int bcm4377_probe(struct pci_dev *pdev, const struct pci_device_id *id) bcm4377->hdev = hdev; hdev->bus =HCI_PCI ; - hdev->dev_type =HCI_PRIMARY ; hdev->open = bcm4377_hci_open; hdev->close = bcm4377_hci_close; hdev->send = bcm4377_hci_send_frame;
drivers/bluetooth/hci_ldisc.c +0 -6
@@ -667,11 +667,6 @@ static int hci_uart_register_dev(struct hci_uart *hu)if (!test_bit (HCI_UART_RESET_ON_INIT , &hu->hdev_flags))set_bit (HCI_QUIRK_RESET_ON_CLOSE , &hdev->quirks); -if (test_bit (HCI_UART_CREATE_AMP , &hu->hdev_flags)) - hdev->dev_type =HCI_AMP ; -else - hdev->dev_type =HCI_PRIMARY ; -/* Only call open() for the protocol after hdev is fully initialized as * open() (or a timer/workqueue it starts) may attempt to reference it. */
@@ -722,7 +717,6 @@ static int hci_uart_set_flags(struct hci_uart *hu, unsigned long flags) {unsigned long valid_flags =BIT (HCI_UART_RAW_DEVICE ) |BIT (HCI_UART_RESET_ON_INIT ) | -BIT (HCI_UART_CREATE_AMP ) |BIT (HCI_UART_INIT_PENDING ) |BIT (HCI_UART_EXT_CONFIG ) |BIT (HCI_UART_VND_DETECT );
drivers/bluetooth/hci_serdev.c +0 -5
@@ -366,11 +366,6 @@ int hci_uart_register_device_priv(struct hci_uart *hu,if (test_bit (HCI_UART_EXT_CONFIG , &hu->hdev_flags))set_bit (HCI_QUIRK_EXTERNAL_CONFIG , &hdev->quirks); -if (test_bit (HCI_UART_CREATE_AMP , &hu->hdev_flags)) - hdev->dev_type =HCI_AMP ; -else - hdev->dev_type =HCI_PRIMARY ; -if (test_bit (HCI_UART_INIT_PENDING , &hu->hdev_flags))return 0 ;
drivers/bluetooth/hci_uart.h +0 -1
@@ -37,7 +37,6 @@#define HCI_UART_RAW_DEVICE 0#define HCI_UART_RESET_ON_INIT 1 -#define HCI_UART_CREATE_AMP 2#define HCI_UART_INIT_PENDING 3#define HCI_UART_EXT_CONFIG 4#define HCI_UART_VND_DETECT 5
drivers/bluetooth/hci_vhci.c +1 -9
@@ -384,17 +384,10 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode) {struct hci_dev *hdev;struct sk_buff *skb; -__u8 dev_type;if (data->hdev)return -EBADFD ; -/* bits 0-1 are dev_type (Primary or AMP) */ - dev_type = opcode &0x03 ; - -if (dev_type !=HCI_PRIMARY && dev_type !=HCI_AMP ) -return -EINVAL ; -/* bits 2-5 are reserved (must be zero) */ if (opcode &0x3c )return -EINVAL ;
@@ -412,7 +405,6 @@ static int __vhci_create_device(struct vhci_data *data, __u8 opcode) data->hdev = hdev; hdev->bus =HCI_VIRTUAL ; - hdev->dev_type = dev_type;hci_set_drvdata (hdev, data); hdev->open = vhci_open_dev;
@@ -634,7 +626,7 @@ static void vhci_open_timeout(struct work_struct *work) struct vhci_data *data = container_of(work, struct vhci_data, open_timeout.work); -vhci_create_device (data, amp ?HCI_AMP :HCI_PRIMARY ); +vhci_create_device (data,0x00 ); }static int vhci_open (struct inode *inode,struct file *file)
drivers/bluetooth/virtio_bt.c +0 -2
@@ -274,7 +274,6 @@ static int virtbt_probe(struct virtio_device *vdev)switch (type) {case VIRTIO_BT_CONFIG_TYPE_PRIMARY : -case VIRTIO_BT_CONFIG_TYPE_AMP :break ;default :return -EINVAL ;
@@ -303,7 +302,6 @@ static int virtbt_probe(struct virtio_device *vdev) vbt->hdev = hdev; hdev->bus =HCI_VIRTIO ; - hdev->dev_type = type;hci_set_drvdata (hdev, vbt); hdev->open = virtbt_open;
include/net/bluetooth/hci.h +0 -114
144 lines not on this page · raw message
include/net/bluetooth/hci_core.h +1 -45
118 lines not on this page · raw message
include/uapi/linux/virtio_bt.h +0 -1
@@ -13,7 +13,6 @@enum virtio_bt_config_type {VIRTIO_BT_CONFIG_TYPE_PRIMARY =0 , -VIRTIO_BT_CONFIG_TYPE_AMP =1 , };enum virtio_bt_config_vendor {
net/bluetooth/hci_conn.c +1 -2
@@ -1173,8 +1173,7 @@ struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src, uint8_t src_type)list_for_each_entry (d, &hci_dev_list, list) {if (!test_bit (HCI_UP , &d->flags) || -hci_dev_test_flag (d,HCI_USER_CHANNEL ) || - d->dev_type !=HCI_PRIMARY ) +hci_dev_test_flag (d,HCI_USER_CHANNEL ))continue ;/* Simple routing:
net/bluetooth/hci_core.c +10 -122
199 lines not on this page · raw message
net/bluetooth/hci_event.c +0 -147
189 lines not on this page · raw message
net/bluetooth/hci_sock.c +1 -4
@@ -485,7 +485,7 @@ static struct sk_buff *create_monitor_event(struct hci_dev *hdev, int event)return NULL ; ni =skb_put (skb,HCI_MON_NEW_INDEX_SIZE ); - ni->type = hdev->dev_type; + ni->type =0x00 ;/* Old hdev->dev_type */ ni->bus = hdev->bus;bacpy (&ni->bdaddr, &hdev->bdaddr); memcpy_and_pad(ni->name, sizeof(ni->name), hdev->name,
@@ -1007,9 +1007,6 @@ static int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd,if (hci_dev_test_flag (hdev,HCI_UNCONFIGURED ))return -EOPNOTSUPP ; -if (hdev->dev_type !=HCI_PRIMARY ) -return -EOPNOTSUPP ; -switch (cmd) {case HCISETRAW :if (!capable (CAP_NET_ADMIN ))
net/bluetooth/hci_sync.c +4 -108
187 lines not on this page · raw message
net/bluetooth/l2cap_core.c +4 -17
@@ -3930,7 +3930,7 @@ static inline int l2cap_command_rej(struct l2cap_conn *conn, }static void l2cap_connect (struct l2cap_conn *conn,struct l2cap_cmd_hdr *cmd, -u8 *data,u8 rsp_code,u8 amp_id) +u8 *data,u8 rsp_code) {struct l2cap_conn_req *req = (struct l2cap_conn_req *) data;struct l2cap_conn_rsp rsp;
@@ -4009,17 +4009,8 @@ static void l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, status =L2CAP_CS_AUTHOR_PEND ; chan->ops->defer (chan); }else { -/* Force pending result for AMP controllers. -* The connection will succeed after the -* physical link is up. -*/ -if (amp_id ==AMP_ID_BREDR ) { -l2cap_state_change (chan,BT_CONFIG ); - result =L2CAP_CR_SUCCESS ; - }else { -l2cap_state_change (chan,BT_CONNECT2 ); - result =L2CAP_CR_PEND ; - } +l2cap_state_change (chan,BT_CONNECT2 ); + result =L2CAP_CR_PEND ; status =L2CAP_CS_NO_INFO ; } }else {
@@ -4084,7 +4075,7 @@ static int l2cap_connect_req(struct l2cap_conn *conn,mgmt_device_connected (hdev, hcon,NULL ,0 );hci_dev_unlock (hdev); -l2cap_connect (conn, cmd, data,L2CAP_CONN_RSP ,0 ); +l2cap_connect (conn, cmd, data,L2CAP_CONN_RSP );return 0 ; }
@@ -7495,10 +7486,6 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)struct l2cap_conn *conn = hcon->l2cap_data;int len; -/* For AMP controller do not create l2cap conn */ -if (!conn && hcon->hdev->dev_type !=HCI_PRIMARY ) - goto drop; -if (!conn) conn =l2cap_conn_add (hcon);
net/bluetooth/mgmt.c +27 -57
133 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 345/493 ice: make ice_vsi_cfg_rxq() static
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <[email protected]>
[ Upstream commit 3e5fb691faee1d43ee13d4ce2666b0a05e1555b3 ]
Currently, XSK control path in ice driver calls directly ice_vsi_cfg_rxq() whereas we have ice_vsi_cfg_single_rxq() for that purpose. Use the latter from XSK side and make ice_vsi_cfg_rxq() static.
ice_vsi_cfg_rxq() resides in ice_base.c and is rather big, so to reduce the code churn let us move two callers of it from ice_lib.c to ice_base.c.
Stable-dep-of: e77f43d531af ("Bluetooth: hci_core: Fix not handling hdev->le_num_of_adv_sets=1")
--- drivers/net/ethernet/intel/ice/ice_base.c | 58 ++++++++++++++++++++++- drivers/net/ethernet/intel/ice/ice_base.h | 3 +- drivers/net/ethernet/intel/ice/ice_lib.c | 56 ---------------------- drivers/net/ethernet/intel/ice/ice_lib.h | 4 -- drivers/net/ethernet/intel/ice/ice_xsk.c | 2 +- 5 files changed, 60 insertions(+), 63 deletions(-)
drivers/net/ethernet/intel/ice/ice_base.c +57 -1
@@ -536,7 +536,7 @@ static void ice_xsk_pool_fill_cb(struct ice_rx_ring *ring)* * Return 0 on success and a negative value on error. */ -int ice_vsi_cfg_rxq (struct ice_rx_ring *ring) +static int ice_vsi_cfg_rxq (struct ice_rx_ring *ring) {struct device *dev =ice_pf_to_dev (ring->vsi->back);u32 num_bufs =ICE_RX_DESC_UNUSED (ring);
@@ -631,6 +631,62 @@ int ice_vsi_cfg_rxq(struct ice_rx_ring *ring)return 0 ; } +int ice_vsi_cfg_single_rxq (struct ice_vsi *vsi,u16 q_idx) +{ +if (q_idx >= vsi->num_rxq) +return -EINVAL ; + +return ice_vsi_cfg_rxq (vsi->rx_rings[q_idx]); +} + +/** +* ice_vsi_cfg_frame_size - setup max frame size and Rx buffer length +* @vsi: VSI +*/ +static void ice_vsi_cfg_frame_size (struct ice_vsi *vsi) +{ +if (!vsi->netdev ||test_bit (ICE_FLAG_LEGACY_RX , vsi->back->flags)) { + vsi->max_frame =ICE_MAX_FRAME_LEGACY_RX ; + vsi->rx_buf_len =ICE_RXBUF_1664 ; +#if (PAGE_SIZE <8192 ) + } else if (!ICE_2K_TOO_SMALL_WITH_PADDING && + (vsi->netdev->mtu <=ETH_DATA_LEN )) { + vsi->max_frame =ICE_RXBUF_1536 -NET_IP_ALIGN ; + vsi->rx_buf_len =ICE_RXBUF_1536 -NET_IP_ALIGN ; +#endif + }else { + vsi->max_frame =ICE_AQ_SET_MAC_FRAME_SIZE_MAX ; + vsi->rx_buf_len =ICE_RXBUF_3072 ; + } +} + +/** +* ice_vsi_cfg_rxqs - Configure the VSI for Rx +* @vsi: the VSI being configured +* +* Return 0 on success and a negative value on error +* Configure the Rx VSI for operation. +*/ +int ice_vsi_cfg_rxqs (struct ice_vsi *vsi) +{ +u16 i; + +if (vsi->type ==ICE_VSI_VF ) + goto setup_rings; + +ice_vsi_cfg_frame_size (vsi); +setup_rings: +/* set up individual rings */ +ice_for_each_rxq (vsi, i) { +int err =ice_vsi_cfg_rxq (vsi->rx_rings[i]); + +if (err) +return err; + } + +return 0 ; +} +/** * __ice_vsi_get_qs - helper function for assigning queues from PF to VSI * @qs_cfg: gathered variables needed for pf->vsi queues assignment
drivers/net/ethernet/intel/ice/ice_base.h +2 -1
@@ -6,7 +6,8 @@#include "ice.h" -int ice_vsi_cfg_rxq (struct ice_rx_ring *ring); +int ice_vsi_cfg_single_rxq (struct ice_vsi *vsi,u16 q_idx); +int ice_vsi_cfg_rxqs (struct ice_vsi *vsi);int __ice_vsi_get_qs (struct ice_qs_cfg *qs_cfg);int ice_vsi_ctrl_one_rx_ring (struct ice_vsi *vsi,bool ena,u16 rxq_idx,bool wait);
drivers/net/ethernet/intel/ice/ice_lib.c +0 -56
74 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_lib.h +0 -4
@@ -54,12 +54,8 @@ bool ice_pf_state_is_nominal(struct ice_pf *pf);void ice_update_eth_stats (struct ice_vsi *vsi); -int ice_vsi_cfg_single_rxq (struct ice_vsi *vsi,u16 q_idx); -int ice_vsi_cfg_single_txq (struct ice_vsi *vsi,struct ice_tx_ring **tx_rings,u16 q_idx); -int ice_vsi_cfg_rxqs (struct ice_vsi *vsi); -int ice_vsi_cfg_lan_txqs (struct ice_vsi *vsi);void ice_vsi_cfg_msix (struct ice_vsi *vsi);
drivers/net/ethernet/intel/ice/ice_xsk.c +1 -1
@@ -250,7 +250,7 @@ static int ice_qp_ena(struct ice_vsi *vsi, u16 q_idx)ice_tx_xsk_pool (vsi, q_idx); } - err =ice_vsi_cfg_rxq (rx_ring); + err =ice_vsi_cfg_single_rxq (vsi, q_idx);if (err)return err;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 346/493 ice: make ice_vsi_cfg_txq() static
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maciej Fijalkowski <[email protected]>
[ Upstream commit a292ba981324ec790eb671df1c64fae5c98c4b3d ]
Currently, XSK control path in ice driver calls directly ice_vsi_cfg_txq() whereas we have ice_vsi_cfg_single_txq() for that purpose. Use the latter from XSK side and make ice_vsi_cfg_txq() static.
ice_vsi_cfg_txq() resides in ice_base.c and is rather big, so to reduce the code churn let us move the callers of it from ice_lib.c to ice_base.c.
This change puts ice_qp_ena() on nice diet due to the checks and operations that ice_vsi_cfg_single_{r,t}xq() do internally.
add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-182 (-182)
Function old new deltaice_xsk_pool_setup 2165 1983 -182
Total: Before=472597, After=472415, chg -0.04%
Stable-dep-of: e77f43d531af ("Bluetooth: hci_core: Fix not handling hdev->le_num_of_adv_sets=1")
--- drivers/net/ethernet/intel/ice/ice_base.c | 76 ++++++++++++++++++++++- drivers/net/ethernet/intel/ice/ice_base.h | 7 ++- drivers/net/ethernet/intel/ice/ice_lib.c | 73 ---------------------- drivers/net/ethernet/intel/ice/ice_lib.h | 6 -- drivers/net/ethernet/intel/ice/ice_xsk.c | 20 +----- 5 files changed, 82 insertions(+), 100 deletions(-)
drivers/net/ethernet/intel/ice/ice_base.c +75 -1
@@ -882,7 +882,7 @@ void ice_vsi_free_q_vectors(struct ice_vsi *vsi)* @ring: Tx ring to be configured * @qg_buf: queue group buffer */ -int +static int ice_vsi_cfg_txq (struct ice_vsi *vsi,struct ice_tx_ring *ring,struct ice_aqc_add_tx_qgrp *qg_buf) {
@@ -953,6 +953,80 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_tx_ring *ring,return 0 ; } +int ice_vsi_cfg_single_txq (struct ice_vsi *vsi,struct ice_tx_ring **tx_rings, +u16 q_idx) +{ + DEFINE_FLEX(struct ice_aqc_add_tx_qgrp, qg_buf, txqs, 1); + +if (q_idx >= vsi->alloc_txq || !tx_rings || !tx_rings[q_idx]) +return -EINVAL ; + + qg_buf->num_txqs =1 ; + +return ice_vsi_cfg_txq (vsi, tx_rings[q_idx], qg_buf); +} + +/** +* ice_vsi_cfg_txqs - Configure the VSI for Tx +* @vsi: the VSI being configured +* @rings: Tx ring array to be configured +* @count: number of Tx ring array elements +* +* Return 0 on success and a negative value on error +* Configure the Tx VSI for operation. +*/ +static int +ice_vsi_cfg_txqs (struct ice_vsi *vsi,struct ice_tx_ring **rings,u16 count) +{ + DEFINE_FLEX(struct ice_aqc_add_tx_qgrp, qg_buf, txqs, 1); +int err =0 ; +u16 q_idx; + + qg_buf->num_txqs =1 ; + +for (q_idx =0 ; q_idx < count; q_idx++) { + err =ice_vsi_cfg_txq (vsi, rings[q_idx], qg_buf); +if (err) +break ; + } + +return err; +} + +/** +* ice_vsi_cfg_lan_txqs - Configure the VSI for Tx +* @vsi: the VSI being configured +* +* Return 0 on success and a negative value on error +* Configure the Tx VSI for operation. +*/ +int ice_vsi_cfg_lan_txqs (struct ice_vsi *vsi) +{ +return ice_vsi_cfg_txqs (vsi, vsi->tx_rings, vsi->num_txq); +} + +/** +* ice_vsi_cfg_xdp_txqs - Configure Tx queues dedicated for XDP in given VSI +* @vsi: the VSI being configured +* +* Return 0 on success and a negative value on error +* Configure the Tx queues dedicated for XDP in given VSI for operation. +*/ +int ice_vsi_cfg_xdp_txqs (struct ice_vsi *vsi) +{ +int ret; +int i; + + ret =ice_vsi_cfg_txqs (vsi, vsi->xdp_rings, vsi->num_xdp_txq); +if (ret) +return ret; + +ice_for_each_rxq (vsi, i) +ice_tx_xsk_pool (vsi, i); + +return 0 ; +} +/** * ice_cfg_itr - configure the initial interrupt throttle values * @hw: pointer to the HW structure
drivers/net/ethernet/intel/ice/ice_base.h +4 -3
@@ -15,9 +15,10 @@ int ice_vsi_wait_one_rx_ring(struct ice_vsi *vsi, bool ena, u16 rxq_idx);int ice_vsi_alloc_q_vectors (struct ice_vsi *vsi);void ice_vsi_map_rings_to_vectors (struct ice_vsi *vsi);void ice_vsi_free_q_vectors (struct ice_vsi *vsi); -int -ice_vsi_cfg_txq (struct ice_vsi *vsi,struct ice_tx_ring *ring, -struct ice_aqc_add_tx_qgrp *qg_buf); +int ice_vsi_cfg_single_txq (struct ice_vsi *vsi,struct ice_tx_ring **tx_rings, +u16 q_idx); +int ice_vsi_cfg_lan_txqs (struct ice_vsi *vsi); +int ice_vsi_cfg_xdp_txqs (struct ice_vsi *vsi);void ice_cfg_itr (struct ice_hw *hw,struct ice_q_vector *q_vector);void ice_cfg_txq_interrupt (struct ice_vsi *vsi,u16 txq,u16 msix_idx,u16 itr_idx);
drivers/net/ethernet/intel/ice/ice_lib.c +0 -73
79 lines not on this page · raw message
drivers/net/ethernet/intel/ice/ice_lib.h +0 -6
@@ -54,10 +54,6 @@ bool ice_pf_state_is_nominal(struct ice_pf *pf);void ice_update_eth_stats (struct ice_vsi *vsi); -int ice_vsi_cfg_single_txq (struct ice_vsi *vsi,struct ice_tx_ring **tx_rings,u16 q_idx); - -int ice_vsi_cfg_lan_txqs (struct ice_vsi *vsi); -void ice_vsi_cfg_msix (struct ice_vsi *vsi);int ice_vsi_start_all_rx_rings (struct ice_vsi *vsi);
@@ -68,8 +64,6 @@ int ice_vsi_stop_lan_tx_rings(struct ice_vsi *vsi, enum ice_disq_rst_src rst_src, u16 rel_vmvf_num); -int ice_vsi_cfg_xdp_txqs (struct ice_vsi *vsi); -int ice_vsi_stop_xdp_tx_rings (struct ice_vsi *vsi);void ice_cfg_sw_lldp (struct ice_vsi *vsi,bool tx,bool create);
drivers/net/ethernet/intel/ice/ice_xsk.c +3 -17
@@ -218,32 +218,17 @@ static int ice_qp_dis(struct ice_vsi *vsi, u16 q_idx)*/ static int ice_qp_ena (struct ice_vsi *vsi,u16 q_idx) { - DEFINE_FLEX(struct ice_aqc_add_tx_qgrp, qg_buf, txqs, 1); -u16 size =__struct_size (qg_buf);struct ice_q_vector *q_vector; -struct ice_tx_ring *tx_ring; -struct ice_rx_ring *rx_ring;int err; -if (q_idx >= vsi->num_rxq || q_idx >= vsi->num_txq) -return -EINVAL ; - - qg_buf->num_txqs =1 ; - - tx_ring = vsi->tx_rings[q_idx]; - rx_ring = vsi->rx_rings[q_idx]; - q_vector = rx_ring->q_vector; - - err =ice_vsi_cfg_txq (vsi, tx_ring, qg_buf); + err =ice_vsi_cfg_single_txq (vsi, vsi->tx_rings, q_idx);if (err)return err;if (ice_is_xdp_ena_vsi (vsi)) {struct ice_tx_ring *xdp_ring = vsi->xdp_rings[q_idx]; -memset (qg_buf,0 , size); - qg_buf->num_txqs =1 ; - err =ice_vsi_cfg_txq (vsi, xdp_ring, qg_buf); + err =ice_vsi_cfg_single_txq (vsi, vsi->xdp_rings, q_idx);if (err)return err;ice_set_ring_xdp (xdp_ring);
@@ -254,6 +239,7 @@ static int ice_qp_ena(struct ice_vsi *vsi, u16 q_idx)if (err)return err; + q_vector = vsi->rx_rings[q_idx]->q_vector;ice_qvec_cfg_msix (vsi, q_vector); err =ice_vsi_ctrl_one_rx_ring (vsi, true, q_idx, true);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 347/493 overflow: Change DEFINE_FLEX to take __counted_by member
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kees Cook <[email protected]>
[ Upstream commit d8e45f2929b94099913eb66c3ebb18b5063e9421 ]
The norm should be flexible array structures with __counted_by annotations, so DEFINE_FLEX() is updated to expect that. Rename the non-annotated version to DEFINE_RAW_FLEX(), and update the few existing users. Additionally add selftests for the macros.
Stable-dep-of: e77f43d531af ("Bluetooth: hci_core: Fix not handling hdev->le_num_of_adv_sets=1")
--- drivers/net/ethernet/intel/ice/ice_base.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_common.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_ddp.c | 8 +++---- drivers/net/ethernet/intel/ice/ice_lag.c | 6 ++--- drivers/net/ethernet/intel/ice/ice_sched.c | 4 ++-- drivers/net/ethernet/intel/ice/ice_switch.c | 10 ++++----- include/linux/overflow.h | 25 +++++++++++++++++---- lib/overflow_kunit.c | 19 ++++++++++++++++ 8 files changed, 58 insertions(+), 22 deletions(-)
drivers/net/ethernet/intel/ice/ice_base.c +2 -2
@@ -956,7 +956,7 @@ ice_vsi_cfg_txq(struct ice_vsi *vsi, struct ice_tx_ring *ring,int ice_vsi_cfg_single_txq (struct ice_vsi *vsi,struct ice_tx_ring **tx_rings,u16 q_idx) { - DEFINE_FLEX(struct ice_aqc_add_tx_qgrp, qg_buf, txqs, 1); + DEFINE_RAW_FLEX(struct ice_aqc_add_tx_qgrp, qg_buf, txqs, 1);if (q_idx >= vsi->alloc_txq || !tx_rings || !tx_rings[q_idx])return -EINVAL ;
@@ -978,7 +978,7 @@ int ice_vsi_cfg_single_txq(struct ice_vsi *vsi, struct ice_tx_ring **tx_rings,static int ice_vsi_cfg_txqs (struct ice_vsi *vsi,struct ice_tx_ring **rings,u16 count) { - DEFINE_FLEX(struct ice_aqc_add_tx_qgrp, qg_buf, txqs, 1); + DEFINE_RAW_FLEX(struct ice_aqc_add_tx_qgrp, qg_buf, txqs, 1);int err =0 ;u16 q_idx;
drivers/net/ethernet/intel/ice/ice_common.c +2 -2
@@ -4700,7 +4700,7 @@ ice_dis_vsi_txq(struct ice_port_info *pi, u16 vsi_handle, u8 tc, u8 num_queues, enum ice_disq_rst_src rst_src, u16 vmvf_num, struct ice_sq_cd *cd) { - DEFINE_FLEX(struct ice_aqc_dis_txq_item, qg_list, q_id, 1); + DEFINE_RAW_FLEX(struct ice_aqc_dis_txq_item, qg_list, q_id, 1);u16 i, buf_size =__struct_size (qg_list);struct ice_q_ctx *q_ctx;int status = -ENOENT ;
@@ -4922,7 +4922,7 @@ int ice_dis_vsi_rdma_qset(struct ice_port_info *pi, u16 count, u32 *qset_teid, u16 *q_id) { - DEFINE_FLEX(struct ice_aqc_dis_txq_item, qg_list, q_id, 1); + DEFINE_RAW_FLEX(struct ice_aqc_dis_txq_item, qg_list, q_id, 1);u16 qg_size =__struct_size (qg_list);struct ice_hw *hw;int status =0 ;
drivers/net/ethernet/intel/ice/ice_ddp.c +4 -4
@@ -1934,8 +1934,8 @@ static enum ice_ddp_state ice_init_pkg_info(struct ice_hw *hw,*/ static enum ice_ddp_state ice_get_pkg_info (struct ice_hw *hw) { - DEFINE_FLEX(struct ice_aqc_get_pkg_info_resp, pkg_info, pkg_info, - ICE_PKG_CNT); + DEFINE_RAW_FLEX(struct ice_aqc_get_pkg_info_resp, pkg_info, pkg_info, + ICE_PKG_CNT);u16 size =__struct_size (pkg_info);u32 i;
@@ -1986,8 +1986,8 @@ static enum ice_ddp_state ice_chk_pkg_compat(struct ice_hw *hw,struct ice_pkg_hdr *ospkg, struct ice_seg **seg) { -DEFINE_FLEX (struct ice_aqc_get_pkg_info_resp ,pkg ,pkg_info , -ICE_PKG_CNT ); +DEFINE_RAW_FLEX (struct ice_aqc_get_pkg_info_resp ,pkg ,pkg_info , +ICE_PKG_CNT );u16 size =__struct_size (pkg);enum ice_ddp_state state;u32 i;
drivers/net/ethernet/intel/ice/ice_lag.c +3 -3
@@ -491,7 +491,7 @@ static void ice_lag_move_vf_node_tc(struct ice_lag *lag, u8 oldport, u8 newport, u16 vsi_num, u8 tc) { - DEFINE_FLEX(struct ice_aqc_move_elem, buf, teid, 1); + DEFINE_RAW_FLEX(struct ice_aqc_move_elem, buf, teid, 1);struct device *dev =ice_pf_to_dev (lag->pf);u16 numq, valq, num_moved, qbuf_size;u16 buf_size =__struct_size (buf);
@@ -849,7 +849,7 @@ static void ice_lag_reclaim_vf_tc(struct ice_lag *lag, struct ice_hw *src_hw, u16 vsi_num, u8 tc) { - DEFINE_FLEX(struct ice_aqc_move_elem, buf, teid, 1); + DEFINE_RAW_FLEX(struct ice_aqc_move_elem, buf, teid, 1);struct device *dev =ice_pf_to_dev (lag->pf);u16 numq, valq, num_moved, qbuf_size;u16 buf_size =__struct_size (buf);
@@ -1873,7 +1873,7 @@ static void ice_lag_move_vf_nodes_tc_sync(struct ice_lag *lag, struct ice_hw *dest_hw, u16 vsi_num, u8 tc) { - DEFINE_FLEX(struct ice_aqc_move_elem, buf, teid, 1); + DEFINE_RAW_FLEX(struct ice_aqc_move_elem, buf, teid, 1);struct device *dev =ice_pf_to_dev (lag->pf);u16 numq, valq, num_moved, qbuf_size;u16 buf_size =__struct_size (buf);
drivers/net/ethernet/intel/ice/ice_sched.c +2 -2
@@ -237,7 +237,7 @@ static int ice_sched_remove_elems(struct ice_hw *hw, struct ice_sched_node *parent, u32 node_teid) { - DEFINE_FLEX(struct ice_aqc_delete_elem, buf, teid, 1); + DEFINE_RAW_FLEX(struct ice_aqc_delete_elem, buf, teid, 1);u16 buf_size =__struct_size (buf);u16 num_groups_removed =0 ;int status;
@@ -2219,7 +2219,7 @@ int ice_sched_move_nodes(struct ice_port_info *pi, struct ice_sched_node *parent, u16 num_items, u32 *list) { - DEFINE_FLEX(struct ice_aqc_move_elem, buf, teid, 1); + DEFINE_RAW_FLEX(struct ice_aqc_move_elem, buf, teid, 1);u16 buf_len =__struct_size (buf);struct ice_sched_node *node;u16 i, grps_movd =0 ;
drivers/net/ethernet/intel/ice/ice_switch.c +5 -5
@@ -1812,7 +1812,7 @@ ice_aq_alloc_free_vsi_list(struct ice_hw *hw, u16 *vsi_list_id,enum ice_sw_lkup_type lkup_type, enum ice_adminq_opc opc) { - DEFINE_FLEX(struct ice_aqc_alloc_free_res_elem, sw_buf, elem, 1); + DEFINE_RAW_FLEX(struct ice_aqc_alloc_free_res_elem, sw_buf, elem, 1);u16 buf_len =__struct_size (sw_buf);struct ice_aqc_res_elem *vsi_ele;int status;
@@ -2081,7 +2081,7 @@ ice_aq_get_recipe_to_profile(struct ice_hw *hw, u32 profile_id, u64 *r_assoc,*/ int ice_alloc_recipe (struct ice_hw *hw,u16 *rid) { - DEFINE_FLEX(struct ice_aqc_alloc_free_res_elem, sw_buf, elem, 1); + DEFINE_RAW_FLEX(struct ice_aqc_alloc_free_res_elem, sw_buf, elem, 1);u16 buf_len =__struct_size (sw_buf);int status;
@@ -4420,7 +4420,7 @@ int ice_alloc_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items, u16 *counter_id) { - DEFINE_FLEX(struct ice_aqc_alloc_free_res_elem, buf, elem, 1); + DEFINE_RAW_FLEX(struct ice_aqc_alloc_free_res_elem, buf, elem, 1);u16 buf_len =__struct_size (buf);int status;
@@ -4448,7 +4448,7 @@ int ice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items, u16 counter_id) { - DEFINE_FLEX(struct ice_aqc_alloc_free_res_elem, buf, elem, 1); + DEFINE_RAW_FLEX(struct ice_aqc_alloc_free_res_elem, buf, elem, 1);u16 buf_len =__struct_size (buf);int status;
@@ -4478,7 +4478,7 @@ ice_free_res_cntr(struct ice_hw *hw, u8 type, u8 alloc_shared, u16 num_items,*/ int ice_share_res (struct ice_hw *hw,u16 type,u8 shared,u16 res_id) { - DEFINE_FLEX(struct ice_aqc_alloc_free_res_elem, buf, elem, 1); + DEFINE_RAW_FLEX(struct ice_aqc_alloc_free_res_elem, buf, elem, 1);u16 buf_len =__struct_size (buf);u16 res_type;int status;
include/linux/overflow.h +21 -4
@@ -321,7 +321,7 @@ static inline size_t __must_check size_sub(size_t minuend, size_t subtrahend)* @count: Number of elements in the array; must be compile-time const. * @initializer: initializer expression (could be empty for no init). */ -#define _DEFINE_FLEX (type, name, member, count, initializer) \ +#define _DEFINE_FLEX(type, name, member, count, initializer...) \ _Static_assert(__builtin_constant_p(count), \ "onstack flex array members require compile-time const count"); \ union { \
@@ -331,8 +331,8 @@ static inline size_t __must_check size_sub(size_t minuend, size_t subtrahend) type *name = (type *)&name##_u/** -* DEFINE_FLEX() - Define an on-stack instance of structure with a trailing -* flexible array member. +* DEFINE_RAW_FLEX() - Define an on-stack instance of structure with a trailing +* flexible array member, when it does not have a __counted_by annotation. * * @type: structure type name, including "struct" keyword. * @name: Name for a variable to define.
@@ -343,7 +343,24 @@ static inline size_t __must_check size_sub(size_t minuend, size_t subtrahend)* flexible array member. * Use __struct_size(@name) to get compile-time size of it afterwards. */ -#define DEFINE_FLEX (type, name, member, count) \ +#define DEFINE_RAW_FLEX (type, name, member, count) \ _DEFINE_FLEX(type, name, member, count, = {}) +/** +* DEFINE_FLEX() - Define an on-stack instance of structure with a trailing +* flexible array member. +* +* @TYPE: structure type name, including "struct" keyword. +* @NAME: Name for a variable to define. +* @MEMBER: Name of the array member. +* @COUNTER: Name of the __counted_by member. +* @COUNT: Number of elements in the array; must be compile-time const. +* +* Define a zeroed, on-stack, instance of @TYPE structure with a trailing +* flexible array member. +* Use __struct_size(@NAME) to get compile-time size of it afterwards. +*/ +#define DEFINE_FLEX (TYPE ,NAME ,MEMBER ,COUNTER ,COUNT ) \ + _DEFINE_FLEX(TYPE, NAME, MEMBER, COUNT, = { .obj.COUNTER = COUNT, }) +#endif /* __LINUX_OVERFLOW_H */
lib/overflow_kunit.c +19 -0
@@ -1113,6 +1113,24 @@ static void castable_to_type_test(struct kunit *test)#undef TEST_CASTABLE_TO_TYPE } +struct foo { +int a; +u32 counter; + s16 array[] __counted_by(counter); +}; + +static void DEFINE_FLEX_test (struct kunit *test) +{ + DEFINE_RAW_FLEX(struct foo, two, array, 2); + DEFINE_FLEX(struct foo, eight, array, counter, 8); + DEFINE_FLEX(struct foo, empty, array, counter, 0); + +KUNIT_EXPECT_EQ (test,__struct_size (two), +sizeof (struct foo ) +sizeof (s16) +sizeof (s16)); +KUNIT_EXPECT_EQ (test,__struct_size (eight),24 ); +KUNIT_EXPECT_EQ (test,__struct_size (empty),sizeof (struct foo )); +} +static struct kunit_case overflow_test_cases[] = {KUNIT_CASE (u8_u8__u8_overflow_test),KUNIT_CASE (s8_s8__s8_overflow_test),
@@ -1135,6 +1153,7 @@ static struct kunit_case overflow_test_cases[] = {KUNIT_CASE (overflows_type_test),KUNIT_CASE (same_type_test),KUNIT_CASE (castable_to_type_test), + KUNIT_CASE(DEFINE_FLEX_test), {} };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 348/493 Bluetooth: hci_conn, hci_sync: Use __counted_by() to avoid -Wfamnae warnings
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo A. R. Silva <[email protected]>
[ Upstream commit c4585edf708edb5277a3cc4b8581ccb833f3307d ]
Prepare for the coming implementation by GCC and Clang of the __counted_by attribute. Flexible array members annotated with __counted_by can have their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family functions).
Also, -Wflex-array-member-not-at-end is coming in GCC-14, and we are getting ready to enable it globally.
So, use the DEFINE_FLEX() helper for multiple on-stack definitions of a flexible structure where the size of the flexible-array member is known at compile-time, and refactor the rest of the code, accordingly.
Notice that, due to the use of __counted_by() in struct hci_cp_le_create_cis, the for loop in function hci_cs_le_create_cis() had to be modified. Once the index i, through which cp->cis[i] is accessed, falls in the interval [0, cp->num_cis), cp->num_cis cannot be decremented all the way down to zero while accessing cp->cis[]:
net/bluetooth/hci_event.c:4310:
4310 for (i = 0; cp->num_cis; cp->num_cis--, i++) {
...4314 handle = __le16_to_cpu(cp->cis[i].cis_handle);
otherwise, only half (one iteration before cp->num_cis == i) or half plus one (one iteration before cp->num_cis < i) of the items in the array will be accessed before running into an out-of-bounds issue. So, in order to avoid this, set cp->num_cis to zero just after the for loop.
Also, make use of aux_num_cis variable to update cmd->num_cis after a list_for_each_entry_rcu() loop.
With these changes, fix the following warnings:net/bluetooth/hci_sync.c:1239:56: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] net/bluetooth/hci_sync.c:1415:51: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] net/bluetooth/hci_sync.c:1731:51: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] net/bluetooth/hci_sync.c:6497:45: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
Stable-dep-of: e77f43d531af ("Bluetooth: hci_core: Fix not handling hdev->le_num_of_adv_sets=1")
--- include/net/bluetooth/hci.h | 8 ++-- net/bluetooth/hci_event.c | 3 +- net/bluetooth/hci_sync.c | 84 +++++++++++++++---------------------- 3 files changed, 40 insertions(+), 55 deletions(-)
include/net/bluetooth/hci.h +4 -4
@@ -1920,7 +1920,7 @@ struct hci_cp_le_set_ext_adv_data {__u8 operation;__u8 frag_pref;__u8 length; -__u8 data[]; + __u8 data[] __counted_by(length); } __packed;#define HCI_OP_LE_SET_EXT_SCAN_RSP_DATA 0x2038
@@ -1929,7 +1929,7 @@ struct hci_cp_le_set_ext_scan_rsp_data {__u8 operation;__u8 frag_pref;__u8 length; -__u8 data[]; + __u8 data[] __counted_by(length); } __packed;#define HCI_OP_LE_SET_EXT_ADV_ENABLE 0x2039
@@ -1955,7 +1955,7 @@ struct hci_cp_le_set_per_adv_data {__u8 handle;__u8 operation;__u8 length; -__u8 data[]; + __u8 data[] __counted_by(length); } __packed;#define HCI_OP_LE_SET_PER_ADV_ENABLE 0x2040
@@ -2056,7 +2056,7 @@ struct hci_cis {struct hci_cp_le_create_cis {__u8 num_cis; -struct hci_cis cis[]; + struct hci_cis cis[] __counted_by(num_cis); } __packed;#define HCI_OP_LE_REMOVE_CIG 0x2065
net/bluetooth/hci_event.c +2 -1
@@ -4250,7 +4250,7 @@ static void hci_cs_le_create_cis(struct hci_dev *hdev, u8 status)hci_dev_lock (hdev);/* Remove connection if command failed */ -for (i =0 ; cp->num_cis; cp->num_cis--, i++) { +for (i =0 ; i < cp->num_cis; i++) {struct hci_conn *conn;u16 handle;
@@ -4266,6 +4266,7 @@ static void hci_cs_le_create_cis(struct hci_dev *hdev, u8 status)hci_conn_del (conn); } } + cp->num_cis =0 ;if (pending)hci_le_create_cis_pending (hdev);
net/bluetooth/hci_sync.c +34 -50
188 lines not on this page · raw message
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 349/493 Bluetooth: hci_core: Fix not handling hdev->le_num_of_adv_sets=1
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit e77f43d531af41e9ce299eab10dcae8fa5dbc293 ]
If hdev->le_num_of_adv_sets is set to 1 it means that only handle 0x00 can be used, but since the MGMT interface instances start from 1 (instance 0 means all instances in case of MGMT_OP_REMOVE_ADVERTISING) the code needs to map the instance to handle otherwise users will not be able to advertise as instance 1 would attempt to use handle 0x01.
--- include/net/bluetooth/hci_core.h | 1 + net/bluetooth/hci_core.c | 9 +++++++++ net/bluetooth/hci_sync.c | 17 ++++++++--------- 3 files changed, 18 insertions(+), 9 deletions(-)
include/net/bluetooth/hci_core.h +1 -0
@@ -246,6 +246,7 @@ struct adv_info {bool periodic;__u8 mesh;__u8 instance; +__u8 handle;__u32 flags;__u16 timeout;__u16 remaining_time;
net/bluetooth/hci_core.c +9 -0
@@ -1727,6 +1727,15 @@ struct adv_info *hci_add_adv_instance(struct hci_dev *hdev, u8 instance, adv->pending = true; adv->instance = instance; + +/* If controller support only one set and the instance is set to +* 1 then there is no option other than using handle 0x00. +*/ +if (hdev->le_num_of_adv_sets ==1 && instance ==1 ) + adv->handle =0x00 ; +else + adv->handle = instance; +list_add (&adv->list, &hdev->adv_instances); hdev->adv_instance_cnt++; }
net/bluetooth/hci_sync.c +8 -9
@@ -1043,11 +1043,10 @@ static int hci_disable_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance)struct hci_cp_ext_adv_set *set;u8 data[sizeof (*cp) +sizeof (*set) *1 ];u8 size; +struct adv_info *adv =NULL ;/* If request specifies an instance that doesn't exist, fail */ if (instance >0 ) { -struct adv_info *adv; - adv =hci_find_adv_instance (hdev, instance);if (!adv)return -EINVAL ;
@@ -1066,7 +1065,7 @@ static int hci_disable_ext_adv_instance_sync(struct hci_dev *hdev, u8 instance) cp->num_of_sets = !!instance; cp->enable =0x00 ; - set->handle = instance; + set->handle = adv ? adv->handle : instance; size =sizeof (*cp) +sizeof (*set) * cp->num_of_sets;
@@ -1249,7 +1248,7 @@ static int hci_set_ext_scan_rsp_data_sync(struct hci_dev *hdev, u8 instance) len =eir_create_scan_rsp (hdev, instance, pdu->data); - pdu->handle = instance; + pdu->handle = adv ? adv->handle : instance; pdu->length = len; pdu->operation =LE_SET_ADV_DATA_OP_COMPLETE ; pdu->frag_pref =LE_SET_ADV_DATA_NO_FRAG ;
@@ -1331,7 +1330,7 @@ int hci_enable_ext_advertising_sync(struct hci_dev *hdev, u8 instance)memset (set,0 ,sizeof (*set)); - set->handle = instance; + set->handle = adv ? adv->handle : instance;/* Set duration per instance since controller is responsible for * scheduling it.
@@ -1410,10 +1409,10 @@ static int hci_set_per_adv_data_sync(struct hci_dev *hdev, u8 instance) DEFINE_FLEX(struct hci_cp_le_set_per_adv_data, pdu, data, length, HCI_MAX_PER_AD_LENGTH);u8 len; +struct adv_info *adv =NULL ;if (instance) { -struct adv_info *adv =hci_find_adv_instance (hdev, instance); - + adv =hci_find_adv_instance (hdev, instance);if (!adv || !adv->periodic)return 0 ; }
@@ -1421,7 +1420,7 @@ static int hci_set_per_adv_data_sync(struct hci_dev *hdev, u8 instance) len =eir_create_per_adv_data (hdev, instance, pdu->data); pdu->length = len; - pdu->handle = instance; + pdu->handle = adv ? adv->handle : instance; pdu->operation =LE_SET_ADV_DATA_OP_COMPLETE ; return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_PER_ADV_DATA,
@@ -1734,7 +1733,7 @@ static int hci_set_ext_adv_data_sync(struct hci_dev *hdev, u8 instance) len =eir_create_adv_data (hdev, instance, pdu->data); pdu->length = len; - pdu->handle = instance; + pdu->handle = adv ? adv->handle : instance; pdu->operation =LE_SET_ADV_DATA_OP_COMPLETE ; pdu->frag_pref =LE_SET_ADV_DATA_NO_FRAG ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 350/493 drm/bridge: Fix improper bridge init order with pre_enable_prev_first
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jagan Teki <[email protected]>
[ Upstream commit e18aeeda0b6905c333df5a0566b99f5c84426098 ]
For a given bridge pipeline if any bridge sets pre_enable_prev_first flag then the pre_enable for the previous bridge will be called before pre_enable of this bridge and opposite is done for post_disable.
These are the potential bridge flags to alter bridge init order in order to satisfy the MIPI DSI host and downstream panel or bridge to function. However the existing pre_enable_prev_first logic with associated bridge ordering has broken for both pre_enable and post_disable calls.
[pre_enable]
The altered bridge ordering has failed if two consecutive bridges on a given pipeline enables the pre_enable_prev_first flag.
Example:
- Panel
- Bridge 1
- Bridge 2 pre_enable_prev_first
- Bridge 3
- Bridge 4 pre_enable_prev_first
- Bridge 5 pre_enable_prev_first
- Bridge 6
- Encoder
In this example, Bridge 4 and Bridge 5 have pre_enable_prev_first.
The logic looks for a bridge which enabled pre_enable_prev_first flag on each iteration and assigned the previou bridge to limit pointer if the bridge doesn't enable pre_enable_prev_first flags.
If control found Bridge 2 is pre_enable_prev_first then the iteration looks for Bridge 3 and found it is not pre_enable_prev_first and assigns it's previous Bridge 4 to limit pointer and calls pre_enable of Bridge 3 and Bridge 2 and assign iter pointer with limit which is Bridge 4.
Here is the actual problem, for the next iteration control look for Bridge 5 instead of Bridge 4 has iter pointer in previous iteration moved to Bridge 4 so this iteration skips the Bridge 4. The iteration found Bridge 6 doesn't pre_enable_prev_first flags so the limit assigned to Encoder. From next iteration Encoder skips as it is the last bridge for reverse order pipeline.
So, the resulting pre_enable bridge order would be,
- Panel, Bridge 1, Bridge 3, Bridge 2, Bridge 6, Bridge 5.
This patch fixes this by assigning limit to next pointer instead of previous bridge since the iteration always looks for bridge that does NOT request prev so assigning next makes sure the last bridge on a given iteration what exactly the limit bridge is.
So, the resulting pre_enable bridge order with fix would be,
- Panel, Bridge 1, Bridge 3, Bridge 2, Bridge 6, Bridge 5, Bridge 4, Encoder.
[post_disable]
The altered bridge ordering has failed if two consecutive bridges on a given pipeline enables the pre_enable_prev_first flag.
Example:
- Panel
- Bridge 1
- Bridge 2 pre_enable_prev_first
- Bridge 3
- Bridge 4 pre_enable_prev_first
- Bridge 5 pre_enable_prev_first
- Bridge 6
- Encoder
In this example Bridge 5 and Bridge 4 have pre_enable_prev_first.
The logic looks for a bridge which enabled pre_enable_prev_first flags on each iteration and assigned the previou bridge to next and next to limit pointer if the bridge does enable pre_enable_prev_first flag.
If control starts from Bridge 6 then it found next Bridge 5 is pre_enable_prev_first and immediately the next assigned to previous Bridge 6 and limit assignments to next Bridge 6 and call post_enable of Bridge 6 even though the next consecutive Bridge 5 is enabled with pre_enable_prev_first. This clearly misses the logic to find the state of next conducive bridge as everytime the next and limit assigns previous bridge if given bridge enabled pre_enable_prev_first.
So, the resulting post_disable bridge order would be,
- Encoder, Bridge 6, Bridge 5, Bridge 4, Bridge 3, Bridge 2, Bridge 1, Panel.
This patch fixes this by assigning next with previou bridge only if the bridge doesn't enable pre_enable_prev_first flag and the next further assign it to limit. This way we can find the bridge that NOT requested prev to disable last.
So, the resulting pre_enable bridge order with fix would be,
- Encoder, Bridge 4, Bridge 5, Bridge 6, Bridge 2, Bridge 3, Bridge 1, Panel.
Validated the bridge init ordering by incorporating dummy bridges in the sun6i-mipi-dsi pipeline
--- drivers/gpu/drm/drm_bridge.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_bridge.c +8 -2
@@ -687,11 +687,17 @@ void drm_atomic_bridge_chain_post_disable(struct drm_bridge *bridge,*/ list_for_each_entry_from (next, &encoder->bridge_chain, chain_node) { -if (next->pre_enable_prev_first) { +if (!next->pre_enable_prev_first) { next =list_prev_entry (next, chain_node); limit = next;break ; } + +if (list_is_last (&next->chain_node, + &encoder->bridge_chain)) { + limit = next; +break ; + } }/* Call these bridges in reverse order */
@@ -774,7 +780,7 @@ void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge,/* Found first bridge that does NOT * request prev to be enabled first */ - limit =list_prev_entry (next, chain_node); + limit = next;break ; } }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 351/493 drm/ci: update device type for volteer devices
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vignesh Raman <[email protected]>
[ Upstream commit a2c71b711e7efc6478976233768bdbc3386e6dce ]
Volteer devices in the collabora lab are categorized under the asus-cx9400-volteer device type. The majority of these units has an Intel Core i5-1130G7 CPU, while some of them have a Intel Core i7-1160G7 CPU instead. So due to this difference, new device type template is added for the Intel Core i5-1130G7 and i7-1160G7 variants of the Acer Chromebook Spin 514 (CP514-2H) volteer Chromebooks. So update the same in drm-ci.
https://gitlab.collabora.com/lava/lava/-/merge_requests/149
--- drivers/gpu/drm/ci/test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/ci/test.yml +3 -3
@@ -237,11 +237,11 @@ i915:cml: i915:tgl: extends: - .i915 - parallel: 8 + parallel: 5 variables: - DEVICE_TYPE: asus-cx9400-volteer + DEVICE_TYPE: acer-cp514-2h-1130g7-volteer GPU_VERSION: tgl - RUNNER_TAG: mesa-ci-x86-64-lava-asus-cx9400-volteer + RUNNER_TAG: mesa-ci-x86-64-lava-acer-cp514-2h-1130g7-volteer .amdgpu: extends:
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 352/493 drm/nouveau/dp: Fix incorrect return code in r535_dp_aux_xfer()
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lyude Paul <[email protected]>
[ Upstream commit 97252d0a4bfbb07079503d059f7522d305fe0f7a ]
I've recently been seeing some unexplained GSP errors on my RTX 6000 from failed aux transactions:
[ 132.915867] nouveau 0000:1f:00.0: gsp: cli:0xc1d00002 obj:0x00730000 ctrl cmd:0x00731341 failed: 0x0000ffff
While the cause of these is not yet clear, these messages made me notice that the aux transactions causing these transactions were succeeding - not failing. As it turns out, this is because we're currently not returning the correct variable when r535_dp_aux_xfer() hits an error - causing us to never propagate GSP errors for failed aux transactions to userspace.
So, let's fix that.
--- drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/engine/disp/r535.c +1 -1
@@ -1080,7 +1080,7 @@ r535_dp_aux_xfer(struct nvkm_outp *outp, u8 type, u32 addr, u8 *data, u8 *psize) ret =nvkm_gsp_rm_ctrl_push (&disp->rm.objcom, &ctrl,sizeof (*ctrl));if (ret) {nvkm_gsp_rm_ctrl_done (&disp->rm.objcom, ctrl); -return PTR_ERR (ctrl); +return ret; }memcpy (data, ctrl->data, size);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 353/493 drm/omapdrm: Fix console by implementing fb_dirty
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
[ Upstream commit 632bac50544c0929ced9eed41e7d04c08adecbb0 ]
The framebuffer console stopped updating with commit f231af498c29 ("drm/fb-helper: Disconnect damage worker from update logic").
Let's fix the issue by implementing fb_dirty similar to what was done with commit 039a72ce7e57 ("drm/i915/fbdev: Implement fb_dirty for intel custom fb helper").
--- drivers/gpu/drm/omapdrm/omap_fbdev.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/gpu/drm/omapdrm/omap_fbdev.c +12 -0
@@ -238,8 +238,20 @@ static int omap_fbdev_create(struct drm_fb_helper *helper,return ret; } +static int omap_fbdev_dirty (struct drm_fb_helper *helper,struct drm_clip_rect *clip) +{ +if (!(clip->x1 < clip->x2 && clip->y1 < clip->y2)) +return 0 ; + +if (helper->fb->funcs->dirty) +return helper->fb->funcs->dirty (helper->fb,NULL ,0 ,0 , clip,1 ); + +return 0 ; +} +static const struct drm_fb_helper_funcs omap_fb_helper_funcs = { .fb_probe = omap_fbdev_create, + .fb_dirty = omap_fbdev_dirty, };static struct drm_fb_helper *get_fb (struct fb_info *fbi)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 354/493 drm/omapdrm: Fix console with deferred ops
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
[ Upstream commit 01c0cce88c5480cc2505b79330246ef12eda938f ]
Commit 95da53d63dcf ("drm/omapdrm: Use regular fbdev I/O helpers") stopped console from updating for command mode displays because there is no damage handling in fb_sys_write() unlike we had earlier in drm_fb_helper_sys_write().
Let's fix the issue by adding FB_GEN_DEFAULT_DEFERRED_DMAMEM_OPS and FB_DMAMEM_HELPERS_DEFERRED as suggested by Thomas. We cannot use the FB_DEFAULT_DEFERRED_OPS as fb_deferred_io_mmap() won't work properly for write-combine.
--- drivers/gpu/drm/omapdrm/Kconfig | 2 +- drivers/gpu/drm/omapdrm/omap_fbdev.c | 28 ++++++++++++++++++++++------ drivers/video/fbdev/core/Kconfig | 6 ++++++ include/linux/fb.h | 4 ++++ 4 files changed, 33 insertions(+), 7 deletions(-)
drivers/gpu/drm/omapdrm/Kconfig +1 -1
@@ -4,7 +4,7 @@ config DRM_OMAP depends on DRM && OF depends on ARCH_OMAP2PLUS select DRM_KMS_HELPER - select FB_DMAMEM_HELPERS if DRM_FBDEV_EMULATION + select FB_DMAMEM_HELPERS_DEFERRED if DRM_FBDEV_EMULATION select VIDEOMODE_HELPERS select HDMI default n
drivers/gpu/drm/omapdrm/omap_fbdev.c +22 -6
@@ -51,6 +51,10 @@ static void pan_worker(struct work_struct *work)omap_gem_roll (bo, fbi->var.yoffset * npages); } +FB_GEN_DEFAULT_DEFERRED_DMAMEM_OPS (omap_fbdev, + drm_fb_helper_damage_range, + drm_fb_helper_damage_area) +static int omap_fbdev_pan_display (struct fb_var_screeninfo *var,struct fb_info *fbi) {
@@ -78,11 +82,9 @@ static int omap_fbdev_pan_display(struct fb_var_screeninfo *var,static int omap_fbdev_fb_mmap (struct fb_info *info,struct vm_area_struct *vma) { -struct drm_fb_helper *helper = info->par; -struct drm_framebuffer *fb = helper->fb; -struct drm_gem_object *bo =drm_gem_fb_get_obj (fb,0 ); + vma->vm_page_prot =pgprot_writecombine (vm_get_page_prot (vma->vm_flags)); -return drm_gem_mmap_obj (bo,omap_gem_mmap_size (bo), vma); +return fb_deferred_io_mmap (info, vma); }static void omap_fbdev_fb_destroy (struct fb_info *info)
@@ -94,6 +96,7 @@ static void omap_fbdev_fb_destroy(struct fb_info *info)DBG (); +fb_deferred_io_cleanup (info);drm_fb_helper_fini (helper);omap_gem_unpin (bo);
@@ -104,15 +107,19 @@ static void omap_fbdev_fb_destroy(struct fb_info *info)kfree (fbdev); } +/* +* For now, we cannot use FB_DEFAULT_DEFERRED_OPS and fb_deferred_io_mmap() +* because we use write-combine. +*/ static const struct fb_ops omap_fb_ops = { .owner =THIS_MODULE , - __FB_DEFAULT_DMAMEM_OPS_RDWR, +__FB_DEFAULT_DEFERRED_OPS_RDWR (omap_fbdev), .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, .fb_setcmap = drm_fb_helper_setcmap, .fb_blank = drm_fb_helper_blank, .fb_pan_display = omap_fbdev_pan_display, - __FB_DEFAULT_DMAMEM_OPS_DRAW, +__FB_DEFAULT_DEFERRED_OPS_DRAW (omap_fbdev), .fb_ioctl = drm_fb_helper_ioctl, .fb_mmap = omap_fbdev_fb_mmap, .fb_destroy = omap_fbdev_fb_destroy,
@@ -213,6 +220,15 @@ static int omap_fbdev_create(struct drm_fb_helper *helper, fbi->fix.smem_start = dma_addr; fbi->fix.smem_len = bo->size; +/* deferred I/O */ + helper->fbdefio.delay =HZ /20 ; + helper->fbdefio.deferred_io = drm_fb_helper_deferred_io; + + fbi->fbdefio = &helper->fbdefio; + ret =fb_deferred_io_init (fbi); +if (ret) + goto fail; +/* if we have DMM, then we can use it for scrolling by just * shuffling pages around in DMM rather than doing sw blit. */
drivers/video/fbdev/core/Kconfig +6 -0
@@ -144,6 +144,12 @@ config FB_DMAMEM_HELPERS select FB_SYS_IMAGEBLIT select FB_SYSMEM_FOPS +config FB_DMAMEM_HELPERS_DEFERRED + bool + depends on FB_CORE + select FB_DEFERRED_IO + select FB_DMAMEM_HELPERS + config FB_IOMEM_FOPS tristate depends on FB_CORE
include/linux/fb.h +4 -0
@@ -686,6 +686,10 @@ extern int fb_deferred_io_fsync(struct file *file, loff_t start, __FB_GEN_DEFAULT_DEFERRED_OPS_RDWR(__prefix, __damage_range, sys) \ __FB_GEN_DEFAULT_DEFERRED_OPS_DRAW(__prefix, __damage_area, sys) +#define FB_GEN_DEFAULT_DEFERRED_DMAMEM_OPS (__prefix, __damage_range, __damage_area) \ + __FB_GEN_DEFAULT_DEFERRED_OPS_RDWR(__prefix, __damage_range, sys) \ + __FB_GEN_DEFAULT_DEFERRED_OPS_DRAW(__prefix, __damage_area, sys) +/* * Initializes struct fb_ops for deferred I/O. */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 355/493 printk: Let no_printk() use _printk()
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit 8522f6b760ca588928eede740d5d69dd1e936b49 ]
When printk-indexing is enabled, each printk() invocation emits a pi_entry structure, containing the format string and other information related to its location in the kernel sources. This is even true for no_printk(): while the actual code to print the message is optimized out by the compiler due to the always-false check, the pi_entry structure is still emitted.
As the main purpose of no_printk() is to provide a helper to maintain printf()-style format checking when debugging is disabled, this leads to the inclusion in the index of lots of printk formats that cannot be emitted by the current kernel.
Fix this by switching no_printk() from printk() to _printk().
This reduces the size of an arm64 defconfig kernel with CONFIG_PRINTK_INDEX=y by 576 KiB.
--- include/linux/printk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/printk.h +1 -1
@@ -126,7 +126,7 @@ struct va_format {#define no_printk (fmt, ...) \ ({ \ if (0) \ - printk(fmt, ##__VA_ARGS__); \ + _printk(fmt, ##__VA_ARGS__); \ 0; \ })
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 356/493 dev_printk: Add and use dev_no_printk()
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
[ Upstream commit c26ec799042a3888935d59b599f33e41efedf5f8 ]
When printk-indexing is enabled, each dev_printk() invocation emits a pi_entry structure. This is even true when the dev_printk() is protected by an always-false check, as is typically the case for debug
messages: while the actual code to print the message is optimized out by the compiler, the pi_entry structure is still emitted.
Avoid emitting pi_entry structures for unavailable dev_printk() kernel messages by:
1. Introducing a dev_no_printk() helper, mimicked after the existing no_printk() helper, which calls _dev_printk() instead of dev_printk(),
2. Replacing all "if (0) dev_printk(...)" constructs by calls to the new helper.
This reduces the size of an arm64 defconfig kernel with CONFIG_PRINTK_INDEX=y by 957 KiB.
--- include/linux/dev_printk.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-)
include/linux/dev_printk.h +13 -12
@@ -129,6 +129,16 @@ void _dev_info(const struct device *dev, const char *fmt, ...) _dev_printk(level, dev, fmt, ##__VA_ARGS__); \ }) +/* +* Dummy dev_printk for disabled debugging statements to use whilst maintaining +* gcc's format checking. +*/ +#define dev_no_printk (level, dev, fmt, ...) \ + ({ \ + if (0) \ + _dev_printk(level, dev, fmt, ##__VA_ARGS__); \ + }) +/* * #defines for all the dev_<level> macros to prefix with whatever * possible use of #define dev_fmt(fmt) ...
@@ -158,10 +168,7 @@ void _dev_info(const struct device *dev, const char *fmt, ...) dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)#else #define dev_dbg (dev, fmt, ...) \ -({ \ - if (0) \ - dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \ -}) + dev_no_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)#endif #ifdef CONFIG_PRINTK
@@ -247,20 +254,14 @@ do { \ } while (0)#else #define dev_dbg_ratelimited (dev, fmt, ...) \ -do { \ - if (0) \ - dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \ -} while (0) + dev_no_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)#endif #ifdef VERBOSE_DEBUG #define dev_vdbg dev_dbg#else #define dev_vdbg (dev, fmt, ...) \ -({ \ - if (0) \ - dev_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__); \ -}) + dev_no_printk(KERN_DEBUG, dev, dev_fmt(fmt), ##__VA_ARGS__)#endif /*
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 357/493 drm/lcdif: Do not disable clocks on already suspended hardware
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Vasut <[email protected]>
[ Upstream commit 172695f145fb4798ab605e8a73f6e87711930124 ]
In case the LCDIF is enabled in DT but unused, the clocks used by the LCDIF are not enabled. Those clocks may even have a use count of 0 in case there are no other users of those clocks. This can happen e.g. in case the LCDIF drives HDMI bridge which has no panel plugged into the HDMI connector.
Do not attempt to disable clocks in the suspend callback and re-enable clocks in the resume callback unless the LCDIF is enabled and was in use before the system entered suspend, otherwise the driver might end up trying to disable clocks which are already disabled with use count 0, and would trigger a warning from clock core about this condition.
Note that the lcdif_rpm_suspend() and lcdif_rpm_resume() functions internally perform the clocks disable and enable operations and act as runtime PM hooks too.
--- drivers/gpu/drm/mxsfb/lcdif_drv.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/mxsfb/lcdif_drv.c +5 -1
@@ -340,6 +340,9 @@ static int __maybe_unused lcdif_suspend(struct device *dev)if (ret)return ret; +if (pm_runtime_suspended (dev)) +return 0 ; +return lcdif_rpm_suspend (dev); }
@@ -347,7 +350,8 @@ static int __maybe_unused lcdif_resume(struct device *dev) {struct drm_device *drm =dev_get_drvdata (dev); -lcdif_rpm_resume (dev); +if (!pm_runtime_suspended (dev)) +lcdif_rpm_resume (dev);return drm_mode_config_helper_resume (drm); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 358/493 drm/dp: Dont attempt AUX transfers when eDP panels are not powered
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit 8df1ddb5bf11ab820ad991e164dab82c0960add9 ]
If an eDP panel is not powered on then any attempts to talk to it over the DP AUX channel will timeout. Unfortunately these attempts may be quite slow. Userspace can initiate these attempts either via a /dev/drm_dp_auxN device or via the created i2c device.
Making the DP AUX drivers timeout faster is a difficult proposition. In theory we could just poll the panel's HPD line in the AUX transfer function and immediately return an error there. However, this is easier said than done. For one thing, there's no hard requirement to hook the HPD line up for eDP panels and it's OK to just delay a fixed amount. For another thing, the HPD line may not be fast to probe. On parade-ps8640 we need to wait for the bridge chip's firmware to boot before we can get the HPD line and this is a slow process.
The fact that the transfers are taking so long to timeout is causing real problems. The open source fwupd daemon sometimes scans DP busses looking for devices whose firmware need updating. If it happens to scan while a panel is turned off this scan can take a long time. The fwupd daemon could try to be smarter and only scan when eDP panels are turned on, but we can also improve the behavior in the kernel.
Let's let eDP panels drivers specify that a panel is turned off and then modify the common AUX transfer code not to attempt a transfer in this case.
Stable-dep-of: 5e842d55bad7 ("drm/panel: atna33xc20: Fix unbalanced regulator in the case HPD doesn't assert")
--- drivers/gpu/drm/display/drm_dp_helper.c | 35 +++++++++++++++++++ drivers/gpu/drm/panel/panel-edp.c | 3 ++ .../gpu/drm/panel/panel-samsung-atna33xc20.c | 2 ++ include/drm/display/drm_dp_helper.h | 6 ++++ 4 files changed, 46 insertions(+)
drivers/gpu/drm/display/drm_dp_helper.c +35 -0
@@ -532,6 +532,15 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request,mutex_lock (&aux->hw_mutex); +/* +* If the device attached to the aux bus is powered down then there's +* no reason to attempt a transfer. Error out immediately. +*/ +if (aux->powered_down) { + ret = -EBUSY ; + goto unlock; + } +/* * The specification doesn't give any recommendation on how often to * retry native transactions. We used to retry 7 times like for
@@ -599,6 +608,29 @@ int drm_dp_dpcd_probe(struct drm_dp_aux *aux, unsigned int offset) }EXPORT_SYMBOL (drm_dp_dpcd_probe); +/** +* drm_dp_dpcd_set_powered() - Set whether the DP device is powered +* @aux: DisplayPort AUX channel; for convenience it's OK to pass NULL here +* and the function will be a no-op. +* @powered: true if powered; false if not +* +* If the endpoint device on the DP AUX bus is known to be powered down +* then this function can be called to make future transfers fail immediately +* instead of needing to time out. +* +* If this function is never called then a device defaults to being powered. +*/ +void drm_dp_dpcd_set_powered (struct drm_dp_aux *aux,bool powered) +{ +if (!aux) +return ; + +mutex_lock (&aux->hw_mutex); + aux->powered_down = !powered; +mutex_unlock (&aux->hw_mutex); +} +EXPORT_SYMBOL (drm_dp_dpcd_set_powered); +/** * drm_dp_dpcd_read() - read a series of bytes from the DPCD * @aux: DisplayPort AUX channel (SST or MST)
@@ -1858,6 +1890,9 @@ static int drm_dp_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs,struct drm_dp_aux_msg msg;int err =0 ; +if (aux->powered_down) +return -EBUSY ; + dp_aux_i2c_transfer_size =clamp (dp_aux_i2c_transfer_size,1 ,DP_AUX_MAX_PAYLOAD_BYTES );memset (&msg,0 ,sizeof (msg));
drivers/gpu/drm/panel/panel-edp.c +3 -0
@@ -397,6 +397,7 @@ static int panel_edp_suspend(struct device *dev) {struct panel_edp *p =dev_get_drvdata (dev); +drm_dp_dpcd_set_powered (p->aux, false);gpiod_set_value_cansleep (p->enable_gpio,0 );regulator_disable (p->supply); p->unprepared_time =ktime_get_boottime ();
@@ -453,6 +454,7 @@ static int panel_edp_prepare_once(struct panel_edp *p) }gpiod_set_value_cansleep (p->enable_gpio,1 ); +drm_dp_dpcd_set_powered (p->aux, true); delay = p->desc->delay.hpd_reliable;if (p->no_hpd)
@@ -489,6 +491,7 @@ static int panel_edp_prepare_once(struct panel_edp *p)return 0 ; error: +drm_dp_dpcd_set_powered (p->aux, false);gpiod_set_value_cansleep (p->enable_gpio,0 );regulator_disable (p->supply); p->unprepared_time =ktime_get_boottime ();
drivers/gpu/drm/panel/panel-samsung-atna33xc20.c +2 -0
@@ -72,6 +72,7 @@ static int atana33xc20_suspend(struct device *dev)if (p->el3_was_on)atana33xc20_wait (p->el_on3_off_time,150 ); +drm_dp_dpcd_set_powered (p->aux, false); ret =regulator_disable (p->supply);if (ret)return ret;
@@ -93,6 +94,7 @@ static int atana33xc20_resume(struct device *dev) ret =regulator_enable (p->supply);if (ret)return ret; +drm_dp_dpcd_set_powered (p->aux, true); p->powered_on_time =ktime_get_boottime ();if (p->no_hpd) {
include/drm/display/drm_dp_helper.h +6 -0
@@ -463,9 +463,15 @@ struct drm_dp_aux {* @is_remote: Is this AUX CH actually using sideband messaging. */ bool is_remote; + +/** +* @powered_down: If true then the remote endpoint is powered down. +*/ +bool powered_down; };int drm_dp_dpcd_probe (struct drm_dp_aux *aux,unsigned int offset); +void drm_dp_dpcd_set_powered (struct drm_dp_aux *aux,bool powered);ssize_t drm_dp_dpcd_read (struct drm_dp_aux *aux,unsigned int offset,void *buffer,size_t size); ssize_t drm_dp_dpcd_write(struct drm_dp_aux *aux, unsigned int offset,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 359/493 drm/panel: atna33xc20: Fix unbalanced regulator in the case HPD doesnt assert
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit 5e842d55bad7794823a50f24fd645b58f2ef93ab ]
When the atna33xc20 driver was first written the resume code never returned an error. If there was a problem waiting for HPD it just printed a warning and moved on. This changed in response to review feedback [1] on a future patch but I accidentally didn't account for rolling back the regulator enable in the error cases. Do so now.
[1] https://lore.kernel.org/all/[email protected]/
--- .../gpu/drm/panel/panel-samsung-atna33xc20.c | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-)
drivers/gpu/drm/panel/panel-samsung-atna33xc20.c +13 -9
@@ -109,19 +109,17 @@ static int atana33xc20_resume(struct device *dev)if (hpd_asserted <0 ) ret = hpd_asserted; -if (ret) +if (ret) {dev_warn (dev,"Error waiting for HPD GPIO: %d\n" , ret); - -return ret; - } - -if (p->aux->wait_hpd_asserted) { + goto error; + } + }else if (p->aux->wait_hpd_asserted) { ret = p->aux->wait_hpd_asserted (p->aux,HPD_MAX_US ); -if (ret) +if (ret) {dev_warn (dev,"Controller error waiting for HPD: %d\n" , ret); - -return ret; + goto error; + } }/*
@@ -133,6 +131,12 @@ static int atana33xc20_resume(struct device *dev)* right times. */ return 0 ; + +error: +drm_dp_dpcd_set_powered (p->aux, false); +regulator_disable (p->supply); + +return ret; }static int atana33xc20_disable (struct drm_panel *panel)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 360/493 drm/amd/display: Fix potential index out of bounds in color transformation function
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
[ Upstream commit 63ae548f1054a0b71678d0349c7dc9628ddd42ca ]
Fixes index out of bounds issue in the color transformation function. The issue could occur when the index 'i' exceeds the number of transfer function points (TRANSFER_FUNC_POINTS).
The fix adds a check to ensure 'i' is within bounds before accessing the transfer function points. If 'i' is out of bounds, an error message is logged and the function returns false to indicate an error.
Reported by smatch:drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_cm_common.c:405 cm_helper_translate_curve_to_hw_format() error: buffer overflow 'output_tf->tf_pts.red' 1025 <= s32max drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_cm_common.c:406 cm_helper_translate_curve_to_hw_format() error: buffer overflow 'output_tf->tf_pts.green' 1025 <= s32max drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_cm_common.c:407 cm_helper_translate_curve_to_hw_format() error: buffer overflow 'output_tf->tf_pts.blue' 1025 <= s32max
--- drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_cm_common.c +5 -0
@@ -382,6 +382,11 @@ bool cm_helper_translate_curve_to_hw_format(struct dc_context *ctx, i += increment) {if (j == hw_points -1 )break ; +if (i >=TRANSFER_FUNC_POINTS ) { +DC_LOG_ERROR ("Index out of bounds: i=%d, TRANSFER_FUNC_POINTS=%d\n" , + i,TRANSFER_FUNC_POINTS ); +return false; + } rgb_resulted[j].red = output_tf->tf_pts.red[i]; rgb_resulted[j].green = output_tf->tf_pts.green[i]; rgb_resulted[j].blue = output_tf->tf_pts.blue[i];
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 361/493 drm/amd/display: Remove redundant condition in dcn35_calc_blocks_to_gate()
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivasan Shanmugam <[email protected]>
[ Upstream commit a43dbeaba81eb645a12a004c67722c632ed0d94b ]
pipe_ctx->plane_res.mpcc_inst is of a type that can only hold values between 0 and 255, so it's always greater than or equal to 0.
Thus the condition 'pipe_ctx->plane_res.mpcc_inst >= 0' was always true and has been removed.
Fixes the below:drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn35/dcn35_hwseq.c:1023 dcn35_calc_blocks_to_gate() warn: always true condition '(pipe_ctx->plane_res.mpcc_inst >= 0) => (0-255 >= 0)'
--- drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dcn35/dcn35_hwseq.c +1 -2
@@ -999,8 +999,7 @@ void dcn35_calc_blocks_to_gate(struct dc *dc, struct dc_state *context,if (pipe_ctx->plane_res.dpp) update_state->pg_pipe_res_update[PG_DPP ][pipe_ctx->plane_res.hubp->inst] = false; -if ((pipe_ctx->plane_res.dpp || pipe_ctx->stream_res.opp) && - pipe_ctx->plane_res.mpcc_inst >=0 ) +if (pipe_ctx->plane_res.dpp || pipe_ctx->stream_res.opp) update_state->pg_pipe_res_update[PG_MPCC ][pipe_ctx->plane_res.mpcc_inst] = false;if (pipe_ctx->stream_res.dsc)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 362/493 ASoC: Intel: Disable route checks for Skylake boards
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 0cb3b7fd530b8c107443218ce6db5cb6e7b5dbe1 ]
Topology files that are propagated to the world and utilized by the skylake-driver carry shortcomings in their SectionGraphs.
Since commit daa480bde6b3 ("ASoC: soc-core: tidyup for snd_soc_dapm_add_routes()") route checks are no longer permissive. Probe failures for Intel boards have been partially addressed by commit a22ae72b86a4 ("ASoC: soc-core: disable route checks for legacy devices") and its follow up but only skl_nau88l25_ssm4567.c is patched. Fix the problem for the rest of the boards.
--- sound/soc/intel/boards/bxt_da7219_max98357a.c | 1 + sound/soc/intel/boards/bxt_rt298.c | 1 + sound/soc/intel/boards/glk_rt5682_max98357a.c | 2 ++ sound/soc/intel/boards/kbl_da7219_max98357a.c | 1 + sound/soc/intel/boards/kbl_da7219_max98927.c | 4 ++++ sound/soc/intel/boards/kbl_rt5660.c | 1 + sound/soc/intel/boards/kbl_rt5663_max98927.c | 2 ++ sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c | 1 + sound/soc/intel/boards/skl_hda_dsp_generic.c | 2 ++ sound/soc/intel/boards/skl_nau88l25_max98357a.c | 1 + sound/soc/intel/boards/skl_rt286.c | 1 + 11 files changed, 17 insertions(+)
sound/soc/intel/boards/bxt_da7219_max98357a.c +1 -0
@@ -768,6 +768,7 @@ static struct snd_soc_card broxton_audio_card = { .dapm_routes = audio_map, .num_dapm_routes = ARRAY_SIZE(audio_map), .fully_routed = true, + .disable_route_checks = true, .late_probe = bxt_card_late_probe, };
sound/soc/intel/boards/bxt_rt298.c +1 -0
@@ -574,6 +574,7 @@ static struct snd_soc_card broxton_rt298 = { .dapm_routes = broxton_rt298_map, .num_dapm_routes = ARRAY_SIZE(broxton_rt298_map), .fully_routed = true, + .disable_route_checks = true, .late_probe = bxt_card_late_probe, };
sound/soc/intel/boards/glk_rt5682_max98357a.c +2 -0
@@ -649,6 +649,8 @@ static int geminilake_audio_probe(struct platform_device *pdev) card = &glk_audio_card_rt5682_m98357a; card->dev = &pdev->dev;snd_soc_card_set_drvdata (card, ctx); +if (!snd_soc_acpi_sof_parent (&pdev->dev)) + card->disable_route_checks = true;/* override platform name, if required */ mach = pdev->dev.platform_data;
sound/soc/intel/boards/kbl_da7219_max98357a.c +1 -0
@@ -639,6 +639,7 @@ static struct snd_soc_card kabylake_audio_card_da7219_m98357a = { .dapm_routes = kabylake_map, .num_dapm_routes = ARRAY_SIZE(kabylake_map), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
sound/soc/intel/boards/kbl_da7219_max98927.c +4 -0
@@ -1036,6 +1036,7 @@ static struct snd_soc_card kbl_audio_card_da7219_m98927 = { .codec_conf = max98927_codec_conf, .num_configs = ARRAY_SIZE(max98927_codec_conf), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
@@ -1054,6 +1055,7 @@ static struct snd_soc_card kbl_audio_card_max98927 = { .codec_conf = max98927_codec_conf, .num_configs = ARRAY_SIZE(max98927_codec_conf), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
@@ -1071,6 +1073,7 @@ static struct snd_soc_card kbl_audio_card_da7219_m98373 = { .codec_conf = max98373_codec_conf, .num_configs = ARRAY_SIZE(max98373_codec_conf), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
@@ -1088,6 +1091,7 @@ static struct snd_soc_card kbl_audio_card_max98373 = { .codec_conf = max98373_codec_conf, .num_configs = ARRAY_SIZE(max98373_codec_conf), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
sound/soc/intel/boards/kbl_rt5660.c +1 -0
@@ -518,6 +518,7 @@ static struct snd_soc_card kabylake_audio_card_rt5660 = { .dapm_routes = kabylake_rt5660_map, .num_dapm_routes = ARRAY_SIZE(kabylake_rt5660_map), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
sound/soc/intel/boards/kbl_rt5663_max98927.c +2 -0
@@ -966,6 +966,7 @@ static struct snd_soc_card kabylake_audio_card_rt5663_m98927 = { .codec_conf = max98927_codec_conf, .num_configs = ARRAY_SIZE(max98927_codec_conf), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
@@ -982,6 +983,7 @@ static struct snd_soc_card kabylake_audio_card_rt5663 = { .dapm_routes = kabylake_5663_map, .num_dapm_routes = ARRAY_SIZE(kabylake_5663_map), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c +1 -0
@@ -791,6 +791,7 @@ static struct snd_soc_card kabylake_audio_card = { .codec_conf = max98927_codec_conf, .num_configs = ARRAY_SIZE(max98927_codec_conf), .fully_routed = true, + .disable_route_checks = true, .late_probe = kabylake_card_late_probe, };
sound/soc/intel/boards/skl_hda_dsp_generic.c +2 -0
@@ -227,6 +227,8 @@ static int skl_hda_audio_probe(struct platform_device *pdev) ctx->common_hdmi_codec_drv = mach->mach_params.common_hdmi_codec_drv; hda_soc_card.dev = &pdev->dev; +if (!snd_soc_acpi_sof_parent (&pdev->dev)) + hda_soc_card.disable_route_checks = true;if (mach->mach_params.dmic_num >0 ) { snprintf(hda_soc_components, sizeof(hda_soc_components),
sound/soc/intel/boards/skl_nau88l25_max98357a.c +1 -0
@@ -654,6 +654,7 @@ static struct snd_soc_card skylake_audio_card = { .dapm_routes = skylake_map, .num_dapm_routes = ARRAY_SIZE(skylake_map), .fully_routed = true, + .disable_route_checks = true, .late_probe = skylake_card_late_probe, };
sound/soc/intel/boards/skl_rt286.c +1 -0
@@ -523,6 +523,7 @@ static struct snd_soc_card skylake_rt286 = { .dapm_routes = skylake_rt286_map, .num_dapm_routes = ARRAY_SIZE(skylake_rt286_map), .fully_routed = true, + .disable_route_checks = true, .late_probe = skylake_card_late_probe, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 363/493 ASoC: Intel: avs: ssm4567: Do not ignore route checks
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit e6719d48ba6329536c459dcee5a571e535687094 ]
A copy-paste from intel/boards/skl_nau88l25_ssm4567.c made the avs's equivalent disable route checks as well. Such behavior is not desired.
--- sound/soc/intel/avs/boards/ssm4567.c | 1 - 1 file changed, 1 deletion(-)
sound/soc/intel/avs/boards/ssm4567.c +0 -1
@@ -172,7 +172,6 @@ static int avs_ssm4567_probe(struct platform_device *pdev) card->dapm_routes = card_base_routes; card->num_dapm_routes =ARRAY_SIZE (card_base_routes); card->fully_routed = true; - card->disable_route_checks = true; ret =snd_soc_fixup_dai_links_platform_name (card, pname);if (ret)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 364/493 mtd: core: Report error if first mtd_otp_size() call fails in mtd_otp_nvmem_add()
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aapo Vienamo <[email protected]>
[ Upstream commit d44f0bbbd8d182debcce88bda55b05269f3d33d6 ]
Jump to the error reporting code in mtd_otp_nvmem_add() if the mtd_otp_size() call fails. Without this fix, the error is not logged.
--- drivers/mtd/mtdcore.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/mtd/mtdcore.c +4 -2
@@ -956,8 +956,10 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd)if (mtd->_get_user_prot_info && mtd->_read_user_prot_reg) { size =mtd_otp_size (mtd, true); -if (size <0 ) -return size; +if (size <0 ) { + err = size; + goto err; + }if (size >0 ) { nvmem = mtd_otp_nvmem_register(mtd, "user-otp", size,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 365/493 mtd: rawnand: hynix: fixed typo
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maxim Korotkov <[email protected]>
[ Upstream commit 6819db94e1cd3ce24a432f3616cd563ed0c4eaba ]
The function hynix_nand_rr_init() should probably return an error code. Judging by the usage, it seems that the return code is passed up the call stack.
Right now, it always returns 0 and the function hynix_nand_cleanup() in hynix_nand_init() has never been called.
Found by RASU JSC and Linux Verification Center (linuxtesting.org)
--- drivers/mtd/nand/raw/nand_hynix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/raw/nand_hynix.c +1 -1
@@ -402,7 +402,7 @@ static int hynix_nand_rr_init(struct nand_chip *chip)if (ret)pr_warn ("failed to initialize read-retry infrastructure" ); -return 0 ; +return ret; } static void hynix_nand_extract_oobsize(struct nand_chip *chip,
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 366/493 drm/imagination: avoid -Woverflow warning
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 07b9d0144fff9af08b8dcd0ae134510bfd539e42 ]
The array size calculation in pvr_vm_mips_fini() appears to be incorrect based on taking the size of the pointer rather than the size of the array, which manifests as a warning about signed integer overflow:
In file included from include/linux/kernel.h:16,
from drivers/gpu/drm/imagination/pvr_rogue_fwif.h:10,
from drivers/gpu/drm/imagination/pvr_ccb.h:7,
from drivers/gpu/drm/imagination/pvr_device.h:7,
from drivers/gpu/drm/imagination/pvr_vm_mips.c:4:drivers/gpu/drm/imagination/pvr_vm_mips.c: In function 'pvr_vm_mips_fini':include/linux/array_size.h:11:25: error: overflow in conversion from 'long unsigned int' to 'int' changes value from '18446744073709551615' to '-1' [-Werror=overflow]
11 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
| ^drivers/gpu/drm/imagination/pvr_vm_mips.c:106:24: note: in expansion of macro 'ARRAY_SIZE'
106 | for (page_nr = ARRAY_SIZE(mips_data->pt_pages) - 1; page_nr >= 0; page_nr--) {
| ^~~~~~~~~~Just use the number of array elements directly here, and in the corresponding init function for consistency.
--- drivers/gpu/drm/imagination/pvr_vm_mips.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/imagination/pvr_vm_mips.c +2 -2
@@ -46,7 +46,7 @@ pvr_vm_mips_init(struct pvr_device *pvr_dev)if (!mips_data)return -ENOMEM ; -for (page_nr =0 ; page_nr <ARRAY_SIZE (mips_data->pt_pages); page_nr++) { +for (page_nr =0 ; page_nr <PVR_MIPS_PT_PAGE_COUNT ; page_nr++) { mips_data->pt_pages[page_nr] =alloc_page (GFP_KERNEL | __GFP_ZERO);if (!mips_data->pt_pages[page_nr]) { err = -ENOMEM ;
@@ -102,7 +102,7 @@ pvr_vm_mips_fini(struct pvr_device *pvr_dev)int page_nr;vunmap (mips_data->pt); -for (page_nr =ARRAY_SIZE (mips_data->pt_pages) -1 ; page_nr >=0 ; page_nr--) { +for (page_nr =PVR_MIPS_PT_PAGE_COUNT -1 ; page_nr >=0 ; page_nr--) {dma_unmap_page (from_pvr_device (pvr_dev)->dev, mips_data->pt_dma_addr[page_nr],PAGE_SIZE ,DMA_TO_DEVICE );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 367/493 ASoC: mediatek: Assign dummy when codec not specified for a DAI link
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 5f39231888c63f0a7708abc86b51b847476379d8 ]
MediaTek sound card drivers are checking whether a DAI link is present and used on a board to assign the correct parameters and this is done by checking the codec DAI names at probe time.
If no real codec is present, assign the dummy codec to the DAI link to avoid NULL pointer during string comparison.
--- sound/soc/mediatek/common/mtk-soundcard-driver.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
sound/soc/mediatek/common/mtk-soundcard-driver.c +5 -1
@@ -22,7 +22,11 @@ static int set_card_codec_info(struct snd_soc_card *card, codec_node =of_get_child_by_name (sub_node,"codec" );if (!codec_node) { -dev_dbg (dev,"%s no specified codec\n" , dai_link->name); +dev_dbg (dev,"%s no specified codec: setting dummy.\n" , dai_link->name); + + dai_link->codecs = &snd_soc_dummy_dlc; + dai_link->num_codecs =1 ; + dai_link->dynamic =1 ;return 0 ; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 368/493 drm/panel: ltk050h3146w: add MIPI_DSI_MODE_VIDEO to LTK050H3148W flags
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit 80cc8c0d09e6bab3bd016ddaccd0570cadbe1891 ]
Similar to other variants, the LTK050H3148W wants to run in video mode when displaying data. So far only the Synopsis DSI driver was using this panel and it is always switching to video mode, independent of this flag being set.
Other DSI drivers might handle this differently, so add the flag.
--- drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c +2 -1
@@ -326,7 +326,8 @@ static const struct drm_display_mode ltk050h3148w_mode = {static const struct ltk050h3146w_desc ltk050h3148w_data = { .mode = <k050h3148w_mode, .init = ltk050h3148w_init_sequence, - .mode_flags =MIPI_DSI_MODE_VIDEO_SYNC_PULSE |MIPI_DSI_MODE_VIDEO_BURST , + .mode_flags =MIPI_DSI_MODE_VIDEO |MIPI_DSI_MODE_VIDEO_SYNC_PULSE | +MIPI_DSI_MODE_VIDEO_BURST , };static int ltk050h3146w_init_sequence (struct ltk050h3146w *ctx)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 369/493 drm/panel: ltk050h3146w: drop duplicate commands from LTK050H3148W init
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Stuebner <[email protected]>
[ Upstream commit 55679cc22e60e8ec23b2340248389022798416cd ]
The init sequence specifies the 0x11 and 0x29 dsi commands, which are the exit-sleep and display-on commands.
In the actual prepare step the driver already uses the appropriate function calls for those, so drop the duplicates.
--- drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c +0 -2
@@ -295,8 +295,6 @@ static int ltk050h3148w_init_sequence(struct ltk050h3146w *ctx)mipi_dsi_dcs_write_seq (dsi,0xbd ,0x00 );mipi_dsi_dcs_write_seq (dsi,0xc6 ,0xef );mipi_dsi_dcs_write_seq (dsi,0xd4 ,0x02 ); -mipi_dsi_dcs_write_seq (dsi,0x11 ); -mipi_dsi_dcs_write_seq (dsi,0x29 ); ret =mipi_dsi_dcs_set_tear_on (dsi,1 );if (ret <0 ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 370/493 fbdev: shmobile: fix snprintf truncation
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 26c8cfb9d1e4b252336d23dd5127a8cbed414a32 ]
The name of the overlay does not fit into the fixed-length field:
drivers/video/fbdev/sh_mobile_lcdcfb.c:1577:2: error: 'snprintf' will always be truncated; specified size is 16, but format string expands to at least 25
Make it short enough by changing the string.
--- drivers/video/fbdev/sh_mobile_lcdcfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/fbdev/sh_mobile_lcdcfb.c +1 -1
@@ -1575,7 +1575,7 @@ sh_mobile_lcdc_overlay_fb_init(struct sh_mobile_lcdc_overlay *ovl)*/ info->fix = sh_mobile_lcdc_overlay_fix;snprintf (info->fix.id,sizeof (info->fix.id), -"SH Mobile LCDC Overlay %u" , ovl->index); +"SHMobile ovl %u" , ovl->index); info->fix.smem_start = ovl->dma_handle; info->fix.smem_len = ovl->fb_size; info->fix.line_length = ovl->pitch;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 371/493 ASoC: kirkwood: Fix potential NULL dereference
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit ea60ab95723f5738e7737b56dda95e6feefa5b50 ]
In kirkwood_dma_hw_params() mv_mbus_dram_info() returns NULL if CONFIG_PLAT_ORION macro is not defined.
Fix this bug by adding NULL check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- sound/soc/kirkwood/kirkwood-dma.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/kirkwood/kirkwood-dma.c +3 -0
@@ -182,6 +182,9 @@ static int kirkwood_dma_hw_params(struct snd_soc_component *component,const struct mbus_dram_target_info *dram =mv_mbus_dram_info ();unsigned long addr = substream->runtime->dma_addr; +if (!dram) +return 0 ; +if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK )kirkwood_dma_conf_mbus_windows (priv->io,KIRKWOOD_PLAYBACK_WIN , addr, dram);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 372/493 drm/meson: vclk: fix calculation of 59.94 fractional rates
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Hewitt <[email protected]>
[ Upstream commit bfbc68e4d8695497f858a45a142665e22a512ea3 ]
Playing 4K media with 59.94 fractional rate (typically VP9) causes the screen to lose sync with the following error reported in the system log:
[ 89.610280] Fatal Error, invalid HDMI vclk freq 593406
Modetest shows the following:
3840x2160 59.94 3840 4016 4104 4400 2160 2168 2178 2250 593407 flags: xxxx, xxxx, drm calculated value -------------------------------------^
Change the fractional rate calculation to stop DIV_ROUND_CLOSEST rounding down which results in vclk freq failing to match correctly.
--- drivers/gpu/drm/meson/meson_vclk.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/meson/meson_vclk.c +3 -3
@@ -790,13 +790,13 @@ meson_vclk_vic_supported_freq(struct meson_drm *priv, unsigned int phy_freq, FREQ_1000_1001(params[i].pixel_freq));DRM_DEBUG_DRIVER ("i = %d phy_freq = %d alt = %d\n" , i, params[i].phy_freq, -FREQ_1000_1001 (params[i].phy_freq/10 )*10 ); +FREQ_1000_1001 (params[i].phy_freq/1000 )*1000 );/* Match strict frequency */ if (phy_freq == params[i].phy_freq && vclk_freq == params[i].vclk_freq)return MODE_OK ;/* Match 1000/1001 variant */ -if (phy_freq == (FREQ_1000_1001 (params[i].phy_freq/10 )*10 ) && +if (phy_freq == (FREQ_1000_1001 (params[i].phy_freq/1000 )*1000 ) && vclk_freq ==FREQ_1000_1001 (params[i].vclk_freq))return MODE_OK ; }
@@ -1070,7 +1070,7 @@ void meson_vclk_setup(struct meson_drm *priv, unsigned int target,for (freq =0 ; params[freq].pixel_freq ; ++freq) {if ((phy_freq == params[freq].phy_freq || - phy_freq ==FREQ_1000_1001 (params[freq].phy_freq/10 )*10 ) && + phy_freq ==FREQ_1000_1001 (params[freq].phy_freq/1000 )*1000 ) && (vclk_freq == params[freq].vclk_freq || vclk_freq ==FREQ_1000_1001 (params[freq].vclk_freq))) {if (vclk_freq != params[freq].vclk_freq)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 373/493 drm/mediatek: Add 0 size check to mtk_drm_gem_obj
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Justin Green <[email protected]>
[ Upstream commit 1e4350095e8ab2577ee05f8c3b044e661b5af9a0 ]
Add a check to mtk_drm_gem_init if we attempt to allocate a GEM object of 0 bytes. Currently, no such check exists and the kernel will panic if a userspace application attempts to allocate a 0x0 GBM buffer.
Tested by attempting to allocate a 0x0 GBM buffer on an MT8188 and verifying that we now return EINVAL.
--- drivers/gpu/drm/mediatek/mtk_drm_gem.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/mediatek/mtk_drm_gem.c +3 -0
@@ -38,6 +38,9 @@ static struct mtk_drm_gem_obj *mtk_drm_gem_init(struct drm_device *dev, size =round_up (size,PAGE_SIZE ); +if (size ==0 ) +return ERR_PTR (-EINVAL ); + mtk_gem_obj =kzalloc (sizeof (*mtk_gem_obj),GFP_KERNEL );if (!mtk_gem_obj)return ERR_PTR (-ENOMEM );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 374/493 drm/mediatek: Init `ddp_comp` with devm_kcalloc()
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit 01a2c5123e27b3c4685bf2fc4c2e879f6e0c7b33 ]
In the case where conn_routes is true we allocate an extra slot in the ddp_comp array but mtk_drm_crtc_create() never seemed to initialize it in the test case I ran. For me, this caused a later crash when we looped through the array in mtk_drm_crtc_mode_valid(). This showed up for me when I booted with slub_debug=FZPUA which poisons the memory initially. Without slub_debug I couldn't reproduce, presumably because the later code handles the value being NULL and in most cases (not guaranteed in all cases) the memory the allocator returned started out as 0.
It really doesn't hurt to initialize the array with devm_kcalloc() since the array is small and the overhead of initting a handful of elements to 0 is small. In general initting memory to zero is a safer practice and usually it's suggested to only use the non-initting alloc functions if you really need to.
Let's switch the function to use an allocation function that zeros the memory. For me, this avoids the crash.
--- drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/mediatek/mtk_drm_crtc.c +4 -4
@@ -992,10 +992,10 @@ int mtk_drm_crtc_create(struct drm_device *drm_dev, mtk_crtc->mmsys_dev = priv->mmsys_dev; mtk_crtc->ddp_comp_nr = path_len; - mtk_crtc->ddp_comp =devm_kmalloc_array (dev, - mtk_crtc->ddp_comp_nr + (conn_routes ?1 :0 ), -sizeof (*mtk_crtc->ddp_comp), -GFP_KERNEL ); + mtk_crtc->ddp_comp =devm_kcalloc (dev, + mtk_crtc->ddp_comp_nr + (conn_routes ?1 :0 ), +sizeof (*mtk_crtc->ddp_comp), +GFP_KERNEL );if (!mtk_crtc->ddp_comp)return -ENOMEM ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 375/493 ASoC: SOF: Intel: hda-dai: fix channel map configuration for aggregated dailink
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 831045513c8a2ef14c3cf39b33d1ccedf588c4a8 ]
The existing code derives the channel map used to program the HDaudio link DMA from the hw_params, but that is not quite right in the case of aggregation. The code in soc-pcm.c splits the hw_params depending on the codec_ch_map, and we need to reconstruct the channel-map to insert the data in the right places.
This issue is seen only on amplifier feedback capture where the data from the second amplifier was replaced by that of the first amplifier.
Note that the loop iterator of the macro for_each_rtd_cpu_dais() is reused in a following loop. This is different to all existing usages of that macro, hence the use of a boolean flag to avoid an access to an uninitialized variable.
--- sound/soc/sof/intel/hda-dai.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-)
sound/soc/sof/intel/hda-dai.c +29 -2
@@ -434,10 +434,17 @@ int sdw_hda_dai_hw_params(struct snd_pcm_substream *substream, int link_id) {struct snd_soc_dapm_widget *w =snd_soc_dai_get_widget (cpu_dai, substream->stream); +struct snd_soc_pcm_runtime *rtd =snd_soc_substream_to_rtd (substream);const struct hda_dai_widget_dma_ops *ops; +struct snd_soc_dai_link_ch_map *ch_maps;struct hdac_ext_stream *hext_stream; +struct snd_soc_dai *dai;struct snd_sof_dev *sdev; +bool cpu_dai_found = false; +int cpu_dai_id; +int ch_mask;int ret; +int j; ret =non_hda_dai_hw_params (substream, params, cpu_dai);if (ret <0 ) {
@@ -452,9 +459,29 @@ int sdw_hda_dai_hw_params(struct snd_pcm_substream *substream,if (!hext_stream)return -ENODEV ; -/* in the case of SoundWire we need to program the PCMSyCM registers */ +/* +* in the case of SoundWire we need to program the PCMSyCM registers. In case +* of aggregated devices, we need to define the channel mask for each sublink +* by reconstructing the split done in soc-pcm.c +*/ +for_each_rtd_cpu_dais (rtd, cpu_dai_id, dai) { +if (dai == cpu_dai) { + cpu_dai_found = true; +break ; + } + } + +if (!cpu_dai_found) +return -ENODEV ; + + ch_mask =0 ; +for_each_link_ch_maps (rtd->dai_link, j, ch_maps) { +if (ch_maps->cpu == cpu_dai_id) + ch_mask |= ch_maps->ch_mask; + } + ret =hdac_bus_eml_sdw_map_stream_ch (sof_to_bus (sdev), link_id, cpu_dai->id, -GENMASK (params_channels (params) -1 ,0 ), + ch_mask,hdac_stream (hext_stream)->stream_tag, substream->stream);if (ret <0 ) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 376/493 powerpc/fsl-soc: hide unused const variable
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 01acaf3aa75e1641442cc23d8fe0a7bb4226efb1 ]
vmpic_msi_feature is only used conditionally, which triggers a rare -Werror=unused-const-variable= warning with gcc:
arch/powerpc/sysdev/fsl_msi.c:567:37: error: 'vmpic_msi_feature' defined but not used [-Werror=unused-const-variable=]
567 | static const struct fsl_msi_feature vmpic_msi_feature =
Hide this one in the same #ifdef as the reference so we can turn on the warning by default.
--- arch/powerpc/sysdev/fsl_msi.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/sysdev/fsl_msi.c +2 -0
@@ -566,10 +566,12 @@ static const struct fsl_msi_feature ipic_msi_feature = { .msiir_offset = 0x38, }; +#ifdef CONFIG_EPAPR_PARAVIRT static const struct fsl_msi_feature vmpic_msi_feature = { .fsl_pic_ip =FSL_PIC_IP_VMPIC , .msiir_offset =0 , }; +#endif static const struct of_device_id fsl_of_msi_ids[] = { {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 377/493 ASoC: SOF: Intel: mtl: Correct rom_status_reg
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
[ Upstream commit 1f1b820dc3c65b6883da3130ba3b8624dcbf87db ]
ACE1 architecture changed the place where the ROM updates the status code from the shared SRAM window to HFFLGP1QW0 register for the status and HFFLGP1QW0 + 4 for the error code.
The rom_status_reg is not used on MTL because it was wrongly assigned based on older platform convention (SRAM window) and it was giving inconsistent readings.
--- sound/soc/sof/intel/mtl.c | 4 ++-- sound/soc/sof/intel/mtl.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
sound/soc/sof/intel/mtl.c +2 -2
@@ -727,7 +727,7 @@ const struct sof_intel_dsp_desc mtl_chip_info = { .ipc_ack = MTL_DSP_REG_HFIPCXIDA, .ipc_ack_mask = MTL_DSP_REG_HFIPCXIDA_DONE, .ipc_ctl = MTL_DSP_REG_HFIPCXCTL, - .rom_status_reg = MTL_DSP_ROM_STS, + .rom_status_reg = MTL_DSP_REG_HFFLGPXQWY, .rom_init_timeout = 300, .ssp_count = MTL_SSP_COUNT, .ssp_base_offset = CNL_SSP_BASE_OFFSET,
@@ -755,7 +755,7 @@ const struct sof_intel_dsp_desc arl_s_chip_info = { .ipc_ack = MTL_DSP_REG_HFIPCXIDA, .ipc_ack_mask = MTL_DSP_REG_HFIPCXIDA_DONE, .ipc_ctl = MTL_DSP_REG_HFIPCXCTL, - .rom_status_reg = MTL_DSP_ROM_STS, + .rom_status_reg = MTL_DSP_REG_HFFLGPXQWY, .rom_init_timeout = 300, .ssp_count = MTL_SSP_COUNT, .ssp_base_offset = CNL_SSP_BASE_OFFSET,
sound/soc/sof/intel/mtl.h +2 -2
@@ -70,8 +70,8 @@#define MTL_DSP_ROM_STS MTL_SRAM_WINDOW_OFFSET(0)/* ROM status */ #define MTL_DSP_ROM_ERROR (MTL_SRAM_WINDOW_OFFSET(0) + 0x4)/* ROM error code */ -#define MTL_DSP_REG_HFFLGPXQWY 0x163200/* ROM debug status */ -#define MTL_DSP_REG_HFFLGPXQWY_ERROR 0x163204/* ROM debug error code */ +#define MTL_DSP_REG_HFFLGPXQWY 0x163200/* DSP core0 status */ +#define MTL_DSP_REG_HFFLGPXQWY_ERROR 0x163204/* DSP core0 error */ #define MTL_DSP_REG_HfIMRIS1 0x162088#define MTL_DSP_REG_HfIMRIS1_IU_MASK BIT(0)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 378/493 ASoC: SOF: Intel: lnl: Correct rom_status_reg
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
[ Upstream commit b852574c671a9983dd51c81582c8c5085f3dc382 ]
ACE2 architecture changed the place where the ROM updates the status code from the shared SRAM window (and HFFLGP1QW0 in ACE1) to HFDSC register for the status and HFDEC (HFDSC + 4) for the error code.
The rom_status_reg is not used on LNL because it was wrongly assigned based on older platform convention (SRAM window) and it was giving inconsistent readings.
Add new header file for lnl specific register definitions.
--- sound/soc/sof/intel/lnl.c | 3 ++- sound/soc/sof/intel/lnl.h | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 sound/soc/sof/intel/lnl.h
sound/soc/sof/intel/lnl.c +2 -1
@@ -16,6 +16,7 @@#include "hda-ipc.h" #include "../sof-audio.h" #include "mtl.h" +#include "lnl.h" #include <sound/hda-mlink.h> /* LunarLake ops */
@@ -176,7 +177,7 @@ const struct sof_intel_dsp_desc lnl_chip_info = { .ipc_ack = MTL_DSP_REG_HFIPCXIDA, .ipc_ack_mask = MTL_DSP_REG_HFIPCXIDA_DONE, .ipc_ctl = MTL_DSP_REG_HFIPCXCTL, - .rom_status_reg = MTL_DSP_ROM_STS, + .rom_status_reg = LNL_DSP_REG_HFDSC, .rom_init_timeout = 300, .ssp_count = MTL_SSP_COUNT, .d0i3_offset = MTL_HDA_VS_D0I3C,
sound/soc/sof/intel/lnl.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause) */ +/* +* This file is provided under a dual BSD/GPLv2 license. When using or +* redistributing this file, you may do so under either license. +* +* Copyright(c) 2024 Intel Corporation. All rights reserved. +*/ + +#ifndef __SOF_INTEL_LNL_H +#define __SOF_INTEL_LNL_H + +#define LNL_DSP_REG_HFDSC 0x160200/* DSP core0 status */ +#define LNL_DSP_REG_HFDEC 0x160204/* DSP core0 error */ + +#endif /* __SOF_INTEL_LNL_H */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 379/493 ASoC: SOF: Intel: mtl: Disable interrupts when firmware boot failed
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
[ Upstream commit 26187f44aabdf3df7609b7c78724a059c230a2ad ]
In case of error during the firmware boot we need to disable the interrupts which were enabled as part of the boot sequence.
--- sound/soc/sof/intel/mtl.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/sof/intel/mtl.c +1 -0
@@ -503,6 +503,7 @@ int mtl_dsp_cl_init(struct snd_sof_dev *sdev, int stream_tag, bool imr_boot) dump_msg =kasprintf (GFP_KERNEL ,"Boot iteration failed: %d/%d" , hda->boot_iteration,HDA_FW_BOOT_ATTEMPTS );snd_sof_dsp_dbg_dump (sdev, dump_msg, flags); +mtl_enable_interrupts (sdev, false);mtl_dsp_core_power_down (sdev,SOF_DSP_PRIMARY_CORE );kfree (dump_msg);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 380/493 ASoC: SOF: Intel: mtl: Implement firmware boot state check
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Ujfalusi <[email protected]>
[ Upstream commit 6b1c1c47e76f0161bda2b1ac2e86a219fe70244f ]
With the corrected rom_status_reg values we can now add a check for target boot status for firmware booting.
With the check now we can identify failed firmware boots (IMR boots) and we can use the fallback to purge boot the DSP.
--- sound/soc/sof/intel/mtl.c | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-)
sound/soc/sof/intel/mtl.c +32 -5
@@ -439,7 +439,7 @@ int mtl_dsp_cl_init(struct snd_sof_dev *sdev, int stream_tag, bool imr_boot) {struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;const struct sof_intel_dsp_desc *chip = hda->desc; -unsigned int status; +unsigned int status, target_status;u32 ipc_hdr, flags;char *dump_msg;int ret;
@@ -485,13 +485,40 @@ int mtl_dsp_cl_init(struct snd_sof_dev *sdev, int stream_tag, bool imr_boot)mtl_enable_ipc_interrupts (sdev); +if (chip->rom_status_reg ==MTL_DSP_ROM_STS ) { +/* +* Workaround: when the ROM status register is pointing to +* the SRAM window (MTL_DSP_ROM_STS) the platform cannot catch +* ROM_INIT_DONE because of a very short timing window. +* Follow the recommendations and skip target state waiting. +*/ +return 0 ; + } +/* -* ACE workaround: don't wait for ROM INIT. -* The platform cannot catch ROM_INIT_DONE because of a very short -* timing window. Follow the recommendations and skip this part. +* step 7: +* - Cold/Full boot: wait for ROM init to proceed to download the firmware +* - IMR boot: wait for ROM firmware entered (firmware booted up from IMR) */ +if (imr_boot) + target_status =FSR_STATE_FW_ENTERED ; +else + target_status =FSR_STATE_INIT_DONE ; -return 0 ; + ret =snd_sof_dsp_read_poll_timeout (sdev,HDA_DSP_BAR , + chip->rom_status_reg, status, + (FSR_TO_STATE_CODE (status) == target_status), +HDA_DSP_REG_POLL_INTERVAL_US , + chip->rom_init_timeout * +USEC_PER_MSEC ); + +if (!ret) +return 0 ; + +if (hda->boot_iteration ==HDA_FW_BOOT_ATTEMPTS ) +dev_err (sdev->dev, +"%s: timeout with rom_status_reg (%#x) read\n" , + __func__, chip->rom_status_reg); err: flags =SOF_DBG_DUMP_PCI |SOF_DBG_DUMP_MBOX |SOF_DBG_DUMP_OPTIONAL ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 381/493 fbdev: sisfb: hide unused variables
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 688cf598665851b9e8cb5083ff1d208ce43d10ff ]
Building with W=1 shows that a couple of variables in this driver are only used in certain configurations:
drivers/video/fbdev/sis/init301.c:239:28: error: 'SiS_Part2CLVX_6' defined but not used [-Werror=unused-const-variable=]
239 | static const unsigned char SiS_Part2CLVX_6[] = { /* 1080i */
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:230:28: error: 'SiS_Part2CLVX_5' defined but not used [-Werror=unused-const-variable=]
230 | static const unsigned char SiS_Part2CLVX_5[] = { /* 750p */
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:211:28: error: 'SiS_Part2CLVX_4' defined but not used [-Werror=unused-const-variable=]
211 | static const unsigned char SiS_Part2CLVX_4[] = { /* PAL */
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:192:28: error: 'SiS_Part2CLVX_3' defined but not used [-Werror=unused-const-variable=]
192 | static const unsigned char SiS_Part2CLVX_3[] = { /* NTSC, 525i, 525p */
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:184:28: error: 'SiS_Part2CLVX_2' defined but not used [-Werror=unused-const-variable=]
184 | static const unsigned char SiS_Part2CLVX_2[] = {
| ^~~~~~~~~~~~~~~
drivers/video/fbdev/sis/init301.c:176:28: error: 'SiS_Part2CLVX_1' defined but not used [-Werror=unused-const-variable=]
176 | static const unsigned char SiS_Part2CLVX_1[] = {
| ^~~~~~~~~~~~~~~This started showing up after the definitions were moved into the source file from the header, which was not flagged by the compiler. Move the definition into the appropriate #ifdef block that already exists next to them.
--- drivers/video/fbdev/sis/init301.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/video/fbdev/sis/init301.c +1 -2
@@ -172,7 +172,7 @@ static const unsigned char SiS_HiTVGroup3_2[] = { };/* 301C / 302ELV extended Part2 TV registers (4 tap scaler) */ - +#ifdef CONFIG_FB_SIS_315 static const unsigned char SiS_Part2CLVX_1[] = {0x00 ,0x00 , 0x00,0x20,0x00,0x00,0x7F,0x20,0x02,0x7F,0x7D,0x20,0x04,0x7F,0x7D,0x1F,0x06,0x7E,
@@ -245,7 +245,6 @@ static const unsigned char SiS_Part2CLVX_6[] = { /* 1080i */ 0xFF,0xFF, }; -#ifdef CONFIG_FB_SIS_315 /* 661 et al LCD data structure (2.03.00) */ static const unsigned char SiS_LCDStruct661[] = {/* 1024x768 */
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 382/493 selftests: cgroup: skip test_cgcore_lesser_ns_open when cgroup2 mounted without nsdelegate
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tianchen Ding <[email protected]>
[ Upstream commit 4793cb599b1bdc3d356f0374c2c99ffe890ae876 ]
The test case test_cgcore_lesser_ns_open only tasks effect when cgroup2 is mounted with "nsdelegate" mount option. If it misses this option, or is remounted without "nsdelegate", the test case will fail. For example, running bpf/test_cgroup_storage first, and then run cgroup/test_core will fail on test_cgcore_lesser_ns_open. Skip it if "nsdelegate" is not detected in cgroup2 mount options.
--- tools/testing/selftests/cgroup/cgroup_util.c | 8 +++++--- tools/testing/selftests/cgroup/cgroup_util.h | 2 +- tools/testing/selftests/cgroup/test_core.c | 7 ++++++- tools/testing/selftests/cgroup/test_cpu.c | 2 +- tools/testing/selftests/cgroup/test_cpuset.c | 2 +- tools/testing/selftests/cgroup/test_freezer.c | 2 +- tools/testing/selftests/cgroup/test_hugetlb_memcg.c | 2 +- tools/testing/selftests/cgroup/test_kill.c | 2 +- tools/testing/selftests/cgroup/test_kmem.c | 2 +- tools/testing/selftests/cgroup/test_memcontrol.c | 2 +- tools/testing/selftests/cgroup/test_zswap.c | 2 +- 11 files changed, 20 insertions(+), 13 deletions(-)
tools/testing/selftests/cgroup/cgroup_util.c +5 -3
@@ -195,10 +195,10 @@ int cg_write_numeric(const char *cgroup, const char *control, long value)return cg_write (cgroup, control, buf); } -int cg_find_unified_root (char *root,size_t len) +int cg_find_unified_root (char *root,size_t len,bool *nsdelegate) {char buf[10 *PAGE_SIZE ]; -char *fs, *mount, *type; +char *fs, *mount, *type, *options;const char delim[] ="\n\t " ;if (read_text ("/proc/self/mounts" , buf,sizeof (buf)) <=0 )
@@ -211,12 +211,14 @@ int cg_find_unified_root(char *root, size_t len)for (fs =strtok (buf, delim); fs; fs =strtok (NULL , delim)) { mount =strtok (NULL , delim); type =strtok (NULL , delim); -strtok (NULL , delim); + options =strtok (NULL , delim);strtok (NULL , delim);strtok (NULL , delim);if (strcmp (type,"cgroup2" ) ==0 ) {strncpy (root, mount, len); +if (nsdelegate) + *nsdelegate = !!strstr (options,"nsdelegate" );return 0 ; } }
tools/testing/selftests/cgroup/cgroup_util.h +1 -1
@@ -21,7 +21,7 @@ static inline int values_close(long a, long b, int err)return abs (a - b) <= (a + b) /100 * err; } -extern int cg_find_unified_root (char *root,size_t len); +extern int cg_find_unified_root (char *root,size_t len,bool *nsdelegate);extern char *cg_name (const char *root,const char *name);extern char *cg_name_indexed (const char *root,const char *name,int index);extern char *cg_control (const char *cgroup,const char *control);
tools/testing/selftests/cgroup/test_core.c +6 -1
@@ -18,6 +18,8 @@#include "../kselftest.h" #include "cgroup_util.h" +static bool nsdelegate; +static int touch_anon (char *buf,size_t size) {int fd;
@@ -775,6 +777,9 @@ static int test_cgcore_lesser_ns_open(const char *root)pid_t pid;int status; +if (!nsdelegate) +return KSFT_SKIP ; + cg_test_a =cg_name (root,"cg_test_a" ); cg_test_b =cg_name (root,"cg_test_b" );
@@ -862,7 +867,7 @@ int main(int argc, char *argv[])char root[PATH_MAX ];int i, ret =EXIT_SUCCESS ; -if (cg_find_unified_root (root,sizeof (root))) +if (cg_find_unified_root (root,sizeof (root), &nsdelegate))ksft_exit_skip ("cgroup v2 isn't mounted\n" );if (cg_read_strstr (root,"cgroup.subtree_control" ,"memory" ))
tools/testing/selftests/cgroup/test_cpu.c +1 -1
@@ -700,7 +700,7 @@ int main(int argc, char *argv[])char root[PATH_MAX ];int i, ret =EXIT_SUCCESS ; -if (cg_find_unified_root (root,sizeof (root))) +if (cg_find_unified_root (root,sizeof (root),NULL ))ksft_exit_skip ("cgroup v2 isn't mounted\n" );if (cg_read_strstr (root,"cgroup.subtree_control" ,"cpu" ))
tools/testing/selftests/cgroup/test_cpuset.c +1 -1
@@ -249,7 +249,7 @@ int main(int argc, char *argv[])char root[PATH_MAX ];int i, ret =EXIT_SUCCESS ; -if (cg_find_unified_root (root,sizeof (root))) +if (cg_find_unified_root (root,sizeof (root),NULL ))ksft_exit_skip ("cgroup v2 isn't mounted\n" );if (cg_read_strstr (root,"cgroup.subtree_control" ,"cpuset" ))
tools/testing/selftests/cgroup/test_freezer.c +1 -1
@@ -827,7 +827,7 @@ int main(int argc, char *argv[])char root[PATH_MAX ];int i, ret =EXIT_SUCCESS ; -if (cg_find_unified_root (root,sizeof (root))) +if (cg_find_unified_root (root,sizeof (root),NULL ))ksft_exit_skip ("cgroup v2 isn't mounted\n" );for (i =0 ; i <ARRAY_SIZE (tests); i++) {switch (tests[i].fn (root)) {
tools/testing/selftests/cgroup/test_hugetlb_memcg.c +1 -1
@@ -214,7 +214,7 @@ int main(int argc, char **argv)return ret; } -if (cg_find_unified_root (root,sizeof (root))) +if (cg_find_unified_root (root,sizeof (root),NULL ))ksft_exit_skip ("cgroup v2 isn't mounted\n" );switch (test_hugetlb_memcg (root)) {
tools/testing/selftests/cgroup/test_kill.c +1 -1
@@ -276,7 +276,7 @@ int main(int argc, char *argv[])char root[PATH_MAX ];int i, ret =EXIT_SUCCESS ; -if (cg_find_unified_root (root,sizeof (root))) +if (cg_find_unified_root (root,sizeof (root),NULL ))ksft_exit_skip ("cgroup v2 isn't mounted\n" );for (i =0 ; i <ARRAY_SIZE (tests); i++) {switch (tests[i].fn (root)) {
tools/testing/selftests/cgroup/test_kmem.c +1 -1
@@ -420,7 +420,7 @@ int main(int argc, char **argv)char root[PATH_MAX ];int i, ret =EXIT_SUCCESS ; -if (cg_find_unified_root (root,sizeof (root))) +if (cg_find_unified_root (root,sizeof (root),NULL ))ksft_exit_skip ("cgroup v2 isn't mounted\n" );/*
tools/testing/selftests/cgroup/test_memcontrol.c +1 -1
@@ -1314,7 +1314,7 @@ int main(int argc, char **argv)char root[PATH_MAX ];int i, proc_status, ret =EXIT_SUCCESS ; -if (cg_find_unified_root (root,sizeof (root))) +if (cg_find_unified_root (root,sizeof (root),NULL ))ksft_exit_skip ("cgroup v2 isn't mounted\n" );/*
tools/testing/selftests/cgroup/test_zswap.c +1 -1
@@ -324,7 +324,7 @@ int main(int argc, char **argv)char root[PATH_MAX ];int i, ret =EXIT_SUCCESS ; -if (cg_find_unified_root (root,sizeof (root))) +if (cg_find_unified_root (root,sizeof (root),NULL ))ksft_exit_skip ("cgroup v2 isn't mounted\n" );if (!zswap_configured ())
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 383/493 ASoC: Intel: avs: Restore stream decoupling on prepare
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amadeusz Sławiński <[email protected]>
[ Upstream commit 680507581e025d16a0b6d3782603ca8c598fbe2b ]
Revert changes from commit b87b8f43afd5 ("ASoC: Intel: avs: Drop superfluous stream decoupling") to restore working streaming during S3.
--- sound/soc/intel/avs/pcm.c | 4 ++++ 1 file changed, 4 insertions(+)
sound/soc/intel/avs/pcm.c +4 -0
@@ -356,6 +356,7 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct sn stream_info->sig_bits); format_val =snd_hdac_stream_format (runtime->channels, bits, runtime->rate); +snd_hdac_ext_stream_decouple (bus, link_stream, true);snd_hdac_ext_stream_reset (link_stream);snd_hdac_ext_stream_setup (link_stream, format_val);
@@ -611,6 +612,7 @@ static int avs_dai_fe_prepare(struct snd_pcm_substream *substream, struct snd_sostruct avs_dev *adev =to_avs_dev (dai->dev);struct hdac_ext_stream *host_stream;unsigned int format_val; +struct hdac_bus *bus;unsigned int bits;int ret;
@@ -620,6 +622,8 @@ static int avs_dai_fe_prepare(struct snd_pcm_substream *substream, struct snd_soif (hdac_stream (host_stream)->prepared)return 0 ; + bus =hdac_stream (host_stream)->bus; +snd_hdac_ext_stream_decouple (bus, data->host_stream, true);snd_hdac_stream_reset (hdac_stream (host_stream)); stream_info =snd_soc_dai_get_pcm_stream (dai, substream->stream);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 384/493 ASoC: Intel: avs: Fix ASRC module initialization
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 9d2e26f31c7cc3fa495c423af9b4902ec0dc7be3 ]
The ASRC module configuration consists of several reserved fields. Zero them out when initializing the module to avoid sending invalid data.
--- sound/soc/intel/avs/path.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/intel/avs/path.c +1 -0
@@ -367,6 +367,7 @@ static int avs_asrc_create(struct avs_dev *adev, struct avs_path_module *mod)struct avs_tplg_module *t = mod->template;struct avs_asrc_cfg cfg; +memset (&cfg,0 ,sizeof (cfg)); cfg.base.cpc = t->cfg_base->cpc; cfg.base.ibs = t->cfg_base->ibs; cfg.base.obs = t->cfg_base->obs;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 385/493 ASoC: Intel: avs: Fix potential integer overflow
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit c7e832cabe635df47c2bf6df7801e97bf3045b1e ]
While stream_tag for CLDMA on SKL-based platforms is always 1, function hda_cldma_setup() uses AZX_SD_CTL_STRM() macro which does:
stream_tag << 20
what combined with stream_tag type of 'unsigned int' generates a potential overflow issue. Update the field type to fix that.
--- sound/soc/intel/avs/cldma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/avs/cldma.c +1 -1
@@ -35,7 +35,7 @@ struct hda_cldma {unsigned int buffer_size;unsigned int num_periods; -unsigned int stream_tag; +unsigned char stream_tag;void __iomem *sd_addr;struct snd_dma_buffer dmab_data;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 386/493 ASoC: Intel: avs: Test result of avs_get_module_entry()
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cezary Rojewski <[email protected]>
[ Upstream commit 41bf4525fadb3d8df3860420d6ac9025c51a3bac ]
While PROBE_MOD_UUID is always part of the base AudioDSP firmware manifest, from maintenance point of view it is better to check the result.
--- sound/soc/intel/avs/probes.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
sound/soc/intel/avs/probes.c +9 -5
@@ -19,8 +19,11 @@ static int avs_dsp_init_probe(struct avs_dev *adev, union avs_connector_node_idstruct avs_probe_cfg cfg = {{0 }};struct avs_module_entry mentry;u8 dummy; +int ret; -avs_get_module_entry (adev, &AVS_PROBE_MOD_UUID , &mentry); + ret =avs_get_module_entry (adev, &AVS_PROBE_MOD_UUID , &mentry); +if (ret) +return ret;/* * Probe module uses no cycles, audio data format and input and output
@@ -39,11 +42,12 @@ static int avs_dsp_init_probe(struct avs_dev *adev, union avs_connector_node_idstatic void avs_dsp_delete_probe (struct avs_dev *adev) {struct avs_module_entry mentry; +int ret; -avs_get_module_entry (adev, &AVS_PROBE_MOD_UUID , &mentry); - -/* There is only ever one probe module instance. */ -avs_dsp_delete_module (adev, mentry.module_id,0 ,INVALID_PIPELINE_ID ,0 ); + ret =avs_get_module_entry (adev, &AVS_PROBE_MOD_UUID , &mentry); +if (!ret) +/* There is only ever one probe module instance. */ +avs_dsp_delete_module (adev, mentry.module_id,0 ,INVALID_PIPELINE_ID ,0 ); }static inline struct hdac_ext_stream *avs_compr_get_host_stream (struct snd_compr_stream *cstream)
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 387/493 media: ngene: Add dvb_ca_en50221_init return value check
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Burakov <[email protected]>
[ Upstream commit 9bb1fd7eddcab2d28cfc11eb20f1029154dac718 ]
The return value of dvb_ca_en50221_init() is not checked here that may cause undefined behavior in case of nonzero value return.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/media/pci/ngene/ngene-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/pci/ngene/ngene-core.c +3 -1
@@ -1488,7 +1488,9 @@ static int init_channel(struct ngene_channel *chan) }if (dev->ci.en && (io &NGENE_IO_TSOUT )) { -dvb_ca_en50221_init (adapter, dev->ci.en,0 ,1 ); + ret =dvb_ca_en50221_init (adapter, dev->ci.en,0 ,1 ); +if (ret !=0 ) + goto err;set_transfer (chan,1 ); chan->dev->channel[2 ].DataFormatFlags =DF_SWAP32 ;set_transfer (&chan->dev->channel[2 ],1 );
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 388/493 staging: media: starfive: Remove links when unregistering devices
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Changhuang Liang <[email protected]>
[ Upstream commit 810dd605e917c716f6f83e6cd8ea23d9155d32a2 ]
Need to remove links when unregistering devices.
--- drivers/staging/media/starfive/camss/stf-camss.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/staging/media/starfive/camss/stf-camss.c +6 -0
@@ -162,6 +162,12 @@ static int stfcamss_register_devs(struct stfcamss *stfcamss)static void stfcamss_unregister_devs (struct stfcamss *stfcamss) { +struct stf_capture *cap_yuv = &stfcamss->captures[STF_CAPTURE_YUV ]; +struct stf_isp_dev *isp_dev = &stfcamss->isp_dev; + +media_entity_remove_links (&isp_dev->subdev.entity); +media_entity_remove_links (&cap_yuv->video.vdev.entity); +stf_isp_unregister (&stfcamss->isp_dev);stf_capture_unregister (stfcamss); }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 389/493 media: rcar-vin: work around -Wenum-compare-conditional warning
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
[ Upstream commit 1a742c6010d136cb6c441a0f1dd2bfbfae3c4df2 ]
clang-19 warns about mixing two enum types here:
drivers/media/platform/renesas/rcar-vin/rcar-vin.h:296:12: error: conditional expression between different enumeration types ('enum rvin_csi_id' and 'enum rvin_isp_id') [-Werror,-Wenum-compare-conditional] drivers/media/platform/renesas/rcar-vin/rcar-core.c:216:18: error: conditional expression between different enumeration types ('enum rvin_csi_id' and 'enum rvin_isp_id') [-Werror,-Wenum-compare-conditional] drivers/media/platform/renesas/rcar-vin/rcar-vin.h:296:12: error: conditional expression between different enumeration types ('enum rvin_csi_id' and 'enum rvin_isp_id') [-Werror,-Wenum-compare-conditional] drivers/media/platform/renesas/rcar-vin/rcar-vin.h:296:12: error: conditional expression between different enumeration types ('enum rvin_csi_id' and 'enum rvin_isp_id') [-Werror,-Wenum-compare-conditional]
This one is intentional, and there is already a cast to work around another warning, so address this by adding another cast.
--- drivers/media/platform/renesas/rcar-vin/rcar-vin.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/renesas/rcar-vin/rcar-vin.h +1 -1
@@ -59,7 +59,7 @@ enum rvin_isp_id {#define RVIN_REMOTES_MAX \ (((unsigned int)RVIN_CSI_MAX) > ((unsigned int)RVIN_ISP_MAX) ? \ - RVIN_CSI_MAX : RVIN_ISP_MAX) + (unsigned int)RVIN_CSI_MAX : (unsigned int)RVIN_ISP_MAX)/** * enum rvin_dma_state - DMA states
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 390/493 media: radio-shark2: Avoid led_names truncations
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ricardo Ribalda <[email protected]>
[ Upstream commit 1820e16a3019b6258e6009d34432946a6ddd0a90 ]
Increase the size of led_names so it can fit any valid v4l2 device name.
Fixes:drivers/media/radio/radio-shark2.c:197:17: warning: ‘%s’ directive output may be truncated writing up to 35 bytes into a region of size 32 [-Wformat-truncation=]
--- drivers/media/radio/radio-shark2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/radio/radio-shark2.c +1 -1
@@ -62,7 +62,7 @@ struct shark_device {#ifdef SHARK_USE_LEDS struct work_struct led_work;struct led_classdev leds[NO_LEDS ]; -char led_names[NO_LEDS ][32 ]; +char led_names[NO_LEDS ][64 ];atomic_t brightness[NO_LEDS ];unsigned long brightness_new;#endif
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 391/493 drm: bridge: cdns-mhdp8546: Fix possible null pointer dereference
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit 935a92a1c400285545198ca2800a4c6c519c650a ]
In cdns_mhdp_atomic_enable(), the return value of drm_mode_duplicate() is assigned to mhdp_state->current_mode, and there is a dereference of it in drm_mode_set_name(), which will lead to a NULL pointer dereference on failure of drm_mode_duplicate().
Fix this bug add a check of mhdp_state->current_mode.
--- drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +3 -0
@@ -2057,6 +2057,9 @@ static void cdns_mhdp_atomic_enable(struct drm_bridge *bridge, mhdp_state =to_cdns_mhdp_bridge_state (new_state); mhdp_state->current_mode =drm_mode_duplicate (bridge->dev, mode); +if (!mhdp_state->current_mode) +return ; +drm_mode_set_name (mhdp_state->current_mode);dev_dbg (mhdp->dev,"%s: Enabling mode %s\n" , __func__, mode->name);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 392/493 platform/x86: xiaomi-wmi: Fix race condition when reporting key events
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Armin Wolf <[email protected]>
[ Upstream commit 290680c2da8061e410bcaec4b21584ed951479af ]
Multiple WMI events can be received concurrently, so multiple instances of xiaomi_wmi_notify() can be active at the same time. Since the input device is shared between those handlers, the key input sequence can be disturbed.
Fix this by protecting the key input sequence with a mutex.
Compile-tested only.
--- drivers/platform/x86/xiaomi-wmi.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
drivers/platform/x86/xiaomi-wmi.c +18 -0
@@ -2,8 +2,10 @@/* WMI driver for Xiaomi Laptops */ #include <linux/acpi.h> +#include <linux/device.h> #include <linux/input.h> #include <linux/module.h> +#include <linux/mutex.h> #include <linux/wmi.h> #include <uapi/linux/input-event-codes.h>
@@ -20,12 +22,21 @@struct xiaomi_wmi {struct input_dev *input_dev; +struct mutex key_lock;/* Protects the key event sequence */ unsigned int key_code; }; +static void xiaomi_mutex_destroy (void *data) +{ +struct mutex *lock = data; + +mutex_destroy (lock); +} +static int xiaomi_wmi_probe (struct wmi_device *wdev,const void *context) {struct xiaomi_wmi *data; +int ret;if (wdev ==NULL || context ==NULL )return -EINVAL ;
@@ -35,6 +46,11 @@ static int xiaomi_wmi_probe(struct wmi_device *wdev, const void *context)return -ENOMEM ;dev_set_drvdata (&wdev->dev, data); +mutex_init (&data->key_lock); + ret =devm_add_action_or_reset (&wdev->dev, xiaomi_mutex_destroy, &data->key_lock); +if (ret <0 ) +return ret; + data->input_dev =devm_input_allocate_device (&wdev->dev);if (data->input_dev ==NULL )return -ENOMEM ;
@@ -59,10 +75,12 @@ static void xiaomi_wmi_notify(struct wmi_device *wdev, union acpi_object *dummy)if (data ==NULL )return ; +mutex_lock (&data->key_lock);input_report_key (data->input_dev, data->key_code,1 );input_sync (data->input_dev);input_report_key (data->input_dev, data->key_code,0 );input_sync (data->input_dev); +mutex_unlock (&data->key_lock); }static const struct wmi_device_id xiaomi_wmi_id_table[] = {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 393/493 drm/msm/dp: allow voltage swing / pre emphasis of 3
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Baryshkov <[email protected]>
[ Upstream commit 22578178e5dd6d3aa4490879df8b6c2977d980be ]
Both dp_link_adjust_levels() and dp_ctrl_update_vx_px() limit swing and pre-emphasis to 2, while the real maximum value for the sum of the voltage swing and pre-emphasis is 3. Fix the DP code to remove this limitation.
Patchwork: https://patchwork.freedesktop.org/patch/577006/
--- drivers/gpu/drm/msm/dp/dp_ctrl.c | 6 +++--- drivers/gpu/drm/msm/dp/dp_link.c | 22 +++++++++++----------- drivers/gpu/drm/msm/dp/dp_link.h | 14 +------------- 3 files changed, 15 insertions(+), 27 deletions(-)
drivers/gpu/drm/msm/dp/dp_ctrl.c +3 -3
@@ -1019,14 +1019,14 @@ static int dp_ctrl_update_vx_px(struct dp_ctrl_private *ctrl)if (ret)return ret; -if (voltage_swing_level >=DP_TRAIN_VOLTAGE_SWING_MAX ) { +if (voltage_swing_level >=DP_TRAIN_LEVEL_MAX ) {drm_dbg_dp (ctrl->drm_dev,"max. voltage swing level reached %d\n" , voltage_swing_level); max_level_reached |=DP_TRAIN_MAX_SWING_REACHED ; } -if (pre_emphasis_level >=DP_TRAIN_PRE_EMPHASIS_MAX ) { +if (pre_emphasis_level >=DP_TRAIN_LEVEL_MAX ) {drm_dbg_dp (ctrl->drm_dev,"max. pre-emphasis level reached %d\n" , pre_emphasis_level);
@@ -1117,7 +1117,7 @@ static int dp_ctrl_link_train_1(struct dp_ctrl_private *ctrl, }if (ctrl->link->phy_params.v_level >= -DP_TRAIN_VOLTAGE_SWING_MAX ) { +DP_TRAIN_LEVEL_MAX ) {DRM_ERROR_RATELIMITED ("max v_level reached\n" );return -EAGAIN ; }
drivers/gpu/drm/msm/dp/dp_link.c +11 -11
@@ -1109,6 +1109,7 @@ int dp_link_get_colorimetry_config(struct dp_link *dp_link)int dp_link_adjust_levels (struct dp_link *dp_link,u8 *link_status) {int i; +u8 max_p_level;int v_max =0 , p_max =0 ;struct dp_link_private *link;
@@ -1140,30 +1141,29 @@ int dp_link_adjust_levels(struct dp_link *dp_link, u8 *link_status)* Adjust the voltage swing and pre-emphasis level combination to within * the allowable range. */ -if (dp_link->phy_params.v_level >DP_TRAIN_VOLTAGE_SWING_MAX ) { +if (dp_link->phy_params.v_level >DP_TRAIN_LEVEL_MAX ) {drm_dbg_dp (link->drm_dev,"Requested vSwingLevel=%d, change to %d\n" , dp_link->phy_params.v_level, -DP_TRAIN_VOLTAGE_SWING_MAX ); - dp_link->phy_params.v_level =DP_TRAIN_VOLTAGE_SWING_MAX ; +DP_TRAIN_LEVEL_MAX ); + dp_link->phy_params.v_level =DP_TRAIN_LEVEL_MAX ; } -if (dp_link->phy_params.p_level >DP_TRAIN_PRE_EMPHASIS_MAX ) { +if (dp_link->phy_params.p_level >DP_TRAIN_LEVEL_MAX ) {drm_dbg_dp (link->drm_dev,"Requested preEmphasisLevel=%d, change to %d\n" , dp_link->phy_params.p_level, -DP_TRAIN_PRE_EMPHASIS_MAX ); - dp_link->phy_params.p_level =DP_TRAIN_PRE_EMPHASIS_MAX ; +DP_TRAIN_LEVEL_MAX ); + dp_link->phy_params.p_level =DP_TRAIN_LEVEL_MAX ; } -if ((dp_link->phy_params.p_level >DP_TRAIN_PRE_EMPHASIS_LVL_1 ) - && (dp_link->phy_params.v_level == -DP_TRAIN_VOLTAGE_SWING_LVL_2 )) { + max_p_level =DP_TRAIN_LEVEL_MAX - dp_link->phy_params.v_level; +if (dp_link->phy_params.p_level > max_p_level) {drm_dbg_dp (link->drm_dev,"Requested preEmphasisLevel=%d, change to %d\n" , dp_link->phy_params.p_level, -DP_TRAIN_PRE_EMPHASIS_LVL_1 ); - dp_link->phy_params.p_level =DP_TRAIN_PRE_EMPHASIS_LVL_1 ; + max_p_level); + dp_link->phy_params.p_level = max_p_level; } drm_dbg_dp(link->drm_dev, "adjusted: v_level=%d, p_level=%d\n",
drivers/gpu/drm/msm/dp/dp_link.h +1 -13
@@ -19,19 +19,7 @@ struct dp_link_info {unsigned long capabilities; }; -enum dp_link_voltage_level { -DP_TRAIN_VOLTAGE_SWING_LVL_0 =0 , -DP_TRAIN_VOLTAGE_SWING_LVL_1 =1 , -DP_TRAIN_VOLTAGE_SWING_LVL_2 =2 , -DP_TRAIN_VOLTAGE_SWING_MAX =DP_TRAIN_VOLTAGE_SWING_LVL_2 , -}; - -enum dp_link_preemaphasis_level { -DP_TRAIN_PRE_EMPHASIS_LVL_0 =0 , -DP_TRAIN_PRE_EMPHASIS_LVL_1 =1 , -DP_TRAIN_PRE_EMPHASIS_LVL_2 =2 , -DP_TRAIN_PRE_EMPHASIS_MAX =DP_TRAIN_PRE_EMPHASIS_LVL_2 , -}; +#define DP_TRAIN_LEVEL_MAX 3struct dp_link_test_video {u32 test_video_pattern;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 394/493 drm/msm/dp: Avoid a long timeout for AUX transfer if nothing connected
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Douglas Anderson <[email protected]>
[ Upstream commit 5d1a7493343cc00d9019880b686e4e0a0f649531 ]
As documented in the description of the transfer() function of "struct drm_dp_aux", the transfer() function can be called at any time regardless of the state of the DP port. Specifically if the kernel has the DP AUX character device enabled and userspace accesses "/dev/drm_dp_auxN" directly then the AUX transfer function will be called regardless of whether a DP device is connected.
For eDP panels we have a special rule where we wait (with a 5 second timeout) for HPD to go high. This rule was important before all panels drivers were converted to call wait_hpd_asserted() and actually can be removed in a future commit.
For external DP devices we never checked for HPD. That means that trying to access the DP AUX character device (AKA hexdump -C /dev/drm_dp_auxN) would very, very slowly timeout. Specifically on my system:
$ time hexdump -C /dev/drm_dp_aux0 hexdump: /dev/drm_dp_aux0: Connection timed out real 0m8.200s We want access to the drm_dp_auxN character device to fail faster than 8 seconds when no DP cable is plugged in.
Let's add a test to make transfers fail right away if a device isn't plugged in. Rather than testing the HPD line directly, we have the dp_display module tell us when AUX transfers should be enabled so we can handle cases where HPD is signaled out of band like with Type C.
Patchwork: https://patchwork.freedesktop.org/patch/583127/
--- drivers/gpu/drm/msm/dp/dp_aux.c | 20 ++++++++++++++++++++ drivers/gpu/drm/msm/dp/dp_aux.h | 1 + drivers/gpu/drm/msm/dp/dp_display.c | 4 ++++ 3 files changed, 25 insertions(+)
drivers/gpu/drm/msm/dp/dp_aux.c +20 -0
@@ -35,6 +35,7 @@ struct dp_aux_private {bool no_send_stop;bool initted;bool is_edp; +bool enable_xfers;u32 offset;u32 segment;
@@ -301,6 +302,17 @@ static ssize_t dp_aux_transfer(struct drm_dp_aux *dp_aux, goto exit; } +/* +* If we're using DP and an external display isn't connected then the +* transfer won't succeed. Return right away. If we don't do this we +* can end up with long timeouts if someone tries to access the DP AUX +* character device when no DP device is connected. +*/ +if (!aux->is_edp && !aux->enable_xfers) { + ret = -ENXIO ; + goto exit; + } +/* * For eDP it's important to give a reasonably long wait here for HPD * to be asserted. This is because the panel driver may have _just_
@@ -433,6 +445,14 @@ irqreturn_t dp_aux_isr(struct drm_dp_aux *dp_aux)return IRQ_HANDLED ; } +void dp_aux_enable_xfers (struct drm_dp_aux *dp_aux,bool enabled) +{ +struct dp_aux_private *aux; + + aux = container_of(dp_aux, struct dp_aux_private, dp_aux); + aux->enable_xfers = enabled; +} +void dp_aux_reconfig (struct drm_dp_aux *dp_aux) {struct dp_aux_private *aux;
drivers/gpu/drm/msm/dp/dp_aux.h +1 -0
@@ -12,6 +12,7 @@int dp_aux_register (struct drm_dp_aux *dp_aux);void dp_aux_unregister (struct drm_dp_aux *dp_aux);irqreturn_t dp_aux_isr (struct drm_dp_aux *dp_aux); +void dp_aux_enable_xfers (struct drm_dp_aux *dp_aux,bool enabled);void dp_aux_init (struct drm_dp_aux *dp_aux);void dp_aux_deinit (struct drm_dp_aux *dp_aux);void dp_aux_reconfig (struct drm_dp_aux *dp_aux);
drivers/gpu/drm/msm/dp/dp_display.c +4 -0
@@ -565,6 +565,8 @@ static int dp_hpd_plug_handle(struct dp_display_private *dp, u32 data)int ret;struct platform_device *pdev = dp->dp_display.pdev; +dp_aux_enable_xfers (dp->aux, true); +mutex_lock (&dp->event_mutex); state = dp->hpd_state;
@@ -630,6 +632,8 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data)u32 state;struct platform_device *pdev = dp->dp_display.pdev; +dp_aux_enable_xfers (dp->aux, false); +mutex_lock (&dp->event_mutex); state = dp->hpd_state;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 395/493 media: ipu3-cio2: Request IRQ earlier
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sakari Ailus <[email protected]>
[ Upstream commit a069f79bfa6ec1ea0744981ea8425c8a25322579 ]
Call devm_request_irq() before registering the async notifier, as otherwise it would be possible to use the device before the interrupts could be delivered to the driver.
--- drivers/media/pci/intel/ipu3/ipu3-cio2.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/media/pci/intel/ipu3/ipu3-cio2.c +5 -5
@@ -1789,11 +1789,6 @@ static int cio2_pci_probe(struct pci_dev *pci_dev,v4l2_async_nf_init (&cio2->notifier, &cio2->v4l2_dev); -/* Register notifier for subdevices we care */ - r =cio2_parse_firmware (cio2); -if (r) - goto fail_clean_notifier; - r =devm_request_irq (dev, pci_dev->irq, cio2_irq,IRQF_SHARED ,CIO2_NAME , cio2);if (r) {
@@ -1801,6 +1796,11 @@ static int cio2_pci_probe(struct pci_dev *pci_dev, goto fail_clean_notifier; } +/* Register notifier for subdevices we care */ + r =cio2_parse_firmware (cio2); +if (r) + goto fail_clean_notifier; +pm_runtime_put_noidle (dev);pm_runtime_allow (dev);
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 396/493 media: dt-bindings: ovti,ov2680: Fix the power supply names
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Fabio Estevam <[email protected]>
[ Upstream commit e2f6ea61b6f3e4ebbb7dff857eea6220c18cd17b ]
The original .txt bindings had the OV2680 power supply names correct, but the transition from .txt to yaml spelled them incorrectly.
Fix the OV2680 power supply names as the original .txt bindings as these are the names used by the OV2680 driver and in devicetree.
--- .../bindings/media/i2c/ovti,ov2680.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
Documentation/devicetree/bindings/media/i2c/ovti,ov2680.yaml +9 -9
@@ -37,15 +37,15 @@ properties: active low. maxItems: 1 - dovdd-supply: + DOVDD-supply: description: Definition of the regulator used as interface power supply. - avdd-supply: + AVDD-supply: description: Definition of the regulator used as analog power supply. - dvdd-supply: + DVDD-supply: description: Definition of the regulator used as digital power supply.
@@ -59,9 +59,9 @@ required: - reg - clocks - clock-names - - dovdd-supply - - avdd-supply - - dvdd-supply + - DOVDD-supply + - AVDD-supply + - DVDD-supply - reset-gpios - port
@@ -82,9 +82,9 @@ examples: clock-names = "xvclk"; reset-gpios = <&gpio1 3 GPIO_ACTIVE_LOW>; - dovdd-supply = <&sw2_reg>; - dvdd-supply = <&sw2_reg>; - avdd-supply = <®_peri_3p15v>; + DOVDD-supply = <&sw2_reg>; + DVDD-supply = <&sw2_reg>; + AVDD-supply = <®_peri_3p15v>; port { ov2680_to_mipi: endpoint {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 397/493 media: i2c: et8ek8: Dont strip remove function when driver is builtin
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
[ Upstream commit 545b215736c5c4b354e182d99c578a472ac9bfce ]
Using __exit for the remove function results in the remove callback being discarded with CONFIG_VIDEO_ET8EK8=y. When such a device gets unbound (e.g. using sysfs or hotplug), the driver is just removed without the cleanup being performed. This results in resource leaks. Fix it by compiling in the remove callback unconditionally.
This also fixes a W=1 modpost warning:
WARNING: modpost: drivers/media/i2c/et8ek8/et8ek8: section mismatch in reference: et8ek8_i2c_driver+0x10 (section: .data) -> et8ek8_remove (section: .exit.text)
--- drivers/media/i2c/et8ek8/et8ek8_driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/i2c/et8ek8/et8ek8_driver.c +2 -2
@@ -1475,7 +1475,7 @@ static int et8ek8_probe(struct i2c_client *client)return ret; } -static void __exit et8ek8_remove(struct i2c_client *client) +static void et8ek8_remove (struct i2c_client *client) {struct v4l2_subdev *subdev =i2c_get_clientdata (client);struct et8ek8_sensor *sensor =to_et8ek8_sensor (subdev);
@@ -1517,7 +1517,7 @@ static struct i2c_driver et8ek8_i2c_driver = { .of_match_table = et8ek8_of_table, }, .probe = et8ek8_probe, - .remove = __exit_p(et8ek8_remove), + .remove = et8ek8_remove, .id_table = et8ek8_id_table, };
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 398/493 media: v4l2-subdev: Fix stream handling for crop API
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Pinchart <[email protected]>
[ Upstream commit 34d7bf1c8e59f5fbf438ee32c96389ebe41ca2e8 ]
When support for streams was added to the V4L2 subdev API, the v4l2_subdev_crop structure was extended with a stream field, but the field was not handled in the core code that translates the VIDIOC_SUBDEV_[GS]_CROP ioctls to the selection API. Fix it.
--- drivers/media/v4l2-core/v4l2-subdev.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/v4l2-core/v4l2-subdev.c +2 -0
@@ -732,6 +732,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,memset (&sel,0 ,sizeof (sel)); sel.which = crop->which; sel.pad = crop->pad; + sel.stream = crop->stream; sel.target =V4L2_SEL_TGT_CROP ; rval = v4l2_subdev_call(
@@ -756,6 +757,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,memset (&sel,0 ,sizeof (sel)); sel.which = crop->which; sel.pad = crop->pad; + sel.stream = crop->stream; sel.target =V4L2_SEL_TGT_CROP ; sel.r = crop->rect;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 399/493 fbdev: sh7760fb: allow modular build
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Randy Dunlap <[email protected]>
[ Upstream commit 51084f89d687e14d96278241e5200cde4b0985c7 ]
There is no reason to prohibit sh7760fb from being built as a loadable module as suggested by Geert, so change the config symbol from bool to tristate to allow that and change the FB dependency as needed.
--- drivers/video/fbdev/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/video/fbdev/Kconfig +2 -2
@@ -1680,8 +1680,8 @@ config FB_COBALT select FB_IOMEM_HELPERS config FB_SH7760 - bool "SH7760/SH7763/SH7720/SH7721 LCDC support" - depends on FB=y && (CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7763 \ + tristate "SH7760/SH7763/SH7720/SH7721 LCDC support" + depends on FB && (CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7763 \ || CPU_SUBTYPE_SH7720 || CPU_SUBTYPE_SH7721) select FB_IOMEM_HELPERS help
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 400/493 media: atomisp: ssh_css: Fix a null-pointer dereference in load_video_binaries
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhipeng Lu <[email protected]>
[ Upstream commit 3b621e9e9e148c0928ab109ac3d4b81487469acb ]
The allocation failure of mycs->yuv_scaler_binary in load_video_binaries() is followed with a dereference of mycs->yuv_scaler_binary after the following call chain:
sh_css_pipe_load_binaries()
|-> load_video_binaries(mycs->yuv_scaler_binary == NULL)
|
|-> sh_css_pipe_unload_binaries()
|-> unload_video_binaries()In unload_video_binaries(), it calls to ia_css_binary_unload with argument &pipe->pipe_settings.video.yuv_scaler_binary[i], which refers to the same memory slot as mycs->yuv_scaler_binary. Thus, a null-pointer dereference is triggered.
--- drivers/staging/media/atomisp/pci/sh_css.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/media/atomisp/pci/sh_css.c +1 -0
@@ -4719,6 +4719,7 @@ static int load_video_binaries(struct ia_css_pipe *pipe)sizeof (struct ia_css_binary ), GFP_KERNEL);if (!mycs->yuv_scaler_binary) { + mycs->num_yuv_scaler =0 ; err = -ENOMEM ;return err; }
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 401/493 drm/arm/malidp: fix a possible null pointer dereference
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huai-Yuan Liu <[email protected]>
[ Upstream commit a1f95aede6285dba6dd036d907196f35ae3a11ea ]
In malidp_mw_connector_reset, new memory is allocated with kzalloc, but no check is performed. In order to prevent null pointer dereferencing, ensure that mw_state is checked before calling __drm_atomic_helper_connector_reset.
--- drivers/gpu/drm/arm/malidp_mw.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/arm/malidp_mw.c +4 -1
@@ -72,7 +72,10 @@ static void malidp_mw_connector_reset(struct drm_connector *connector)__drm_atomic_helper_connector_destroy_state (connector->state);kfree (connector->state); -__drm_atomic_helper_connector_reset (connector, &mw_state->base); + connector->state =NULL ; + +if (mw_state) +__drm_atomic_helper_connector_reset (connector, &mw_state->base); } static enum drm_connector_status
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 402/493 drm: vc4: Fix possible null pointer dereference
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aleksandr Mishin <[email protected]>
[ Upstream commit c534b63bede6cb987c2946ed4d0b0013a52c5ba7 ]
In vc4_hdmi_audio_init() of_get_address() may return
NULL which is later dereferenced. Fix this bug by adding NULL check.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/gpu/drm/vc4/vc4_hdmi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/vc4/vc4_hdmi.c +2 -0
@@ -2739,6 +2739,8 @@ static int vc4_hdmi_audio_init(struct vc4_hdmi *vc4_hdmi) index =1 ; addr =of_get_address (dev->of_node, index,NULL ,NULL ); +if (!addr) +return -EINVAL ; vc4_hdmi->audio.dma_data.addr =be32_to_cpup (addr) + mai_data->offset; vc4_hdmi->audio.dma_data.addr_width =DMA_SLAVE_BUSWIDTH_4_BYTES ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 403/493 ASoC: tracing: Export SND_SOC_DAPM_DIR_OUT to its value
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt <[email protected]>
[ Upstream commit 58300f8d6a48e58d1843199be743f819e2791ea3 ]
The string SND_SOC_DAPM_DIR_OUT is printed in the snd_soc_dapm_path trace event instead of its value:
(((REC->path_dir) == SND_SOC_DAPM_DIR_OUT) ? "->" : "<-")
User space cannot parse this, as it has no idea what SND_SOC_DAPM_DIR_OUT is. Use TRACE_DEFINE_ENUM() to convert it to its value:
(((REC->path_dir) == 1) ? "->" : "<-")
So that user space tools, such as perf and trace-cmd, can parse it correctly.
--- include/trace/events/asoc.h | 2 ++ 1 file changed, 2 insertions(+)
include/trace/events/asoc.h +2 -0
@@ -12,6 +12,8 @@#define DAPM_DIRECT "(direct)"#define DAPM_ARROW (dir) (((dir) == SND_SOC_DAPM_DIR_OUT) ? "->" : "<-") +TRACE_DEFINE_ENUM (SND_SOC_DAPM_DIR_OUT ); +struct snd_soc_jack ;struct snd_soc_card ;struct snd_soc_dapm_widget ;
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 404/493 drm/bridge: anx7625: Dont log an error when DSI host cant be found
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit ef4a9204d594fe959cdbc7418273caf4001535c8 ]
Given that failing to find a DSI host causes the driver to defer probe, make use of dev_err_probe() to log the reason. This makes the defer probe reason available and avoids alerting userspace about something that is not necessarily an error.
--- drivers/gpu/drm/bridge/analogix/anx7625.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/analogix/anx7625.c +2 -4
@@ -2076,10 +2076,8 @@ static int anx7625_setup_dsi_device(struct anx7625_data *ctx) }; host =of_find_mipi_dsi_host_by_node (ctx->pdata.mipi_host_node); -if (!host) { -DRM_DEV_ERROR (dev,"fail to find dsi host.\n" ); -return -EPROBE_DEFER ; - } +if (!host) +return dev_err_probe (dev, -EPROBE_DEFER ,"fail to find dsi host.\n" ); dsi =devm_mipi_dsi_device_register_full (dev, host, &info);if (IS_ERR (dsi)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 405/493 drm/bridge: icn6211: Dont log an error when DSI host cant be found
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 275fafe58faa7fdb10fa245412696ecef676aac5 ]
Given that failing to find a DSI host causes the driver to defer probe, make use of dev_err_probe() to log the reason. This makes the defer probe reason available and avoids alerting userspace about something that is not necessarily an error.
--- drivers/gpu/drm/bridge/chipone-icn6211.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/chipone-icn6211.c +2 -4
@@ -563,10 +563,8 @@ static int chipone_dsi_host_attach(struct chipone *icn) host =of_find_mipi_dsi_host_by_node (host_node);of_node_put (host_node); -if (!host) { -dev_err (dev,"failed to find dsi host\n" ); -return -EPROBE_DEFER ; - } +if (!host) +return dev_err_probe (dev, -EPROBE_DEFER ,"failed to find dsi host\n" ); dsi =mipi_dsi_device_register_full (host, &info);if (IS_ERR (dsi)) {
Signature · 1 line
2.43.0
Greg Kroah-Hartman
maintainerPATCH 406/493 drm/bridge: lt8912b: Dont log an error when DSI host cant be found
In reply to Greg Kroah-Hartman6.8-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit b3b4695ff47c4964d4ccb930890c9ffd8e455e20 ]
Given that failing to find a DSI host causes the driver to defer probe, make use of dev_err_probe() to log the reason. This makes the defer probe reason available and avoids alerting userspace about something that is not necessarily an error.
--- drivers/gpu/drm/bridge/lontium-lt8912b.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/bridge/lontium-lt8912b.c +2 -4
@@ -494,10 +494,8 @@ static int lt8912_attach_dsi(struct lt8912 *lt) }; host =of_find_mipi_dsi_host_by_node (lt->host_node); -if (!host) { -dev_err (dev,"failed to find dsi host\n" ); -return -EPROBE_DEFER ; - } +if (!host) +return dev_err_probe (dev, -EPROBE_DEFER ,"failed to find dsi host\n" ); dsi =devm_mipi_dsi_device_register_full (dev, host, &info);if (IS_ERR (dsi)) {
Signature · 1 line
2.43.0