5.18.3-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainerPATCH 115/879 drm/plane: Move range check for format_count earlier
In reply to Greg Kroah-HartmanFrom: Steven Price <[email protected]>
[ Upstream commit 4b674dd69701c2e22e8e7770c1706a69f3b17269 ]
While the check for format_count > 64 in __drm_universal_plane_init() shouldn't be hit (it's a WARN_ON), in its current position it will then leak the plane->format_types array and fail to call drm_mode_object_unregister() leaking the modeset identifier. Move it to the start of the function to avoid allocating those resources in the first place.
--- drivers/gpu/drm/drm_plane.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/drm_plane.c +7 -7
@@ -247,6 +247,13 @@ static int __drm_universal_plane_init(struct drm_device *dev,if (WARN_ON (config->num_total_plane >=32 ))return -EINVAL ; +/* +* First driver to need more than 64 formats needs to fix this. Each +* format is encoded as a bit and the current code only supports a u64. +*/ +if (WARN_ON (format_count >64 )) +return -EINVAL ; +WARN_ON (drm_drv_uses_atomic_modeset (dev) && (!funcs->atomic_destroy_state || !funcs->atomic_duplicate_state));
@@ -268,13 +275,6 @@ static int __drm_universal_plane_init(struct drm_device *dev,return -ENOMEM ; } -/* -* First driver to need more than 64 formats needs to fix this. Each -* format is encoded as a bit and the current code only supports a u64. -*/ -if (WARN_ON (format_count >64 )) -return -EINVAL ; -if (format_modifiers) {const uint64_t *temp_modifiers = format_modifiers;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 116/879 drm/amdkfd: Fix circular lock dependency warning
In reply to Greg Kroah-HartmanFrom: Mukul Joshi <[email protected]>
[ Upstream commit b179fc28d521379ba7e0a38eec1a4c722e7ea634 ]
[ 168.544078] ======================================================
[ 168.550309] WARNING: possible circular locking dependency detected
[ 168.556523] 5.16.0-kfd-fkuehlin #148 Tainted: G E
[ 168.562558] ------------------------------------------------------
[ 168.568764] kfdtest/3479 is trying to acquire lock:
[ 168.573672] ffffffffc0927a70 (&topology_lock){++++}-{3:3}, at:
kfd_topology_device_by_id+0x16/0x60 [amdgpu] [ 168.583663]
but task is already holding lock:
[ 168.589529] ffff97d303dee668 (&mm->mmap_lock#2){++++}-{3:3}, at:
vm_mmap_pgoff+0xa9/0x180 [ 168.597755]
which lock already depends on the new lock.[ 168.605970]
the existing dependency chain (in reverse order) is:
[ 168.613487]
-> #3 (&mm->mmap_lock#2){++++}-{3:3}:
[ 168.619700] lock_acquire+0xca/0x2e0
[ 168.623814] down_read+0x3e/0x140
[ 168.627676] do_user_addr_fault+0x40d/0x690
[ 168.632399] exc_page_fault+0x6f/0x270
[ 168.636692] asm_exc_page_fault+0x1e/0x30
[ 168.641249] filldir64+0xc8/0x1e0
[ 168.645115] call_filldir+0x7c/0x110
[ 168.649238] ext4_readdir+0x58e/0x940
[ 168.653442] iterate_dir+0x16a/0x1b0
[ 168.657558] __x64_sys_getdents64+0x83/0x140
[ 168.662375] do_syscall_64+0x35/0x80
[ 168.666492] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 168.672095]
-> #2 (&type->i_mutex_dir_key#6){++++}-{3:3}:
[ 168.679008] lock_acquire+0xca/0x2e0
[ 168.683122] down_read+0x3e/0x140
[ 168.686982] path_openat+0x5b2/0xa50
[ 168.691095] do_file_open_root+0xfc/0x190
[ 168.695652] file_open_root+0xd8/0x1b0
[ 168.702010] kernel_read_file_from_path_initns+0xc4/0x140
[ 168.709542] _request_firmware+0x2e9/0x5e0
[ 168.715741] request_firmware+0x32/0x50
[ 168.721667] amdgpu_cgs_get_firmware_info+0x370/0xdd0 [amdgpu]
[ 168.730060] smu7_upload_smu_firmware_image+0x53/0x190 [amdgpu]
[ 168.738414] fiji_start_smu+0xcf/0x4e0 [amdgpu]
[ 168.745539] pp_dpm_load_fw+0x21/0x30 [amdgpu]
[ 168.752503] amdgpu_pm_load_smu_firmware+0x4b/0x80 [amdgpu]
[ 168.760698] amdgpu_device_fw_loading+0xb8/0x140 [amdgpu]
[ 168.768412] amdgpu_device_init.cold+0xdf6/0x1716 [amdgpu]
[ 168.776285] amdgpu_driver_load_kms+0x15/0x120 [amdgpu]
[ 168.784034] amdgpu_pci_probe+0x19b/0x3a0 [amdgpu]
[ 168.791161] local_pci_probe+0x40/0x80
[ 168.797027] work_for_cpu_fn+0x10/0x20
[ 168.802839] process_one_work+0x273/0x5b0
[ 168.808903] worker_thread+0x20f/0x3d0
[ 168.814700] kthread+0x176/0x1a0
[ 168.819968] ret_from_fork+0x1f/0x30
[ 168.825563]
-> #1 (&adev->pm.mutex){+.+.}-{3:3}:
[ 168.834721] lock_acquire+0xca/0x2e0
[ 168.840364] __mutex_lock+0xa2/0x930
[ 168.846020] amdgpu_dpm_get_mclk+0x37/0x60 [amdgpu]
[ 168.853257] amdgpu_amdkfd_get_local_mem_info+0xba/0xe0 [amdgpu]
[ 168.861547] kfd_create_vcrat_image_gpu+0x1b1/0xbb0 [amdgpu]
[ 168.869478] kfd_create_crat_image_virtual+0x447/0x510 [amdgpu]
[ 168.877884] kfd_topology_add_device+0x5c8/0x6f0 [amdgpu]
[ 168.885556] kgd2kfd_device_init.cold+0x385/0x4c5 [amdgpu]
[ 168.893347] amdgpu_amdkfd_device_init+0x138/0x180 [amdgpu]
[ 168.901177] amdgpu_device_init.cold+0x141b/0x1716 [amdgpu]
[ 168.909025] amdgpu_driver_load_kms+0x15/0x120 [amdgpu]
[ 168.916458] amdgpu_pci_probe+0x19b/0x3a0 [amdgpu]
[ 168.923442] local_pci_probe+0x40/0x80
[ 168.929249] work_for_cpu_fn+0x10/0x20
[ 168.935008] process_one_work+0x273/0x5b0
[ 168.940944] worker_thread+0x20f/0x3d0
[ 168.946623] kthread+0x176/0x1a0
[ 168.951765] ret_from_fork+0x1f/0x30
[ 168.957277]
-> #0 (&topology_lock){++++}-{3:3}:
[ 168.965993] check_prev_add+0x8f/0xbf0
[ 168.971613] __lock_acquire+0x1299/0x1ca0
[ 168.977485] lock_acquire+0xca/0x2e0
[ 168.982877] down_read+0x3e/0x140
[ 168.987975] kfd_topology_device_by_id+0x16/0x60 [amdgpu]
[ 168.995583] kfd_device_by_id+0xa/0x20 [amdgpu]
[ 169.002180] kfd_mmap+0x95/0x200 [amdgpu]
[ 169.008293] mmap_region+0x337/0x5a0
[ 169.013679] do_mmap+0x3aa/0x540
[ 169.018678] vm_mmap_pgoff+0xdc/0x180
[ 169.024095] ksys_mmap_pgoff+0x186/0x1f0
[ 169.029734] do_syscall_64+0x35/0x80
[ 169.035005] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 169.041754]
other info that might help us debug this:[ 169.053276] Chain exists of:
&topology_lock --> &type->i_mutex_dir_key#6 --> &mm->mmap_lock#2[ 169.068389] Possible unsafe locking scenario:
[ 169.076661] CPU0 CPU1
[ 169.082383] ---- ----
[ 169.088087] lock(&mm->mmap_lock#2);
[ 169.092922] lock(&type->i_mutex_dir_key#6);
[ 169.100975] lock(&mm->mmap_lock#2);
[ 169.108320] lock(&topology_lock);
[ 169.112957]
*** DEADLOCK ***This commit fixes the deadlock warning by ensuring pm.mutex is not held while holding the topology lock. For this, kfd_local_mem_info is moved into the KFD dev struct and filled during device init. This cached value can then be used instead of querying the value again and again.
--- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 7 ++----- drivers/gpu/drm/amd/amdkfd/kfd_crat.c | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_device.c | 2 ++ drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 1 + drivers/gpu/drm/amd/amdkfd/kfd_topology.c | 7 ++----- 5 files changed, 8 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_chardev.c +2 -5
@@ -944,8 +944,6 @@ static int kfd_ioctl_acquire_vm(struct file *filep, struct kfd_process *p,bool kfd_dev_is_large_bar (struct kfd_dev *dev) { -struct kfd_local_mem_info mem_info; -if (debug_largebar) {pr_debug ("Simulate large-bar allocation on non large-bar machine\n" );return true;
@@ -954,9 +952,8 @@ bool kfd_dev_is_large_bar(struct kfd_dev *dev)if (dev->use_iommu_v2)return false; -amdgpu_amdkfd_get_local_mem_info (dev->adev, &mem_info); -if (mem_info.local_mem_size_private ==0 && - mem_info.local_mem_size_public >0 ) +if (dev->local_mem_info.local_mem_size_private ==0 && + dev->local_mem_info.local_mem_size_public >0 )return true;return false; }
drivers/gpu/drm/amd/amdkfd/kfd_crat.c +1 -1
@@ -2152,7 +2152,7 @@ static int kfd_create_vcrat_image_gpu(void *pcrat_image,* report the total FB size (public+private) as a single * private heap. */ -amdgpu_amdkfd_get_local_mem_info (kdev->adev, &local_mem_info); + local_mem_info = kdev->local_mem_info; sub_type_hdr = (typeof (sub_type_hdr))((char *)sub_type_hdr + sub_type_hdr->length);
drivers/gpu/drm/amd/amdkfd/kfd_device.c +2 -0
@@ -575,6 +575,8 @@ bool kgd2kfd_device_init(struct kfd_dev *kfd,if (kfd_resume (kfd)) goto kfd_resume_error; +amdgpu_amdkfd_get_local_mem_info (kfd->adev, &kfd->local_mem_info); +if (kfd_topology_add_device (kfd)) {dev_err (kfd_device,"Error adding device to topology\n" ); goto kfd_topology_add_device_error;
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +1 -0
@@ -272,6 +272,7 @@ struct kfd_dev {struct kgd2kfd_shared_resources shared_resources;struct kfd_vmid_info vm_info; +struct kfd_local_mem_info local_mem_info;const struct kfd2kgd_calls *kfd2kgd;struct mutex doorbell_mutex;
drivers/gpu/drm/amd/amdkfd/kfd_topology.c +2 -5
@@ -1102,15 +1102,12 @@ static uint32_t kfd_generate_gpu_id(struct kfd_dev *gpu)uint32_t buf[7 ];uint64_t local_mem_size;int i; -struct kfd_local_mem_info local_mem_info;if (!gpu)return 0 ; -amdgpu_amdkfd_get_local_mem_info (gpu->adev, &local_mem_info); - - local_mem_size = local_mem_info.local_mem_size_private + - local_mem_info.local_mem_size_public; + local_mem_size = gpu->local_mem_info.local_mem_size_private + + gpu->local_mem_info.local_mem_size_public; buf[0 ] = gpu->pdev->devfn; buf[1] = gpu->pdev->subsystem_vendor |
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 117/879 drm/amd/pm: fix the compile warning
In reply to Greg Kroah-HartmanFrom: Evan Quan <[email protected]>
[ Upstream commit 555238d92ac32dbad2d77ad2bafc48d17391990c ]
Fix the compile warning below:drivers/gpu/drm/amd/amdgpu/../pm/legacy-dpm/kv_dpm.c:1641kv_get_acp_boot_level() warn: always true condition '(table->entries[i]->clk >= 0) => (0-u32max >= 0)'
--- drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/gpu/drm/amd/pm/legacy-dpm/kv_dpm.c +1 -13
@@ -1623,19 +1623,7 @@ static int kv_update_samu_dpm(struct amdgpu_device *adev, bool gate)static u8 kv_get_acp_boot_level (struct amdgpu_device *adev) { -u8 i; -struct amdgpu_clock_voltage_dependency_table *table = - &adev->pm.dpm.dyn_state.acp_clock_voltage_dependency_table; - -for (i =0 ; i < table->count; i++) { -if (table->entries[i].clk >=0 )/* XXX */ -break ; - } - -if (i >= table->count) - i = table->count -1 ; - -return i; +return 0 ; }static void kv_update_acp_boot_level (struct amdgpu_device *adev)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 118/879 ath10k: skip ath10k_halt during suspend for driver state RESTARTING
In reply to Greg Kroah-HartmanFrom: Abhishek Kumar <[email protected]>
[ Upstream commit b72a4aff947ba807177bdabb43debaf2c66bee05 ]
Double free crash is observed when FW recovery(caused by wmi timeout/crash) is followed by immediate suspend event. The FW recovery is triggered by ath10k_core_restart() which calls driver clean up via ath10k_halt(). When the suspend event occurs between the FW recovery, the restart worker thread is put into frozen state until suspend completes. The suspend event triggers ath10k_stop() which again triggers ath10k_halt() The double invocation of ath10k_halt() causes ath10k_htt_rx_free() to be called twice(Note: ath10k_htt_rx_alloc was not called by restart worker thread because of its frozen state), causing the crash.
To fix this, during the suspend flow, skip call to ath10k_halt() in ath10k_stop() when the current driver state is ATH10K_STATE_RESTARTING. Also, for driver state ATH10K_STATE_RESTARTING, call ath10k_wait_for_suspend() in ath10k_stop(). This is because call to ath10k_wait_for_suspend() is skipped later in
[ath10k_halt() > ath10k_core_stop()] for the driver state ATH10K_STATE_RESTARTING.
The frozen restart worker thread will be cancelled during resume when the device comes out of suspend.
Below is the crash stack for reference:
[ 428.469167] ------------[ cut here ]------------ [ 428.469180] kernel BUG at mm/slub.c:4150! [ 428.469193] invalid opcode: 0000 [#1] PREEMPT SMP NOPTI [ 428.469219] Workqueue: events_unbound async_run_entry_fn [ 428.469230] RIP: 0010:kfree+0x319/0x31b [ 428.469241] RSP: 0018:ffffa1fac015fc30 EFLAGS: 00010246 [ 428.469247] RAX: ffffedb10419d108 RBX: ffff8c05262b0000 [ 428.469252] RDX: ffff8c04a8c07000 RSI: 0000000000000000 [ 428.469256] RBP: ffffa1fac015fc78 R08: 0000000000000000 [ 428.469276] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 428.469285] Call Trace: [ 428.469295] ? dma_free_attrs+0x5f/0x7d [ 428.469320] ath10k_core_stop+0x5b/0x6f [ 428.469336] ath10k_halt+0x126/0x177 [ 428.469352] ath10k_stop+0x41/0x7e [ 428.469387] drv_stop+0x88/0x10e [ 428.469410] __ieee80211_suspend+0x297/0x411 [ 428.469441] rdev_suspend+0x6e/0xd0 [ 428.469462] wiphy_suspend+0xb1/0x105 [ 428.469483] ? name_show+0x2d/0x2d [ 428.469490] dpm_run_callback+0x8c/0x126 [ 428.469511] ? name_show+0x2d/0x2d [ 428.469517] __device_suspend+0x2e7/0x41b [ 428.469523] async_suspend+0x1f/0x93 [ 428.469529] async_run_entry_fn+0x3d/0xd1 [ 428.469535] process_one_work+0x1b1/0x329 [ 428.469541] worker_thread+0x213/0x372 [ 428.469547] kthread+0x150/0x15f [ 428.469552] ? pr_cont_work+0x58/0x58 [ 428.469558] ? kthread_blkcg+0x31/0x31
Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00288-QCARMSWPZ-1
--- drivers/net/wireless/ath/ath10k/mac.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/mac.c +18 -2
@@ -5339,13 +5339,29 @@ static int ath10k_start(struct ieee80211_hw *hw)static void ath10k_stop (struct ieee80211_hw *hw) {struct ath10k *ar = hw->priv; +u32 opt;ath10k_drain_tx (ar);mutex_lock (&ar->conf_mutex);if (ar->state !=ATH10K_STATE_OFF ) { -if (!ar->hw_rfkill_on) -ath10k_halt (ar); +if (!ar->hw_rfkill_on) { +/* If the current driver state is RESTARTING but not yet +* fully RESTARTED because of incoming suspend event, +* then ath10k_halt() is already called via +* ath10k_core_restart() and should not be called here. +*/ +if (ar->state !=ATH10K_STATE_RESTARTING ) { +ath10k_halt (ar); + }else { +/* Suspending here, because when in RESTARTING +* state, ath10k_core_stop() skips +* ath10k_wait_for_suspend(). +*/ + opt =WMI_PDEV_SUSPEND_AND_DISABLE_INTR ; +ath10k_wait_for_suspend (ar, opt); + } + } ar->state =ATH10K_STATE_OFF ; }mutex_unlock (&ar->conf_mutex);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 119/879 arm64: compat: Do not treat syscall number as ESR_ELx for a bad syscall
In reply to Greg Kroah-HartmanFrom: Alexandru Elisei <[email protected]>
[ Upstream commit 3fed9e551417b84038b15117732ea4505eee386b ]
If a compat process tries to execute an unknown system call above the __ARM_NR_COMPAT_END number, the kernel sends a SIGILL signal to the offending process. Information about the error is printed to dmesg in compat_arm_syscall() -> arm64_notify_die() -> arm64_force_sig_fault() -> arm64_show_signal().
arm64_show_signal() interprets a non-zero value for current->thread.fault_code as an exception syndrome and displays the message associated with the ESR_ELx.EC field (bits 31:26). current->thread.fault_code is set in compat_arm_syscall() -> arm64_notify_die() with the bad syscall number instead of a valid ESR_ELx value. This means that the ESR_ELx.EC field has the value that the user set for the syscall number and the kernel can end up printing bogus exception messages*. For example, for the syscall number 0x68000000, which evaluates to ESR_ELx.EC value of 0x1A (ESR_ELx_EC_FPAC) the kernel prints this error:
[ 18.349161] syscall[300]: unhandled exception: ERET/ERETAA/ERETAB, ESR 0x68000000, Oops - bad compat syscall(2) in syscall[10000+50000] [ 18.350639] CPU: 2 PID: 300 Comm: syscall Not tainted 5.18.0-rc1 #79 [ 18.351249] Hardware name: Pine64 RockPro64 v2.0 (DT)
[..]
which is misleading, as the bad compat syscall has nothing to do with pointer authentication.
Stop arm64_show_signal() from printing exception syndrome information by having compat_arm_syscall() set the ESR_ELx value to 0, as it has no meaning for an invalid system call number. The example above now becomes:
[ 19.935275] syscall[301]: unhandled exception: Oops - bad compat syscall(2) in syscall[10000+50000] [ 19.936124] CPU: 1 PID: 301 Comm: syscall Not tainted 5.18.0-rc1-00005-g7e08006d4102 #80 [ 19.936894] Hardware name: Pine64 RockPro64 v2.0 (DT)
[..]
which although shows less information because the syscall number, wrongfully advertised as the ESR value, is missing, it is better than showing plainly wrong information. The syscall number can be easily obtained with strace.
*A 32-bit value above or equal to 0x8000_0000 is interpreted as a negative integer in compat_arm_syscal() and the condition scno < __ARM_NR_COMPAT_END evaluates to true; the syscall will exit to userspace in this case with the ENOSYS error code instead of arm64_notify_die() being called.
--- arch/arm64/kernel/sys_compat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/kernel/sys_compat.c +1 -1
@@ -113,6 +113,6 @@ long compat_arm_syscall(struct pt_regs *regs, int scno) addr =instruction_pointer (regs) - (compat_thumb_mode (regs) ?2 :4 );arm64_notify_die ("Oops - bad compat syscall(2)" , regs, -SIGILL ,ILL_ILLTRP , addr, scno); +SIGILL ,ILL_ILLTRP , addr,0 );return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 120/879 drm: msm: fix error check return value of irq_of_parse_and_map()
In reply to Greg Kroah-HartmanFrom: Lv Ruyi <[email protected]>
[ Upstream commit b9e4f1d2b505df8e2439b63e67afaa287c1c43e2 ]
The irq_of_parse_and_map() function returns 0 on failure, and does not return an negative value.
Patchwork: https://patchwork.freedesktop.org/patch/483175/
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +3 -3
@@ -570,9 +570,9 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev) } irq =irq_of_parse_and_map (pdev->dev.of_node,0 ); -if (irq <0 ) { - ret = irq; -DRM_DEV_ERROR (&pdev->dev,"failed to get irq: %d\n" , ret); +if (!irq) { + ret = -EINVAL ; +DRM_DEV_ERROR (&pdev->dev,"failed to get irq\n" ); goto fail; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 121/879 drm/msm/dpu: Clean up CRC debug logs
In reply to Greg Kroah-HartmanFrom: Jessica Zhang <[email protected]>
[ Upstream commit 3ce8bdca394fc606b55e7c5ed779d171aaae5d09 ]
Currently, dpu_hw_lm_collect_misr returns EINVAL if CRC is disabled. This causes a lot of spam in the DRM debug logs as it's called for every vblank.
Instead of returning EINVAL when CRC is disabled in dpu_hw_lm_collect_misr, let's return ENODATA and add an extra ENODATA check before the debug log in dpu_crtc_get_crc.
Changes since V1:
- Added reported-by and suggested-by tags
Patchwork: https://patchwork.freedesktop.org/patch/484274/
--- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 3 ++- drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +2 -1
@@ -204,7 +204,8 @@ static int dpu_crtc_get_crc(struct drm_crtc *crtc) rc = m->hw_lm->ops.collect_misr (m->hw_lm, &crcs[i]);if (rc) { -DRM_DEBUG_DRIVER ("MISR read failed\n" ); +if (rc != -ENODATA ) +DRM_DEBUG_DRIVER ("MISR read failed\n" );return rc; } }
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_lm.c +1 -1
@@ -138,7 +138,7 @@ static int dpu_hw_lm_collect_misr(struct dpu_hw_mixer *ctx, u32 *misr_value) ctrl =DPU_REG_READ (c,LM_MISR_CTRL );if (!(ctrl &LM_MISR_CTRL_ENABLE )) -return -EINVAL ; +return -ENODATA ;if (!(ctrl &LM_MISR_CTRL_STATUS ))return -EINVAL ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 122/879 xtensa: move trace_hardirqs_off call back to entry.S
In reply to Greg Kroah-HartmanFrom: Max Filippov <[email protected]>
[ Upstream commit de4415d0bac91192ee9c74e849bc61429efa9b42 ]
Context tracking call must be done after hardirq tracking call, otherwise lockdep_assert_irqs_disabled called from rcu_eqs_exit gives a warning. To avoid context tracking logic duplication for IRQ/exception entry paths move trace_hardirqs_off call back to common entry code.
--- arch/xtensa/kernel/entry.S | 19 +++++++++++++------ arch/xtensa/kernel/traps.c | 11 ++--------- 2 files changed, 15 insertions(+), 15 deletions(-)
arch/xtensa/kernel/entry.S +13 -6
@@ -442,7 +442,6 @@ KABI_W or a3, a3, a0 moveqz a3, a0, a2 # a3 = LOCKLEVEL iff interrupt KABI_W movi a2, PS_WOE_MASK KABI_W or a3, a3, a2 - rsr a2, exccause #endif /* restore return address (or 0 if return to userspace) */
@@ -469,19 +468,27 @@ KABI_W or a3, a3, a2 save_xtregs_opt a1 a3 a4 a5 a6 a7 PT_XTREGS_OPT +#ifdef CONFIG_TRACE_IRQFLAGS + rsr abi_tmp0, ps + extui abi_tmp0, abi_tmp0, PS_INTLEVEL_SHIFT, PS_INTLEVEL_WIDTH + beqz abi_tmp0, 1f + abi_call trace_hardirqs_off +1: +#endif + /* Go to second-level dispatcher. Set up parameters to pass to the * exception handler and call the exception handler. */ - rsr a4, excsave1 - addx4 a4, a2, a4 - l32i a4, a4, EXC_TABLE_DEFAULT # load handler - mov abi_arg1, a2 # pass EXCCAUSE + l32i abi_arg1, a1, PT_EXCCAUSE # pass EXCCAUSE + rsr abi_tmp0, excsave1 + addx4 abi_tmp0, abi_arg1, abi_tmp0 + l32i abi_tmp0, abi_tmp0, EXC_TABLE_DEFAULT # load handler mov abi_arg0, a1 # pass stack frame /* Call the second-level handler */ - abi_callx a4 + abi_callx abi_tmp0 /* Jump here for exception exit */ .global common_exception_return
arch/xtensa/kernel/traps.c +2 -9
@@ -242,12 +242,8 @@ DEFINE_PER_CPU(unsigned long, nmi_count);void do_nmi (struct pt_regs *regs) { -struct pt_regs *old_regs; +struct pt_regs *old_regs =set_irq_regs (regs); -if ((regs->ps &PS_INTLEVEL_MASK ) <LOCKLEVEL ) -trace_hardirqs_off (); - - old_regs =set_irq_regs (regs);nmi_enter (); ++*this_cpu_ptr (&nmi_count);check_valid_nmi ();
@@ -269,12 +265,9 @@ void do_interrupt(struct pt_regs *regs)XCHAL_INTLEVEL6_MASK , XCHAL_INTLEVEL7_MASK, }; -struct pt_regs *old_regs; +struct pt_regs *old_regs =set_irq_regs (regs);unsigned unhandled = ~0u ; -trace_hardirqs_off (); - - old_regs =set_irq_regs (regs);irq_enter ();for (;;) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 123/879 ath11k: fix warning of not found station for bssid in message
In reply to Greg Kroah-HartmanFrom: Wen Gong <[email protected]>
[ Upstream commit 7330e1ec9748948177830c6e1a13379835d577f9 ]
When test connect/disconnect to an AP frequently with WCN6855, sometimes it show below log.
[ 277.040121] wls1: deauthenticating from 8c:21:0a:b3:5a:64 by local choice (Reason: 3=DEAUTH_LEAVING) [ 277.050906] ath11k_pci 0000:05:00.0: wmi stats vdev id 0 mac 00:03:7f:29:61:11 [ 277.050944] ath11k_pci 0000:05:00.0: wmi stats bssid 8c:21:0a:b3:5a:64 vif pK-error [ 277.050954] ath11k_pci 0000:05:00.0: not found station for bssid 8c:21:0a:b3:5a:64 [ 277.050961] ath11k_pci 0000:05:00.0: failed to parse rssi chain -71 [ 277.050967] ath11k_pci 0000:05:00.0: failed to pull fw stats: -71 [ 277.050976] ath11k_pci 0000:05:00.0: wmi stats vdev id 0 mac 00:03:7f:29:61:11 [ 277.050983] ath11k_pci 0000:05:00.0: wmi stats bssid 8c:21:0a:b3:5a:64 vif pK-error [ 277.050989] ath11k_pci 0000:05:00.0: not found station for bssid 8c:21:0a:b3:5a:64 [ 277.050995] ath11k_pci 0000:05:00.0: failed to parse rssi chain -71 [ 277.051000] ath11k_pci 0000:05:00.0: failed to pull fw stats: -71 [ 278.064050] ath11k_pci 0000:05:00.0: failed to request fw stats: -110
Reason is:
When running disconnect operation, sta_info removed from local->sta_hash by __sta_info_destroy_part1() from __sta_info_flush(), after this, ieee80211_find_sta_by_ifaddr() which called by ath11k_wmi_tlv_fw_stats_data_parse() and ath11k_wmi_tlv_rssi_chain_parse() cannot find this station, then failed log printed.
steps are like this:
1. when disconnect from AP, __sta_info_destroy() called __sta_info_destroy_part1() and __sta_info_destroy_part2().
2. in __sta_info_destroy_part1(), it has "sta_info_hash_del(local, sta)" and "list_del_rcu(&sta->list)", it will remove the ieee80211_sta from the list of ieee80211_hw.
3. in __sta_info_destroy_part2(), it called drv_sta_state()->ath11k_mac_op_sta_state(), then peer->sta is clear at this moment.
4. in __sta_info_destroy_part2(), it then called sta_set_sinfo()->drv_sta_statistics() ->ath11k_mac_op_sta_statistics(), then WMI_REQUEST_STATS_CMDID sent to firmware.
5. WMI_UPDATE_STATS_EVENTID reported from firmware, at this moment, the ieee80211_sta can not be found again because it has remove from list in step2 and also peer->sta is clear in step3.
6. in __sta_info_destroy_part2(), it then called cleanup_single_sta()-> sta_info_free()->kfree(sta), at this moment, the ieee80211_sta is freed in memory, then the failed log will not happen because function ath11k_mac_op_sta_state() will not be called.
Actually this print log is not a real error, it is only to skip parse the info, so change to skip print by default debug setting.
Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3
--- drivers/net/wireless/ath/ath11k/wmi.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath11k/wmi.c +6 -5
@@ -5789,9 +5789,9 @@ static int ath11k_wmi_tlv_rssi_chain_parse(struct ath11k_base *ab, arvif->bssid, NULL);if (!sta) { -ath11k_warn (ab,"not found station for bssid %pM\n" , - arvif->bssid); - ret = -EPROTO ; +ath11k_dbg (ab,ATH11K_DBG_WMI , +"not found station of bssid %pM for rssi chain\n" , + arvif->bssid); goto exit; }
@@ -5889,8 +5889,9 @@ static int ath11k_wmi_tlv_fw_stats_data_parse(struct ath11k_base *ab,"wmi stats vdev id %d snr %d\n" , src->vdev_id, src->beacon_snr); }else { -ath11k_warn (ab,"not found station for bssid %pM\n" , - arvif->bssid); +ath11k_dbg (ab,ATH11K_DBG_WMI , +"not found station of bssid %pM for vdev stat\n" , + arvif->bssid); } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 124/879 scsi: target: tcmu: Fix possible data corruption
In reply to Greg Kroah-HartmanFrom: Xiaoguang Wang <[email protected]>
[ Upstream commit bb9b9eb0ae2e9d3f6036f0ad907c3a83dcd43485 ]
When tcmu_vma_fault() gets a page successfully, before the current context completes page fault procedure, find_free_blocks() may run and call unmap_mapping_range() to unmap the page. Assume that when find_free_blocks() initially completes and the previous page fault procedure starts to run again and completes, then one truncated page has been mapped to userspace. But note that tcmu_vma_fault() has gotten a refcount for the page so any other subsystem won't be able to use the page unless the userspace address is unmapped later.
If another command subsequently runs and needs to extend dbi_thresh it may reuse the corresponding slot for the previous page in data_bitmap. Then though we'll allocate new page for this slot in data_area, no page fault will happen because we have a valid map and the real request's data will be lost.
Filesystem implementations will also run into this issue but they usually lock the page when vm_operations_struct->fault gets a page and unlock the page after finish_fault() completes. For truncate filesystems lock pages in truncate_inode_pages() to protect against racing wrt. page faults.
To fix this possible data corruption scenario we can apply a method similar to the filesystems. For pages that are to be freed, tcmu_blocks_release() locks and unlocks. Make tcmu_vma_fault() also lock found page under cmdr_lock. At the same time, since tcmu_vma_fault() gets an extra page refcount, tcmu_blocks_release() won't free pages if pages are in page fault procedure, which means it is safe to call tcmu_blocks_release() before unmap_mapping_range().
With these changes tcmu_blocks_release() will wait for all page faults to be completed before calling unmap_mapping_range(). And later, if unmap_mapping_range() is called, it will ensure stale mappings are removed.
--- drivers/target/target_core_user.c | 40 ++++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-)
drivers/target/target_core_user.c +37 -3
@@ -20,6 +20,7 @@#include <linux/configfs.h> #include <linux/mutex.h> #include <linux/workqueue.h> +#include <linux/pagemap.h> #include <net/genetlink.h> #include <scsi/scsi_common.h> #include <scsi/scsi_proto.h>
@@ -1667,6 +1668,26 @@ static u32 tcmu_blocks_release(struct tcmu_dev *udev, unsigned long first,xas_lock (&xas);xas_for_each (&xas, page, (last +1 ) * udev->data_pages_per_blk -1 ) {xas_store (&xas,NULL ); +/* +* While reaching here there may be page faults occurring on +* the to-be-released pages. A race condition may occur if +* unmap_mapping_range() is called before page faults on these +* pages have completed; a valid but stale map is created. +* +* If another command subsequently runs and needs to extend +* dbi_thresh, it may reuse the slot corresponding to the +* previous page in data_bitmap. Though we will allocate a new +* page for the slot in data_area, no page fault will happen +* because we have a valid map. Therefore the command's data +* will be lost. +* +* We lock and unlock pages that are to be released to ensure +* all page faults have completed. This way +* unmap_mapping_range() can ensure stale maps are cleanly +* removed. +*/ +lock_page (page); +unlock_page (page);__free_page (page); pages_freed++; }
@@ -1822,6 +1843,7 @@ static struct page *tcmu_try_get_data_page(struct tcmu_dev *udev, uint32_t dpi) page =xa_load (&udev->data_pages, dpi);if (likely (page)) {get_page (page); +lock_page (page);mutex_unlock (&udev->cmdr_lock);return page; }
@@ -1863,6 +1885,7 @@ static vm_fault_t tcmu_vma_fault(struct vm_fault *vmf)struct page *page;unsigned long offset;void *addr; +vm_fault_t ret =0 ;int mi =tcmu_find_mem_index (vmf->vma);if (mi <0 )
@@ -1887,10 +1910,11 @@ static vm_fault_t tcmu_vma_fault(struct vm_fault *vmf) page =tcmu_try_get_data_page (udev, dpi);if (!page)return VM_FAULT_SIGBUS ; + ret =VM_FAULT_LOCKED ; } vmf->page = page; -return 0 ; +return ret; }static const struct vm_operations_struct tcmu_vm_ops = {
@@ -3205,12 +3229,22 @@ static void find_free_blocks(void) udev->dbi_max = block; } +/* +* Release the block pages. +* +* Also note that since tcmu_vma_fault() gets an extra page +* refcount, tcmu_blocks_release() won't free pages if pages +* are mapped. This means it is safe to call +* tcmu_blocks_release() before unmap_mapping_range() which +* drops the refcount of any pages it unmaps and thus releases +* them. +*/ + pages_freed =tcmu_blocks_release (udev, start, end -1 ); +/* Here will truncate the data area from off */ off = udev->data_off + (loff_t )start * udev->data_blk_size;unmap_mapping_range (udev->inode->i_mapping, off,0 ,1 ); -/* Release the block pages */ - pages_freed =tcmu_blocks_release (udev, start, end -1 );mutex_unlock (&udev->cmdr_lock); total_pages_freed += pages_freed;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 125/879 ipv6: Dont send rs packets to the interface of ARPHRD_TUNNEL
In reply to Greg Kroah-HartmanFrom: jianghaoran <[email protected]>
[ Upstream commit b52e1cce31ca721e937d517411179f9196ee6135 ]
ARPHRD_TUNNEL interface can't process rs packets
and will generate TX errors
ex:
ip tunnel add ethn mode ipip local 192.168.1.1 remote 192.168.1.2 ifconfig ethn x.x.x.x
ethn: flags=209<UP,POINTOPOINT,RUNNING,NOARP> mtu 1480
inet x.x.x.x netmask 255.255.255.255 destination x.x.x.x inet6 fe80::5efe:ac1e:3cdb prefixlen 64 scopeid 0x20<link>
tunnel txqueuelen 1000 (IPIP Tunnel)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 3 dropped 0 overruns 0 carrier 0 collisions 0
--- net/ipv6/addrconf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv6/addrconf.c +2 -1
@@ -4219,7 +4219,8 @@ static void addrconf_dad_completed(struct inet6_ifaddr *ifp, bool bump_id, send_rs = send_mld &&ipv6_accept_ra (ifp->idev) && ifp->idev->cnf.rtr_solicits !=0 && - (dev->flags&IFF_LOOPBACK ) ==0 ; + (dev->flags &IFF_LOOPBACK ) ==0 && + (dev->type !=ARPHRD_TUNNEL );read_unlock_bh (&ifp->idev->lock);/* While dad is in progress mld report's source address is in6_addrany.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 126/879 net/mlx5: use kvfree() for kvzalloc() in mlx5_ct_fs_smfs_matcher_create
In reply to Greg Kroah-HartmanFrom: Ziyang Xuan <[email protected]>
[ Upstream commit c389362096be8ee69ec3a163a0699a31e84b8451 ]
The memory of spec is allocated with kvzalloc(), the corresponding release function should not be kfree(), use kvfree() instead.
Generated by: scripts/coccinelle/api/kfree_mismatch.cocci
--- drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en/tc/ct_fs_smfs.c +1 -1
@@ -101,7 +101,7 @@ mlx5_ct_fs_smfs_matcher_create(struct mlx5_ct_fs *fs, struct mlx5dr_table *tbl, spec->match_criteria_enable =MLX5_MATCH_MISC_PARAMETERS_2 |MLX5_MATCH_OUTER_HEADERS ; dr_matcher =mlx5_smfs_matcher_create (tbl, priority, spec); -kfree (spec); +kvfree (spec);if (!dr_matcher)return ERR_PTR (-EINVAL );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 127/879 net/mlx5: fs, delete the FTE when there are no rules attached to it
In reply to Greg Kroah-HartmanFrom: Mark Bloch <[email protected]>
[ Upstream commit 7b0c6338597613f465d131bd939a51844a00455a ]
When an FTE has no children is means all the rules where removed and the FTE can be deleted regardless of the dests_size value. While dests_size should be 0 when there are no children be extra careful not to leak memory or get firmware syndrome if the proper bookkeeping of dests_size wasn't done.
--- drivers/net/ethernet/mellanox/mlx5/core/fs_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/fs_core.c +5 -5
@@ -2071,16 +2071,16 @@ void mlx5_del_flow_rules(struct mlx5_flow_handle *handle)down_write_ref_node (&fte->node, false);for (i = handle->num_rules -1 ; i >=0 ; i--)tree_remove_node (&handle->rule[i]->node, true); -if (fte->dests_size) { -if (fte->modify_mask) -modify_fte (fte); -up_write_ref_node (&fte->node, false); - }else if (list_empty (&fte->node.children)) { +if (list_empty (&fte->node.children)) {del_hw_fte (&fte->node);/* Avoid double call to del_hw_fte */ fte->node.del_hw_func =NULL ;up_write_ref_node (&fte->node, false);tree_put_node (&fte->node, false); + }else if (fte->dests_size) { +if (fte->modify_mask) +modify_fte (fte); +up_write_ref_node (&fte->node, false); }else {up_write_ref_node (&fte->node, false); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 128/879 ASoC: dapm: Dont fold register value changes into notifications
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit ad685980469b9f9b99d4d6ea05f4cb8f57cb2234 ]
DAPM tracks and reports the value presented to the user from DAPM controls separately to the register value, these may diverge during initialisation or when an autodisable control is in use.
When writing DAPM controls we currently report that a change has occurred if either the DAPM value or the value stored in the register has changed, meaning that if the two are out of sync we may appear to report a spurious event to userspace. Since we use this folded in value for nothing other than the value reported to userspace simply drop the folding in of the register change.
--- sound/soc/soc-dapm.c | 2 -- 1 file changed, 2 deletions(-)
sound/soc/soc-dapm.c +0 -2
@@ -3437,7 +3437,6 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol, update.val = val; card->update = &update; } - change |= reg_change; ret =soc_dapm_mixer_update_power (card, kcontrol, connect, rconnect);
@@ -3539,7 +3538,6 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol, update.val = val; card->update = &update; } - change |= reg_change; ret =soc_dapm_mux_update_power (card, kcontrol, item[0 ], e);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 129/879 ASoC: SOF: ipc3-topology: Correct get_control_data for non bytes payload
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit a962890a5a3cce903ff7c7a19fadee63ed9efdc7 ]
It is possible to craft a topology where sof_get_control_data() would do out of bounds access because it expects that it is only called when the payload is bytes type.
Confusingly it also handles other types of controls, but the payload parsing implementation is only valid for bytes.
Fix the code to count the non bytes controls and instead of storing a pointer to sof_abi_hdr in sof_widget_data (which is only valid for bytes), store the pointer to the data itself and add a new member to save the size of the data.
In case of non bytes controls we store the pointer to the chanv itself, which is just an array of values at the end.
In case of bytes control, drop the wrong cdata->data (wdata[i].pdata) check against NULL since it is incorrect and invalid in this context. The data is pointing to the end of cdata struct, so it should never be null.
--- sound/soc/sof/ipc3-topology.c | 39 +++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 13 deletions(-)
sound/soc/sof/ipc3-topology.c +26 -13
@@ -20,7 +20,8 @@struct sof_widget_data {int ctrl_type;int ipc_cmd; -struct sof_abi_hdr *pdata; +void *pdata; +size_t pdata_size;struct snd_sof_control *control; };
@@ -784,16 +785,26 @@ static int sof_get_control_data(struct snd_soc_component *scomp, } cdata = wdata[i].control->ipc_control_data; - wdata[i].pdata = cdata->data; -if (!wdata[i].pdata) -return -EINVAL ; -/* make sure data is valid - data can be updated at runtime */ -if (widget->dobj.widget.kcontrol_type[i] ==SND_SOC_TPLG_TYPE_BYTES && - wdata[i].pdata->magic !=SOF_ABI_MAGIC ) -return -EINVAL ; +if (widget->dobj.widget.kcontrol_type[i] ==SND_SOC_TPLG_TYPE_BYTES ) { +/* make sure data is valid - data can be updated at runtime */ +if (cdata->data->magic !=SOF_ABI_MAGIC ) +return -EINVAL ; + + wdata[i].pdata = cdata->data->data; + wdata[i].pdata_size = cdata->data->size; + }else { +/* points to the control data union */ + wdata[i].pdata = cdata->chanv; +/* +* wdata[i].control->size is calculated with struct_size +* and includes the size of struct sof_ipc_ctrl_data +*/ + wdata[i].pdata_size = wdata[i].control->size - +sizeof (struct sof_ipc_ctrl_data ); + } - *size += wdata[i].pdata->size; + *size += wdata[i].pdata_size;/* get data type */ switch (cdata->cmd) {
@@ -876,10 +887,12 @@ static int sof_process_load(struct snd_soc_component *scomp,*/ if (ipc_data_size) {for (i =0 ; i < widget->num_kcontrols; i++) { -memcpy (&process->data[offset], - wdata[i].pdata->data, - wdata[i].pdata->size); - offset += wdata[i].pdata->size; +if (!wdata[i].pdata_size) +continue ; + +memcpy (&process->data[offset], wdata[i].pdata, + wdata[i].pdata_size); + offset += wdata[i].pdata_size; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 130/879 mlxsw: spectrum_dcb: Do not warn about priority changes
In reply to Greg Kroah-HartmanFrom: Petr Machata <[email protected]>
[ Upstream commit b6b584562cbe7dc357083459d6dd5b171e12cadb ]
The idea behind the warnings is that the user would get warned in case when more than one priority is configured for a given DSCP value on a netdevice.
The warning is currently wrong, because dcb_ieee_getapp_mask() returns the first matching entry, not all of them, and the warning will then claim that some priority is "current", when in fact it is not.
But more importantly, the warning is misleading in general. Consider the following commands:
# dcb app flush dev swp19 dscp-prio # dcb app add dev swp19 dscp-prio 24:3 # dcb app replace dev swp19 dscp-prio 24:2
The last command will issue the following warning:
mlxsw_spectrum3 0000:07:00.0 swp19: Ignoring new priority 2 for DSCP 24 in favor of current value of 3
The reason is that the "replace" command works by first adding the new value, and then removing all old values. This is the only way to make the replacement without causing the traffic to be prioritized to whatever the chip defaults to. The warning is issued in response to adding the new priority, and then no warning is shown when the old priority is removed. The upshot is that the canonical way to change traffic prioritization always produces a warning about ignoring the new priority, but what gets configured is in fact what the user intended.
An option to just emit warning every time that the prioritization changes just to make it clear that it happened is obviously unsatisfactory.
Therefore, in this patch, remove the warnings.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c | 13 ------------- 1 file changed, 13 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_dcb.c +0 -13
@@ -168,8 +168,6 @@ static int mlxsw_sp_dcbnl_ieee_setets(struct net_device *dev,static int mlxsw_sp_dcbnl_app_validate (struct net_device *dev,struct dcb_app *app) { -int prio; -if (app->priority >=IEEE_8021QAZ_MAX_TCS ) {netdev_err (dev,"APP entry with priority value %u is invalid\n" , app->priority);
@@ -183,17 +181,6 @@ static int mlxsw_sp_dcbnl_app_validate(struct net_device *dev, app->protocol);return -EINVAL ; } - -/* Warn about any DSCP APP entries with the same PID. */ - prio =fls (dcb_ieee_getapp_mask (dev, app)); -if (prio--) { -if (prio < app->priority) -netdev_warn (dev,"Choosing priority %d for DSCP %d in favor of previously-active value of %d\n" , - app->priority, app->protocol, prio); -else if (prio > app->priority) -netdev_warn (dev,"Ignoring new priority %d for DSCP %d in favor of current value of %d\n" , - app->priority, app->protocol, prio); - }break ;case IEEE_8021QAZ_APP_SEL_ETHERTYPE :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 131/879 mlxsw: Treat LLDP packets as control
In reply to Greg Kroah-HartmanFrom: Petr Machata <[email protected]>
[ Upstream commit 0106668cd2f91bf913fb78972840dedfba80a3c3 ]
When trapping packets for on-CPU processing, Spectrum machines differentiate between control and non-control traps. Traffic trapped through non-control traps is treated as data and kept in shared buffer in pools 0-4. Traffic trapped through control traps is kept in the dedicated control buffer 9. The advantage of marking traps as control is that pressure in the data plane does not prevent the control traffic to be processed.
When the LLDP trap was introduced, it was marked as a control trap. But then in commit aed4b5721143 ("mlxsw: spectrum: PTP: Hook into packet receive path"), PTP traps were introduced. Because Ethernet-encapsulated PTP packets look to the Spectrum-1 ASIC as LLDP traffic and are trapped under the LLDP trap, this trap was reconfigured as non-control, in sync with the PTP traps.
There is however no requirement that PTP traffic be handled as data. Besides, the usual encapsulation for PTP traffic is UDP, not bare Ethernet, and that is in deployments that even need PTP, which is far less common than LLDP. This is reflected by the default policer, which was not bumped up to the 19Kpps / 24Kpps that is the expected load of a PTP-enabled Spectrum-1 switch.
Marking of LLDP trap as non-control was therefore probably misguided. In this patch, change it back to control.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_trap.c +1 -1
@@ -864,7 +864,7 @@ static const struct mlxsw_sp_trap_item mlxsw_sp_trap_items_arr[] = { .trap = MLXSW_SP_TRAP_CONTROL(LLDP, LLDP, TRAP), .listeners_arr = {MLXSW_RXL (mlxsw_sp_rx_ptp_listener,LLDP ,TRAP_TO_CPU , - false, SP_LLDP, DISCARD), + true, SP_LLDP, DISCARD), }, }, {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 132/879 drm/amdgpu/psp: move PSP memory alloc from hw_init to sw_init
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
[ Upstream commit b95b5391684b39695887afb4a13cccee7820f5d6 ]
Memory allocations should be done in sw_init. hw_init should just be hardware programming needed to initialize the IP block. This is how most other IP blocks work. Move the GPU memory allocations from psp hw_init to psp sw_init and move the memory free to sw_fini. This also fixes a potential GPU memory leak if psp hw_init fails.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 95 ++++++++++++------------- 1 file changed, 47 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c +47 -48
@@ -357,7 +357,39 @@ static int psp_sw_init(void *handle) } } + ret =amdgpu_bo_create_kernel (adev,PSP_1_MEG ,PSP_1_MEG , +amdgpu_sriov_vf (adev) ? +AMDGPU_GEM_DOMAIN_VRAM :AMDGPU_GEM_DOMAIN_GTT , + &psp->fw_pri_bo, + &psp->fw_pri_mc_addr, + &psp->fw_pri_buf); +if (ret) +return ret; + + ret =amdgpu_bo_create_kernel (adev,PSP_FENCE_BUFFER_SIZE ,PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM , + &psp->fence_buf_bo, + &psp->fence_buf_mc_addr, + &psp->fence_buf); +if (ret) + goto failed1; + + ret =amdgpu_bo_create_kernel (adev,PSP_CMD_BUFFER_SIZE ,PAGE_SIZE , +AMDGPU_GEM_DOMAIN_VRAM , + &psp->cmd_buf_bo, &psp->cmd_buf_mc_addr, + (void **)&psp->cmd_buf_mem); +if (ret) + goto failed2; +return 0 ; + +failed2: +amdgpu_bo_free_kernel (&psp->fw_pri_bo, + &psp->fw_pri_mc_addr, &psp->fw_pri_buf); +failed1: +amdgpu_bo_free_kernel (&psp->fence_buf_bo, + &psp->fence_buf_mc_addr, &psp->fence_buf); +return ret; }static int psp_sw_fini (void *handle)
@@ -391,6 +423,13 @@ static int psp_sw_fini(void *handle)kfree (cmd); cmd =NULL ; +amdgpu_bo_free_kernel (&psp->fw_pri_bo, + &psp->fw_pri_mc_addr, &psp->fw_pri_buf); +amdgpu_bo_free_kernel (&psp->fence_buf_bo, + &psp->fence_buf_mc_addr, &psp->fence_buf); +amdgpu_bo_free_kernel (&psp->cmd_buf_bo, &psp->cmd_buf_mc_addr, + (void **)&psp->cmd_buf_mem); +return 0 ; }
@@ -2430,51 +2469,18 @@ static int psp_load_fw(struct amdgpu_device *adev)struct psp_context *psp = &adev->psp;if (amdgpu_sriov_vf (adev) &&amdgpu_in_reset (adev)) { -psp_ring_stop (psp,PSP_RING_TYPE__KM );/* should not destroy ring, only stop */ - goto skip_memalloc; - } - -if (amdgpu_sriov_vf (adev)) { - ret =amdgpu_bo_create_kernel (adev,PSP_1_MEG ,PSP_1_MEG , -AMDGPU_GEM_DOMAIN_VRAM , - &psp->fw_pri_bo, - &psp->fw_pri_mc_addr, - &psp->fw_pri_buf); +/* should not destroy ring, only stop */ +psp_ring_stop (psp,PSP_RING_TYPE__KM ); }else { - ret =amdgpu_bo_create_kernel (adev,PSP_1_MEG ,PSP_1_MEG , -AMDGPU_GEM_DOMAIN_GTT , - &psp->fw_pri_bo, - &psp->fw_pri_mc_addr, - &psp->fw_pri_buf); - } - -if (ret) - goto failed; - - ret =amdgpu_bo_create_kernel (adev,PSP_FENCE_BUFFER_SIZE ,PAGE_SIZE , -AMDGPU_GEM_DOMAIN_VRAM , - &psp->fence_buf_bo, - &psp->fence_buf_mc_addr, - &psp->fence_buf); -if (ret) - goto failed; - - ret =amdgpu_bo_create_kernel (adev,PSP_CMD_BUFFER_SIZE ,PAGE_SIZE , -AMDGPU_GEM_DOMAIN_VRAM , - &psp->cmd_buf_bo, &psp->cmd_buf_mc_addr, - (void **)&psp->cmd_buf_mem); -if (ret) - goto failed; +memset (psp->fence_buf,0 ,PSP_FENCE_BUFFER_SIZE ); -memset (psp->fence_buf,0 ,PSP_FENCE_BUFFER_SIZE ); - - ret =psp_ring_init (psp,PSP_RING_TYPE__KM ); -if (ret) { -DRM_ERROR ("PSP ring init failed!\n" ); - goto failed; + ret =psp_ring_init (psp,PSP_RING_TYPE__KM ); +if (ret) { +DRM_ERROR ("PSP ring init failed!\n" ); + goto failed; + } } -skip_memalloc: ret =psp_hw_start (psp);if (ret) goto failed;
@@ -2592,13 +2598,6 @@ static int psp_hw_fini(void *handle)psp_tmr_terminate (psp);psp_ring_destroy (psp,PSP_RING_TYPE__KM ); -amdgpu_bo_free_kernel (&psp->fw_pri_bo, - &psp->fw_pri_mc_addr, &psp->fw_pri_buf); -amdgpu_bo_free_kernel (&psp->fence_buf_bo, - &psp->fence_buf_mc_addr, &psp->fence_buf); -amdgpu_bo_free_kernel (&psp->cmd_buf_bo, &psp->cmd_buf_mc_addr, - (void **)&psp->cmd_buf_mem); -return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 133/879 drm/amdgpu/ucode: Remove firmware load type check in amdgpu_ucode_free_bo
In reply to Greg Kroah-HartmanFrom: Alice Wong <[email protected]>
[ Upstream commit ab0cd4a9ae5b4679b714d8dbfedc0901fecdce9f ]
When psp_hw_init failed, it will set the load_type to AMDGPU_FW_LOAD_DIRECT. During amdgpu_device_ip_fini, amdgpu_ucode_free_bo checks that load_type is AMDGPU_FW_LOAD_DIRECT and skips deallocating fw_buf causing memory leak. Remove load_type check in amdgpu_ucode_free_bo.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ucode.c +1 -2
@@ -714,8 +714,7 @@ int amdgpu_ucode_create_bo(struct amdgpu_device *adev)void amdgpu_ucode_free_bo (struct amdgpu_device *adev) { -if (adev->firmware.load_type !=AMDGPU_FW_LOAD_DIRECT ) -amdgpu_bo_free_kernel (&adev->firmware.fw_buf, +amdgpu_bo_free_kernel (&adev->firmware.fw_buf, &adev->firmware.fw_buf_mc, &adev->firmware.fw_buf_ptr); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 134/879 regulator: mt6315: Enforce regulator-compatible, not name
In reply to Greg Kroah-HartmanFrom: Nícolas F. R. A. Prado <[email protected]>
[ Upstream commit 6d435a94ba5bb4f2ad381c0828fbae89c66b50fe ]
The MT6315 PMIC dt-binding should enforce that one of the valid regulator-compatible is set in each regulator node. However it was mistakenly matching against regulator-name instead.
Fix the typo. This not only fixes the compatible verification, but also lifts the regulator-name restriction, so that more meaningful names can be set for each platform.
--- .../devicetree/bindings/regulator/mt6315-regulator.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/regulator/mt6315-regulator.yaml +1 -1
@@ -31,7 +31,7 @@ properties: $ref: "regulator.yaml#" properties: - regulator-name: + regulator-compatible: pattern: "^vbuck[1-4]$" additionalProperties: false
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 135/879 ice: always check VF VSI pointer values
In reply to Greg Kroah-HartmanFrom: Jacob Keller <[email protected]>
[ Upstream commit baeb705fd6a7245cc1fa69ed991a9cffdf44a174 ]
The ice_get_vf_vsi function can return NULL in some cases, such as if handling messages during a reset where the VSI is being removed and recreated.
Several places throughout the driver do not bother to check whether this VSI pointer is valid. Static analysis tools maybe report issues because they detect paths where a potentially NULL pointer could be dereferenced.
Fix this by checking the return value of ice_get_vf_vsi everywhere.
--- drivers/net/ethernet/intel/ice/ice_devlink.c | 5 ++- drivers/net/ethernet/intel/ice/ice_repr.c | 7 +++- drivers/net/ethernet/intel/ice/ice_sriov.c | 32 +++++++++++++++++-- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 28 +++++++++++++++- drivers/net/ethernet/intel/ice/ice_virtchnl.c | 5 +++ .../ethernet/intel/ice/ice_virtchnl_fdir.c | 7 +++- 6 files changed, 77 insertions(+), 7 deletions(-)
drivers/net/ethernet/intel/ice/ice_devlink.c +4 -1
@@ -753,9 +753,12 @@ int ice_devlink_create_vf_port(struct ice_vf *vf) pf = vf->pf; dev =ice_pf_to_dev (pf); - vsi =ice_get_vf_vsi (vf); devlink_port = &vf->devlink_port; + vsi =ice_get_vf_vsi (vf); +if (!vsi) +return -EINVAL ; + attrs.flavour =DEVLINK_PORT_FLAVOUR_PCI_VF ; attrs.pci_vf.pf = pf->hw.bus.func; attrs.pci_vf.vf = vf->vf_id;
drivers/net/ethernet/intel/ice/ice_repr.c +6 -1
@@ -293,8 +293,13 @@ static int ice_repr_add(struct ice_vf *vf)struct ice_q_vector *q_vector;struct ice_netdev_priv *np;struct ice_repr *repr; +struct ice_vsi *vsi;int err; + vsi =ice_get_vf_vsi (vf); +if (!vsi) +return -EINVAL ; + repr =kzalloc (sizeof (*repr),GFP_KERNEL );if (!repr)return -ENOMEM ;
@@ -313,7 +318,7 @@ static int ice_repr_add(struct ice_vf *vf) goto err_alloc; } - repr->src_vsi =ice_get_vf_vsi (vf); + repr->src_vsi = vsi; repr->vf = vf; vf->repr = repr; np =netdev_priv (repr->netdev);
drivers/net/ethernet/intel/ice/ice_sriov.c +29 -3
@@ -46,7 +46,12 @@ static void ice_free_vf_entries(struct ice_pf *pf)*/ static void ice_vf_vsi_release (struct ice_vf *vf) { -ice_vsi_release (ice_get_vf_vsi (vf)); +struct ice_vsi *vsi =ice_get_vf_vsi (vf); + +if (WARN_ON (!vsi)) +return ; + +ice_vsi_release (vsi);ice_vf_invalidate_vsi (vf); }
@@ -104,6 +109,8 @@ static void ice_dis_vf_mappings(struct ice_vf *vf) hw = &pf->hw; vsi =ice_get_vf_vsi (vf); +if (WARN_ON (!vsi)) +return ; dev =ice_pf_to_dev (pf);wr32 (hw,VPINT_ALLOC (vf->vf_id),0 );
@@ -341,6 +348,9 @@ static void ice_ena_vf_q_mappings(struct ice_vf *vf, u16 max_txq, u16 max_rxq)struct ice_hw *hw = &vf->pf->hw;u32 reg; +if (WARN_ON (!vsi)) +return ; +/* set regardless of mapping mode */ wr32 (hw,VPLAN_TXQ_MAPENA (vf->vf_id),VPLAN_TXQ_MAPENA_TX_ENA_M );
@@ -386,6 +396,9 @@ static void ice_ena_vf_mappings(struct ice_vf *vf) {struct ice_vsi *vsi =ice_get_vf_vsi (vf); +if (WARN_ON (!vsi)) +return ; +ice_ena_vf_msix_mappings (vf);ice_ena_vf_q_mappings (vf, vsi->alloc_txq, vsi->alloc_rxq); }
@@ -1128,6 +1141,8 @@ static struct ice_vf *ice_get_vf_from_pfq(struct ice_pf *pf, u16 pfq)u16 rxq_idx; vsi =ice_get_vf_vsi (vf); +if (!vsi) +continue ;ice_for_each_rxq (vsi, rxq_idx)if (vsi->rxq_map[rxq_idx] == pfq) {
@@ -1521,8 +1536,15 @@ static int ice_calc_all_vfs_min_tx_rate(struct ice_pf *pf)static bool ice_min_tx_rate_oversubscribed (struct ice_vf *vf,int min_tx_rate) { -int link_speed_mbps =ice_get_link_speed_mbps (ice_get_vf_vsi (vf)); -int all_vfs_min_tx_rate =ice_calc_all_vfs_min_tx_rate (vf->pf); +struct ice_vsi *vsi =ice_get_vf_vsi (vf); +int all_vfs_min_tx_rate; +int link_speed_mbps; + +if (WARN_ON (!vsi)) +return false; + + link_speed_mbps =ice_get_link_speed_mbps (vsi); + all_vfs_min_tx_rate =ice_calc_all_vfs_min_tx_rate (vf->pf);/* this VF's previous rate is being overwritten */ all_vfs_min_tx_rate -= vf->min_tx_rate;
@@ -1566,6 +1588,10 @@ ice_set_vf_bw(struct net_device *netdev, int vf_id, int min_tx_rate, goto out_put_vf; vsi =ice_get_vf_vsi (vf); +if (!vsi) { + ret = -EINVAL ; + goto out_put_vf; + }/* when max_tx_rate is zero that means no max Tx rate limiting, so only * check if max_tx_rate is non-zero
drivers/net/ethernet/intel/ice/ice_vf_lib.c +27 -1
@@ -220,8 +220,10 @@ static void ice_vf_clear_counters(struct ice_vf *vf) {struct ice_vsi *vsi =ice_get_vf_vsi (vf); +if (vsi) + vsi->num_vlan =0 ; + vf->num_mac =0 ; - vsi->num_vlan =0 ;memset (&vf->mdd_tx_events,0 ,sizeof (vf->mdd_tx_events));memset (&vf->mdd_rx_events,0 ,sizeof (vf->mdd_rx_events)); }
@@ -251,6 +253,9 @@ static int ice_vf_rebuild_vsi(struct ice_vf *vf)struct ice_vsi *vsi =ice_get_vf_vsi (vf);struct ice_pf *pf = vf->pf; +if (WARN_ON (!vsi)) +return -EINVAL ; +if (ice_vsi_rebuild (vsi, true)) {dev_err (ice_pf_to_dev (pf),"failed to rebuild VF %d VSI\n" , vf->vf_id);
@@ -514,6 +519,10 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags)ice_trigger_vf_reset (vf, flags &ICE_VF_RESET_VFLR , false); vsi =ice_get_vf_vsi (vf); +if (WARN_ON (!vsi)) { + err = -EIO ; + goto out_unlock; + }ice_dis_vf_qs (vf);
@@ -572,6 +581,11 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags) vf->vf_ops->post_vsi_rebuild (vf); vsi =ice_get_vf_vsi (vf); +if (WARN_ON (!vsi)) { + err = -EINVAL ; + goto out_unlock; + } +ice_eswitch_update_repr (vsi);ice_eswitch_replay_vf_mac_rule (vf);
@@ -610,6 +624,9 @@ void ice_dis_vf_qs(struct ice_vf *vf) {struct ice_vsi *vsi =ice_get_vf_vsi (vf); +if (WARN_ON (!vsi)) +return ; +ice_vsi_stop_lan_tx_rings (vsi,ICE_NO_RESET , vf->vf_id);ice_vsi_stop_all_rx_rings (vsi);ice_set_vf_state_qs_dis (vf);
@@ -790,6 +807,9 @@ static int ice_vf_rebuild_host_mac_cfg(struct ice_vf *vf)u8 broadcast[ETH_ALEN ];int status; +if (WARN_ON (!vsi)) +return -EINVAL ; +if (ice_is_eswitch_mode_switchdev (vf->pf))return 0 ;
@@ -875,6 +895,9 @@ static int ice_vf_rebuild_host_tx_rate_cfg(struct ice_vf *vf)struct ice_vsi *vsi =ice_get_vf_vsi (vf);int err; +if (WARN_ON (!vsi)) +return -EINVAL ; +if (vf->min_tx_rate) { err =ice_set_min_bw_limit (vsi, (u64 )vf->min_tx_rate *1000 );if (err) {
@@ -938,6 +961,9 @@ void ice_vf_rebuild_host_cfg(struct ice_vf *vf)struct device *dev =ice_pf_to_dev (vf->pf);struct ice_vsi *vsi =ice_get_vf_vsi (vf); +if (WARN_ON (!vsi)) +return ; +ice_vf_set_host_trust_cfg (vf);if (ice_vf_rebuild_host_mac_cfg (vf))
drivers/net/ethernet/intel/ice/ice_virtchnl.c +5 -0
@@ -2392,6 +2392,11 @@ static int ice_vc_ena_vlan_stripping(struct ice_vf *vf) } vsi =ice_get_vf_vsi (vf); +if (!vsi) { + v_ret =VIRTCHNL_STATUS_ERR_PARAM ; + goto error_param; + } +if (vsi->inner_vlan_ops.ena_stripping (vsi,ETH_P_8021Q )) v_ret =VIRTCHNL_STATUS_ERR_PARAM ;
drivers/net/ethernet/intel/ice/ice_virtchnl_fdir.c +6 -1
@@ -1344,7 +1344,12 @@ static void ice_vf_fdir_dump_info(struct ice_vf *vf) pf = vf->pf; hw = &pf->hw; dev =ice_pf_to_dev (pf); - vf_vsi = pf->vsi[vf->lan_vsi_idx]; + vf_vsi =ice_get_vf_vsi (vf); +if (!vf_vsi) { +dev_dbg (dev,"VF %d: invalid VSI pointer\n" , vf->vf_id); +return ; + } + vsi_num =ice_get_hw_vsi_num (hw, vf_vsi->idx); fd_size =rd32 (hw,VSIQF_FD_SIZE (vsi_num));
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 136/879 HID: bigben: fix slab-out-of-bounds Write in bigben_probe
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
[ Upstream commit fc4ef9d5724973193bfa5ebed181dba6de3a56db ]
There is a slab-out-of-bounds Write bug in hid-bigbenff driver. The problem is the driver assumes the device must have an input but some malicious devices violate this assumption.
Fix this by checking hid_device's input is non-empty before its usage.
--- drivers/hid/hid-bigbenff.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/hid/hid-bigbenff.c +6 -0
@@ -347,6 +347,12 @@ static int bigben_probe(struct hid_device *hid, bigben->report =list_entry (report_list->next, struct hid_report, list); +if (list_empty (&hid->inputs)) { +hid_err (hid,"no inputs found\n" ); + error = -ENODEV ; + goto error_hw_stop; + } + hidinput = list_first_entry(&hid->inputs, struct hid_input, list);set_bit (FF_RUMBLE , hidinput->input->ffbit);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 137/879 drm/tegra: gem: Do not try to dereference ERR_PTR()
In reply to Greg Kroah-HartmanFrom: Thierry Reding <[email protected]>
[ Upstream commit cb7e1abc2c73633e1eefa168ab2dad6e838899c9 ]
When mapping the DMA-BUF attachment fails, map->sgt will be an ERR_PTR- encoded error code and the cleanup code would try to free that memory, which obviously would fail.
Zero out that pointer after extracting the error code when this happens so that kfree() can do the right thing.
--- drivers/gpu/drm/tegra/gem.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/tegra/gem.c +1 -0
@@ -88,6 +88,7 @@ static struct host1x_bo_mapping *tegra_bo_pin(struct device *dev, struct host1x_if (IS_ERR (map->sgt)) {dma_buf_detach (buf, map->attach); err =PTR_ERR (map->sgt); + map->sgt =NULL ; goto free; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 138/879 of: Support more than one crash kernel regions for kexec -s
In reply to Greg Kroah-HartmanFrom: Zhen Lei <[email protected]>
[ Upstream commit 8af6b91f58341325bf74ecb0389ddc0039091d84 ]
When "crashkernel=X,high" is used, there may be two crash regions:
high=crashk_res and low=crashk_low_res. But now the syscall kexec_file_load() only add crashk_res into "linux,usable-memory-range", this may cause the second kernel to have no available dma memory.
Fix it like kexec-tools does for option -c, add both 'high' and 'low' regions into the dtb.
--- drivers/of/kexec.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/of/kexec.c +9 -0
@@ -386,6 +386,15 @@ void *of_kexec_alloc_and_setup_fdt(const struct kimage *image, crashk_res.end - crashk_res.start + 1);if (ret) goto out; + +if (crashk_low_res.end) { + ret =fdt_appendprop_addrrange (fdt,0 , chosen_node, +"linux,usable-memory-range" , + crashk_low_res.start, + crashk_low_res.end - crashk_low_res.start +1 ); +if (ret) + goto out; + } }/* add bootargs */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 139/879 ASoC: tscs454: Add endianness flag in snd_soc_component_driver
In reply to Greg Kroah-HartmanFrom: Charles Keepax <[email protected]>
[ Upstream commit ff69ec96b87dccb3a29edef8cec5d4fefbbc2055 ]
The endianness flag is used on the CODEC side to specify an ambivalence to endian, typically because it is lost over the hardware link. This device receives audio over an I2S DAI and as such should have endianness applied.
A fixup is also required to use the width directly rather than relying on the format in hw_params, now both little and big endian would be supported. It is worth noting this changes the behaviour of S24_LE to use a word length of 24 rather than 32. This would appear to be a correction since the fact S24_LE is stored as 32 bits should not be presented over the bus.
--- sound/soc/codecs/tscs454.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/soc/codecs/tscs454.c +6 -6
@@ -3120,18 +3120,17 @@ static int set_aif_sample_format(struct snd_soc_component *component,unsigned int width;int ret; -switch (format) { -case SNDRV_PCM_FORMAT_S16_LE : +switch (snd_pcm_format_width (format)) { +case 16 : width =FV_WL_16 ;break ; -case SNDRV_PCM_FORMAT_S20_3LE : +case 20 : width =FV_WL_20 ;break ; -case SNDRV_PCM_FORMAT_S24_3LE : +case 24 : width =FV_WL_24 ;break ; -case SNDRV_PCM_FORMAT_S24_LE : -case SNDRV_PCM_FORMAT_S32_LE : +case 32 : width =FV_WL_32 ;break ;default :
@@ -3326,6 +3325,7 @@ static const struct snd_soc_component_driver soc_component_dev_tscs454 = { .num_dapm_routes = ARRAY_SIZE(tscs454_intercon), .controls = tscs454_snd_controls, .num_controls = ARRAY_SIZE(tscs454_snd_controls), + .endianness = 1, };#define TSCS454_RATES SNDRV_PCM_RATE_8000_96000
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 140/879 net/mlx5: Increase FW pre-init timeout for health recovery
In reply to Greg Kroah-HartmanFrom: Gavin Li <[email protected]>
[ Upstream commit 37ca95e62ee23fa6d2c2c64e3dc40b4a0c0146dc ]
Currently, health recovery will reload driver to recover it from fatal errors. During the driver's load process, it would wait for FW to set the pre-init bit for up to 120 seconds, beyond this threshold it would abort the load process. In some cases, such as a FW upgrade on the DPU, this timeout period is insufficient, and the user has no way to recover the host device.
To solve this issue, introduce a new FW pre-init timeout for health recovery, which is set to 2 hours.
The timeout for devlink reload and probe will use the original one because they are user triggered flows, and therefore should not have a significantly long timeout, during which the user command would hang.
--- .../net/ethernet/mellanox/mlx5/core/devlink.c | 4 ++-- .../ethernet/mellanox/mlx5/core/fw_reset.c | 2 +- .../ethernet/mellanox/mlx5/core/lib/tout.c | 1 + .../ethernet/mellanox/mlx5/core/lib/tout.h | 1 + .../net/ethernet/mellanox/mlx5/core/main.c | 23 +++++++++++-------- .../ethernet/mellanox/mlx5/core/mlx5_core.h | 2 +- 6 files changed, 20 insertions(+), 13 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/devlink.c +2 -2
@@ -178,13 +178,13 @@ static int mlx5_devlink_reload_up(struct devlink *devlink, enum devlink_reload_a *actions_performed =BIT (action);switch (action) {case DEVLINK_RELOAD_ACTION_DRIVER_REINIT : -return mlx5_load_one (dev); +return mlx5_load_one (dev, false);case DEVLINK_RELOAD_ACTION_FW_ACTIVATE :if (limit ==DEVLINK_RELOAD_LIMIT_NO_RESET )break ;/* On fw_activate action, also driver is reloaded and reinit performed */ *actions_performed |=BIT (DEVLINK_RELOAD_ACTION_DRIVER_REINIT ); -return mlx5_load_one (dev); +return mlx5_load_one (dev, false);default :/* Unsupported action should not get to this function */ WARN_ON (1 );
drivers/net/ethernet/mellanox/mlx5/core/fw_reset.c +1 -1
@@ -149,7 +149,7 @@ static void mlx5_fw_reset_complete_reload(struct mlx5_core_dev *dev)if (test_bit (MLX5_FW_RESET_FLAGS_PENDING_COMP , &fw_reset->reset_flags)) {complete (&fw_reset->done); }else { -mlx5_load_one (dev); +mlx5_load_one (dev, false);devlink_remote_reload_actions_performed (priv_to_devlink (dev),0 ,BIT (DEVLINK_RELOAD_ACTION_DRIVER_REINIT ) |BIT (DEVLINK_RELOAD_ACTION_FW_ACTIVATE ));
drivers/net/ethernet/mellanox/mlx5/core/lib/tout.c +1 -0
@@ -10,6 +10,7 @@ struct mlx5_timeouts {static const u32 tout_def_sw_val[MAX_TIMEOUT_TYPES ] = { [MLX5_TO_FW_PRE_INIT_TIMEOUT_MS ] =120000 , + [MLX5_TO_FW_PRE_INIT_ON_RECOVERY_TIMEOUT_MS ] =7200000 , [MLX5_TO_FW_PRE_INIT_WARN_MESSAGE_INTERVAL_MS ] =20000 , [MLX5_TO_FW_PRE_INIT_WAIT_MS ] =2 , [MLX5_TO_FW_INIT_MS ] =2000 ,
drivers/net/ethernet/mellanox/mlx5/core/lib/tout.h +1 -0
@@ -7,6 +7,7 @@enum mlx5_timeouts_types {/* pre init timeouts (not read from FW) */ MLX5_TO_FW_PRE_INIT_TIMEOUT_MS , +MLX5_TO_FW_PRE_INIT_ON_RECOVERY_TIMEOUT_MS ,MLX5_TO_FW_PRE_INIT_WARN_MESSAGE_INTERVAL_MS ,MLX5_TO_FW_PRE_INIT_WAIT_MS ,
drivers/net/ethernet/mellanox/mlx5/core/main.c +14 -9
@@ -1014,7 +1014,7 @@ static void mlx5_cleanup_once(struct mlx5_core_dev *dev)mlx5_devcom_unregister_device (dev->priv.devcom); } -static int mlx5_function_setup (struct mlx5_core_dev *dev,bool boot) +static int mlx5_function_setup (struct mlx5_core_dev *dev,u64 timeout) {int err;
@@ -1029,11 +1029,11 @@ static int mlx5_function_setup(struct mlx5_core_dev *dev, bool boot)/* wait for firmware to accept initialization segments configurations */ - err =wait_fw_init (dev,mlx5_tout_ms (dev,FW_PRE_INIT_TIMEOUT ), + err =wait_fw_init (dev, timeout,mlx5_tout_ms (dev,FW_PRE_INIT_WARN_MESSAGE_INTERVAL ));if (err) {mlx5_core_err (dev,"Firmware over %llu MS in pre-initializing state, aborting\n" , -mlx5_tout_ms (dev,FW_PRE_INIT_TIMEOUT )); + timeout);return err; }
@@ -1296,7 +1296,7 @@ int mlx5_init_one(struct mlx5_core_dev *dev)mutex_lock (&dev->intf_state_mutex); dev->state =MLX5_DEVICE_STATE_UP ; - err =mlx5_function_setup (dev, true); + err =mlx5_function_setup (dev,mlx5_tout_ms (dev,FW_PRE_INIT_TIMEOUT ));if (err) goto err_function;
@@ -1360,9 +1360,10 @@ void mlx5_uninit_one(struct mlx5_core_dev *dev)mutex_unlock (&dev->intf_state_mutex); } -int mlx5_load_one (struct mlx5_core_dev *dev) +int mlx5_load_one (struct mlx5_core_dev *dev,bool recovery) {int err =0 ; +u64 timeout;mutex_lock (&dev->intf_state_mutex);if (test_bit (MLX5_INTERFACE_STATE_UP , &dev->intf_state)) {
@@ -1372,7 +1373,11 @@ int mlx5_load_one(struct mlx5_core_dev *dev)/* remove any previous indication of internal error */ dev->state =MLX5_DEVICE_STATE_UP ; - err =mlx5_function_setup (dev, false); +if (recovery) + timeout =mlx5_tout_ms (dev,FW_PRE_INIT_ON_RECOVERY_TIMEOUT ); +else + timeout =mlx5_tout_ms (dev,FW_PRE_INIT_TIMEOUT ); + err =mlx5_function_setup (dev, timeout);if (err) goto err_function;
@@ -1746,7 +1751,7 @@ static void mlx5_pci_resume(struct pci_dev *pdev)mlx5_pci_trace (dev,"Enter, loading driver..\n" ); - err =mlx5_load_one (dev); + err =mlx5_load_one (dev, false);mlx5_pci_trace (dev,"Done, err = %d, device %s\n" , err, !err ?"recovered" :"Failed" );
@@ -1833,7 +1838,7 @@ static int mlx5_resume(struct pci_dev *pdev) {struct mlx5_core_dev *dev =pci_get_drvdata (pdev); -return mlx5_load_one (dev); +return mlx5_load_one (dev, false); }static const struct pci_device_id mlx5_core_pci_table[] = {
@@ -1878,7 +1883,7 @@ int mlx5_recover_device(struct mlx5_core_dev *dev)return -EIO ; } -return mlx5_load_one (dev); +return mlx5_load_one (dev, true); }static struct pci_driver mlx5_core_driver = {
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +1 -1
@@ -290,7 +290,7 @@ void mlx5_mdev_uninit(struct mlx5_core_dev *dev);int mlx5_init_one (struct mlx5_core_dev *dev);void mlx5_uninit_one (struct mlx5_core_dev *dev);void mlx5_unload_one (struct mlx5_core_dev *dev); -int mlx5_load_one (struct mlx5_core_dev *dev); +int mlx5_load_one (struct mlx5_core_dev *dev,bool recovery);int mlx5_vport_get_other_func_cap (struct mlx5_core_dev *dev,u16 function_id,void *out);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 141/879 ASoC: Intel: sof_ssp_amp: fix no DMIC BE Link on Chromebooks
In reply to Greg Kroah-HartmanFrom: Brent Lu <[email protected]>
[ Upstream commit d1c808765deb2bcd35d827402ed4d75d068aae18 ]
The SOF topology supports 2 BE Links(dmic01 and dmic16k) and each link supports up to four DMICs. However, Chromebook does not implement ACPI NHLT table so the mach->mach_params.dmic_num is always zero. We add a quirk so machine driver knows it's running on a Chromebook and need to create BE Links for DMIC.
--- sound/soc/intel/boards/sof_ssp_amp.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
sound/soc/intel/boards/sof_ssp_amp.c +14 -2
@@ -9,6 +9,7 @@#include <linux/acpi.h> #include <linux/delay.h> +#include <linux/dmi.h> #include <linux/module.h> #include <linux/platform_device.h> #include <sound/core.h>
@@ -78,6 +79,16 @@ struct sof_card_private {bool idisp_codec; }; +static const struct dmi_system_id chromebook_platforms[] = { + { + .ident ="Google Chromebooks" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Google" ), + } + }, + {}, +}; +static const struct snd_soc_dapm_widget sof_ssp_amp_dapm_widgets[] = {SND_SOC_DAPM_MIC ("SoC DMIC" ,NULL ), };
@@ -371,7 +382,7 @@ static int sof_ssp_amp_probe(struct platform_device *pdev)struct snd_soc_dai_link *dai_links;struct snd_soc_acpi_mach *mach;struct sof_card_private *ctx; -int dmic_be_num, hdmi_num =0 ; +int dmic_be_num =0 , hdmi_num =0 ;int ret, ssp_codec; ctx =devm_kzalloc (&pdev->dev,sizeof (*ctx),GFP_KERNEL );
@@ -383,7 +394,8 @@ static int sof_ssp_amp_probe(struct platform_device *pdev) mach = pdev->dev.platform_data; - dmic_be_num = mach->mach_params.dmic_num; +if (dmi_check_system (chromebook_platforms) || mach->mach_params.dmic_num >0 ) + dmic_be_num =2 ; ssp_codec = sof_ssp_amp_quirk &SOF_AMPLIFIER_SSP_MASK ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 142/879 scsi: hisi_sas: Undo RPM resume for failed notify phy event for v3 HW
In reply to Greg Kroah-HartmanFrom: Xiang Chen <[email protected]>
[ Upstream commit 9b5387fe5af38116b452259d87cd66594b6277c1 ]
If we fail to notify the phy up event then undo the RPM resume, as the phy up notify event handling pairs with that RPM resume.
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +8 -2
@@ -1563,9 +1563,15 @@ static irqreturn_t phy_up_v3_hw(int phy_no, struct hisi_hba *hisi_hba) phy->port_id = port_id; -/* Call pm_runtime_put_sync() with pairs in hisi_sas_phyup_pm_work() */ +/* +* Call pm_runtime_get_noresume() which pairs with +* hisi_sas_phyup_pm_work() -> pm_runtime_put_sync(). +* For failure call pm_runtime_put() as we are in a hardirq context. +*/ pm_runtime_get_noresume (dev); -hisi_sas_notify_phy_event (phy,HISI_PHYE_PHY_UP_PM ); + res =hisi_sas_notify_phy_event (phy,HISI_PHYE_PHY_UP_PM ); +if (!res) +pm_runtime_put (dev); res =IRQ_HANDLED ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 143/879 scsi: lpfc: Inhibit aborts if external loopback plug is inserted
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit ead76d4c09b89f4c8d632648026a476a5a34fde8 ]
After running a short external loopback test, when the external loopback is removed and a normal cable inserted that is directly connected to a target device, the system oops in the llpfc_set_rrq_active() routine.
When the loopback was inserted an FLOGI was transmit. As we're looped back, we receive the FLOGI request. The FLOGI is ABTS'd as we recognize the same wppn thus understand it's a loopback. However, as the ABTS sends address information the port is not set to (fffffe), the ABTS is dropped on the wire. A short 1 frame loopback test is run and completes before the ABTS times out. The looback is unplugged and the new cable plugged in, and the an FLOGI to the new device occurs and completes. Due to a mixup in ref counting the completion of the new FLOGI releases the fabric ndlp. Then the original ABTS completes and references the released ndlp generating the oops.
Correct by no-op'ing the ABTS when in loopback mode (it will be dropped anyway). Added a flag to track the mode to recognize when it should be no-op'd.
--- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_els.c | 12 ++++++++++++ drivers/scsi/lpfc/lpfc_hbadisc.c | 3 +++ drivers/scsi/lpfc/lpfc_sli.c | 8 +++++--- 4 files changed, 21 insertions(+), 3 deletions(-)
drivers/scsi/lpfc/lpfc.h +1 -0
@@ -1025,6 +1025,7 @@ struct lpfc_hba {#define LS_MDS_LINK_DOWN 0x8/* MDS Diagnostics Link Down */ #define LS_MDS_LOOPBACK 0x10/* MDS Diagnostics Link Up (Loopback) */ #define LS_CT_VEN_RPA 0x20/* Vendor RPA sent to switch */ +#define LS_EXTERNAL_LOOPBACK 0x40/* External loopback plug inserted */ uint32_t hba_flag;/* hba generic flags */ #define HBA_ERATT_HANDLED 0x1/* This flag is set when eratt handled */
drivers/scsi/lpfc/lpfc_els.c +12 -0
@@ -1387,6 +1387,9 @@ lpfc_issue_els_flogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, phba->hba_flag |= (HBA_FLOGI_ISSUED |HBA_FLOGI_OUTSTANDING ); +/* Clear external loopback plug detected flag */ + phba->link_flag &= ~LS_EXTERNAL_LOOPBACK ; +/* Check for a deferred FLOGI ACC condition */ if (phba->defer_flogi_acc_flag) {/* lookup ndlp for received FLOGI */
@@ -8182,6 +8185,9 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,uint32_t fc_flag =0 ;uint32_t port_state =0 ; +/* Clear external loopback plug detected flag */ + phba->link_flag &= ~LS_EXTERNAL_LOOPBACK ; + cmd = *lp++; sp = (struct serv_parm *) lp;
@@ -8233,6 +8239,12 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,return 1 ; } +/* External loopback plug insertion detected */ + phba->link_flag |=LS_EXTERNAL_LOOPBACK ; + +lpfc_printf_vlog (vport,KERN_INFO ,LOG_ELS |LOG_LIBDFC , +"1119 External Loopback plug detected\n" ); +/* abort the flogi coming back to ourselves * due to external loopback on the port. */
drivers/scsi/lpfc/lpfc_hbadisc.c +3 -0
@@ -1221,6 +1221,9 @@ lpfc_linkdown(struct lpfc_hba *phba) phba->defer_flogi_acc_flag = false; +/* Clear external loopback plug detected flag */ + phba->link_flag &= ~LS_EXTERNAL_LOOPBACK ; +spin_lock_irq (&phba->hbalock); phba->fcf.fcf_flag &= ~(FCF_AVAILABLE |FCF_SCAN_DONE );spin_unlock_irq (&phba->hbalock);
drivers/scsi/lpfc/lpfc_sli.c +5 -3
@@ -12202,7 +12202,8 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,if (phba->link_state <LPFC_LINK_UP || (phba->sli_rev ==LPFC_SLI_REV4 && - phba->sli4_hba.link_state.status ==LPFC_FC_LA_TYPE_LINK_DOWN )) + phba->sli4_hba.link_state.status ==LPFC_FC_LA_TYPE_LINK_DOWN ) || + (phba->link_flag &LS_EXTERNAL_LOOPBACK )) ia = true;else ia = false;
@@ -12661,7 +12662,8 @@ lpfc_sli_abort_taskmgmt(struct lpfc_vport *vport, struct lpfc_sli_ring *pring, ndlp = lpfc_cmd->rdata->pnode;if (lpfc_is_link_up (phba) && - (ndlp && ndlp->nlp_state ==NLP_STE_MAPPED_NODE )) + (ndlp && ndlp->nlp_state ==NLP_STE_MAPPED_NODE ) && + !(phba->link_flag &LS_EXTERNAL_LOOPBACK )) ia = false;else ia = true;
@@ -21126,7 +21128,7 @@ lpfc_sli4_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, abtswqe = &abtsiocb->wqe;memset (abtswqe,0 ,sizeof (*abtswqe)); -if (!lpfc_is_link_up (phba)) +if (!lpfc_is_link_up (phba) || (phba->link_flag &LS_EXTERNAL_LOOPBACK ))bf_set (abort_cmd_ia, &abtswqe->abort_cmd,1 );bf_set (abort_cmd_criteria, &abtswqe->abort_cmd,T_XRI_TAG ); abtswqe->abort_cmd.rsrvd5 =0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 144/879 scsi: lpfc: Alter FPIN stat accounting logic
In reply to Greg Kroah-HartmanFrom: James Smart <[email protected]>
[ Upstream commit e6f51041450282a8668af3a8fc5c7744e81a447c ]
When configuring CMF management based on signals instead of FPINs, FPIN alarm and warning statistics are not tracked.
Change the behavior so that FPIN alarms and warnings are always tracked regardless of the configured mode.
Similar changes are made in the CMF signal stat accounting logic. Upon receipt of a signal, only track signaled alarms and warnings. FPIN stats should not be incremented upon receipt of a signal.
--- drivers/scsi/lpfc/lpfc_els.c | 49 +++++++++++------------------------ drivers/scsi/lpfc/lpfc_init.c | 22 ++-------------- 2 files changed, 17 insertions(+), 54 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +15 -34
@@ -3877,9 +3877,6 @@ lpfc_least_capable_settings(struct lpfc_hba *phba, {u32 rsp_sig_cap =0 , drv_sig_cap =0 ;u32 rsp_sig_freq_cyc =0 , rsp_sig_freq_scale =0 ; -struct lpfc_cgn_info *cp; -u32 crc; -u16 sig_freq;/* Get rsp signal and frequency capabilities. */ rsp_sig_cap =be32_to_cpu (pcgd->xmt_signal_capability);
@@ -3935,25 +3932,7 @@ lpfc_least_capable_settings(struct lpfc_hba *phba, } } -if (!phba->cgn_i) -return ; - -/* Update signal frequency in congestion info buffer */ - cp = (struct lpfc_cgn_info *)phba->cgn_i->virt; - -/* Frequency (in ms) Signal Warning/Signal Congestion Notifications -* are received by the HBA -*/ - sig_freq = phba->cgn_sig_freq; - -if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ONLY ) - cp->cgn_warn_freq =cpu_to_le16 (sig_freq); -if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ALARM ) { - cp->cgn_alarm_freq =cpu_to_le16 (sig_freq); - cp->cgn_warn_freq =cpu_to_le16 (sig_freq); - } - crc =lpfc_cgn_calc_crc32 (cp,LPFC_CGN_INFO_SZ ,LPFC_CGN_CRC32_SEED ); - cp->cgn_info_crc =cpu_to_le32 (crc); +/* We are NOT recording signal frequency in congestion info buffer */ return ; out_no_support:
@@ -9971,11 +9950,14 @@ lpfc_els_rcv_fpin_cgn(struct lpfc_hba *phba, struct fc_tlv_desc *tlv)/* Take action here for an Alarm event */ if (phba->cmf_active_mode !=LPFC_CFG_OFF ) {if (phba->cgn_reg_fpin &LPFC_CGN_FPIN_ALARM ) { -/* Track of alarm cnt for cgn_info */ -atomic_inc (&phba->cgn_fabric_alarm_cnt);/* Track of alarm cnt for SYNC_WQE */ atomic_inc (&phba->cgn_sync_alarm_cnt); } +/* Track alarm cnt for cgn_info regardless +* of whether CMF is configured for Signals +* or FPINs. +*/ +atomic_inc (&phba->cgn_fabric_alarm_cnt); goto cleanup; }break ;
@@ -9983,11 +9965,14 @@ lpfc_els_rcv_fpin_cgn(struct lpfc_hba *phba, struct fc_tlv_desc *tlv)/* Take action here for a Warning event */ if (phba->cmf_active_mode !=LPFC_CFG_OFF ) {if (phba->cgn_reg_fpin &LPFC_CGN_FPIN_WARN ) { -/* Track of warning cnt for cgn_info */ -atomic_inc (&phba->cgn_fabric_warn_cnt);/* Track of warning cnt for SYNC_WQE */ atomic_inc (&phba->cgn_sync_warn_cnt); } +/* Track warning cnt and freq for cgn_info +* regardless of whether CMF is configured for +* Signals or FPINs. +*/ +atomic_inc (&phba->cgn_fabric_warn_cnt); cleanup:/* Save frequency in ms */ phba->cgn_fpin_frequency =
@@ -9996,14 +9981,10 @@ lpfc_els_rcv_fpin_cgn(struct lpfc_hba *phba, struct fc_tlv_desc *tlv)if (phba->cgn_i) { cp = (struct lpfc_cgn_info *) phba->cgn_i->virt; -if (phba->cgn_reg_fpin & -LPFC_CGN_FPIN_ALARM ) - cp->cgn_alarm_freq = -cpu_to_le16 (value); -if (phba->cgn_reg_fpin & -LPFC_CGN_FPIN_WARN ) - cp->cgn_warn_freq = -cpu_to_le16 (value); + cp->cgn_alarm_freq = +cpu_to_le16 (value); + cp->cgn_warn_freq = +cpu_to_le16 (value); crc = lpfc_cgn_calc_crc32 (cp, LPFC_CGN_INFO_SZ,
drivers/scsi/lpfc/lpfc_init.c +2 -20
@@ -5866,21 +5866,8 @@ lpfc_cgn_save_evt_cnt(struct lpfc_hba *phba)/* Use the frequency found in the last rcv'ed FPIN */ value = phba->cgn_fpin_frequency; -if (phba->cgn_reg_fpin &LPFC_CGN_FPIN_WARN ) - cp->cgn_warn_freq =cpu_to_le16 (value); -if (phba->cgn_reg_fpin &LPFC_CGN_FPIN_ALARM ) - cp->cgn_alarm_freq =cpu_to_le16 (value); - -/* Frequency (in ms) Signal Warning/Signal Congestion Notifications -* are received by the HBA -*/ - value = phba->cgn_sig_freq; - -if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ONLY || - phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ALARM ) - cp->cgn_warn_freq =cpu_to_le16 (value); -if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ALARM ) - cp->cgn_alarm_freq =cpu_to_le16 (value); + cp->cgn_warn_freq =cpu_to_le16 (value); + cp->cgn_alarm_freq =cpu_to_le16 (value); lvalue =lpfc_cgn_calc_crc32 (cp,LPFC_CGN_INFO_SZ ,LPFC_CGN_CRC32_SEED );
@@ -6595,9 +6582,6 @@ lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli)/* Alarm overrides warning, so check that first */ if (cgn_signal->alarm_cnt) {if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ALARM ) { -/* Keep track of alarm cnt for cgn_info */ -atomic_add (cgn_signal->alarm_cnt, - &phba->cgn_fabric_alarm_cnt);/* Keep track of alarm cnt for CMF_SYNC_WQE */ atomic_add (cgn_signal->alarm_cnt, &phba->cgn_sync_alarm_cnt);
@@ -6606,8 +6590,6 @@ lpfc_sli4_async_sli_evt(struct lpfc_hba *phba, struct lpfc_acqe_sli *acqe_sli)/* signal action needs to be taken */ if (phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ONLY || phba->cgn_reg_signal ==EDC_CG_SIG_WARN_ALARM ) { -/* Keep track of warning cnt for cgn_info */ -atomic_add (cnt, &phba->cgn_fabric_warn_cnt);/* Keep track of warning cnt for CMF_SYNC_WQE */ atomic_add (cnt, &phba->cgn_sync_warn_cnt); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 145/879 net: remove two BUG() from skb_checksum_help()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit d7ea0d9df2a6265b2b180d17ebc64b38105968fc ]
I have a syzbot report that managed to get a crash in skb_checksum_help()
If syzbot can trigger these BUG(), it makes sense to replace them with more friendly WARN_ON_ONCE() since skb_checksum_help() can instead return an error code.
Note that syzbot will still crash there, until real bug is fixed.
--- net/core/dev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
net/core/dev.c +6 -2
@@ -3215,11 +3215,15 @@ int skb_checksum_help(struct sk_buff *skb) } offset =skb_checksum_start_offset (skb); -BUG_ON (offset >=skb_headlen (skb)); + ret = -EINVAL ; +if (WARN_ON_ONCE (offset >=skb_headlen (skb))) + goto out; + csum =skb_checksum (skb, offset, skb->len - offset,0 ); offset += skb->csum_offset; -BUG_ON (offset +sizeof (__sum16) >skb_headlen (skb)); +if (WARN_ON_ONCE (offset +sizeof (__sum16) >skb_headlen (skb))) + goto out; ret =skb_ensure_writable (skb, offset +sizeof (__sum16));if (ret)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 146/879 s390/preempt: disable __preempt_count_add() optimization for PROFILE_ALL_BRANCHES
In reply to Greg Kroah-HartmanFrom: Heiko Carstens <[email protected]>
[ Upstream commit 63678eecec57fc51b778be3da35a397931287170 ]
gcc 12 does not (always) optimize away code that should only be generated if parameters are constant and within in a certain range. This depends on various obscure kernel config options, however in particular PROFILE_ALL_BRANCHES can trigger this compile error:
In function ‘__atomic_add_const’,
inlined from ‘__preempt_count_add.part.0’ at ./arch/s390/include/asm/preempt.h:50:3:
./arch/s390/include/asm/atomic_ops.h:80:9: error: impossible constraint in ‘asm’
80 | asm volatile( \
| ^~~Workaround this by simply disabling the optimization for PROFILE_ALL_BRANCHES, since the kernel will be so slow, that this optimization won't matter at all.
--- arch/s390/include/asm/preempt.h | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
arch/s390/include/asm/preempt.h +11 -4
@@ -46,10 +46,17 @@ static inline bool test_preempt_need_resched(void)static inline void __preempt_count_add (int val) { -if (__builtin_constant_p (val) && (val >=-128 ) && (val <=127 )) -__atomic_add_const (val, &S390_lowcore.preempt_count); -else -__atomic_add (val, &S390_lowcore.preempt_count); +/* +* With some obscure config options and CONFIG_PROFILE_ALL_BRANCHES +* enabled, gcc 12 fails to handle __builtin_constant_p(). +*/ +if (!IS_ENABLED (CONFIG_PROFILE_ALL_BRANCHES )) { +if (__builtin_constant_p (val) && (val >=-128 ) && (val <=127 )) { +__atomic_add_const (val, &S390_lowcore.preempt_count); +return ; + } + } +__atomic_add (val, &S390_lowcore.preempt_count); }static inline void __preempt_count_sub (int val)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 147/879 perf/amd/ibs: Cascade pmu init functions return value
In reply to Greg Kroah-HartmanFrom: Ravi Bangoria <[email protected]>
[ Upstream commit 39b2ca75eec8a33e2ffdb8aa0c4840ec3e3b472c ]
IBS pmu initialization code ignores return value provided by callee functions. Fix it.
--- arch/x86/events/amd/ibs.c | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-)
arch/x86/events/amd/ibs.c +29 -8
@@ -759,9 +759,10 @@ static __init int perf_ibs_pmu_init(struct perf_ibs *perf_ibs, char *name)return ret; } -static __init void perf_event_ibs_init (void ) +static __init int perf_event_ibs_init (void ) {struct attribute **attr = ibs_op_format_attrs; +int ret;/* * Some chips fail to reset the fetch count when it is written; instead
@@ -773,7 +774,9 @@ static __init void perf_event_ibs_init(void)if (boot_cpu_data.x86 ==0x19 && boot_cpu_data.x86_model <0x10 ) perf_ibs_fetch.fetch_ignore_if_zero_rip =1 ; -perf_ibs_pmu_init (&perf_ibs_fetch,"ibs_fetch" ); + ret =perf_ibs_pmu_init (&perf_ibs_fetch,"ibs_fetch" ); +if (ret) +return ret;if (ibs_caps &IBS_CAPS_OPCNT ) { perf_ibs_op.config_mask |=IBS_OP_CNT_CTL ;
@@ -786,15 +789,35 @@ static __init void perf_event_ibs_init(void) perf_ibs_op.cnt_mask |= IBS_OP_MAX_CNT_EXT_MASK; } -perf_ibs_pmu_init (&perf_ibs_op,"ibs_op" ); + ret =perf_ibs_pmu_init (&perf_ibs_op,"ibs_op" ); +if (ret) + goto err_op; + + ret =register_nmi_handler (NMI_LOCAL , perf_ibs_nmi_handler,0 ,"perf_ibs" ); +if (ret) + goto err_nmi; -register_nmi_handler (NMI_LOCAL , perf_ibs_nmi_handler,0 ,"perf_ibs" );pr_info ("perf: AMD IBS detected (0x%08x)\n" , ibs_caps); +return 0 ; + +err_nmi: +perf_pmu_unregister (&perf_ibs_op.pmu); +free_percpu (perf_ibs_op.pcpu); + perf_ibs_op.pcpu =NULL ; +err_op: +perf_pmu_unregister (&perf_ibs_fetch.pmu); +free_percpu (perf_ibs_fetch.pcpu); + perf_ibs_fetch.pcpu =NULL ; + +return ret; }#else /* defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD) */ -static __init void perf_event_ibs_init (void ) { } +static __init int perf_event_ibs_init (void ) +{ +return 0 ; +}#endif
@@ -1064,9 +1087,7 @@ static __init int amd_ibs_init(void) x86_pmu_amd_ibs_starting_cpu, x86_pmu_amd_ibs_dying_cpu); -perf_event_ibs_init (); - -return 0 ; +return perf_event_ibs_init (); }/* Since we need the pci subsystem to init ibs we can't do this earlier: */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 148/879 sched/core: Avoid obvious double update_rq_clock warning
In reply to Greg Kroah-HartmanFrom: Hao Jia <[email protected]>
[ Upstream commit 2679a83731d51a744657f718fc02c3b077e47562 ]
When we use raw_spin_rq_lock() to acquire the rq lock and have to update the rq clock while holding the lock, the kernel may issue a WARN_DOUBLE_CLOCK warning.
Since we directly use raw_spin_rq_lock() to acquire rq lock instead of rq_lock(), there is no corresponding change to rq->clock_update_flags. In particular, we have obtained the rq lock of other CPUs, the rq->clock_update_flags of this CPU may be RQCF_UPDATED at this time, and then calling update_rq_clock() will trigger the WARN_DOUBLE_CLOCK warning.
So we need to clear RQCF_UPDATED of rq->clock_update_flags to avoid the WARN_DOUBLE_CLOCK warning.
For the sched_rt_period_timer() and migrate_task_rq_dl() cases we simply replace raw_spin_rq_lock()/raw_spin_rq_unlock() with rq_lock()/rq_unlock().
For the {pull,push}_{rt,dl}_task() cases, we add the double_rq_clock_clear_update() function to clear RQCF_UPDATED of rq->clock_update_flags, and call double_rq_clock_clear_update() before double_lock_balance()/double_rq_lock() returns to avoid the WARN_DOUBLE_CLOCK warning.
Some call trace reports:
Call Trace 1:
<IRQ> sched_rt_period_timer+0x10f/0x3a0 ? enqueue_top_rt_rq+0x110/0x110 __hrtimer_run_queues+0x1a9/0x490 hrtimer_interrupt+0x10b/0x240 __sysvec_apic_timer_interrupt+0x8a/0x250 sysvec_apic_timer_interrupt+0x9a/0xd0 </IRQ> <TASK> asm_sysvec_apic_timer_interrupt+0x12/0x20
Call Trace 2:
<TASK> activate_task+0x8b/0x110 push_rt_task.part.108+0x241/0x2c0 push_rt_tasks+0x15/0x30 finish_task_switch+0xaa/0x2e0 ? __switch_to+0x134/0x420 __schedule+0x343/0x8e0 ? hrtimer_start_range_ns+0x101/0x340 schedule+0x4e/0xb0 do_nanosleep+0x8e/0x160 hrtimer_nanosleep+0x89/0x120 ? hrtimer_init_sleeper+0x90/0x90 __x64_sys_nanosleep+0x96/0xd0 do_syscall_64+0x34/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
Call Trace 3:
<TASK> deactivate_task+0x93/0xe0 pull_rt_task+0x33e/0x400 balance_rt+0x7e/0x90 __schedule+0x62f/0x8e0 do_task_dead+0x3f/0x50 do_exit+0x7b8/0xbb0 do_group_exit+0x2d/0x90 get_signal+0x9df/0x9e0 ? preempt_count_add+0x56/0xa0 ? __remove_hrtimer+0x35/0x70 arch_do_signal_or_restart+0x36/0x720 ? nanosleep_copyout+0x39/0x50 ? do_nanosleep+0x131/0x160 ? audit_filter_inodes+0xf5/0x120 exit_to_user_mode_prepare+0x10f/0x1e0 syscall_exit_to_user_mode+0x17/0x30 do_syscall_64+0x40/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
Call Trace 4:
update_rq_clock+0x128/0x1a0 migrate_task_rq_dl+0xec/0x310 set_task_cpu+0x84/0x1e4 try_to_wake_up+0x1d8/0x5c0 wake_up_process+0x1c/0x30 hrtimer_wakeup+0x24/0x3c __hrtimer_run_queues+0x114/0x270 hrtimer_interrupt+0xe8/0x244 arch_timer_handler_phys+0x30/0x50 handle_percpu_devid_irq+0x88/0x140 generic_handle_domain_irq+0x40/0x60 gic_handle_irq+0x48/0xe0 call_on_irq_stack+0x2c/0x60 do_interrupt_handler+0x80/0x84
Steps to reproduce:
1. Enable CONFIG_SCHED_DEBUG when compiling the kernel
2. echo 1 > /sys/kernel/debug/clear_warn_once
echo "WARN_DOUBLE_CLOCK" > /sys/kernel/debug/sched/features echo "NO_RT_PUSH_IPI" > /sys/kernel/debug/sched/features
3. Run some rt/dl tasks that periodically work and sleep, e.g. Create 2*n rt or dl (90% running) tasks via rt-app (on a system with n CPUs), and Dietmar Eggemann reports Call Trace 4 when running on PREEMPT_RT kernel.
--- kernel/sched/core.c | 6 +++--- kernel/sched/deadline.c | 5 +++-- kernel/sched/rt.c | 5 +++-- kernel/sched/sched.h | 28 ++++++++++++++++++++++++---- 4 files changed, 33 insertions(+), 11 deletions(-)
kernel/sched/core.c +3 -3
@@ -610,10 +610,10 @@ void double_rq_lock(struct rq *rq1, struct rq *rq2)swap (rq1, rq2);raw_spin_rq_lock (rq1); -if (__rq_lockp (rq1) ==__rq_lockp (rq2)) -return ; +if (__rq_lockp (rq1) !=__rq_lockp (rq2)) +raw_spin_rq_lock_nested (rq2,SINGLE_DEPTH_NESTING ); - raw_spin_rq_lock_nested(rq2, SINGLE_DEPTH_NESTING); + double_rq_clock_clear_update(rq1, rq2); }#endif
kernel/sched/deadline.c +3 -2
@@ -1832,6 +1832,7 @@ select_task_rq_dl(struct task_struct *p, int cpu, int flags)static void migrate_task_rq_dl (struct task_struct *p,int new_cpu__maybe_unused ) { +struct rq_flags rf;struct rq *rq;if (READ_ONCE (p->__state) !=TASK_WAKING )
@@ -1843,7 +1844,7 @@ static void migrate_task_rq_dl(struct task_struct *p, int new_cpu __maybe_unused* from try_to_wake_up(). Hence, p->pi_lock is locked, but * rq->lock is not... So, lock it */ -raw_spin_rq_lock (rq); +rq_lock (rq, &rf);if (p->dl.dl_non_contending) {update_rq_clock (rq);sub_running_bw (&p->dl, &rq->dl);
@@ -1859,7 +1860,7 @@ static void migrate_task_rq_dl(struct task_struct *p, int new_cpu __maybe_unusedput_task_struct (p); }sub_rq_bw (&p->dl, &rq->dl); -raw_spin_rq_unlock (rq); +rq_unlock (rq, &rf); }static void check_preempt_equal_dl (struct rq *rq,struct task_struct *p)
kernel/sched/rt.c +3 -2
@@ -871,6 +871,7 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)int enqueue =0 ;struct rt_rq *rt_rq =sched_rt_period_rt_rq (rt_b, i);struct rq *rq =rq_of_rt_rq (rt_rq); +struct rq_flags rf;int skip;/*
@@ -885,7 +886,7 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)if (skip)continue ; -raw_spin_rq_lock (rq); +rq_lock (rq, &rf);update_rq_clock (rq);if (rt_rq->rt_time) {
@@ -923,7 +924,7 @@ static int do_sched_rt_period_timer(struct rt_bandwidth *rt_b, int overrun)if (enqueue)sched_rt_rq_enqueue (rt_rq); -raw_spin_rq_unlock (rq); +rq_unlock (rq, &rf); }if (!throttled && (!rt_bandwidth_enabled () || rt_b->rt_runtime ==RUNTIME_INF ))
kernel/sched/sched.h +24 -4
@@ -2478,6 +2478,24 @@ unsigned long arch_scale_freq_capacity(int cpu) }#endif +#ifdef CONFIG_SCHED_DEBUG +/* +* In double_lock_balance()/double_rq_lock(), we use raw_spin_rq_lock() to +* acquire rq lock instead of rq_lock(). So at the end of these two functions +* we need to call double_rq_clock_clear_update() to clear RQCF_UPDATED of +* rq->clock_update_flags to avoid the WARN_DOUBLE_CLOCK warning. +*/ +static inline void double_rq_clock_clear_update (struct rq *rq1,struct rq *rq2) +{ + rq1->clock_update_flags &= (RQCF_REQ_SKIP |RQCF_ACT_SKIP ); +/* rq1 == rq2 for !CONFIG_SMP, so just clear RQCF_UPDATED once. */ +#ifdef CONFIG_SMP + rq2->clock_update_flags &= (RQCF_REQ_SKIP |RQCF_ACT_SKIP ); +#endif +} +#else +static inline void double_rq_clock_clear_update (struct rq *rq1,struct rq *rq2) {} +#endif #ifdef CONFIG_SMP
@@ -2543,14 +2561,15 @@ static inline int _double_lock_balance(struct rq *this_rq, struct rq *busiest) __acquires(busiest->lock) __acquires(this_rq->lock) { -if (__rq_lockp (this_rq) ==__rq_lockp (busiest)) -return 0 ; - -if (likely (raw_spin_rq_trylock (busiest))) +if (__rq_lockp (this_rq) ==__rq_lockp (busiest) || +likely (raw_spin_rq_trylock (busiest))) { +double_rq_clock_clear_update (this_rq, busiest);return 0 ; + }if (rq_order_less (this_rq, busiest)) {raw_spin_rq_lock_nested (busiest,SINGLE_DEPTH_NESTING ); +double_rq_clock_clear_update (this_rq, busiest);return 0 ; }
@@ -2644,6 +2663,7 @@ static inline void double_rq_lock(struct rq *rq1, struct rq *rq2)BUG_ON (rq1 != rq2);raw_spin_rq_lock (rq1);__acquire (rq2->lock);/* Fake it out ;) */ +double_rq_clock_clear_update (rq1, rq2); }/*
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 149/879 spi: stm32-qspi: Fix wait_cmd timeout in APM mode
In reply to Greg Kroah-HartmanFrom: Patrice Chotard <[email protected]>
[ Upstream commit d83d89ea68b4726700fa87b22db075e4217e691c ]
In APM mode, TCF and TEF flags are not set. To avoid timeout in stm32_qspi_wait_cmd(), don't check if TCF/TEF are set.
--- drivers/spi/spi-stm32-qspi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/spi/spi-stm32-qspi.c +2 -1
@@ -308,7 +308,8 @@ static int stm32_qspi_wait_cmd(struct stm32_qspi *qspi,if (!op->data.nbytes) goto wait_nobusy; -if (readl_relaxed (qspi->io_base +QSPI_SR ) &SR_TCF ) +if ((readl_relaxed (qspi->io_base +QSPI_SR ) &SR_TCF ) || + qspi->fmode ==CCR_FMODE_APM ) goto out;reinit_completion (&qspi->data_completion);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 150/879 dma-debug: change allocation mode from GFP_NOWAIT to GFP_ATIOMIC
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
[ Upstream commit 84bc4f1dbbbb5f8aa68706a96711dccb28b518e5 ]
We observed the error "cacheline tracking ENOMEM, dma-debug disabled" during a light system load (copying some files). The reason for this error is that the dma_active_cacheline radix tree uses GFP_NOWAIT allocation - so it can't access the emergency memory reserves and it fails as soon as anybody reaches the watermark.
This patch changes GFP_NOWAIT to GFP_ATOMIC, so that it can access the emergency memory reserves.
--- kernel/dma/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/dma/debug.c +1 -1
@@ -448,7 +448,7 @@ void debug_dma_dump_mappings(struct device *dev)* other hand, consumes a single dma_debug_entry, but inserts 'nents' * entries into the tree. */ -static RADIX_TREE(dma_active_cacheline, GFP_NOWAIT); +static RADIX_TREE(dma_active_cacheline, GFP_ATOMIC);static DEFINE_SPINLOCK (radix_lock);#define ACTIVE_CACHELINE_MAX_OVERLAP ((1 << RADIX_TREE_MAX_TAGS) - 1)#define CACHELINE_PER_PAGE_SHIFT (PAGE_SHIFT - L1_CACHE_SHIFT)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 151/879 fs: hold writers when changing mounts idmapping
In reply to Greg Kroah-HartmanFrom: Christian Brauner <[email protected]>
[ Upstream commit e1bbcd277a53e08d619ffeec56c5c9287f2bf42f ]
Hold writers when changing a mount's idmapping to make it more robust.
The vfs layer takes care to retrieve the idmapping of a mount once ensuring that the idmapping used for vfs permission checking is identical to the idmapping passed down to the filesystem.
For ioctl codepaths the filesystem itself is responsible for taking the idmapping into account if they need to. While all filesystems with FS_ALLOW_IDMAP raised take the same precautions as the vfs we should enforce it explicitly by making sure there are no active writers on the relevant mount while changing the idmapping.
This is similar to turning a mount ro with the difference that in contrast to turning a mount ro changing the idmapping can only ever be done once while a mount can transition between ro and rw as much as it wants.
This is a minor user-visible change. But it is extremely unlikely to matter. The caller must've created a detached mount via OPEN_TREE_CLONE and then handed that O_PATH fd to another process or thread which then must've gotten a writable fd for that mount and started creating files in there while the caller is still changing mount properties. While not impossible it will be an extremely rare corner-case and should in general be considered a bug in the application. Consider making a mount MOUNT_ATTR_NOEXEC or MOUNT_ATTR_NODEV while allowing someone else to perform lookups or exec'ing in parallel by handing them a copy of the OPEN_TREE_CLONE fd or another fd beneath that mount.
--- fs/namespace.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/namespace.c +3 -2
@@ -4026,8 +4026,9 @@ static int can_idmap_mount(const struct mount_kattr *kattr, struct mount *mnt)static inline bool mnt_allow_writers (const struct mount_kattr *kattr,const struct mount *mnt) { -return !(kattr->attr_set &MNT_READONLY ) || - (mnt->mnt.mnt_flags &MNT_READONLY ); +return (!(kattr->attr_set &MNT_READONLY ) || + (mnt->mnt.mnt_flags &MNT_READONLY )) && + !kattr->mnt_userns; }static int mount_setattr_prepare (struct mount_kattr *kattr,struct mount *mnt)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 152/879 ASoC: SOF: amd: add missing platform_device_unregister in acp_pci_rn_probe
In reply to Greg Kroah-HartmanFrom: Zheng Bin <[email protected]>
[ Upstream commit cbcab8cd737c74c20195c31d647e19f7cb49c9b8 ]
acp_pci_rn_probe misses a call platform_device_unregister in error path, this patch fixes that.
--- sound/soc/sof/amd/pci-rn.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/sof/amd/pci-rn.c +1 -0
@@ -93,6 +93,7 @@ static int acp_pci_rn_probe(struct pci_dev *pci, const struct pci_device_id *pci res =devm_kzalloc (&pci->dev,sizeof (struct resource ) *ARRAY_SIZE (renoir_res),GFP_KERNEL );if (!res) {sof_pci_remove (pci); +platform_device_unregister (dmic_dev);return -ENOMEM ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 153/879 ACPI: PM: Block ASUS B1400CEAE from suspend to idle by default
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
[ Upstream commit d52848620de00cde4a3a5df908e231b8c8868250 ]
ASUS B1400CEAE fails to resume from suspend to idle by default. This was bisected back to commit df4f9bc4fb9c ("nvme-pci: add support for ACPI StorageD3Enable property") but this is a red herring to the problem.
Before this commit the system wasn't getting into deepest sleep state. Presumably this commit is allowing entry into deepest sleep state as advertised by firmware, but there are some other problems related to the wakeup.
As it is confirmed the system works properly with S3, set the default for this system to S3.
--- drivers/acpi/sleep.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/acpi/sleep.c +12 -0
@@ -373,6 +373,18 @@ static const struct dmi_system_id acpisleep_dmi_table[] __initconst = { DMI_MATCH(DMI_PRODUCT_NAME, "20GGA00L00"), }, }, +/* +* ASUS B1400CEAE hangs on resume from suspend (see +* https://bugzilla.kernel.org/show_bug.cgi?id=215742). +*/ + { + .callback = init_default_s3, + .ident = "ASUS B1400CEAE", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_NAME, "ASUS EXPERTBOOK B1400CEAE"), + }, + }, {}, };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 154/879 ipmi:ssif: Check for NULL msg when handling events and messages
In reply to Greg Kroah-HartmanFrom: Corey Minyard <[email protected]>
[ Upstream commit 7602b957e2404e5f98d9a40b68f1fd27f0028712 ]
Even though it's not possible to get into the SSIF_GETTING_MESSAGES and SSIF_GETTING_EVENTS states without a valid message in the msg field, it's probably best to be defensive here and check and print a log, since that means something else went wrong.
Also add a default clause to that switch statement to release the lock and print a log, in case the state variable gets messed up somehow.
--- drivers/char/ipmi/ipmi_ssif.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/char/ipmi/ipmi_ssif.c +23 -0
@@ -814,6 +814,14 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,break ;case SSIF_GETTING_EVENTS : +if (!msg) { +/* Should never happen, but just in case. */ +dev_warn (&ssif_info->client->dev, +"No message set while getting events\n" ); +ipmi_ssif_unlock_cond (ssif_info, flags); +break ; + } +if ((result <0 ) || (len <3 ) || (msg->rsp[2 ] !=0 )) {/* Error getting event, probably done. */ msg->done (msg);
@@ -838,6 +846,14 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,break ;case SSIF_GETTING_MESSAGES : +if (!msg) { +/* Should never happen, but just in case. */ +dev_warn (&ssif_info->client->dev, +"No message set while getting messages\n" ); +ipmi_ssif_unlock_cond (ssif_info, flags); +break ; + } +if ((result <0 ) || (len <3 ) || (msg->rsp[2 ] !=0 )) {/* Error getting event, probably done. */ msg->done (msg);
@@ -861,6 +877,13 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,deliver_recv_msg (ssif_info, msg); }break ; + +default : +/* Should never happen, but just in case. */ +dev_warn (&ssif_info->client->dev, +"Invalid state in message done handling: %d\n" , + ssif_info->ssif_state); +ipmi_ssif_unlock_cond (ssif_info, flags); } flags =ipmi_ssif_lock_cond (ssif_info, &oflags);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 155/879 ipmi: Add an intializer for ipmi_smi_msg struct
In reply to Greg Kroah-HartmanFrom: Corey Minyard <[email protected]>
[ Upstream commit 9824117dd964ecebf5d81990dbf21dfb56445049 ]
There was a "type" element added to this structure, but some static values were missed. The default value will be zero, which is correct, but create an initializer for the type and initialize the type properly in the initializer to avoid future issues.
--- drivers/char/ipmi/ipmi_poweroff.c | 4 +--- drivers/char/ipmi/ipmi_watchdog.c | 14 +++++--------- include/linux/ipmi_smi.h | 6 ++++++ 3 files changed, 12 insertions(+), 12 deletions(-)
drivers/char/ipmi/ipmi_poweroff.c +1 -3
@@ -94,9 +94,7 @@ static void dummy_recv_free(struct ipmi_recv_msg *msg) {atomic_dec (&dummy_count); } -static struct ipmi_smi_msg halt_smi_msg = { - .done = dummy_smi_free -}; +static struct ipmi_smi_msg halt_smi_msg =INIT_IPMI_SMI_MSG (dummy_smi_free);static struct ipmi_recv_msg halt_recv_msg = { .done = dummy_recv_free };
drivers/char/ipmi/ipmi_watchdog.c +5 -9
@@ -354,9 +354,7 @@ static void msg_free_recv(struct ipmi_recv_msg *msg)complete (&msg_wait); } } -static struct ipmi_smi_msg smi_msg = { - .done = msg_free_smi -}; +static struct ipmi_smi_msg smi_msg =INIT_IPMI_SMI_MSG (msg_free_smi);static struct ipmi_recv_msg recv_msg = { .done = msg_free_recv };
@@ -475,9 +473,8 @@ static void panic_recv_free(struct ipmi_recv_msg *msg)atomic_dec (&panic_done_count); } -static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg = { - .done = panic_smi_free -}; +static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg = +INIT_IPMI_SMI_MSG (panic_smi_free);static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg = { .done = panic_recv_free };
@@ -516,9 +513,8 @@ static void panic_halt_ipmi_heartbeat(void)atomic_sub (2 , &panic_done_count); } -static struct ipmi_smi_msg panic_halt_smi_msg = { - .done = panic_smi_free -}; +static struct ipmi_smi_msg panic_halt_smi_msg = +INIT_IPMI_SMI_MSG (panic_smi_free);static struct ipmi_recv_msg panic_halt_recv_msg = { .done = panic_recv_free };
include/linux/ipmi_smi.h +6 -0
@@ -125,6 +125,12 @@ struct ipmi_smi_msg {void (*done)(struct ipmi_smi_msg *msg); }; +#define INIT_IPMI_SMI_MSG (done_handler) \ +{ \ + .done = done_handler, \ + .type = IPMI_SMI_MSG_TYPE_NORMAL \ +} +struct ipmi_smi_handlers {struct module *owner;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 156/879 ipmi: Fix pr_fmt to avoid compilation issues
In reply to Greg Kroah-HartmanFrom: Corey Minyard <[email protected]>
[ Upstream commit 2ebaf18a0b7fb764bba6c806af99fe868cee93de ]
The was it was wouldn't work in some situations, simplify it. What was there was unnecessary complexity.
--- drivers/char/ipmi/ipmi_msghandler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/ipmi/ipmi_msghandler.c +2 -2
@@ -11,8 +11,8 @@* Copyright 2002 MontaVista Software Inc. */ -#define pr_fmt (fmt) "%s" fmt, "IPMI message handler: " -#define dev_fmt pr_fmt +#define pr_fmt (fmt) "IPMI message handler: " fmt +#define dev_fmt (fmt) pr_fmt(fmt)#include <linux/module.h> #include <linux/errno.h>
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 157/879 kunit: bail out of test filtering logic quicker if OOM
In reply to Greg Kroah-HartmanFrom: Daniel Latypov <[email protected]>
[ Upstream commit a02353f491622e49c7ddedc6a6dc4f1d6ed2150a ]
When filtering what tests to run (suites and/or cases) via kunit.filter_glob (e.g. kunit.py run <glob>), we allocate copies of suites.
These allocations can fail, and we largely don't handle that.
Note: realistically, this probably doesn't matter much. We're not allocating much memory and this happens early in boot, so if we can't do that, then there's likely far bigger problems.
This patch makes us immediately bail out from the top-level function (kunit_filter_suites) with -ENOMEM if any of the underlying kmalloc() calls return NULL.
Implementation note: we used to return NULL pointers from some functions to indicate either that all suites/tests were filtered out or there was an error allocating the new array.
We'll log a short error in this case and not run any tests or print a TAP header. From a kunit.py user's perspective, they'll get a message about missing/invalid TAP output and have to dig into the test.log to see it. Since hitting this error seems so unlikely, it's probably fine to not invent a way to plumb this error message more visibly.
See also: https://lore.kernel.org/linux-kselftest/[email protected]/
--- lib/kunit/executor.c | 27 ++++++++++++++++++++++----- lib/kunit/executor_test.c | 4 +++- 2 files changed, 25 insertions(+), 6 deletions(-)
lib/kunit/executor.c +22 -5
@@ -71,9 +71,13 @@ kunit_filter_tests(struct kunit_suite *const suite, const char *test_glob)/* Use memcpy to workaround copy->name being const. */ copy =kmalloc (sizeof (*copy),GFP_KERNEL ); +if (!copy) +return ERR_PTR (-ENOMEM );memcpy (copy, suite,sizeof (*copy)); filtered =kcalloc (n +1 ,sizeof (*filtered),GFP_KERNEL ); +if (!filtered) +return ERR_PTR (-ENOMEM ); n =0 ;kunit_suite_for_each_test_case (suite, test_case) {
@@ -106,14 +110,16 @@ kunit_filter_subsuite(struct kunit_suite * const * const subsuite, filtered =kmalloc_array (n +1 ,sizeof (*filtered),GFP_KERNEL );if (!filtered) -return NULL ; +return ERR_PTR (-ENOMEM ); n =0 ;for (i =0 ; subsuite[i] !=NULL ; ++i) {if (!glob_match (filter->suite_glob, subsuite[i]->name))continue ; filtered_suite =kunit_filter_tests (subsuite[i], filter->test_glob); -if (filtered_suite) +if (IS_ERR (filtered_suite)) +return ERR_CAST (filtered_suite); +else if (filtered_suite) filtered[n++] = filtered_suite; } filtered[n] =NULL ;
@@ -146,7 +152,8 @@ static void kunit_free_suite_set(struct suite_set suite_set) }static struct suite_set kunit_filter_suites (const struct suite_set *suite_set, -const char *filter_glob) +const char *filter_glob, +int *err) {int i;struct kunit_suite *const **copy, *const *filtered_subsuite;
@@ -166,6 +173,10 @@ static struct suite_set kunit_filter_suites(const struct suite_set *suite_set,for (i =0 ; i < max; ++i) { filtered_subsuite =kunit_filter_subsuite (suite_set->start[i], &filter); +if (IS_ERR (filtered_subsuite)) { + *err =PTR_ERR (filtered_subsuite); +return filtered; + }if (filtered_subsuite) *copy++ = filtered_subsuite; }
@@ -236,9 +247,15 @@ int kunit_run_all_tests(void) .start = __kunit_suites_start, .end = __kunit_suites_end, }; +int err; -if (filter_glob_param) - suite_set =kunit_filter_suites (&suite_set, filter_glob_param); +if (filter_glob_param) { + suite_set =kunit_filter_suites (&suite_set, filter_glob_param, &err); +if (err) { +pr_err ("kunit executor: error filtering suites: %d\n" , err); +return err; + } + }if (!action_param)kunit_exec_run_tests (&suite_set);
lib/kunit/executor_test.c +3 -1
@@ -137,14 +137,16 @@ static void filter_suites_test(struct kunit *test) .end = suites + 2, };struct suite_set filtered = {.start =NULL , .end =NULL }; +int err =0 ;/* Emulate two files, each having one suite */ subsuites[0 ][0 ] =alloc_fake_suite (test,"suite0" , dummy_test_cases); subsuites[1 ][0 ] =alloc_fake_suite (test,"suite1" , dummy_test_cases);/* Filter out suite1 */ - filtered =kunit_filter_suites (&suite_set,"suite0" ); + filtered =kunit_filter_suites (&suite_set,"suite0" , &err);kfree_subsuites_at_end (test, &filtered);/* let us use ASSERTs without leaking */ +KUNIT_EXPECT_EQ (test, err,0 );KUNIT_ASSERT_EQ (test, filtered.end - filtered.start, (ptrdiff_t )1 );KUNIT_ASSERT_NOT_ERR_OR_NULL (test, filtered.start);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 158/879 rtlwifi: Use pr_warn instead of WARN_ONCE
In reply to Greg Kroah-HartmanFrom: Dongliang Mu <[email protected]>
[ Upstream commit ad732da434a2936128769216eddaece3b1af4588 ]
This memory allocation failure can be triggered by fault injection or high pressure testing, resulting a WARN.
Fix this by replacing WARN with pr_warn.
--- drivers/net/wireless/realtek/rtlwifi/usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/realtek/rtlwifi/usb.c +1 -1
@@ -1014,7 +1014,7 @@ int rtl_usb_probe(struct usb_interface *intf, hw =ieee80211_alloc_hw (sizeof (struct rtl_priv ) +sizeof (struct rtl_usb_priv ), &rtl_ops);if (!hw) { -WARN_ONCE (true,"rtl_usb: ieee80211 alloc failed\n" ); +pr_warn ("rtl_usb: ieee80211 alloc failed\n" );return -ENOMEM ; } rtlpriv = hw->priv;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 159/879 mt76: mt7915: accept rx frames with non-standard VHT MCS10-11
In reply to Greg Kroah-HartmanFrom: Felix Fietkau <[email protected]>
[ Upstream commit 77045a3740fa3d2325293cf8623899532b39303e ]
The hardware receives them properly, they should not be dropped
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +1 -1
@@ -521,7 +521,7 @@ mt7915_mac_fill_rx_rate(struct mt7915_dev *dev, status->encoding =RX_ENC_VHT ;if (gi) status->enc_flags |=RX_ENC_FLAG_SHORT_GI ; -if (i >9 ) +if (i >11 )return -EINVAL ;break ;case MT_PHY_TYPE_HE_MU :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 160/879 mt76: mt7921: accept rx frames with non-standard VHT MCS10-11
In reply to Greg Kroah-HartmanFrom: Felix Fietkau <[email protected]>
[ Upstream commit 3128ea016965ce9f91ddf4e1dd944724462d1698 ]
The hardware receives them properly, they should not be dropped
--- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +1 -1
@@ -696,7 +696,7 @@ mt7921_mac_fill_rx(struct mt7921_dev *dev, struct sk_buff *skb) status->nss =FIELD_GET (MT_PRXV_NSTS , v0) +1 ; status->encoding =RX_ENC_VHT ; -if (i >9 ) +if (i >11 )return -EINVAL ;break ;case MT_PHY_TYPE_HE_MU :
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 161/879 mt76: fix encap offload ethernet type check
In reply to Greg Kroah-HartmanFrom: Felix Fietkau <[email protected]>
[ Upstream commit bc98e7fdd80d215b4b55eea001023231eb8ce12e ]
The driver needs to check if the format is 802.2 vs 802.3 in order to set a tx descriptor flag. skb->protocol can't be used, since it may not be properly initialized for packets coming in from a packet socket.
Fix misdetection by checking the ethertype from the skb data instead
--- drivers/net/wireless/mediatek/mt76/mt7915/mac.c | 4 +++- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mac.c +3 -1
@@ -1017,6 +1017,7 @@ mt7915_mac_write_txwi_8023(struct mt7915_dev *dev, __le32 *txwi,u8 tid = skb->priority &IEEE80211_QOS_CTL_TID_MASK ;u8 fc_type, fc_stype; +u16 ethertype;bool wmm = false;u32 val;
@@ -1030,7 +1031,8 @@ mt7915_mac_write_txwi_8023(struct mt7915_dev *dev, __le32 *txwi, val =FIELD_PREP (MT_TXD1_HDR_FORMAT ,MT_HDR_FORMAT_802_3 ) |FIELD_PREP (MT_TXD1_TID , tid); -if (be16_to_cpu (skb->protocol) >=ETH_P_802_3_MIN ) + ethertype =get_unaligned_be16 (&skb->data[12 ]); +if (ethertype >=ETH_P_802_3_MIN ) val |=MT_TXD1_ETH_802_3 ; txwi[1 ] |=cpu_to_le32 (val);
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +3 -1
@@ -814,6 +814,7 @@ mt7921_mac_write_txwi_8023(struct mt7921_dev *dev, __le32 *txwi, {u8 tid = skb->priority &IEEE80211_QOS_CTL_TID_MASK ;u8 fc_type, fc_stype; +u16 ethertype;bool wmm = false;u32 val;
@@ -827,7 +828,8 @@ mt7921_mac_write_txwi_8023(struct mt7921_dev *dev, __le32 *txwi, val =FIELD_PREP (MT_TXD1_HDR_FORMAT ,MT_HDR_FORMAT_802_3 ) |FIELD_PREP (MT_TXD1_TID , tid); -if (be16_to_cpu (skb->protocol) >=ETH_P_802_3_MIN ) + ethertype =get_unaligned_be16 (&skb->data[12 ]); +if (ethertype >=ETH_P_802_3_MIN ) val |=MT_TXD1_ETH_802_3 ; txwi[1 ] |=cpu_to_le32 (val);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 162/879 media: rga: fix possible memory leak in rga_probe
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
[ Upstream commit a71eb6025305192e646040cd76ccacb5bd48a1b5 ]
rga->m2m_dev needs to be freed when rga_probe fails.
--- drivers/media/platform/rockchip/rga/rga.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/media/platform/rockchip/rga/rga.c +4 -2
@@ -865,7 +865,7 @@ static int rga_probe(struct platform_device *pdev) ret =pm_runtime_resume_and_get (rga->dev);if (ret <0 ) - goto rel_vdev; + goto rel_m2m; rga->version.major = (rga_read (rga,RGA_VERSION_INFO ) >>24 ) &0xFF ; rga->version.minor = (rga_read (rga,RGA_VERSION_INFO ) >>20 ) &0x0F ;
@@ -881,7 +881,7 @@ static int rga_probe(struct platform_device *pdev) DMA_ATTR_WRITE_COMBINE);if (!rga->cmdbuf_virt) { ret = -ENOMEM ; - goto rel_vdev; + goto rel_m2m; } rga->src_mmu_pages =
@@ -918,6 +918,8 @@ static int rga_probe(struct platform_device *pdev) free_dma:dma_free_attrs (rga->dev,RGA_CMDBUF_SIZE , rga->cmdbuf_virt, rga->cmdbuf_phy,DMA_ATTR_WRITE_COMBINE ); +rel_m2m: +v4l2_m2m_release (rga->m2m_dev); rel_vdev:video_device_release (vfd); unreg_v4l2_dev:
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 163/879 media: coda: limit frame interval enumeration to supported encoder frame sizes
In reply to Greg Kroah-HartmanFrom: Philipp Zabel <[email protected]>
[ Upstream commit 67e33dd957880879e785cfea83a3aa24bd5c5577 ]
Let VIDIOC_ENUM_FRAMEINTERVALS return -EINVAL if userspace queries frame intervals for frame sizes unsupported by the encoder. Fixes the following v4l2-compliance failure:
fail: v4l2-test-formats.cpp(123): found frame intervals for invalid size 47x16
fail: v4l2-test-formats.cpp(282): node->codec_mask & STATEFUL_ENCODER
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: FAIL
[hverkuil: drop incorrect 'For decoder devices, return -ENOTTY.' in the commit log]
--- .../media/platform/chips-media/coda-common.c | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/media/platform/chips-media/coda-common.c +14 -6
@@ -1324,7 +1324,8 @@ static int coda_enum_frameintervals(struct file *file, void *fh, struct v4l2_frmivalenum *f) {struct coda_ctx *ctx =fh_to_ctx (fh); -int i; +struct coda_q_data *q_data; +const struct coda_codec *codec;if (f->index)return -EINVAL ;
@@ -1333,12 +1334,19 @@ static int coda_enum_frameintervals(struct file *file, void *fh,if (!ctx->vdoa && f->pixel_format ==V4L2_PIX_FMT_YUYV )return -EINVAL ; -for (i =0 ; i <CODA_MAX_FORMATS ; i++) { -if (f->pixel_format == ctx->cvd->src_formats[i] || - f->pixel_format == ctx->cvd->dst_formats[i]) -break ; +if (coda_format_normalize_yuv (f->pixel_format) ==V4L2_PIX_FMT_YUV420 ) { + q_data =get_q_data (ctx,V4L2_BUF_TYPE_VIDEO_CAPTURE ); + codec =coda_find_codec (ctx->dev, f->pixel_format, + q_data->fourcc); + }else { + codec =coda_find_codec (ctx->dev,V4L2_PIX_FMT_YUV420 , + f->pixel_format); } -if (i ==CODA_MAX_FORMATS ) +if (!codec) +return -EINVAL ; + +if (f->width <MIN_W || f->width > codec->max_w || + f->height <MIN_H || f->height > codec->max_h)return -EINVAL ; f->type =V4L2_FRMIVAL_TYPE_CONTINUOUS ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 164/879 media: hantro: HEVC: unconditionnaly set pps_{cb/cr}_qp_offset values
In reply to Greg Kroah-HartmanFrom: Benjamin Gaignard <[email protected]>
[ Upstream commit 46c836569196f377f87a3657b330cffaf94bd727 ]
Always set pps_cb_qp_offset and pps_cr_qp_offset values in Hantro/G2 register whatever is V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT flag value.
The vendor code does the same to set these values.
This fixes conformance test CAINIT_G_SHARP_3.
Fluster HEVC score is increase by one with this patch.
--- drivers/staging/media/hantro/hantro_g2_hevc_dec.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/staging/media/hantro/hantro_g2_hevc_dec.c +2 -7
@@ -180,13 +180,8 @@ static void set_params(struct hantro_ctx *ctx)hantro_reg_write (vpu, &g2_max_cu_qpd_depth,0 ); } -if (pps->flags &V4L2_HEVC_PPS_FLAG_PPS_SLICE_CHROMA_QP_OFFSETS_PRESENT ) { -hantro_reg_write (vpu, &g2_cb_qp_offset, pps->pps_cb_qp_offset); -hantro_reg_write (vpu, &g2_cr_qp_offset, pps->pps_cr_qp_offset); - }else { -hantro_reg_write (vpu, &g2_cb_qp_offset,0 ); -hantro_reg_write (vpu, &g2_cr_qp_offset,0 ); - } +hantro_reg_write (vpu, &g2_cb_qp_offset, pps->pps_cb_qp_offset); +hantro_reg_write (vpu, &g2_cr_qp_offset, pps->pps_cr_qp_offset);hantro_reg_write (vpu, &g2_filt_offset_beta, pps->pps_beta_offset_div2);hantro_reg_write (vpu, &g2_filt_offset_tc, pps->pps_tc_offset_div2);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 165/879 media: ccs-core.c: fix failure to call clk_disable_unprepare
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
[ Upstream commit eca89cf60b040ee2cae693ea72a0364284f3084c ]
Fixes smatch warning:
drivers/media/i2c/ccs/ccs-core.c:1676 ccs_power_on() warn: 'sensor->ext_clk' from clk_prepare_enable() not released on lines: 1606.
--- drivers/media/i2c/ccs/ccs-core.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/media/i2c/ccs/ccs-core.c +5 -2
@@ -1602,8 +1602,11 @@ static int ccs_power_on(struct device *dev)usleep_range (1000 ,2000 ); }while (--retry); -if (!reset) -return -EIO ; +if (!reset) { +dev_err (dev,"software reset failed\n" ); + rval = -EIO ; + goto out_cci_addr_fail; + } }if (sensor->hwcfg.i2c_addr_alt) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 166/879 media: imon: reorganize serialization
In reply to Greg Kroah-HartmanFrom: Tetsuo Handa <[email protected]>
[ Upstream commit db264d4c66c0fe007b5d19fd007707cd0697603d ]
Since usb_register_dev() from imon_init_display() from imon_probe() holds minor_rwsem while display_open() which holds driver_lock and ictx->lock is called with minor_rwsem held from usb_open(), holding driver_lock or ictx->lock when calling usb_register_dev() causes circular locking dependency problem.
Since usb_deregister_dev() from imon_disconnect() holds minor_rwsem while display_open() which holds driver_lock is called with minor_rwsem held, holding driver_lock when calling usb_deregister_dev() also causes circular locking dependency problem.
Sean Young explained that the problem is there are imon devices which have two usb interfaces, even though it is one device. The probe and disconnect function of both usb interfaces can run concurrently.
Alan Stern responded that the driver and USB cores guarantee that when an interface is probed, both the interface and its USB device are locked. Ditto for when the disconnect callback gets run. So concurrent probing/ disconnection of multiple interfaces on the same device is not possible.
Therefore, we don't need locks for handling race between imon_probe() and imon_disconnect(). But we still need to handle race between display_open() /vfd_write()/lcd_write()/display_close() and imon_disconnect(), for disconnect event can happen while file descriptors are in use.
Since "struct file"->private_data is set by display_open(), vfd_write()/ lcd_write()/display_close() can assume that "struct file"->private_data is not NULL even after usb_set_intfdata(interface, NULL) was called.
Replace insufficiently held driver_lock with refcount_t based management. Add a boolean flag for recording whether imon_disconnect() was already called. Use RCU for accessing this boolean flag and refcount_t.
Since the boolean flag for imon_disconnect() is shared, disconnect event on either intf0 or intf1 affects both interfaces. But I assume that this change does not matter, for usually disconnect event would not happen while interfaces are in use.
--- drivers/media/rc/imon.c | 99 +++++++++++++++++++---------------------- 1 file changed, 47 insertions(+), 52 deletions(-)
drivers/media/rc/imon.c +47 -52
@@ -153,6 +153,24 @@ struct imon_context {const struct imon_usb_dev_descr *dev_descr;/* device description with key */ /* table for front panels */ +/* +* Fields for deferring free_imon_context(). +* +* Since reference to "struct imon_context" is stored into +* "struct file"->private_data, we need to remember +* how many file descriptors might access this "struct imon_context". +*/ +refcount_t users; +/* +* Use a flag for telling display_open()/vfd_write()/lcd_write() that +* imon_disconnect() was already called. +*/ +bool disconnected; +/* +* We need to wait for RCU grace period in order to allow +* display_open() to safely check ->disconnected and increment ->users. +*/ +struct rcu_head rcu; };#define TOUCH_TIMEOUT (HZ/30)
@@ -160,18 +178,18 @@ struct imon_context {/* vfd character device file operations */ static const struct file_operations vfd_fops = { .owner =THIS_MODULE , - .open = &display_open, - .write = &vfd_write, - .release = &display_close, + .open = display_open, + .write = vfd_write, + .release = display_close, .llseek = noop_llseek, };/* lcd character device file operations */ static const struct file_operations lcd_fops = { .owner =THIS_MODULE , - .open = &display_open, - .write = &lcd_write, - .release = &display_close, + .open = display_open, + .write = lcd_write, + .release = display_close, .llseek = noop_llseek, };
@@ -439,9 +457,6 @@ static struct usb_driver imon_driver = { .id_table = imon_usb_id_table, }; -/* to prevent races between open() and disconnect(), probing, etc */ -static DEFINE_MUTEX (driver_lock); -/* Module bookkeeping bits */ MODULE_AUTHOR (MOD_AUTHOR );MODULE_DESCRIPTION (MOD_DESC );
@@ -481,9 +496,11 @@ static void free_imon_context(struct imon_context *ictx)struct device *dev = ictx->dev;usb_free_urb (ictx->tx_urb); +WARN_ON (ictx->dev_present_intf0);usb_free_urb (ictx->rx_urb_intf0); +WARN_ON (ictx->dev_present_intf1);usb_free_urb (ictx->rx_urb_intf1); -kfree (ictx); +kfree_rcu (ictx, rcu);dev_dbg (dev,"%s: iMON context freed\n" , __func__); }
@@ -499,9 +516,6 @@ static int display_open(struct inode *inode, struct file *file)int subminor;int retval =0 ; -/* prevent races with disconnect */ -mutex_lock (&driver_lock); - subminor =iminor (inode); interface =usb_find_interface (&imon_driver, subminor);if (!interface) {
@@ -509,13 +523,16 @@ static int display_open(struct inode *inode, struct file *file) retval = -ENODEV ; goto exit; } - ictx =usb_get_intfdata (interface); -if (!ictx) { +rcu_read_lock (); + ictx =usb_get_intfdata (interface); +if (!ictx || ictx->disconnected || !refcount_inc_not_zero (&ictx->users)) { +rcu_read_unlock ();pr_err ("no context found for minor %d\n" , subminor); retval = -ENODEV ; goto exit; } +rcu_read_unlock ();mutex_lock (&ictx->lock);
@@ -533,8 +550,10 @@ static int display_open(struct inode *inode, struct file *file)mutex_unlock (&ictx->lock); +if (retval &&refcount_dec_and_test (&ictx->users)) +free_imon_context (ictx); + exit: -mutex_unlock (&driver_lock);return retval; }
@@ -544,16 +563,9 @@ static int display_open(struct inode *inode, struct file *file)*/ static int display_close (struct inode *inode,struct file *file) { -struct imon_context *ictx =NULL ; +struct imon_context *ictx = file->private_data;int retval =0 ; - ictx = file->private_data; - -if (!ictx) { -pr_err ("no context for device\n" ); -return -ENODEV ; - } -mutex_lock (&ictx->lock);if (!ictx->display_supported) {
@@ -568,6 +580,8 @@ static int display_close(struct inode *inode, struct file *file) }mutex_unlock (&ictx->lock); +if (refcount_dec_and_test (&ictx->users)) +free_imon_context (ictx);return retval; }
@@ -934,15 +948,12 @@ static ssize_t vfd_write(struct file *file, const char __user *buf,int offset;int seq;int retval =0 ; -struct imon_context *ictx; +struct imon_context *ictx = file->private_data;static const unsigned char vfd_packet6[] = {0x01 ,0x00 ,0x00 ,0x00 ,0x00 ,0xFF ,0xFF }; - ictx = file->private_data; -if (!ictx) { -pr_err_ratelimited ("no context for device\n" ); +if (ictx->disconnected)return -ENODEV ; - }mutex_lock (&ictx->lock);
@@ -1018,13 +1029,10 @@ static ssize_t lcd_write(struct file *file, const char __user *buf, size_t n_bytes, loff_t *pos) { int retval = 0; -struct imon_context *ictx; +struct imon_context *ictx = file->private_data; - ictx = file->private_data; -if (!ictx) { -pr_err_ratelimited ("no context for device\n" ); +if (ictx->disconnected)return -ENODEV ; - }mutex_lock (&ictx->lock);
@@ -2404,7 +2412,6 @@ static int imon_probe(struct usb_interface *interface,int ifnum, sysfs_err;int ret =0 ;struct imon_context *ictx =NULL ; -struct imon_context *first_if_ctx =NULL ;u16 vendor, product; usbdev =usb_get_dev (interface_to_usbdev (interface));
@@ -2416,17 +2423,12 @@ static int imon_probe(struct usb_interface *interface,dev_dbg (dev,"%s: found iMON device (%04x:%04x, intf%d)\n" , __func__, vendor, product, ifnum); -/* prevent races probing devices w/multiple interfaces */ -mutex_lock (&driver_lock); - first_if =usb_ifnum_to_if (usbdev,0 );if (!first_if) { ret = -ENODEV ; goto fail; } - first_if_ctx =usb_get_intfdata (first_if); -if (ifnum ==0 ) { ictx =imon_init_intf0 (interface, id);if (!ictx) {
@@ -2434,9 +2436,11 @@ static int imon_probe(struct usb_interface *interface, ret = -ENODEV ; goto fail; } +refcount_set (&ictx->users,1 ); }else {/* this is the secondary interface on the device */ +struct imon_context *first_if_ctx =usb_get_intfdata (first_if);/* fail early if first intf failed to register */ if (!first_if_ctx) {
@@ -2450,14 +2454,13 @@ static int imon_probe(struct usb_interface *interface, ret = -ENODEV ; goto fail; } +refcount_inc (&ictx->users); }usb_set_intfdata (interface, ictx);if (ifnum ==0 ) { -mutex_lock (&ictx->lock); -if (product ==0xffdc && ictx->rf_device) { sysfs_err =sysfs_create_group (&interface->dev.kobj, &imon_rf_attr_group);
@@ -2468,21 +2471,17 @@ static int imon_probe(struct usb_interface *interface,if (ictx->display_supported)imon_init_display (ictx, interface); - -mutex_unlock (&ictx->lock); }dev_info (dev,"iMON device (%04x:%04x, intf%d) on usb<%d:%d> initialized\n" , vendor, product, ifnum, usbdev->bus->busnum, usbdev->devnum); -mutex_unlock (&driver_lock);usb_put_dev (usbdev);return 0 ; fail: -mutex_unlock (&driver_lock);usb_put_dev (usbdev);dev_err (dev,"unable to register, err %d\n" , ret);
@@ -2498,10 +2497,8 @@ static void imon_disconnect(struct usb_interface *interface)struct device *dev;int ifnum; -/* prevent races with multi-interface device probing and display_open */ -mutex_lock (&driver_lock); - ictx =usb_get_intfdata (interface); + ictx->disconnected = true; dev = ictx->dev; ifnum = interface->cur_altsetting->desc.bInterfaceNumber;
@@ -2542,11 +2539,9 @@ static void imon_disconnect(struct usb_interface *interface) } } -if (!ictx->dev_present_intf0 && !ictx->dev_present_intf1) +if (refcount_dec_and_test (&ictx->users))free_imon_context (ictx); -mutex_unlock (&driver_lock); -dev_dbg (dev,"%s: iMON device (intf%d) disconnected\n" , __func__, ifnum); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 167/879 media: cec-adap.c: fix is_configuring state
In reply to Greg Kroah-HartmanFrom: Hans Verkuil <[email protected]>
[ Upstream commit 59267fc34f4900dcd2ec3295f6be04b79aee2186 ]
If an adapter is trying to claim a free logical address then it is in the 'is_configuring' state. If during that process the cable is disconnected (HPD goes low, which in turn invalidates the physical address), then cec_adap_unconfigure() is called, and that set the is_configuring boolean to false, even though the thread that's trying to claim an LA is still running.
Don't touch the is_configuring bool in cec_adap_unconfigure(), it will eventually be cleared by the thread. By making that change the cec_config_log_addr() function also had to change: it was aborting if is_configuring became false (since that is what cec_adap_unconfigure() did), but that no longer works. Instead check if the physical address is invalid. That is a much more appropriate check anyway.
This fixes a bug where the the adapter could be disabled even though the device was still configuring. This could cause POLL transmits to time out.
--- drivers/media/cec/core/cec-adap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/cec/core/cec-adap.c +3 -3
@@ -1278,7 +1278,7 @@ static int cec_config_log_addr(struct cec_adapter *adap,* While trying to poll the physical address was reset * and the adapter was unconfigured, so bail out. */ -if (!adap->is_configuring) +if (adap->phys_addr ==CEC_PHYS_ADDR_INVALID )return -EINTR ;if (err)
@@ -1335,7 +1335,6 @@ static void cec_adap_unconfigure(struct cec_adapter *adap) adap->phys_addr != CEC_PHYS_ADDR_INVALID)WARN_ON (adap->ops->adap_log_addr (adap,CEC_LOG_ADDR_INVALID )); adap->log_addrs.log_addr_mask =0 ; - adap->is_configuring = false; adap->is_configured = false;cec_flush (adap);wake_up_interruptible (&adap->kthread_waitq);
@@ -1527,9 +1526,10 @@ static int cec_config_thread_func(void *arg)for (i =0 ; i < las->num_log_addrs; i++) las->log_addr[i] =CEC_LOG_ADDR_INVALID ;cec_adap_unconfigure (adap); + adap->is_configuring = false; adap->kthread_config =NULL ; -mutex_unlock (&adap->lock);complete (&adap->config_completion); +mutex_unlock (&adap->lock);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 168/879 usbnet: Run unregister_netdev() before unbind() again
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
[ Upstream commit d1408f6b4dd78fb1b9e26bcf64477984e5f85409 ]
Commit 2c9d6c2b871d ("usbnet: run unbind() before unregister_netdev()") sought to fix a use-after-free on disconnect of USB Ethernet adapters.
It turns out that a different fix is necessary to address the issue:
https://lore.kernel.org/netdev/18b3541e5372bc9b9fc733d422f4e698c089077c.1650177997.git.lukas@wunner.de/
So the commit was not necessary.
The commit made binding and unbinding of USB Ethernet asymmetrical:
Before, usbnet_probe() first invoked the ->bind() callback and then register_netdev(). usbnet_disconnect() mirrored that by first invoking unregister_netdev() and then ->unbind().
Since the commit, the order in usbnet_disconnect() is reversed and no longer mirrors usbnet_probe().
One consequence is that a PHY disconnected (and stopped) in ->unbind() is afterwards stopped once more by unregister_netdev() as it closes the netdev before unregistering. That necessitates a contortion in ->stop() because the PHY may only be stopped if it hasn't already been disconnected.
Reverting the commit allows making the call to phy_stop() unconditional in ->stop().
--- drivers/net/usb/asix_devices.c | 6 +----- drivers/net/usb/smsc95xx.c | 3 +-- drivers/net/usb/usbnet.c | 6 +++--- 3 files changed, 5 insertions(+), 10 deletions(-)
drivers/net/usb/asix_devices.c +1 -5
@@ -795,11 +795,7 @@ static int ax88772_stop(struct usbnet *dev) {struct asix_common_private *priv = dev->driver_priv; -/* On unplugged USB, we will get MDIO communication errors and the -* PHY will be set in to PHY_HALTED state. -*/ -if (priv->phydev->state !=PHY_HALTED ) -phy_stop (priv->phydev); +phy_stop (priv->phydev);return 0 ; }
drivers/net/usb/smsc95xx.c +1 -2
@@ -1243,8 +1243,7 @@ static int smsc95xx_start_phy(struct usbnet *dev)static int smsc95xx_stop (struct usbnet *dev) { -if (dev->net->phydev) -phy_stop (dev->net->phydev); +phy_stop (dev->net->phydev);return 0 ; }
drivers/net/usb/usbnet.c +3 -3
@@ -1616,9 +1616,6 @@ void usbnet_disconnect (struct usb_interface *intf) xdev->bus->bus_name, xdev->devpath, dev->driver_info->description); -if (dev->driver_info->unbind) - dev->driver_info->unbind (dev, intf); - net = dev->net;unregister_netdev (net);
@@ -1626,6 +1623,9 @@ void usbnet_disconnect (struct usb_interface *intf)usb_scuttle_anchored_urbs (&dev->deferred); +if (dev->driver_info->unbind) + dev->driver_info->unbind (dev, intf); +usb_kill_urb (dev->interrupt);usb_free_urb (dev->interrupt);kfree (dev->padding_pkt);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 169/879 Bluetooth: HCI: Add HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN quirk
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit 05abad857277dda198063017b00ba5b9fed2c0cb ]
This adds HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN quirk which can be used to mark HCI_Enhanced_Setup_Synchronous_Connection as broken even if its support command bit are set since some controller report it as supported but the command don't work properly with some configurations (e.g. BT_VOICE_TRANSPARENT/mSBC).
--- include/net/bluetooth/hci.h | 9 +++++++++ include/net/bluetooth/hci_core.h | 8 ++++++-- net/bluetooth/hci_conn.c | 2 +- net/bluetooth/sco.c | 2 +- 4 files changed, 17 insertions(+), 4 deletions(-)
include/net/bluetooth/hci.h +9 -0
@@ -265,6 +265,15 @@ enum {* runtime suspend, because event filtering takes place there. */ HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL , + +/* +* When this quirk is set, disables the use of +* HCI_OP_ENHANCED_SETUP_SYNC_CONN command to setup SCO connections. +* +* This quirk can be set before hci_register_dev is called or +* during the hdev->setup vendor callback. +*/ + HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN, };/* HCI device flags */
include/net/bluetooth/hci_core.h +6 -2
@@ -1495,8 +1495,12 @@ void hci_conn_del_sysfs(struct hci_conn *conn);#define privacy_mode_capable (dev) (use_ll_privacy(dev) && \ (hdev->commands[39] & 0x04)) -/* Use enhanced synchronous connection if command is supported */ -#define enhanced_sco_capable (dev) ((dev)->commands[29] & 0x08) +/* Use enhanced synchronous connection if command is supported and its quirk +* has not been set. +*/ +#define enhanced_sync_conn_capable (dev) \ + (((dev)->commands[29] & 0x08) && \ + !test_bit(HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN, &(dev)->quirks))/* Use ext scanning if set ext scan param and ext scan enable is supported */ #define use_ext_scan (dev) (((dev)->commands[37] & 0x20) && \
net/bluetooth/hci_conn.c +1 -1
@@ -481,7 +481,7 @@ static bool hci_setup_sync_conn(struct hci_conn *conn, __u16 handle)bool hci_setup_sync (struct hci_conn *conn,__u16 handle) { -if (enhanced_sco_capable (conn->hdev)) +if (enhanced_sync_conn_capable (conn->hdev))return hci_enhanced_setup_sync_conn (conn, handle);return hci_setup_sync_conn (conn, handle);
net/bluetooth/sco.c +1 -1
@@ -885,7 +885,7 @@ static int sco_sock_setsockopt(struct socket *sock, int level, int optname, err = -EBADFD ;break ; } -if (enhanced_sco_capable (hdev) && +if (enhanced_sync_conn_capable (hdev) && voice.setting ==BT_VOICE_TRANSPARENT )sco_pi (sk)->codec.id =BT_CODEC_TRANSPARENT ;hci_dev_put (hdev);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 170/879 Bluetooth: btusb: Set HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN for QCA
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
[ Upstream commit d44e1dbda36fff5d7c2586683c4adc0963aef908 ]
This sets HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN for QCA controllers since SCO appear to not work when using HCI_OP_ENHANCED_SETUP_SYNC_CONN.
--- drivers/bluetooth/btusb.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/bluetooth/btusb.c +5 -0
@@ -3335,6 +3335,11 @@ static int btusb_setup_qca(struct hci_dev *hdev)msleep (QCA_BT_RESET_WAIT_MS ); } +/* Mark HCI_OP_ENHANCED_SETUP_SYNC_CONN as broken as it doesn't seem to +* work with the likes of HSP/HFP mSBC. +*/ +set_bit (HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN , &hdev->quirks); +return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 171/879 Bluetooth: btusb: Set HCI_QUIRK_BROKEN_ERR_DATA_REPORTING for QCA
In reply to Greg Kroah-HartmanFrom: Zijun Hu <[email protected]>
[ Upstream commit 247f226adadfb7be09dd537f177429f4415aef8e ]
Set HCI_QUIRK_BROKEN_ERR_DATA_REPORTING for QCA controllers since they answer HCI_OP_READ_DEF_ERR_DATA_REPORTING with error code "UNKNOWN HCI COMMAND" as shown below:
[ 580.517552] Bluetooth: hci0: unexpected cc 0x0c5a length: 1 < 2 [ 580.517660] Bluetooth: hci0: Opcode 0x c5a failed: -38
hcitool -i hci0 cmd 0x03 0x5a
< HCI Command: ogf 0x03, ocf 0x005a, plen 0
Quoted 1 line
HCI Event:
0x0eplen 4
01 5A 0C 01
btmon log:
< HCI Command: Read Default Erroneous Data Reporting (0x03|0x005a) plen 0
Quoted 1 line
HCI Event: Command Complete (
0x0e) plen 4
Read Default Erroneous Data Reporting (0x03|0x005a) ncmd 1
Status: Unknown HCI Command (0x01)--- drivers/bluetooth/btusb.c | 1 + 1 file changed, 1 insertion(+)
drivers/bluetooth/btusb.c +1 -0
@@ -3339,6 +3339,7 @@ static int btusb_setup_qca(struct hci_dev *hdev)* work with the likes of HSP/HFP mSBC. */ set_bit (HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN , &hdev->quirks); +set_bit (HCI_QUIRK_BROKEN_ERR_DATA_REPORTING , &hdev->quirks);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 172/879 bnxt_en: Configure ptp filters during bnxt open
In reply to Greg Kroah-HartmanFrom: Pavan Chebbi <[email protected]>
[ Upstream commit 11862689e8f117e4702f55000790d7bce6859e84 ]
For correctness, we need to configure the packet filters for timestamping during bnxt_open. This way they are always configured after firmware reset or chip reset. We should not assume that the filters will always be retained across resets.
This patch modifies the ioctl handler and always configures the PTP filters in the bnxt_open() path.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 1 + drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 56 ++++++++++++++----- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h | 2 + 3 files changed, 46 insertions(+), 13 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -0
@@ -10363,6 +10363,7 @@ static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)if (BNXT_PF (bp))bnxt_vf_reps_open (bp);bnxt_ptp_init_rtc (bp, true); +bnxt_ptp_cfg_tstamp_filters (bp);return 0 ; open_err_irq:
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +43 -13
76 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h +2 -0
@@ -113,6 +113,7 @@ struct bnxt_ptp_cfg { BNXT_PTP_MSG_PDELAY_RESP) u8 tx_tstamp_en:1;int rx_filter; +u32 tstamp_filters;u32 refclk_regs[2 ];u32 refclk_mapped_regs[2 ];
@@ -133,6 +134,7 @@ do { \int bnxt_ptp_parse (struct sk_buff *skb,u16 *seq_id,u16 *hdr_off);void bnxt_ptp_update_current_time (struct bnxt *bp);void bnxt_ptp_pps_event (struct bnxt *bp,u32 data1,u32 data2); +void bnxt_ptp_cfg_tstamp_filters (struct bnxt *bp);void bnxt_ptp_reapply_pps (struct bnxt *bp);int bnxt_hwtstamp_set (struct net_device *dev,struct ifreq *ifr);int bnxt_hwtstamp_get (struct net_device *dev,struct ifreq *ifr);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 173/879 media: mediatek: vcodec: prevent kernel crash when rmmod mtk-vcodec-dec.ko
In reply to Greg Kroah-HartmanFrom: Yunfei Dong <[email protected]>
[ Upstream commit c10c0086db688c95bb4e0e378e523818dff1551d ]
If the driver support subdev mode, the parameter "dev->pm.dev" will be NULL in mtk_vcodec_dec_remove. Kernel will crash when try to rmmod mtk-vcodec-dec.ko.
[ 4380.702726] pc : do_raw_spin_trylock+0x4/0x80 [ 4380.707075] lr : _raw_spin_lock_irq+0x90/0x14c [ 4380.711509] sp : ffff80000819bc10 [ 4380.714811] x29: ffff80000819bc10 x28: ffff3600c03e4000 x27: 0000000000000000 [ 4380.721934] x26: 0000000000000000 x25: 0000000000000000 x24: 0000000000000000 [ 4380.729057] x23: ffff3600c0f34930 x22: ffffd5e923549000 x21: 0000000000000220 [ 4380.736179] x20: 0000000000000208 x19: ffffd5e9213e8ebc x18: 0000000000000020 [ 4380.743298] x17: 0000002000000000 x16: ffffd5e9213e8e90 x15: 696c346f65646976 [ 4380.750420] x14: 0000000000000000 x13: 0000000000000001 x12: 0000000000000040 [ 4380.757542] x11: 0000000000000000 x10: 0000000000000000 x9 : 0000000000000000 [ 4380.764664] x8 : 0000000000000000 x7 : ffff3600c7273ae8 x6 : ffffd5e9213e8ebc [ 4380.771786] x5 : 0000000000000000 x4 : 0000000000000001 x3 : 0000000000000000 [ 4380.778908] x2 : 0000000000000000 x1 : ffff3600c03e4000 x0 : 0000000000000208 [ 4380.786031] Call trace: [ 4380.788465] do_raw_spin_trylock+0x4/0x80 [ 4380.792462] __pm_runtime_disable+0x2c/0x1b0 [ 4380.796723] mtk_vcodec_dec_remove+0x5c/0xa0 [mtk_vcodec_dec] [ 4380.802466] platform_remove+0x2c/0x60 [ 4380.806204] __device_release_driver+0x194/0x250 [ 4380.810810] driver_detach+0xc8/0x15c [ 4380.814462] bus_remove_driver+0x5c/0xb0 [ 4380.818375] driver_unregister+0x34/0x64 [ 4380.822288] platform_driver_unregister+0x18/0x24 [ 4380.826979] mtk_vcodec_dec_driver_exit+0x1c/0x888 [mtk_vcodec_dec] [ 4380.833240] __arm64_sys_delete_module+0x190/0x224 [ 4380.838020] invoke_syscall+0x48/0x114 [ 4380.841760] el0_svc_common.constprop.0+0x60/0x11c [ 4380.846540] do_el0_svc+0x28/0x90 [ 4380.849844] el0_svc+0x4c/0x100 [ 4380.852975] el0t_64_sync_handler+0xec/0xf0 [ 4380.857148] el0t_64_sync+0x190/0x194 [ 4380.860801] Code: 94431515 17ffffca d503201f d503245f (b9400004)
--- drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +2 -1
@@ -487,7 +487,8 @@ static int mtk_vcodec_dec_remove(struct platform_device *pdev)video_unregister_device (dev->vfd_dec);v4l2_device_unregister (&dev->v4l2_dev); -pm_runtime_disable (dev->pm.dev); +if (!dev->vdec_pdata->is_subdev_supported) +pm_runtime_disable (dev->pm.dev);mtk_vcodec_fw_release (dev->fw_handler);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 174/879 openrisc: start CPU timer early in boot
In reply to Greg Kroah-HartmanFrom: Jason A. Donenfeld <[email protected]>
[ Upstream commit 516dd4aacd67a0f27da94f3fe63fe0f4dbab6e2b ]
In order to measure the boot process, the timer should be switched on as early in boot as possible. As well, the commit defines the get_cycles macro, like the previous patches in this series, so that generic code is aware that it's implemented by the platform, as is done on other archs.
--- arch/openrisc/include/asm/timex.h | 1 + arch/openrisc/kernel/head.S | 9 +++++++++ 2 files changed, 10 insertions(+)
arch/openrisc/include/asm/timex.h +1 -0
@@ -23,6 +23,7 @@ static inline cycles_t get_cycles(void) {return mfspr (SPR_TTCR ); } +#define get_cycles get_cycles/* This isn't really used any more */ #define CLOCK_TICK_RATE 1000
arch/openrisc/kernel/head.S +9 -0
@@ -521,6 +521,15 @@ _start: l.ori r3,r0,0x1 l.mtspr r0,r3,SPR_SR + /* + * Start the TTCR as early as possible, so that the RNG can make use of + * measurements of boot time from the earliest opportunity. Especially + * important is that the TTCR does not return zero by the time we reach + * rand_initialize(). + */ + l.movhi r3,hi(SPR_TTMR_CR) + l.mtspr r0,r3,SPR_TTMR + CLEAR_GPR(r1) CLEAR_GPR(r2) CLEAR_GPR(r3)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 175/879 nvme-pci: fix a NULL pointer dereference in nvme_alloc_admin_tags
In reply to Greg Kroah-HartmanFrom: Smith, Kyle Miller (Nimble Kernel) <[email protected]>
[ Upstream commit da42761181627e9bdc37d18368b827948a583929 ]
In nvme_alloc_admin_tags, the admin_q can be set to an error (typically -ENOMEM) if the blk_mq_init_queue call fails to set up the queue, which is checked immediately after the call. However, when we return the error message up the stack, to nvme_reset_work the error takes us to nvme_remove_dead_ctrl()
nvme_dev_disable()
nvme_suspend_queue(&dev->queues[0]).
Here, we only check that the admin_q is non-NULL, rather than not an error or NULL, and begin quiescing a queue that never existed, leading to bad / NULL pointer dereference.
--- drivers/nvme/host/pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/host/pci.c +1 -0
@@ -1775,6 +1775,7 @@ static int nvme_alloc_admin_tags(struct nvme_dev *dev) dev->ctrl.admin_q =blk_mq_init_queue (&dev->admin_tagset);if (IS_ERR (dev->ctrl.admin_q)) {blk_mq_free_tag_set (&dev->admin_tagset); + dev->ctrl.admin_q =NULL ;return -ENOMEM ; }if (!blk_get_queue (dev->ctrl.admin_q)) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 176/879 ASoC: rt5645: Fix errorenous cleanup order
In reply to Greg Kroah-HartmanFrom: Lin Ma <[email protected]>
[ Upstream commit 2def44d3aec59e38d2701c568d65540783f90f2f ]
There is a logic error when removing rt5645 device as the function rt5645_i2c_remove() first cancel the &rt5645->jack_detect_work and delete the &rt5645->btn_check_timer latter. However, since the timer handler rt5645_btn_check_callback() will re-queue the jack_detect_work, this cleanup order is buggy.
That is, once the del_timer_sync in rt5645_i2c_remove is concurrently run with the rt5645_btn_check_callback, the canceled jack_detect_work will be rescheduled again, leading to possible use-after-free.
This patch fix the issue by placing the del_timer_sync function before the cancel_delayed_work_sync.
--- sound/soc/codecs/rt5645.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
sound/soc/codecs/rt5645.c +6 -1
@@ -4154,9 +4154,14 @@ static int rt5645_i2c_remove(struct i2c_client *i2c)if (i2c->irq)free_irq (i2c->irq, rt5645); +/* +* Since the rt5645_btn_check_callback() can queue jack_detect_work, +* the timer need to be delted first +*/ +del_timer_sync (&rt5645->btn_check_timer); +cancel_delayed_work_sync (&rt5645->jack_detect_work);cancel_delayed_work_sync (&rt5645->rcclock_work); -del_timer_sync (&rt5645->btn_check_timer);regulator_bulk_disable (ARRAY_SIZE (rt5645->supplies), rt5645->supplies);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 177/879 nbd: Fix hung on disconnect request if socket is closed before
In reply to Greg Kroah-HartmanFrom: Xie Yongji <[email protected]>
[ Upstream commit 491bf8f236fdeec698fa6744993f1ecf3fafd1a5 ]
When userspace closes the socket before sending a disconnect request, the following I/O requests will be blocked in wait_for_reconnect() until dead timeout. This will cause the following disconnect request also hung on blk_mq_quiesce_queue(). That means we have no way to disconnect a nbd device if there are some I/O requests waiting for reconnecting until dead timeout. It's not expected. So let's wake up the thread waiting for reconnecting directly when a disconnect request is sent.
--- drivers/block/nbd.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/block/nbd.c +9 -4
@@ -947,11 +947,15 @@ static int wait_for_reconnect(struct nbd_device *nbd)struct nbd_config *config = nbd->config;if (!config->dead_conn_timeout)return 0 ; -if (test_bit (NBD_RT_DISCONNECTED , &config->runtime_flags)) + +if (!wait_event_timeout (config->conn_wait, +test_bit (NBD_RT_DISCONNECTED , + &config->runtime_flags) || +atomic_read (&config->live_connections) >0 , + config->dead_conn_timeout))return 0 ; -return wait_event_timeout (config->conn_wait, -atomic_read (&config->live_connections) >0 , - config->dead_conn_timeout) >0 ; + +return !test_bit (NBD_RT_DISCONNECTED , &config->runtime_flags); }static int nbd_handle_cmd (struct nbd_cmd *cmd,int index)
@@ -2082,6 +2086,7 @@ static void nbd_disconnect_and_put(struct nbd_device *nbd)mutex_lock (&nbd->config_lock);nbd_disconnect (nbd);sock_shutdown (nbd); +wake_up (&nbd->config->conn_wait);/* * Make sure recv thread has finished, we can safely call nbd_clear_que() * to cancel the inflight I/Os.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 178/879 drm/amd/pm: update smartshift powerboost calc for smu12
In reply to Greg Kroah-HartmanFrom: Sathishkumar S <[email protected]>
[ Upstream commit 138292f1dc00e7e0724f44769f9da39cf2f3bf0b ]
smartshift apu and dgpu power boost are reported as percentage with respect to their power limits. This value[0-100] reflects the boost for the respective device.
--- .../gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c | 60 ++++++++++++++----- 1 file changed, 44 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu12/renoir_ppt.c +44 -16
@@ -1119,6 +1119,39 @@ static int renoir_get_power_profile_mode(struct smu_context *smu,return size; } +static void renoir_get_ss_power_percent (SmuMetrics_t *metrics, +uint32_t *apu_percent,uint32_t *dgpu_percent) +{ +uint32_t apu_boost =0 ; +uint32_t dgpu_boost =0 ; +uint16_t apu_limit =0 ; +uint16_t dgpu_limit =0 ; +uint16_t apu_power =0 ; +uint16_t dgpu_power =0 ; + + apu_power = metrics->ApuPower; + apu_limit = metrics->StapmOriginalLimit; +if (apu_power > apu_limit && apu_limit !=0 ) + apu_boost = ((apu_power - apu_limit) *100 ) / apu_limit; + apu_boost = (apu_boost >100 ) ?100 : apu_boost; + + dgpu_power = metrics->dGpuPower; +if (metrics->StapmCurrentLimit > metrics->StapmOriginalLimit) + dgpu_limit = metrics->StapmCurrentLimit - metrics->StapmOriginalLimit; +if (dgpu_power > dgpu_limit && dgpu_limit !=0 ) + dgpu_boost = ((dgpu_power - dgpu_limit) *100 ) / dgpu_limit; + dgpu_boost = (dgpu_boost >100 ) ?100 : dgpu_boost; + +if (dgpu_boost >= apu_boost) + apu_boost =0 ; +else + dgpu_boost =0 ; + + *apu_percent = apu_boost; + *dgpu_percent = dgpu_boost; +} + +static int renoir_get_smu_metrics_data (struct smu_context *smu,MetricsMember_t member,uint32_t *value)
@@ -1127,6 +1160,9 @@ static int renoir_get_smu_metrics_data(struct smu_context *smu,SmuMetrics_t *metrics = (SmuMetrics_t *)smu_table->metrics_table;int ret =0 ; +uint32_t apu_percent =0 ; +uint32_t dgpu_percent =0 ; + ret = smu_cmn_get_metrics_table(smu, NULL,
@@ -1171,26 +1207,18 @@ static int renoir_get_smu_metrics_data(struct smu_context *smu, *value = metrics->Voltage[1 ];break ;case METRICS_SS_APU_SHARE : -/* return the percentage of APU power with respect to APU's power limit. -* percentage is reported, this isn't boost value. Smartshift power -* boost/shift is only when the percentage is more than 100. +/* return the percentage of APU power boost +* with respect to APU's power limit. */ -if (metrics->StapmOriginalLimit >0 ) - *value = (metrics->ApuPower *100 ) / metrics->StapmOriginalLimit; -else - *value =0 ; +renoir_get_ss_power_percent (metrics, &apu_percent, &dgpu_percent); + *value = apu_percent;break ;case METRICS_SS_DGPU_SHARE : -/* return the percentage of dGPU power with respect to dGPU's power limit. -* percentage is reported, this isn't boost value. Smartshift power -* boost/shift is only when the percentage is more than 100. +/* return the percentage of dGPU power boost +* with respect to dGPU's power limit. */ -if ((metrics->dGpuPower >0 ) && - (metrics->StapmCurrentLimit > metrics->StapmOriginalLimit)) - *value = (metrics->dGpuPower *100 ) / - (metrics->StapmCurrentLimit - metrics->StapmOriginalLimit); -else - *value =0 ; +renoir_get_ss_power_percent (metrics, &apu_percent, &dgpu_percent); + *value = dgpu_percent;break ;default : *value =UINT_MAX ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 179/879 drm/amd/pm: update smartshift powerboost calc for smu13
In reply to Greg Kroah-HartmanFrom: Sathishkumar S <[email protected]>
[ Upstream commit cdf4c8ec39872a61a58d62f19b4db80f0f7bc586 ]
smartshift apu and dgpu power boost are reported as percentage with respect to their power limits. adjust the units of power before calculating the percentage of boost.
--- .../drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c | 62 ++++++++++++++----- 1 file changed, 46 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/yellow_carp_ppt.c +46 -16
@@ -276,6 +276,42 @@ static int yellow_carp_mode2_reset(struct smu_context *smu)return yellow_carp_mode_reset (smu,SMU_RESET_MODE_2 ); } + +static void yellow_carp_get_ss_power_percent (SmuMetrics_t *metrics, +uint32_t *apu_percent,uint32_t *dgpu_percent) +{ +uint32_t apu_boost =0 ; +uint32_t dgpu_boost =0 ; +uint16_t apu_limit =0 ; +uint16_t dgpu_limit =0 ; +uint16_t apu_power =0 ; +uint16_t dgpu_power =0 ; + +/* APU and dGPU power values are reported in milli Watts +* and STAPM power limits are in Watts */ + apu_power = metrics->ApuPower/1000 ; + apu_limit = metrics->StapmOpnLimit; +if (apu_power > apu_limit && apu_limit !=0 ) + apu_boost = ((apu_power - apu_limit) *100 ) / apu_limit; + apu_boost = (apu_boost >100 ) ?100 : apu_boost; + + dgpu_power = metrics->dGpuPower/1000 ; +if (metrics->StapmCurrentLimit > metrics->StapmOpnLimit) + dgpu_limit = metrics->StapmCurrentLimit - metrics->StapmOpnLimit; +if (dgpu_power > dgpu_limit && dgpu_limit !=0 ) + dgpu_boost = ((dgpu_power - dgpu_limit) *100 ) / dgpu_limit; + dgpu_boost = (dgpu_boost >100 ) ?100 : dgpu_boost; + +if (dgpu_boost >= apu_boost) + apu_boost =0 ; +else + dgpu_boost =0 ; + + *apu_percent = apu_boost; + *dgpu_percent = dgpu_boost; + +} +static int yellow_carp_get_smu_metrics_data (struct smu_context *smu,MetricsMember_t member,uint32_t *value)
@@ -284,6 +320,8 @@ static int yellow_carp_get_smu_metrics_data(struct smu_context *smu,SmuMetrics_t *metrics = (SmuMetrics_t *)smu_table->metrics_table;int ret =0 ; +uint32_t apu_percent =0 ; +uint32_t dgpu_percent =0 ; ret =smu_cmn_get_metrics_table (smu,NULL , false);if (ret)
@@ -332,26 +370,18 @@ static int yellow_carp_get_smu_metrics_data(struct smu_context *smu, *value = metrics->Voltage[1 ];break ;case METRICS_SS_APU_SHARE : -/* return the percentage of APU power with respect to APU's power limit. -* percentage is reported, this isn't boost value. Smartshift power -* boost/shift is only when the percentage is more than 100. +/* return the percentage of APU power boost +* with respect to APU's power limit. */ -if (metrics->StapmOpnLimit >0 ) - *value = (metrics->ApuPower *100 ) / metrics->StapmOpnLimit; -else - *value =0 ; +yellow_carp_get_ss_power_percent (metrics, &apu_percent, &dgpu_percent); + *value = apu_percent;break ;case METRICS_SS_DGPU_SHARE : -/* return the percentage of dGPU power with respect to dGPU's power limit. -* percentage is reported, this isn't boost value. Smartshift power -* boost/shift is only when the percentage is more than 100. +/* return the percentage of dGPU power boost +* with respect to dGPU's power limit. */ -if ((metrics->dGpuPower >0 ) && - (metrics->StapmCurrentLimit > metrics->StapmOpnLimit)) - *value = (metrics->dGpuPower *100 ) / - (metrics->StapmCurrentLimit - metrics->StapmOpnLimit); -else - *value =0 ; +yellow_carp_get_ss_power_percent (metrics, &apu_percent, &dgpu_percent); + *value = dgpu_percent;break ;default : *value =UINT_MAX ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 180/879 drm/amdgpu: Move mutex_init(&smu->message_lock) to smu_early_init()
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 4b9caaa0281972ca5ea4e1cdac2e12b9df1ae00b ]
Lockdep complains about the smu->message_lock mutex being used before it is initialized through the following call path:
amdgpu_device_init()
amdgpu_dpm_mode2_reset()
smu_mode2_reset()
smu_v12_0_mode2_reset()
smu_cmn_send_smc_msg_with_param()
Move the mutex_init() call to smu_early_init() to fix the mutex being used before it is initialized.
This fixes the following lockdep splat:
[ 3.867331] ------------[ cut here ]------------ [ 3.867335] fbcon: Taking over console [ 3.867338] DEBUG_LOCKS_WARN_ON(lock->magic != lock) [ 3.867340] WARNING: CPU: 14 PID: 491 at kernel/locking/mutex.c:579 __mutex_lock+0x44c/0x830 [ 3.867349] Modules linked in: amdgpu(+) crct10dif_pclmul drm_ttm_helper crc32_pclmul ttm crc32c_intel ghash_clmulni_intel hid_lg_g15 iommu_v2 sp5100_tco nvme gpu_sched drm_dp_helper nvme_core ccp wmi video hid_logitech_dj ip6_tables ip_tables ipmi_devintf ipmi_msghandler fuse i2c_dev [ 3.867363] CPU: 14 PID: 491 Comm: systemd-udevd Tainted: G I 5.18.0-rc5+ #33 [ 3.867366] Hardware name: Micro-Star International Co., Ltd. MS-7C95/B550M PRO-VDH WIFI (MS-7C95), BIOS 2.90 12/23/2021 [ 3.867369] RIP: 0010:__mutex_lock+0x44c/0x830 [ 3.867372] Code: ff 85 c0 0f 84 33 fc ff ff 8b 0d b7 50 25 01 85 c9 0f 85 25 fc ff ff 48 c7 c6 fb 41 82 99 48 c7 c7 6b 63 80 99 e8 88 2a f8 ff <0f> 0b e9 0b fc ff ff f6 83 b9 0c 00 00 01 0f 85 64 ff ff ff 4c 89 [ 3.867377] RSP: 0018:ffffaef8c0fc79f0 EFLAGS: 00010286 [ 3.867380] RAX: 0000000000000028 RBX: 0000000000000000 RCX: 0000000000000027 [ 3.867382] RDX: ffff9ccc0dda0928 RSI: 0000000000000001 RDI: ffff9ccc0dda0920 [ 3.867384] RBP: ffffaef8c0fc7a80 R08: 0000000000000000 R09: ffffaef8c0fc7820 [ 3.867386] R10: 0000000000000003 R11: ffff9ccc2a2fffe8 R12: 0000000000000002 [ 3.867388] R13: ffff9cc990808058 R14: 0000000000000000 R15: ffff9cc98bfc0000 [ 3.867390] FS: 00007fc4d830f580(0000) GS:ffff9ccc0dd80000(0000) knlGS:0000000000000000 [ 3.867394] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 3.867396] CR2: 0000560a77031410 CR3: 000000010f522000 CR4: 0000000000750ee0 [ 3.867398] PKRU: 55555554 [ 3.867399] Call Trace: [ 3.867401] <TASK> [ 3.867403] ? smu_cmn_send_smc_msg_with_param+0x98/0x240 [amdgpu] [ 3.867533] ? __mutex_lock+0x90/0x830 [ 3.867535] ? amdgpu_dpm_mode2_reset+0x37/0x60 [amdgpu] [ 3.867653] ? smu_cmn_send_smc_msg_with_param+0x98/0x240 [amdgpu] [ 3.867758] smu_cmn_send_smc_msg_with_param+0x98/0x240 [amdgpu] [ 3.867857] smu_mode2_reset+0x2b/0x50 [amdgpu] [ 3.867953] amdgpu_dpm_mode2_reset+0x46/0x60 [amdgpu] [ 3.868096] amdgpu_device_init.cold+0x1069/0x1e78 [amdgpu] [ 3.868219] ? _raw_spin_unlock_irqrestore+0x30/0x50 [ 3.868222] ? pci_conf1_read+0x9b/0xf0 [ 3.868226] amdgpu_driver_load_kms+0x15/0x110 [amdgpu] [ 3.868314] amdgpu_pci_probe+0x1a9/0x3c0 [amdgpu] [ 3.868398] local_pci_probe+0x41/0x80 [ 3.868401] pci_device_probe+0xab/0x200 [ 3.868404] really_probe+0x1a1/0x370 [ 3.868407] __driver_probe_device+0xfc/0x170 [ 3.868410] driver_probe_device+0x1f/0x90 [ 3.868412] __driver_attach+0xbf/0x1a0 [ 3.868414] ? __device_attach_driver+0xe0/0xe0 [ 3.868416] bus_for_each_dev+0x65/0x90 [ 3.868419] bus_add_driver+0x151/0x1f0 [ 3.868421] driver_register+0x89/0xd0 [ 3.868423] ? 0xffffffffc0bd4000 [ 3.868425] do_one_initcall+0x5d/0x300 [ 3.868428] ? do_init_module+0x22/0x240 [ 3.868431] ? rcu_read_lock_sched_held+0x3c/0x70 [ 3.868434] ? trace_kmalloc+0x30/0xe0 [ 3.868437] ? kmem_cache_alloc_trace+0x1e6/0x3a0 [ 3.868440] do_init_module+0x4a/0x240 [ 3.868442] __do_sys_finit_module+0x93/0xf0 [ 3.868446] do_syscall_64+0x5b/0x80 [ 3.868449] ? rcu_read_lock_sched_held+0x3c/0x70 [ 3.868451] ? lockdep_hardirqs_on_prepare+0xd9/0x180 [ 3.868454] ? do_syscall_64+0x67/0x80 [ 3.868456] ? do_syscall_64+0x67/0x80 [ 3.868458] ? do_syscall_64+0x67/0x80 [ 3.868460] ? do_syscall_64+0x67/0x80 [ 3.868462] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 3.868465] RIP: 0033:0x7fc4d8ec1ced [ 3.868467] Code: 5d c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d fb 70 0e 00 f7 d8 64 89 01 48 [ 3.868472] RSP: 002b:00007fff687ae6b8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 [ 3.868475] RAX: ffffffffffffffda RBX: 0000560a76fbca60 RCX: 00007fc4d8ec1ced [ 3.868477] RDX: 0000000000000000 RSI: 00007fc4d902343c RDI: 0000000000000011 [ 3.868479] RBP: 00007fc4d902343c R08: 0000000000000000 R09: 0000560a76fb59c0 [ 3.868481] R10: 0000000000000011 R11: 0000000000000246 R12: 0000000000020000 [ 3.868484] R13: 0000560a76f8bfd0 R14: 0000000000000000 R15: 0000560a76fc2d10 [ 3.868487] </TASK> [ 3.868489] irq event stamp: 120617 [ 3.868490] hardirqs last enabled at (120617): [<ffffffff9817169e>] __up_console_sem+0x5e/0x70 [ 3.868494] hardirqs last disabled at (120616): [<ffffffff98171683>] __up_console_sem+0x43/0x70 [ 3.868497] softirqs last enabled at (119684): [<ffffffff980ee83a>] __irq_exit_rcu+0xca/0x100 [ 3.868501] softirqs last disabled at (119679): [<ffffffff980ee83a>] __irq_exit_rcu+0xca/0x100 [ 3.868504] ---[ end trace 0000000000000000 ]---
--- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +2 -2
@@ -576,6 +576,8 @@ static int smu_early_init(void *handle) smu->smu_baco.platform_support = false; smu->user_dpm_profile.fan_mode =-1 ; +mutex_init (&smu->message_lock); + adev->powerplay.pp_handle = smu; adev->powerplay.pp_funcs = &swsmu_pm_funcs;
@@ -975,8 +977,6 @@ static int smu_sw_init(void *handle)bitmap_zero (smu->smu_feature.supported,SMU_FEATURE_MAX );bitmap_zero (smu->smu_feature.allowed,SMU_FEATURE_MAX ); -mutex_init (&smu->message_lock); -INIT_WORK (&smu->throttling_logging_work, smu_throttling_logging_work_fn);INIT_WORK (&smu->interrupt_work, smu_interrupt_work_fn);atomic64_set (&smu->throttle_int_counter,0 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 181/879 btrfs: fix anon_dev leak in create_subvol()
In reply to Greg Kroah-HartmanFrom: Omar Sandoval <[email protected]>
[ Upstream commit 2256e901f5bddc56e24089c96f27b77da932dfcc ]
When btrfs_qgroup_inherit(), btrfs_alloc_tree_block, or btrfs_insert_root() fail in create_subvol(), we return without freeing anon_dev. Reorganize the error handling in create_subvol() to fix this.
--- fs/btrfs/ioctl.c | 49 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 26 deletions(-)
fs/btrfs/ioctl.c +23 -26
@@ -561,7 +561,7 @@ static noinline int create_subvol(struct user_namespace *mnt_userns,struct timespec64 cur_time =current_time (dir);struct inode *inode;int ret; -dev_t anon_dev =0 ; +dev_t anon_dev;u64 objectid;u64 index =0 ;
@@ -571,11 +571,7 @@ static noinline int create_subvol(struct user_namespace *mnt_userns, ret =btrfs_get_free_objectid (fs_info->tree_root, &objectid);if (ret) - goto fail_free; - - ret =get_anon_bdev (&anon_dev); -if (ret <0 ) - goto fail_free; + goto out_root_item;/* * Don't create subvolume whose level is not zero. Or qgroup will be
@@ -583,9 +579,13 @@ static noinline int create_subvol(struct user_namespace *mnt_userns,*/ if (btrfs_qgroup_level (objectid)) { ret = -ENOSPC ; - goto fail_free; + goto out_root_item; } + ret =get_anon_bdev (&anon_dev); +if (ret <0 ) + goto out_root_item; +btrfs_init_block_rsv (&block_rsv,BTRFS_BLOCK_RSV_TEMP );/* * The same as the snapshot creation, please see the comment
@@ -593,26 +593,26 @@ static noinline int create_subvol(struct user_namespace *mnt_userns,*/ ret =btrfs_subvolume_reserve_metadata (root, &block_rsv,8 , false);if (ret) - goto fail_free; + goto out_anon_dev; trans =btrfs_start_transaction (root,0 );if (IS_ERR (trans)) { ret =PTR_ERR (trans);btrfs_subvolume_release_metadata (root, &block_rsv); - goto fail_free; + goto out_anon_dev; } trans->block_rsv = &block_rsv; trans->bytes_reserved = block_rsv.size; ret =btrfs_qgroup_inherit (trans,0 , objectid, inherit);if (ret) - goto fail; + goto out; leaf =btrfs_alloc_tree_block (trans, root,0 , objectid,NULL ,0 ,0 ,0 ,BTRFS_NESTING_NORMAL );if (IS_ERR (leaf)) { ret =PTR_ERR (leaf); - goto fail; + goto out; }btrfs_mark_buffer_dirty (leaf);
@@ -667,7 +667,7 @@ static noinline int create_subvol(struct user_namespace *mnt_userns,btrfs_tree_unlock (leaf);btrfs_free_tree_block (trans, objectid, leaf,0 ,1 );free_extent_buffer (leaf); - goto fail; + goto out; }free_extent_buffer (leaf);
@@ -676,19 +676,18 @@ static noinline int create_subvol(struct user_namespace *mnt_userns, key.offset = (u64)-1 ; new_root =btrfs_get_new_fs_root (fs_info, objectid, anon_dev);if (IS_ERR (new_root)) { -free_anon_bdev (anon_dev); ret =PTR_ERR (new_root);btrfs_abort_transaction (trans, ret); - goto fail; + goto out; } -/* Freeing will be done in btrfs_put_root() of new_root */ +/* anon_dev is owned by new_root now. */ anon_dev =0 ; ret =btrfs_record_root_in_trans (trans, new_root);if (ret) {btrfs_put_root (new_root);btrfs_abort_transaction (trans, ret); - goto fail; + goto out; } ret =btrfs_create_subvol_root (trans, new_root, root, mnt_userns);
@@ -696,7 +695,7 @@ static noinline int create_subvol(struct user_namespace *mnt_userns,if (ret) {/* We potentially lose an unused inode item here */ btrfs_abort_transaction (trans, ret); - goto fail; + goto out; }/*
@@ -705,28 +704,28 @@ static noinline int create_subvol(struct user_namespace *mnt_userns, ret =btrfs_set_inode_index (BTRFS_I (dir), &index);if (ret) {btrfs_abort_transaction (trans, ret); - goto fail; + goto out; } ret =btrfs_insert_dir_item (trans, name, namelen,BTRFS_I (dir), &key,BTRFS_FT_DIR , index);if (ret) {btrfs_abort_transaction (trans, ret); - goto fail; + goto out; }btrfs_i_size_write (BTRFS_I (dir), dir->i_size + namelen *2 ); ret =btrfs_update_inode (trans, root,BTRFS_I (dir));if (ret) {btrfs_abort_transaction (trans, ret); - goto fail; + goto out; } ret =btrfs_add_root_ref (trans, objectid, root->root_key.objectid,btrfs_ino (BTRFS_I (dir)), index, name, namelen);if (ret) {btrfs_abort_transaction (trans, ret); - goto fail; + goto out; } ret = btrfs_uuid_tree_add(trans, root_item->uuid,
@@ -734,8 +733,7 @@ static noinline int create_subvol(struct user_namespace *mnt_userns,if (ret)btrfs_abort_transaction (trans, ret); -fail: -kfree (root_item); +out: trans->block_rsv =NULL ; trans->bytes_reserved =0 ;btrfs_subvolume_release_metadata (root, &block_rsv);
@@ -751,11 +749,10 @@ static noinline int create_subvol(struct user_namespace *mnt_userns,return PTR_ERR (inode);d_instantiate (dentry, inode); } -return ret; - -fail_free: +out_anon_dev:if (anon_dev)free_anon_bdev (anon_dev); +out_root_item:kfree (root_item);return ret; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 182/879 kunit: tool: make parser stop overwriting status of suites w/ no_tests
In reply to Greg Kroah-HartmanFrom: Daniel Latypov <[email protected]>
[ Upstream commit dbf0b0d53a2b5afa6ef7372dcedf52302669fc2c ]
Consider this invocation
$ ./tools/testing/kunit/kunit.py parse <<EOF
TAP version 14
1..2
ok 1 - suite
# Subtest: no_tests_suite
# catastrophic error!
not ok 1 - no_tests_suite
EOFIt will have a 0 exit code even though there's a "not ok".
Consider this one:
$ ./tools/testing/kunit/kunit.py parse <<EOF TAP version 14 1..2 ok 1 - suite not ok 1 - no_tests_suite EOF
It will a non-zero exit code.
Why?
We have this line in the kunit_parser.py
Quoted 1 line
parent_test=parse_test_header(lines, test)
where we have special handling when we see "# Subtest" and we ignore the explicit reported "not ok 1" status!
Also, NO_TESTS at a suite-level only results in a non-zero status code where then there's only one suite atm.
This change is the minimal one to make sure we don't overwrite it.
--- tools/testing/kunit/kunit_parser.py | 7 +++++-- .../test_data/test_is_test_passed-no_tests_no_plan.log | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-)
tools/testing/kunit/kunit_parser.py +5 -2
@@ -789,8 +789,11 @@ def parse_test(lines: LineStream, expected_num: int, log: List[str]) -> Test: # Check for there being no tests if parent_test and len(subtests) == 0: - test.status = TestStatus.NO_TESTS - test.add_error('0 tests run!') + # Don't override a bad status if this test had one reported. + # Assumption: no subtests means CRASHED is from Test.__init__() + if test.status in (TestStatus.TEST_CRASHED, TestStatus.SUCCESS): + test.status = TestStatus.NO_TESTS + test.add_error('0 tests run!') # Add statuses to TestCounts attribute in Test object bubble_up_test_results(test)
tools/testing/kunit/test_data/test_is_test_passed-no_tests_no_plan.log +1 -1
@@ -3,5 +3,5 @@ TAP version 14 # Subtest: suite 1..1 # Subtest: case - ok 1 - case # SKIP + ok 1 - case ok 1 - suite
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 183/879 net: phy: micrel: Allow probing without .driver_data
In reply to Greg Kroah-HartmanFrom: Fabio Estevam <[email protected]>
[ Upstream commit f2ef6f7539c68c6bd6c32323d8845ee102b7c450 ]
Currently, if the .probe element is present in the phy_driver structure and the .driver_data is not, a NULL pointer dereference happens.
Allow passing .probe without .driver_data by inserting NULL checks for priv->type.
--- drivers/net/phy/micrel.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/net/phy/micrel.c +6 -5
@@ -497,7 +497,7 @@ static int kszphy_config_reset(struct phy_device *phydev) } } -if (priv->led_mode >=0 ) +if (priv->type && priv->led_mode >=0 )kszphy_setup_led (phydev, priv->type->led_mode_reg, priv->led_mode);return 0 ;
@@ -513,10 +513,10 @@ static int kszphy_config_init(struct phy_device *phydev) type = priv->type; -if (type->has_broadcast_disable) +if (type && type->has_broadcast_disable)kszphy_broadcast_disable (phydev); -if (type->has_nand_tree_disable) +if (type && type->has_nand_tree_disable)kszphy_nand_tree_disable (phydev);return kszphy_config_reset (phydev);
@@ -1514,7 +1514,7 @@ static int kszphy_probe(struct phy_device *phydev) priv->type = type; -if (type->led_mode_reg) { +if (type && type->led_mode_reg) { ret =of_property_read_u32 (np,"micrel,led-mode" , &priv->led_mode);if (ret)
@@ -1535,7 +1535,8 @@ static int kszphy_probe(struct phy_device *phydev)unsigned long rate =clk_get_rate (clk);bool rmii_ref_clk_sel_25_mhz; - priv->rmii_ref_clk_sel = type->has_rmii_ref_clk_sel; +if (type) + priv->rmii_ref_clk_sel = type->has_rmii_ref_clk_sel; rmii_ref_clk_sel_25_mhz =of_property_read_bool (np,"micrel,rmii-reference-clock-select-25-mhz" );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 184/879 media: exynos4-is: Fix compile warning
In reply to Greg Kroah-HartmanFrom: Kwanghoon Son <[email protected]>
[ Upstream commit e080f5c1f2b6d02c02ee5d674e0e392ccf63bbaf ]
Declare static on function 'fimc_isp_video_device_unregister'.
When VIDEO_EXYNOS4_ISP_DMA_CAPTURE=n, compiler warns about
warning: no previous prototype for function [-Wmissing-prototypes]
--- drivers/media/platform/samsung/exynos4-is/fimc-isp-video.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/samsung/exynos4-is/fimc-isp-video.h +1 -1
@@ -32,7 +32,7 @@ static inline int fimc_isp_video_device_register(struct fimc_isp *isp,return 0 ; } -void fimc_isp_video_device_unregister (struct fimc_isp *isp, +static inline void fimc_isp_video_device_unregister (struct fimc_isp *isp,enum v4l2_buf_type type) { }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 185/879 media: hantro: Stop using H.264 parameter pic_num
In reply to Greg Kroah-HartmanFrom: Nicolas Dufresne <[email protected]>
[ Upstream commit 831410700909f4e29d5af1ef26b8c59fc2d1988e ]
The hardware expects FrameNumWrap or long_term_frame_idx. Picture numbers are per field, and are mostly used during the memory management process, which is done in userland. This fixes two ITU conformance tests:
- MR6_BT_B
- MR8_BT_B
--- drivers/staging/media/hantro/hantro_h264.c | 2 -- 1 file changed, 2 deletions(-)
drivers/staging/media/hantro/hantro_h264.c +0 -2
@@ -354,8 +354,6 @@ u16 hantro_h264_get_ref_nbr(struct hantro_ctx *ctx, unsigned int dpb_idx)if (!(dpb->flags &V4L2_H264_DPB_ENTRY_FLAG_ACTIVE ))return 0 ; -if (dpb->flags &V4L2_H264_DPB_ENTRY_FLAG_LONG_TERM ) -return dpb->pic_num;return dpb->frame_num; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 186/879 rtw89: cfo: check mac_id to avoid out-of-bounds
In reply to Greg Kroah-HartmanFrom: Ping-Ke Shih <[email protected]>
[ Upstream commit 97df85871a5b187609d30fca6d85b912d9e02f29 ]
Somehow, hardware reports incorrect mac_id and pollute memory. Check index before we access the array.
UBSAN: array-index-out-of-bounds in rtw89/phy.c:2517:23 index 188 is out of range for type 's32 [64]' CPU: 1 PID: 51550 Comm: irq/35-rtw89_pc Tainted: G OE Call Trace: <IRQ> show_stack+0x52/0x58 dump_stack_lvl+0x4c/0x63 dump_stack+0x10/0x12 ubsan_epilogue+0x9/0x45 __ubsan_handle_out_of_bounds.cold+0x44/0x49 ? __alloc_skb+0x92/0x1d0 rtw89_phy_cfo_parse+0x44/0x7f [rtw89_core] rtw89_core_rx+0x261/0x871 [rtw89_core] ? __alloc_skb+0xee/0x1d0 rtw89_pci_napi_poll+0x3fa/0x4ea [rtw89_pci] __napi_poll+0x33/0x1a0 net_rx_action+0x126/0x260 ? __queue_work+0x217/0x4c0 __do_softirq+0xd9/0x315 ? disable_irq_nosync+0x10/0x10 do_softirq.part.0+0x6d/0x90 </IRQ> <TASK> __local_bh_enable_ip+0x62/0x70 rtw89_pci_interrupt_threadfn+0x182/0x1a6 [rtw89_pci] irq_thread_fn+0x28/0x60 irq_thread+0xc8/0x190 ? irq_thread_fn+0x60/0x60 kthread+0x16b/0x190 ? irq_thread_check_affinity+0xe0/0xe0 ? set_kthread_struct+0x50/0x50 ret_from_fork+0x22/0x30 </TASK>
--- drivers/net/wireless/realtek/rtw89/phy.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/realtek/rtw89/phy.c +5 -0
@@ -2213,6 +2213,11 @@ void rtw89_phy_cfo_parse(struct rtw89_dev *rtwdev, s16 cfo_val,struct rtw89_cfo_tracking_info *cfo = &rtwdev->cfo_tracking;u8 macid = phy_ppdu->mac_id; +if (macid >=CFO_TRACK_MAX_USER ) { +rtw89_warn (rtwdev,"mac_id %d is out of range\n" , macid); +return ; + } + cfo->cfo_tail[macid] += cfo_val; cfo->cfo_cnt[macid]++; cfo->packet_count++;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 187/879 of/fdt: Ignore disabled memory nodes
In reply to Greg Kroah-HartmanFrom: Andre Przywara <[email protected]>
[ Upstream commit df5cd369876114f91f9ae60658fea80acfb15890 ]
When we boot a machine using a devicetree, the generic DT code goes through all nodes with a 'device_type = "memory"' property, and collects all memory banks mentioned there. However it does not check for the status property, so any nodes which are explicitly "disabled" will still be added as a memblock.
This ends up badly for QEMU, when booting with secure firmware on arm/arm64 machines, because QEMU adds a node describing secure-only memory:
===================
secram@e000000 {
secure-status = "okay";
status = "disabled";
reg = <0x00 0xe000000 0x00 0x1000000>;
device_type = "memory";
};===================
The kernel will eventually use that memory block (which is located below the main DRAM bank), but accesses to that will be answered with an SError:
===================
[ 0.000000] Internal error: synchronous external abort: 96000050 [#1] PREEMPT SMP [ 0.000000] Modules linked in: [ 0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 5.18.0-rc6-00014-g10c8acb8b679 #524 [ 0.000000] Hardware name: linux,dummy-virt (DT) [ 0.000000] pstate: 200000c5 (nzCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 0.000000] pc : new_slab+0x190/0x340 [ 0.000000] lr : new_slab+0x184/0x340 [ 0.000000] sp : ffff80000a4b3d10
....
==================
The actual crash location and call stack will be somewhat random, and depend on the specific allocation of that physical memory range.
As the DT spec[1] explicitly mentions standard properties, add a simple check to skip over disabled memory nodes, so that we only use memory that is meant for non-secure code to use.
That fixes booting a QEMU arm64 VM with EL3 enabled ("secure=on"), when not using UEFI. In this case the QEMU generated DT will be handed on to the kernel, which will see the secram node.
This issue is reproducible when using TF-A together with U-Boot as firmware, then booting with the "booti" command.
When using U-Boot as an UEFI provider, the code there [2] explicitly filters for disabled nodes when generating the UEFI memory map, so we are safe.
EDK/2 only reads the first bank of the first DT memory node [3] to learn about memory, so we got lucky there.
[1] https://github.com/devicetree-org/devicetree-specification/blob/main/source/chapter3-devicenodes.rst#memory-node (after the table)
[2] https://source.denx.de/u-boot/u-boot/-/blob/master/lib/fdtdec.c#L1061-1063
[3] https://github.com/tianocore/edk2/blob/master/ArmVirtPkg/PrePi/FdtParser.c
--- drivers/of/fdt.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/of/fdt.c +3 -0
@@ -1105,6 +1105,9 @@ int __init early_init_dt_scan_memory(void)if (type ==NULL ||strcmp (type,"memory" ) !=0 )continue ; +if (!of_fdt_device_is_available (fdt, node)) +continue ; + reg =of_get_flat_dt_prop (node,"linux,usable-memory" , &l);if (reg ==NULL ) reg =of_get_flat_dt_prop (node,"reg" , &l);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 188/879 blk-throttle: Set BIO_THROTTLED when bio has been throttled
In reply to Greg Kroah-HartmanFrom: Laibin Qiu <[email protected]>
[ Upstream commit 5a011f889b4832aa80c2a872a5aade5c48d2756f ]
1.In current process, all bio will set the BIO_THROTTLED flag after __blk_throtl_bio().
2.If bio needs to be throttled, it will start the timer and stop submit bio directly. Bio will submit in blk_throtl_dispatch_work_fn() when the timer expires.But in the current process, if bio is throttled. The BIO_THROTTLED will be set to bio after timer start. If the bio has been completed, it may cause use-after-free blow.
BUG: KASAN: use-after-free in blk_throtl_bio+0x12f0/0x2c70 Read of size 2 at addr ffff88801b8902d4 by task fio/26380 dump_stack+0x9b/0xce print_address_description.constprop.6+0x3e/0x60 kasan_report.cold.9+0x22/0x3a blk_throtl_bio+0x12f0/0x2c70 submit_bio_checks+0x701/0x1550 submit_bio_noacct+0x83/0xc80 submit_bio+0xa7/0x330 mpage_readahead+0x380/0x500 read_pages+0x1c1/0xbf0 page_cache_ra_unbounded+0x471/0x6f0 do_page_cache_ra+0xda/0x110 ondemand_readahead+0x442/0xae0 page_cache_async_ra+0x210/0x300 generic_file_buffered_read+0x4d9/0x2130 generic_file_read_iter+0x315/0x490 blkdev_read_iter+0x113/0x1b0 aio_read+0x2ad/0x450 io_submit_one+0xc8e/0x1d60 __se_sys_io_submit+0x125/0x350 do_syscall_64+0x2d/0x40 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Allocated by task 26380: kasan_save_stack+0x19/0x40 __kasan_kmalloc.constprop.2+0xc1/0xd0 kmem_cache_alloc+0x146/0x440 mempool_alloc+0x125/0x2f0 bio_alloc_bioset+0x353/0x590 mpage_alloc+0x3b/0x240 do_mpage_readpage+0xddf/0x1ef0 mpage_readahead+0x264/0x500 read_pages+0x1c1/0xbf0 page_cache_ra_unbounded+0x471/0x6f0 do_page_cache_ra+0xda/0x110 ondemand_readahead+0x442/0xae0 page_cache_async_ra+0x210/0x300 generic_file_buffered_read+0x4d9/0x2130 generic_file_read_iter+0x315/0x490 blkdev_read_iter+0x113/0x1b0 aio_read+0x2ad/0x450 io_submit_one+0xc8e/0x1d60 __se_sys_io_submit+0x125/0x350 do_syscall_64+0x2d/0x40 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Freed by task 0: kasan_save_stack+0x19/0x40 kasan_set_track+0x1c/0x30 kasan_set_free_info+0x1b/0x30 __kasan_slab_free+0x111/0x160 kmem_cache_free+0x94/0x460 mempool_free+0xd6/0x320 bio_free+0xe0/0x130 bio_put+0xab/0xe0 bio_endio+0x3a6/0x5d0 blk_update_request+0x590/0x1370 scsi_end_request+0x7d/0x400 scsi_io_completion+0x1aa/0xe50 scsi_softirq_done+0x11b/0x240 blk_mq_complete_request+0xd4/0x120 scsi_mq_done+0xf0/0x200 virtscsi_vq_done+0xbc/0x150 vring_interrupt+0x179/0x390 __handle_irq_event_percpu+0xf7/0x490 handle_irq_event_percpu+0x7b/0x160 handle_irq_event+0xcc/0x170 handle_edge_irq+0x215/0xb20 common_interrupt+0x60/0x120 asm_common_interrupt+0x1e/0x40
Fix this by move BIO_THROTTLED set into the queue_lock.
--- block/blk-throttle.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
block/blk-throttle.c +2 -1
@@ -2189,13 +2189,14 @@ bool __blk_throtl_bio(struct bio *bio) } out_unlock: -spin_unlock_irq (&q->queue_lock);bio_set_flag (bio,BIO_THROTTLED );#ifdef CONFIG_BLK_DEV_THROTTLING_LOW if (throttled || !td->track_bio_latency) bio->bi_issue.value |=BIO_ISSUE_THROTL_SKIP_LATENCY ;#endif +spin_unlock_irq (&q->queue_lock); +rcu_read_unlock ();return throttled; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 189/879 ASoC: max98357a: remove dependency on GPIOLIB
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 21ca3274333f5c1cbbf9d91e5b33f4f2463859b2 ]
commit dcc2c012c7691 ("ASoC: Fix gpiolib dependencies") removed a series of unnecessary dependencies on GPIOLIB when the gpio was optional.
A similar simplification seems valid for max98357a, so remove the dependency as well. This will avoid the following warning
WARNING: unmet direct dependencies detected for SND_SOC_MAX98357A
Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] && GPIOLIB [=n]
Selected by [y]:
- SND_SOC_INTEL_SOF_CS42L42_MACH [=y] && SOUND [=y] && !UML &&
SND [=y] && SND_SOC [=y] && SND_SOC_INTEL_MACH [=y] &&
(SND_SOC_SOF_HDA_LINK [=y] || SND_SOC_SOF_BAYTRAIL [=n]) && I2C
[=y] && ACPI [=y] && SND_HDA_CODEC_HDMI [=y] &&
SND_SOC_SOF_HDA_AUDIO_CODEC [=y] && (MFD_INTEL_LPSS [=y] ||
COMPILE_TEST [=n])--- sound/soc/codecs/Kconfig | 1 - 1 file changed, 1 deletion(-)
sound/soc/codecs/Kconfig +0 -1
@@ -953,7 +953,6 @@ config SND_SOC_MAX98095 config SND_SOC_MAX98357A tristate "Maxim MAX98357A CODEC" - depends on GPIOLIB config SND_SOC_MAX98371 tristate
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 190/879 ASoC: rt1015p: remove dependency on GPIOLIB
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit b390c25c6757b9d56cecdfbf6d55f15fc89a6386 ]
commit dcc2c012c7691 ("ASoC: Fix gpiolib dependencies") removed a series of unnecessary dependencies on GPIOLIB when the gpio was optional.
A similar simplification seems valid for rt1015p, so remove the dependency as well. This will avoid the following warning
WARNING: unmet direct dependencies detected for SND_SOC_RT1015P
Depends on [n]: SOUND [=y] && !UML && SND [=y] && SND_SOC [=y] &&
GPIOLIB [=n]
Selected by [y]:
- SND_SOC_INTEL_SOF_RT5682_MACH [=y] && SOUND [=y] && !UML && SND
[=y] && SND_SOC [=y] && SND_SOC_INTEL_MACH [=y] &&
(SND_SOC_SOF_HDA_LINK [=y] || SND_SOC_SOF_BAYTRAIL [=n]) && I2C
[=y] && ACPI [=y] && (SND_HDA_CODEC_HDMI [=y] &&
SND_SOC_SOF_HDA_AUDIO_CODEC [=y] && (MFD_INTEL_LPSS [=y] ||
COMPILE_TEST [=y]) || SND_SOC_SOF_BAYTRAIL [=n] &&
(X86_INTEL_LPSS [=n] || COMPILE_TEST [=y]))--- sound/soc/codecs/Kconfig | 1 - 1 file changed, 1 deletion(-)
sound/soc/codecs/Kconfig +0 -1
@@ -1212,7 +1212,6 @@ config SND_SOC_RT1015 config SND_SOC_RT1015P tristate - depends on GPIOLIB config SND_SOC_RT1019 tristate
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 191/879 ACPI: CPPC: Assume no transition latency if no PCCT
In reply to Greg Kroah-HartmanFrom: Pierre Gondois <[email protected]>
[ Upstream commit 6380b7b2b29da9d9c5ab2d4a265901cd93ba3696 ]
The transition_delay_us (struct cpufreq_policy) is currently defined as:
Preferred average time interval between consecutive invocations of the driver to set the frequency for this policy. To be set by the scaling driver (0, which is the default, means no preference).
The transition_latency represents the amount of time necessary for a CPU to change its frequency.
A PCCT table advertises mutliple values:
- pcc_nominal: Expected latency to process a command, in microseconds
- pcc_mpar: The maximum number of periodic requests that the subspace channel can support, reported in commands per minute. 0 indicates no limitation.
- pcc_mrtt: The minimum amount of time that OSPM must wait after the completion of a command before issuing the next command, in microseconds.cppc_get_transition_latency() allows to get the max of them.
commit d4f3388afd48 ("cpufreq / CPPC: Set platform specific transition_delay_us") allows to select transition_delay_us based on the platform, and fallbacks to cppc_get_transition_latency() otherwise.
If _CPC objects are not using PCC channels (no PPCT table), the transition_delay_us is set to CPUFREQ_ETERNAL, leading to really long periods between frequency updates (~4s).
If the desired_reg, where performance requests are written, is in SystemMemory or SystemIo ACPI address space, there is no delay in requests. So return 0 instead of CPUFREQ_ETERNAL, leading to transition_delay_us being set to LATENCY_MULTIPLIER us (1000 us).
This patch also adds two macros to check the address spaces.
--- drivers/acpi/cppc_acpi.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-)
drivers/acpi/cppc_acpi.c +16 -1
@@ -100,6 +100,16 @@ static DEFINE_PER_CPU(struct cpc_desc *, cpc_desc_ptr); (cpc)->cpc_entry.reg.space_id == \ ACPI_ADR_SPACE_PLATFORM_COMM) +/* Check if a CPC register is in SystemMemory */ +#define CPC_IN_SYSTEM_MEMORY (cpc) ((cpc)->type == ACPI_TYPE_BUFFER && \ + (cpc)->cpc_entry.reg.space_id == \ + ACPI_ADR_SPACE_SYSTEM_MEMORY) + +/* Check if a CPC register is in SystemIo */ +#define CPC_IN_SYSTEM_IO (cpc) ((cpc)->type == ACPI_TYPE_BUFFER && \ + (cpc)->cpc_entry.reg.space_id == \ + ACPI_ADR_SPACE_SYSTEM_IO) +/* Evaluates to True if reg is a NULL register descriptor */ #define IS_NULL_REG (reg) ((reg)->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY && \ (reg)->address == 0 && \
@@ -1447,6 +1457,9 @@ EXPORT_SYMBOL_GPL(cppc_set_perf);* transition latency for performance change requests. The closest we have * is the timing information from the PCCT tables which provides the info * on the number and frequency of PCC commands the platform can handle. +* +* If desired_reg is in the SystemMemory or SystemIo ACPI address space, +* then assume there is no latency. */ unsigned int cppc_get_transition_latency (int cpu_num) {
@@ -1472,7 +1485,9 @@ unsigned int cppc_get_transition_latency(int cpu_num)return CPUFREQ_ETERNAL ; desired_reg = &cpc_desc->cpc_regs[DESIRED_PERF ]; -if (!CPC_IN_PCC (desired_reg)) +if (CPC_IN_SYSTEM_MEMORY (desired_reg) ||CPC_IN_SYSTEM_IO (desired_reg)) +return 0 ; +else if (!CPC_IN_PCC (desired_reg))return CPUFREQ_ETERNAL ;if (pcc_ss_id <0 )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 192/879 nvme: set non-mdts limits in nvme_scan_work
In reply to Greg Kroah-HartmanFrom: Chaitanya Kulkarni <[email protected]>
[ Upstream commit 78288665b5d0154978fed431985310cb4f166836 ]
In current implementation we set the non-mdts limits by calling nvme_init_non_mdts_limits() from nvme_init_ctrl_finish(). This also tries to set the limits for the discovery controller which has no I/O queues resulting in the warning message reported by the nvme_log_error() when running blktest nvme/002: -
[ 2005.155946] run blktests nvme/002 at 2022-04-09 16:57:47 [ 2005.192223] loop: module loaded [ 2005.196429] nvmet: adding nsid 1 to subsystem blktests-subsystem-0 [ 2005.200334] nvmet: adding nsid 1 to subsystem blktests-subsystem-1
<------------------------------SNIP---------------------------------->
[ 2008.958108] nvmet: adding nsid 1 to subsystem blktests-subsystem-997 [ 2008.962082] nvmet: adding nsid 1 to subsystem blktests-subsystem-998 [ 2008.966102] nvmet: adding nsid 1 to subsystem blktests-subsystem-999 [ 2008.973132] nvmet: creating discovery controller 1 for subsystem nqn.2014-08.org.nvmexpress.discovery for NQN testhostnqn. *[ 2008.973196] nvme1: Identify(0x6), Invalid Field in Command (sct 0x0 / sc 0x2) MORE DNR* [ 2008.974595] nvme nvme1: new ctrl: "nqn.2014-08.org.nvmexpress.discovery" [ 2009.103248] nvme nvme1: Removing ctrl: NQN "nqn.2014-08.org.nvmexpress.discovery"
Move the call of nvme_init_non_mdts_limits() to nvme_scan_work() after we verify that I/O queues are created since that is a converging point for each transport where these limits are actually used.
1. FC :nvme_fc_create_association()
...
nvme_fc_create_io_queues(ctrl);
...
nvme_start_ctrl()
nvme_scan_queue()
nvme_scan_work()
2. PCIe:-nvme_reset_work()
...
nvme_setup_io_queues()
nvme_create_io_queues()
nvme_alloc_queue()
...
nvme_start_ctrl()
nvme_scan_queue()
nvme_scan_work()
3. RDMA :-nvme_rdma_setup_ctrl
...
nvme_rdma_configure_io_queues
...
nvme_start_ctrl()
nvme_scan_queue()
nvme_scan_work()
4. TCP :-nvme_tcp_setup_ctrl
...
nvme_tcp_configure_io_queues
...
nvme_start_ctrl()
nvme_scan_queue()
nvme_scan_work()
* nvme_scan_work()
...nvme_validate_or_alloc_ns()
nvme_alloc_ns()
nvme_update_ns_info()
nvme_update_disk_info()
nvme_config_discard() <---
blk_queue_max_write_zeroes_sectors() <------ drivers/nvme/host/core.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/nvme/host/core.c +15 -4
@@ -3080,10 +3080,6 @@ int nvme_init_ctrl_finish(struct nvme_ctrl *ctrl)if (ret)return ret; - ret =nvme_init_non_mdts_limits (ctrl); -if (ret <0 ) -return ret; - ret =nvme_configure_apst (ctrl);if (ret <0 )return ret;
@@ -4237,11 +4233,26 @@ static void nvme_scan_work(struct work_struct *work) {struct nvme_ctrl *ctrl = container_of(work, struct nvme_ctrl, scan_work); +int ret;/* No tagset on a live ctrl means IO queues could not created */ if (ctrl->state !=NVME_CTRL_LIVE || !ctrl->tagset)return ; +/* +* Identify controller limits can change at controller reset due to +* new firmware download, even though it is not common we cannot ignore +* such scenario. Controller's non-mdts limits are reported in the unit +* of logical blocks that is dependent on the format of attached +* namespace. Hence re-read the limits at the time of ns allocation. +*/ + ret =nvme_init_non_mdts_limits (ctrl); +if (ret <0 ) { +dev_warn (ctrl->device, +"reading non-mdts-limits failed: %d\n" , ret); +return ; + } +if (test_and_clear_bit (NVME_AER_NOTICE_NS_CHANGED , &ctrl->events)) {dev_info (ctrl->device,"rescanning namespaces.\n" );nvme_clear_changed_ns_log (ctrl);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 193/879 can: mcp251xfd: silence clangs -Wunaligned-access warning
In reply to Greg Kroah-HartmanFrom: Vincent Mailhol <[email protected]>
[ Upstream commit 1a6dd9996699889313327be03981716a8337656b ]
clang emits a -Wunaligned-access warning on unionmcp251xfd_tx_ojb_load_buf.
The reason is that field hw_tx_obj (not declared as packed) is being packed right after a 16 bits field inside a packed struct:
| union mcp251xfd_tx_obj_load_buf {
| struct __packed {
| struct mcp251xfd_buf_cmd cmd;
| /* ^ 16 bits fields */
| struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
| /* ^ not declared as packed */
| } nocrc;
| struct __packed {
| struct mcp251xfd_buf_cmd_crc cmd;
| struct mcp251xfd_hw_tx_obj_raw hw_tx_obj;
| __be16 crc;
| } crc;
| } ____cacheline_aligned;Starting from LLVM 14, having an unpacked struct nested in a packed struct triggers a warning. c.f. [1].
This is a false positive because the field is always being accessed with the relevant put_unaligned_*() function. Adding __packed to the structure declaration silences the warning.
[1] https://github.com/llvm/llvm-project/issues/55520
--- drivers/net/can/spi/mcp251xfd/mcp251xfd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/spi/mcp251xfd/mcp251xfd.h +1 -1
@@ -441,7 +441,7 @@ struct mcp251xfd_hw_tef_obj {/* The tx_obj_raw version is used in spi async, i.e. without * regmap. We have to take care of endianness ourselves. */ -struct mcp251xfd_hw_tx_obj_raw { +struct __packed mcp251xfd_hw_tx_obj_raw {__le32 id;__le32 flags; u8 data[sizeof_field(struct canfd_frame, data)];
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 194/879 x86/microcode: Add explicit CPU vendor dependency
In reply to Greg Kroah-HartmanFrom: Borislav Petkov <[email protected]>
[ Upstream commit 9c55d99e099bd7aa6b91fce8718505c35d5dfc65 ]
Add an explicit dependency to the respective CPU vendor so that the respective microcode support for it gets built only when that support is enabled.
--- arch/x86/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/Kconfig +2 -2
@@ -1313,7 +1313,7 @@ config MICROCODE config MICROCODE_INTEL bool "Intel microcode loading support" - depends on MICROCODE + depends on CPU_SUP_INTEL && MICROCODE default MICROCODE help This options enables microcode patch loading support for Intel
@@ -1325,7 +1325,7 @@ config MICROCODE_INTEL config MICROCODE_AMD bool "AMD microcode loading support" - depends on MICROCODE + depends on CPU_SUP_AMD && MICROCODE help If you select this option, microcode patch loading support for AMD processors will be enabled.
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 195/879 net: ipa: ignore endianness if there is no header
In reply to Greg Kroah-HartmanFrom: Alex Elder <[email protected]>
[ Upstream commit 332ef7c814bdd60f08d0d9013d0e1104798b2d23 ]
If we program an RX endpoint to have no header (header length is 0), header-related endpoint configuration values are meaningless and are ignored.
The only case we support that defines a header is QMAP endpoints. In ipa_endpoint_init_hdr_ext() we set the endianness mask value unconditionally, but it should not be done if there is no header (meaning it is not configured for QMAP).
Set the endianness conditionally, and rearrange the logic in that function slightly to avoid testing the qmap flag twice.
Delete an incorrect comment in ipa_endpoint_init_aggr().
--- drivers/net/ipa/ipa_endpoint.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/net/ipa/ipa_endpoint.c +17 -15
@@ -587,19 +587,23 @@ static void ipa_endpoint_init_hdr_ext(struct ipa_endpoint *endpoint)struct ipa *ipa = endpoint->ipa;u32 val =0 ; - val |=HDR_ENDIANNESS_FMASK ;/* big endian */ - -/* A QMAP header contains a 6 bit pad field at offset 0. The RMNet -* driver assumes this field is meaningful in packets it receives, -* and assumes the header's payload length includes that padding. -* The RMNet driver does *not* pad packets it sends, however, so -* the pad field (although 0) should be ignored. -*/ -if (endpoint->data->qmap && !endpoint->toward_ipa) { - val |=HDR_TOTAL_LEN_OR_PAD_VALID_FMASK ; -/* HDR_TOTAL_LEN_OR_PAD is 0 (pad, not total_len) */ - val |=HDR_PAYLOAD_LEN_INC_PADDING_FMASK ; -/* HDR_TOTAL_LEN_OR_PAD_OFFSET is 0 */ +if (endpoint->data->qmap) { +/* We have a header, so we must specify its endianness */ + val |=HDR_ENDIANNESS_FMASK ;/* big endian */ + +/* A QMAP header contains a 6 bit pad field at offset 0. +* The RMNet driver assumes this field is meaningful in +* packets it receives, and assumes the header's payload +* length includes that padding. The RMNet driver does +* *not* pad packets it sends, however, so the pad field +* (although 0) should be ignored. +*/ +if (!endpoint->toward_ipa) { + val |=HDR_TOTAL_LEN_OR_PAD_VALID_FMASK ; +/* HDR_TOTAL_LEN_OR_PAD is 0 (pad, not total_len) */ + val |=HDR_PAYLOAD_LEN_INC_PADDING_FMASK ; +/* HDR_TOTAL_LEN_OR_PAD_OFFSET is 0 */ + } }/* HDR_PAYLOAD_LEN_INC_PADDING is 0 */
@@ -759,8 +763,6 @@ static void ipa_endpoint_init_aggr(struct ipa_endpoint *endpoint) close_eof = rx_data->aggr_close_eof; val |=aggr_sw_eof_active_encoded (version, close_eof); - -/* AGGR_HARD_BYTE_LIMIT_ENABLE is 0 */ }else { val |=u32_encode_bits (IPA_ENABLE_DEAGGR ,AGGR_EN_FMASK );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 196/879 selftests/bpf: Add missing trampoline program type to trampoline_count test
In reply to Greg Kroah-HartmanFrom: Yuntao Wang <[email protected]>
[ Upstream commit b23316aabffa835ecc516cb81daeef5b9155e8a5 ]
Currently the trampoline_count test doesn't include any fmod_ret bpf programs, fix it to make the test cover all possible trampoline program types.
Since fmod_ret bpf programs can't be attached to __set_task_comm function, as it's neither whitelisted for error injection nor a security hook, change it to bpf_modify_return_test.
This patch also does some other cleanups such as removing duplicate code, dropping inconsistent comments, etc.
--- include/linux/bpf.h | 2 +- .../bpf/prog_tests/trampoline_count.c | 134 +++++++----------- .../bpf/progs/test_trampoline_count.c | 16 ++- 3 files changed, 61 insertions(+), 91 deletions(-)
include/linux/bpf.h +1 -1
@@ -672,7 +672,7 @@ struct btf_func_model {#define BPF_TRAMP_F_RET_FENTRY_RET BIT(4)/* Each call __bpf_prog_enter + call bpf_func + call __bpf_prog_exit is ~50 -* bytes on x86. Pick a number to fit into BPF_IMAGE_SIZE / 2 +* bytes on x86. */ #define BPF_MAX_TRAMP_PROGS 38
tools/testing/selftests/bpf/prog_tests/trampoline_count.c +51 -83
177 lines not on this page · raw message
tools/testing/selftests/bpf/progs/test_trampoline_count.c +9 -7
@@ -1,20 +1,22 @@// SPDX-License-Identifier: GPL-2.0 -#include <stdbool.h> -#include <stddef.h> #include <linux/bpf.h> #include <bpf/bpf_helpers.h> #include <bpf/bpf_tracing.h> -struct task_struct ; +SEC("fentry/bpf_modify_return_test") +int BPF_PROG (fentry_test ,int a,int *b) +{ +return 0 ; +} -SEC("fentry/__set_task_comm") -int BPF_PROG (prog1 ,struct task_struct *tsk,const char *buf,bool exec) +SEC("fmod_ret/bpf_modify_return_test") +int BPF_PROG (fmod_ret_test ,int a,int *b,int ret) {return 0 ; } -SEC("fexit/__set_task_comm") -int BPF_PROG (prog2 ,struct task_struct *tsk,const char *buf,bool exec) +SEC("fexit/bpf_modify_return_test") +int BPF_PROG (fexit_test ,int a,int *b,int ret) {return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 197/879 m68k: atari: Make Atari ROM port I/O write macros return void
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 30b5e6ef4a32ea4985b99200e06d6660a69f9246 ]
The macros implementing Atari ROM port I/O writes do not cast away their output, unlike similar implementations for other I/O buses. When they are combined using conditional expressions in the definitions of outb() and friends, this triggers sparse warnings like:
drivers/net/appletalk/cops.c:382:17: error: incompatible types in conditional expression (different base types):
drivers/net/appletalk/cops.c:382:17: unsigned char
drivers/net/appletalk/cops.c:382:17: void
Fix this by adding casts to "void".
--- arch/m68k/include/asm/raw_io.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/m68k/include/asm/raw_io.h +3 -3
@@ -80,14 +80,14 @@ ({ u16 __v = le16_to_cpu(*(__force volatile u16 *) (addr)); __v; })#define rom_out_8 (addr, b) \ - ({u8 __maybe_unused __w, __v = (b); u32 _addr = ((u32) (addr)); \ + (void)({u8 __maybe_unused __w, __v = (b); u32 _addr = ((u32) (addr)); \ __w = ((*(__force volatile u8 *) ((_addr | 0x10000) + (__v<<1)))); })#define rom_out_be16 (addr, w) \ - ({u16 __maybe_unused __w, __v = (w); u32 _addr = ((u32) (addr)); \ + (void)({u16 __maybe_unused __w, __v = (w); u32 _addr = ((u32) (addr)); \ __w = ((*(__force volatile u16 *) ((_addr & 0xFFFF0000UL) + ((__v & 0xFF)<<1)))); \ __w = ((*(__force volatile u16 *) ((_addr | 0x10000) + ((__v >> 8)<<1)))); })#define rom_out_le16 (addr, w) \ - ({u16 __maybe_unused __w, __v = (w); u32 _addr = ((u32) (addr)); \ + (void)({u16 __maybe_unused __w, __v = (w); u32 _addr = ((u32) (addr)); \ __w = ((*(__force volatile u16 *) ((_addr & 0xFFFF0000UL) + ((__v >> 8)<<1)))); \ __w = ((*(__force volatile u16 *) ((_addr | 0x10000) + ((__v & 0xFF)<<1)))); })
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 198/879 hwmon: (pmbus) Add get_voltage/set_voltage ops
In reply to Greg Kroah-HartmanFrom: Mårten Lindahl <[email protected]>
[ Upstream commit 28bf22ef93eceb42c7583f0909bc9dedc07770e3 ]
The pmbus core does not have operations for getting or setting voltage. Add functions get/set voltage for the dynamic regulator framework.
--- drivers/hwmon/pmbus/pmbus_core.c | 67 ++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+)
drivers/hwmon/pmbus/pmbus_core.c +67 -0
@@ -2548,11 +2548,78 @@ static int pmbus_regulator_get_error_flags(struct regulator_dev *rdev, unsignedreturn 0 ; } +static int pmbus_regulator_get_voltage (struct regulator_dev *rdev) +{ +struct device *dev =rdev_get_dev (rdev); +struct i2c_client *client =to_i2c_client (dev->parent); +struct pmbus_data *data =i2c_get_clientdata (client); +struct pmbus_sensor s = { + .page =rdev_get_id (rdev), + .class =PSC_VOLTAGE_OUT , + .convert = true, + }; + + s.data =_pmbus_read_word_data (client, s.page,0xff ,PMBUS_READ_VOUT ); +if (s.data <0 ) +return s.data; + +return (int )pmbus_reg2data (data, &s) *1000 ;/* unit is uV */ +} + +static int pmbus_regulator_set_voltage (struct regulator_dev *rdev,int min_uv, +int max_uv,unsigned int *selector) +{ +struct device *dev =rdev_get_dev (rdev); +struct i2c_client *client =to_i2c_client (dev->parent); +struct pmbus_data *data =i2c_get_clientdata (client); +struct pmbus_sensor s = { + .page =rdev_get_id (rdev), + .class =PSC_VOLTAGE_OUT , + .convert = true, + .data =-1 , + }; +int val =DIV_ROUND_CLOSEST (min_uv,1000 );/* convert to mV */ +int low, high; + + *selector =0 ; + +if (pmbus_check_word_register (client, s.page,PMBUS_MFR_VOUT_MIN )) + s.data =_pmbus_read_word_data (client, s.page,0xff ,PMBUS_MFR_VOUT_MIN ); +if (s.data <0 ) { + s.data =_pmbus_read_word_data (client, s.page,0xff ,PMBUS_VOUT_MARGIN_LOW ); +if (s.data <0 ) +return s.data; + } + low =pmbus_reg2data (data, &s); + + s.data =-1 ; +if (pmbus_check_word_register (client, s.page,PMBUS_MFR_VOUT_MAX )) + s.data =_pmbus_read_word_data (client, s.page,0xff ,PMBUS_MFR_VOUT_MAX ); +if (s.data <0 ) { + s.data =_pmbus_read_word_data (client, s.page,0xff ,PMBUS_VOUT_MARGIN_HIGH ); +if (s.data <0 ) +return s.data; + } + high =pmbus_reg2data (data, &s); + +/* Make sure we are within margins */ +if (low > val) + val = low; +if (high < val) + val = high; + + val =pmbus_data2reg (data, &s, val); + +return _pmbus_write_word_data (client, s.page,PMBUS_VOUT_COMMAND , (u16 )val); +} +const struct regulator_ops pmbus_regulator_ops = { .enable = pmbus_regulator_enable, .disable = pmbus_regulator_disable, .is_enabled = pmbus_regulator_is_enabled, .get_error_flags = pmbus_regulator_get_error_flags, + .get_voltage = pmbus_regulator_get_voltage, + .set_voltage = pmbus_regulator_set_voltage, };EXPORT_SYMBOL_NS_GPL (pmbus_regulator_ops,PMBUS );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 199/879 rxrpc: Return an error to sendmsg if call failed
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 4ba68c5192554876bd8c3afd904e3064d2915341 ]
If at the end of rxrpc sendmsg() or rxrpc_kernel_send_data() the call that was being given data was aborted remotely or otherwise failed, return an error rather than returning the amount of data buffered for transmission.
The call (presumably) did not complete, so there's not much point continuing with it. AF_RXRPC considers it "complete" and so will be unwilling to do anything else with it - and won't send a notification for it, deeming the return from sendmsg sufficient.
Not returning an error causes afs to incorrectly handle a StoreData operation that gets interrupted by a change of address due to NAT reconfiguration.
This doesn't normally affect most operations since their request parameters tend to fit into a single UDP packet and afs_make_call() returns before the server responds; StoreData is different as it involves transmission of a lot of data.
This can be triggered on a client by doing something like:
dd if=/dev/zero of=/afs/example.com/foo bs=1M count=512
at one prompt, and then changing the network address at another prompt, e.g.:
ifconfig enp6s0 inet 192.168.6.2 && route add 192.168.6.1 dev enp6s0
Tracing packets on an Auristor fileserver looks something like:
192.168.6.1 -> 192.168.6.3 RX 107 ACK Idle Seq: 0 Call: 4 Source Port: 7000 Destination Port: 7001 192.168.6.3 -> 192.168.6.1 AFS (RX) 1482 FS Request: Unknown(64538) (64538) 192.168.6.3 -> 192.168.6.1 AFS (RX) 1482 FS Request: Unknown(64538) (64538) 192.168.6.1 -> 192.168.6.3 RX 107 ACK Idle Seq: 0 Call: 4 Source Port: 7000 Destination Port: 7001 <ARP exchange for 192.168.6.2> 192.168.6.2 -> 192.168.6.1 AFS (RX) 1482 FS Request: Unknown(0) (0) 192.168.6.2 -> 192.168.6.1 AFS (RX) 1482 FS Request: Unknown(0) (0) 192.168.6.1 -> 192.168.6.2 RX 107 ACK Exceeds Window Seq: 0 Call: 4 Source Port: 7000 Destination Port: 7001 192.168.6.1 -> 192.168.6.2 RX 74 ABORT Seq: 0 Call: 4 Source Port: 7000 Destination Port: 7001 192.168.6.1 -> 192.168.6.2 RX 74 ABORT Seq: 29321 Call: 4 Source Port: 7000 Destination Port: 7001
The Auristor fileserver logs code -453 (RXGEN_SS_UNMARSHAL), but the abort code received by kafs is -5 (RX_PROTOCOL_ERROR) as the rx layer sees the condition and generates an abort first and the unmarshal error is a consequence of that at the application layer.
--- net/rxrpc/sendmsg.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/rxrpc/sendmsg.c +6 -0
@@ -444,6 +444,12 @@ static int rxrpc_send_data(struct rxrpc_sock *rx, success: ret = copied; +if (READ_ONCE (call->state) ==RXRPC_CALL_COMPLETE ) { +read_lock_bh (&call->state_lock); +if (call->error <0 ) + ret = call->error; +read_unlock_bh (&call->state_lock); + } out: call->tx_pending = skb;_leave (" = %d" , ret);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 200/879 rxrpc, afs: Fix selection of abort codes
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit de696c4784f0706884458893c5a6c39b3a3ff65c ]
The RX_USER_ABORT code should really only be used to indicate that the user of the rxrpc service (ie. userspace) implicitly caused a call to be aborted
- for instance if the AF_RXRPC socket is closed whilst the call was in progress. (The user may also explicitly abort a call and specify the abort code to use).
Change some of the points of generation to use other abort codes instead:
(1) Abort the call with RXGEN_SS_UNMARSHAL or RXGEN_CC_UNMARSHAL if we see ENOMEM and EFAULT during received data delivery and abort with RX_CALL_DEAD in the default case.
(2) Abort with RXGEN_SS_MARSHAL if we get ENOMEM whilst trying to send a reply.
(3) Abort with RX_CALL_DEAD if we stop hearing from the peer if we had heard from the peer and abort with RX_CALL_TIMEOUT if we hadn't.
(4) Abort with RX_CALL_DEAD if we try to disconnect a call that's not completed successfully or been aborted.
--- fs/afs/rxrpc.c | 8 +++++--- net/rxrpc/call_event.c | 4 ++-- net/rxrpc/conn_object.c | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-)
fs/afs/rxrpc.c +5 -3
@@ -537,6 +537,8 @@ static void afs_deliver_to_call(struct afs_call *call)case -ENODATA :case -EBADMSG :case -EMSGSIZE : +case -ENOMEM : +case -EFAULT : abort_code =RXGEN_CC_UNMARSHAL ;if (state !=AFS_CALL_CL_AWAIT_REPLY ) abort_code =RXGEN_SS_UNMARSHAL ;
@@ -544,7 +546,7 @@ static void afs_deliver_to_call(struct afs_call *call) abort_code, ret, "KUM"); goto local_abort;default : - abort_code =RX_USER_ABORT ; + abort_code =RX_CALL_DEAD ;rxrpc_kernel_abort_call (call->net->socket, call->rxcall, abort_code, ret,"KER" ); goto local_abort;
@@ -836,7 +838,7 @@ void afs_send_empty_reply(struct afs_call *call)case -ENOMEM :_debug ("oom" );rxrpc_kernel_abort_call (net->socket, call->rxcall, -RX_USER_ABORT , -ENOMEM ,"KOO" ); +RXGEN_SS_MARSHAL , -ENOMEM ,"KOO" ); fallthrough;default :_leave (" [error]" );
@@ -878,7 +880,7 @@ void afs_send_simple_reply(struct afs_call *call, const void *buf, size_t len)if (n == -ENOMEM ) {_debug ("oom" );rxrpc_kernel_abort_call (net->socket, call->rxcall, -RX_USER_ABORT , -ENOMEM ,"KOO" ); +RXGEN_SS_MARSHAL , -ENOMEM ,"KOO" ); }_leave (" [error]" ); }
net/rxrpc/call_event.c +2 -2
@@ -377,9 +377,9 @@ void rxrpc_process_call(struct work_struct *work)if (test_bit (RXRPC_CALL_RX_HEARD , &call->flags) && (int )call->conn->hi_serial - (int )call->rx_serial >0 ) {trace_rxrpc_call_reset (call); -rxrpc_abort_call ("EXP" , call,0 ,RX_USER_ABORT , -ECONNRESET ); +rxrpc_abort_call ("EXP" , call,0 ,RX_CALL_DEAD , -ECONNRESET ); }else { -rxrpc_abort_call ("EXP" , call,0 ,RX_USER_ABORT , -ETIME ); +rxrpc_abort_call ("EXP" , call,0 ,RX_CALL_TIMEOUT , -ETIME ); }set_bit (RXRPC_CALL_EV_ABORT , &call->events); goto recheck_state;
net/rxrpc/conn_object.c +1 -1
@@ -183,7 +183,7 @@ void __rxrpc_disconnect_call(struct rxrpc_connection *conn, chan->last_type =RXRPC_PACKET_TYPE_ABORT ;break ;default : - chan->last_abort =RX_USER_ABORT ; + chan->last_abort =RX_CALL_DEAD ; chan->last_type =RXRPC_PACKET_TYPE_ABORT ;break ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 201/879 afs: Adjust ACK interpretation to try and cope with NAT
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit adc9613ff66c26ebaff9814973181ac178beb90b ]
If a client's address changes, say if it is NAT'd, this can disrupt an in progress operation. For most operations, this is not much of a problem, but StoreData can be different as some servers modify the target file as the data comes in, so if a store request is disrupted, the file can get corrupted on the server.
The problem is that the server doesn't recognise packets that come after the change of address as belonging to the original client and will bounce them, either by sending an OUT_OF_SEQUENCE ACK to the apparent new call if the packet number falls within the initial sequence number window of a call or by sending an EXCEEDS_WINDOW ACK if it falls outside and then aborting it. In both cases, firstPacket will be 1 and previousPacket will be 0 in the ACK information.
Fix this by the following means:
(1) If a client call receives an EXCEEDS_WINDOW ACK with firstPacket as 1 and previousPacket as 0, assume this indicates that the server saw the incoming packets from a different peer and thus as a different call. Fail the call with error -ENETRESET.
(2) Also fail the call if a similar OUT_OF_SEQUENCE ACK occurs if the first packet has been hard-ACK'd. If it hasn't been hard-ACK'd, the ACK packet will cause it to get retransmitted, so the call will just be repeated.
(3) Make afs_select_fileserver() treat -ENETRESET as a straight fail of the operation.
(4) Prioritise the error code over things like -ECONNRESET as the server did actually respond.
(5) Make writeback treat -ENETRESET as a retryable error and make it redirty all the pages involved in a write so that the VM will retry.
Note that there is still a circumstance that I can't easily deal with: if the operation is fully received and processed by the server, but the reply is lost due to address change. There's no way to know if the op happened. We can examine the server, but a conflicting change could have been made by a third party - and we can't tell the difference. In such a case, a message like:
kAFS: vnode modified {100058:146266} b7->b8 YFS.StoreData64 (op=2646a)will be logged to dmesg on the next op to touch the file and the client will reset the inode state, including invalidating clean parts of the pagecache.
--- fs/afs/misc.c | 5 ++++- fs/afs/rotate.c | 4 ++++ fs/afs/write.c | 1 + net/rxrpc/input.c | 27 +++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 1 deletion(-)
fs/afs/misc.c +4 -1
@@ -163,8 +163,11 @@ void afs_prioritise_error(struct afs_error *e, int error, u32 abort_code)return ;case -ECONNABORTED : + error =afs_abort_to_error (abort_code); + fallthrough; +case -ENETRESET :/* Responded, but we seem to have changed address */ e->responded = true; - e->error =afs_abort_to_error (abort_code); + e->error = error;return ; } }
fs/afs/rotate.c +4 -0
@@ -292,6 +292,10 @@ bool afs_select_fileserver(struct afs_operation *op) op->error = error; goto iterate_address; +case -ENETRESET : +pr_warn ("kAFS: Peer reset %s (op=%x)\n" , + op->type ? op->type->name :"???" , op->debug_id); + fallthrough;case -ECONNRESET :_debug ("call reset" ); op->error = error;
fs/afs/write.c +1 -0
@@ -636,6 +636,7 @@ static ssize_t afs_write_back_from_locked_folio(struct address_space *mapping,case -EKEYEXPIRED :case -EKEYREJECTED :case -EKEYREVOKED : +case -ENETRESET :afs_redirty_pages (wbc, mapping, start, len);mapping_set_error (mapping, ret);break ;
net/rxrpc/input.c +27 -0
@@ -903,6 +903,33 @@ static void rxrpc_input_ack(struct rxrpc_call *call, struct sk_buff *skb) rxrpc_propose_ack_respond_to_ack); } +/* If we get an EXCEEDS_WINDOW ACK from the server, it probably +* indicates that the client address changed due to NAT. The server +* lost the call because it switched to a different peer. +*/ +if (unlikely (buf.ack.reason ==RXRPC_ACK_EXCEEDS_WINDOW ) && + first_soft_ack ==1 && + prev_pkt ==0 && +rxrpc_is_client_call (call)) { +rxrpc_set_call_completion (call,RXRPC_CALL_REMOTELY_ABORTED , +0 , -ENETRESET ); +return ; + } + +/* If we get an OUT_OF_SEQUENCE ACK from the server, that can also +* indicate a change of address. However, we can retransmit the call +* if we still have it buffered to the beginning. +*/ +if (unlikely (buf.ack.reason ==RXRPC_ACK_OUT_OF_SEQUENCE ) && + first_soft_ack ==1 && + prev_pkt ==0 && + call->tx_hard_ack ==0 && +rxrpc_is_client_call (call)) { +rxrpc_set_call_completion (call,RXRPC_CALL_REMOTELY_ABORTED , +0 , -ENETRESET ); +return ; + } +/* Discard any out-of-order or duplicate ACKs (outside lock). */ if (!rxrpc_is_ack_valid (call, first_soft_ack, prev_pkt)) { trace_rxrpc_rx_discard_ack(call->debug_id, ack_serial,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 202/879 eth: tg3: silence the GCC 12 array-bounds warning
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit 9dec850fd7c210a04b4707df8e6c95bfafdd6a4b ]
GCC 12 currently generates a rather inconsistent warning:
drivers/net/ethernet/broadcom/tg3.c:17795:51: warning: array subscript 5 is above array bounds of ‘struct tg3_napi[5]’ [-Warray-bounds]
17795 | struct tg3_napi *tnapi = &tp->napi[i];
| ~~~~~~~~^~~
i is guaranteed < tp->irq_max which in turn is either 1 or 5. There are more loops like this one in the driver, but strangely GCC 12 dislikes only this single one.
Silence this silliness for now.
--- drivers/net/ethernet/broadcom/Makefile | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/ethernet/broadcom/Makefile +5 -0
@@ -17,3 +17,8 @@ obj-$(CONFIG_BGMAC_BCMA) += bgmac-bcma.o bgmac-bcma-mdio.o obj-$(CONFIG_BGMAC_PLATFORM) += bgmac-platform.o obj-$(CONFIG_SYSTEMPORT) += bcmsysport.o obj-$(CONFIG_BNXT) += bnxt/ + +# FIXME: temporarily silence -Warray-bounds on non W=1+ builds +ifndef KBUILD_EXTRA_WARN +CFLAGS_tg3.o += -Wno-array-bounds +endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 203/879 char: tpm: cr50_i2c: Suppress duplicated error message in .remove()
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit e0687fe958f763f1790f22ed5483025b7624e744 ]
Returning an error value in an i2c remove callback results in an error message being emitted by the i2c core, but otherwise it doesn't make a difference. The device goes away anyhow and the devm cleanups are called.
As tpm_cr50_i2c_remove() emits an error message already and the additional error message by the i2c core doesn't add any useful information, change the return value to zero to suppress this error message.
Note that if i2c_clientdata is NULL, there is something really fishy. Assuming no memory corruption happened (then all bets are lost anyhow), tpm_cr50_i2c_remove() is only called after tpm_cr50_i2c_probe() returned successfully. So there was a tpm chip registered before and after tpm_cr50_i2c_remove() its privdata is freed but the associated character device isn't removed. If after that happened userspace accesses the character device it's likely that the freed memory is accessed. For that reason the warning message is made a bit more frightening.
--- drivers/char/tpm/tpm_tis_i2c_cr50.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm_tis_i2c_cr50.c +2 -2
@@ -768,8 +768,8 @@ static int tpm_cr50_i2c_remove(struct i2c_client *client)struct device *dev = &client->dev;if (!chip) { -dev_err (dev,"Could not get client data at remove\n" ); -return -ENODEV ; +dev_crit (dev,"Could not get client data at remove, memory corruption ahead\n" ); +return 0 ; }tpm_chip_unregister (chip);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 204/879 selftests/bpf: fix btf_dump/btf_dump due to recent clang change
In reply to Greg Kroah-HartmanFrom: Yonghong Song <[email protected]>
[ Upstream commit 4050764cbaa25760aab40857f723393c07898474 ]
Latest llvm-project upstream had a change of behavior related to qualifiers on function return type ([1]). This caused selftests btf_dump/btf_dump failure. The following example shows what changed.
$ cat t.c
typedef const char * const (* const (* const fn_ptr_arr2_t[5])())(char * (*)(int));
struct t {
int a;
fn_ptr_arr2_t l;
};
int foo(struct t *arg) {
return arg->a;
}Compiled with latest upstream llvm15,
$ clang -O2 -g -target bpf -S -emit-llvm t.c
The related generated debuginfo IR looks like:
!16 = !DIDerivedType(tag: DW_TAG_typedef, name: "fn_ptr_arr2_t", file: !1, line: 1, baseType: !17)
!17 = !DICompositeType(tag: DW_TAG_array_type, baseType: !18, size: 320, elements: !32)
!18 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !19)
!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64)
!20 = !DISubroutineType(types: !21)
!21 = !{!22, null}
!22 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !23, size: 64)
!23 = !DISubroutineType(types: !24)
!24 = !{!25, !28}
!25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !26, size: 64)
!26 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !27)
!27 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
You can see two intermediate const qualifier to pointer are dropped in debuginfo IR.With llvm14, we have following debuginfo IR:
!16 = !DIDerivedType(tag: DW_TAG_typedef, name: "fn_ptr_arr2_t", file: !1, line: 1, baseType: !17) !17 = !DICompositeType(tag: DW_TAG_array_type, baseType: !18, size: 320, elements: !34) !18 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !19)
!19 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !20, size: 64)
!20 = !DISubroutineType(types: !21)
!21 = !{!22, null}
!22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !23)
!23 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !24, size: 64)
!24 = !DISubroutineType(types: !25)
!25 = !{!26, !30}
!26 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !27)
!27 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !28, size: 64)
!28 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !29)
!29 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
All const qualifiers are preserved.
To adapt the selftest to both old and new llvm, this patch removed the intermediate const qualifier in const-to-ptr types, to make the test succeed again.
[1] https://reviews.llvm.org/D125919
--- tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/progs/btf_dump_test_case_syntax.c +1 -1
@@ -94,7 +94,7 @@ typedef void (* (*signal_t)(int, void (*)(int)))(int);typedef char * (*fn_ptr_arr1_t [10 ])(int **); -typedef char * (*const (*const fn_ptr_arr2_t [5 ])())(char * (*)(int )); +typedef char * (* (*const fn_ptr_arr2_t [5 ])())(char * (*)(int ));struct struct_w_typedefs {int_t a;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 205/879 gfs2: use i_lock spin_lock for inode qadata
In reply to Greg Kroah-HartmanFrom: Bob Peterson <[email protected]>
[ Upstream commit 5fcff61eea9efd1f4b60e89d2d686b5feaea100f ]
Before this patch, functions gfs2_qa_get and _put used the i_rw_mutex to prevent simultaneous access to its i_qadata. But i_rw_mutex is now used for many other things, including iomap_begin and end, which causes a conflict according to lockdep. We cannot just remove the lock since simultaneous opens (gfs2_open -> gfs2_open_common -> gfs2_qa_get) can then stomp on each others values for i_qadata.
This patch solves the conflict by using the i_lock spin_lock in the inode to prevent simultaneous access.
--- fs/gfs2/quota.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-)
fs/gfs2/quota.c +20 -12
@@ -531,34 +531,42 @@ static void qdsb_put(struct gfs2_quota_data *qd)*/ int gfs2_qa_get (struct gfs2_inode *ip) { -int error =0 ;struct gfs2_sbd *sdp =GFS2_SB (&ip->i_inode); +struct inode *inode = &ip->i_inode;if (sdp->sd_args.ar_quota ==GFS2_QUOTA_OFF )return 0 ; -down_write (&ip->i_rw_mutex); +spin_lock (&inode->i_lock);if (ip->i_qadata ==NULL ) { - ip->i_qadata =kmem_cache_zalloc (gfs2_qadata_cachep,GFP_NOFS ); -if (!ip->i_qadata) { - error = -ENOMEM ; - goto out; - } +struct gfs2_qadata *tmp; + +spin_unlock (&inode->i_lock); + tmp =kmem_cache_zalloc (gfs2_qadata_cachep,GFP_NOFS ); +if (!tmp) +return -ENOMEM ; + +spin_lock (&inode->i_lock); +if (ip->i_qadata ==NULL ) + ip->i_qadata = tmp; +else +kmem_cache_free (gfs2_qadata_cachep, tmp); } ip->i_qadata->qa_ref++; -out: -up_write (&ip->i_rw_mutex); -return error; +spin_unlock (&inode->i_lock); +return 0 ; }void gfs2_qa_put (struct gfs2_inode *ip) { -down_write (&ip->i_rw_mutex); +struct inode *inode = &ip->i_inode; + +spin_lock (&inode->i_lock);if (ip->i_qadata && --ip->i_qadata->qa_ref ==0 ) {kmem_cache_free (gfs2_qadata_cachep, ip->i_qadata); ip->i_qadata =NULL ; } -up_write (&ip->i_rw_mutex); +spin_unlock (&inode->i_lock); }int gfs2_quota_hold (struct gfs2_inode *ip,kuid_t uid,kgid_t gid)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 206/879 linux/types.h: reinstate "__bitwise__" macro for user space use
In reply to Greg Kroah-HartmanFrom: Linus Torvalds <[email protected]>
[ Upstream commit caa28984163cb63ea0be4cb8dbf05defdc7303f9 ]
Commit c724c866bb70 ("linux/types.h: remove unnecessary __bitwise__") was right that there are no users of __bitwise__ in the kernel, but it turns out there are user space users of it that do expect it.
It is, after all, in the uapi directory, so user space usage is to be expected.
Instead of reverting the commit completely, let's just clarify the situation so that it doesn't happen again, and have some in-code explanations for why that "__bitwise__" still exists.
--- include/uapi/linux/types.h | 3 +++ 1 file changed, 3 insertions(+)
include/uapi/linux/types.h +3 -0
@@ -26,6 +26,9 @@#define __bitwise#endif +/* The kernel doesn't use this legacy form, but user space does */ +#define __bitwise__ __bitwise +typedef __u16 __bitwise __le16 ;typedef __u16 __bitwise __be16 ;typedef __u32 __bitwise __le32 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 207/879 scsi: target: tcmu: Avoid holding XArray lock when calling lock_page
In reply to Greg Kroah-HartmanFrom: Bodo Stroesser <[email protected]>
[ Upstream commit 325d5c5fb216674296f3902a8902b942da3adc5b ]
In tcmu_blocks_release(), lock_page() is called to prevent a race causing possible data corruption. Since lock_page() might sleep, calling it while holding XArray lock is a bug.
To fix this, replace the xas_for_each() call with xa_for_each_range(). Since the latter does its own handling of XArray locking, the xas_lock() and xas_unlock() calls around the original loop are no longer necessary.
The switch to xa_for_each_range() slows down the loop slightly. This is acceptable since tcmu_blocks_release() is not relevant for performance.
--- drivers/target/target_core_user.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/target/target_core_user.c +5 -5
@@ -1661,13 +1661,14 @@ static int tcmu_check_and_free_pending_cmd(struct tcmu_cmd *cmd)static u32 tcmu_blocks_release (struct tcmu_dev *udev,unsigned long first,unsigned long last) { -XA_STATE (xas, &udev->data_pages, first * udev->data_pages_per_blk);struct page *page; +unsigned long dpi;u32 pages_freed =0 ; -xas_lock (&xas); -xas_for_each (&xas, page, (last +1 ) * udev->data_pages_per_blk -1 ) { -xas_store (&xas,NULL ); + first = first * udev->data_pages_per_blk; + last = (last +1 ) * udev->data_pages_per_blk -1 ; +xa_for_each_range (&udev->data_pages, dpi, page, first, last) { +xa_erase (&udev->data_pages, dpi);/* * While reaching here there may be page faults occurring on * the to-be-released pages. A race condition may occur if
@@ -1691,7 +1692,6 @@ static u32 tcmu_blocks_release(struct tcmu_dev *udev, unsigned long first,__free_page (page); pages_freed++; } -xas_unlock (&xas);atomic_sub (pages_freed, &global_page_count);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 208/879 kunit: fix executor OOM error handling logic on non-UML
In reply to Greg Kroah-HartmanFrom: Daniel Latypov <[email protected]>
[ Upstream commit 1b11063d32d7e11366e48be64215ff517ce32217 ]
The existing logic happens to work fine on UML, but is not correct when running on other arches.
1. We didn't initialize int err, and kunit_filter_suites() doesn't explicitly set it to 0 on success. So we had false "failures".
Note: it doesn't happen on UML, causing this to get overlooked.
2. If we error out, we do not call kunit_handle_shutdown(). This makes kunit.py timeout when using a non-UML arch, since the QEMU process doesn't ever exit.
--- lib/kunit/executor.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
lib/kunit/executor.c +5 -4
@@ -247,13 +247,13 @@ int kunit_run_all_tests(void) .start = __kunit_suites_start, .end = __kunit_suites_end, }; -int err; +int err =0 ;if (filter_glob_param) { suite_set =kunit_filter_suites (&suite_set, filter_glob_param, &err);if (err) {pr_err ("kunit executor: error filtering suites: %d\n" , err); -return err; + goto out; } }
@@ -268,9 +268,10 @@ int kunit_run_all_tests(void)kunit_free_suite_set (suite_set); } -kunit_handle_shutdown (); -return 0 ; +out: +kunit_handle_shutdown (); +return err; }#if IS_BUILTIN (CONFIG_KUNIT_TEST )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 209/879 IB/rdmavt: add missing locks in rvt_ruc_loopback
In reply to Greg Kroah-HartmanFrom: Niels Dossche <[email protected]>
[ Upstream commit 22cbc6c2681a0a4fe76150270426e763d52353a4 ]
The documentation of the function rvt_error_qp says both r_lock and s_lock need to be held when calling that function.
It also asserts using lockdep that both of those locks are held. rvt_error_qp is called form rvt_send_cq, which is called from rvt_qp_complete_swqe, which is called from rvt_send_complete, which is called from rvt_ruc_loopback in two places. Both of these places do not hold r_lock. Fix this by acquiring a spin_lock of r_lock in both of these places.
The r_lock acquiring cannot be added in rvt_qp_complete_swqe because some of its other callers already have r_lock acquired.
--- drivers/infiniband/sw/rdmavt/qp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/infiniband/sw/rdmavt/qp.c +5 -1
@@ -2775,7 +2775,7 @@ void rvt_qp_iter(struct rvt_dev_info *rdi,EXPORT_SYMBOL (rvt_qp_iter);/* -* This should be called with s_lock held. +* This should be called with s_lock and r_lock held. */ void rvt_send_complete (struct rvt_qp *qp,struct rvt_swqe *wqe,enum ib_wc_status status)
@@ -3134,7 +3134,9 @@ void rvt_ruc_loopback(struct rvt_qp *sqp) rvp->n_loop_pkts++; flush_send: sqp->s_rnr_retry = sqp->s_rnr_retry_cnt; +spin_lock (&sqp->r_lock);rvt_send_complete (sqp, wqe, send_status); +spin_unlock (&sqp->r_lock);if (local_ops) {atomic_dec (&sqp->local_ops_pending); local_ops =0 ;
@@ -3188,7 +3190,9 @@ void rvt_ruc_loopback(struct rvt_qp *sqp)spin_unlock_irqrestore (&qp->r_lock, flags); serr_no_r_lock:spin_lock_irqsave (&sqp->s_lock, flags); +spin_lock (&sqp->r_lock);rvt_send_complete (sqp, wqe, send_status); +spin_unlock (&sqp->r_lock);if (sqp->ibqp.qp_type ==IB_QPT_RC ) {int lastwqe;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 210/879 PCI/ASPM: Make Intel DG2 L1 acceptable latency unlimited
In reply to Greg Kroah-HartmanFrom: Mika Westerberg <[email protected]>
[ Upstream commit 03038d84ace72678a9944524508f218a00377dc0 ]
Intel DG2 discrete graphics PCIe endpoints advertise L1 acceptable exit latency to be < 1us even though they can actually tolerate unlimited exit latencies just fine. Quirk the L1 acceptable exit latency for these endpoints to be unlimited so ASPM L1 can be enabled.
--- drivers/pci/quirks.c | 47 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+)
drivers/pci/quirks.c +47 -0
@@ -12,6 +12,7 @@* file, where their drivers can use them. */ +#include <linux/bitfield.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/export.h>
@@ -5895,3 +5896,49 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_INTEL, 0x1533, rom_bar_overlap_defect);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x1536 , rom_bar_overlap_defect);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x1537 , rom_bar_overlap_defect);DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x1538 , rom_bar_overlap_defect); + +#ifdef CONFIG_PCIEASPM +/* +* Several Intel DG2 graphics devices advertise that they can only tolerate +* 1us latency when transitioning from L1 to L0, which may prevent ASPM L1 +* from being enabled. But in fact these devices can tolerate unlimited +* latency. Override their Device Capabilities value to allow ASPM L1 to +* be enabled. +*/ +static void aspm_l1_acceptable_latency (struct pci_dev *dev) +{ +u32 l1_lat =FIELD_GET (PCI_EXP_DEVCAP_L1 , dev->devcap); + +if (l1_lat <7 ) { + dev->devcap |=FIELD_PREP (PCI_EXP_DEVCAP_L1 ,7 ); +pci_info (dev,"ASPM: overriding L1 acceptable latency from %#x to 0x7\n" , + l1_lat); + } +} +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f80 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f81 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f82 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f83 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f84 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f85 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f86 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f87 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x4f88 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x5690 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x5691 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x5692 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x5693 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x5694 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x5695 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56a0 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56a1 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56a2 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56a3 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56a4 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56a5 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56a6 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56b0 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56b1 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56c0 , aspm_l1_acceptable_latency); +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,0x56c1 , aspm_l1_acceptable_latency); +#endif
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 211/879 ARM: dts: ox820: align interrupt controller node name with dtschema
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit fbcd5ad7a419ad40644a0bb8b4152bc660172d8a ]
Fixes dtbs_check warnings like:
gic@1000: $nodename:0: 'gic@1000' does not match '^interrupt-controller(@[0-9a-f,]+)*$'
--- arch/arm/boot/dts/ox820.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/ox820.dtsi +1 -1
@@ -287,7 +287,7 @@ clocks = <&armclk>; }; - gic: gic@1000 { + gic: interrupt-controller@1000 { compatible = "arm,arm11mp-gic"; interrupt-controller; #interrupt-cells = <3>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 212/879 ARM: dts: socfpga: align interrupt controller node name with dtschema
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit c9bdd50d2019f78bf4c1f6a79254c27771901023 ]
Fixes dtbs_check warnings like:
$nodename:0: 'intc@fffed000' does not match '^interrupt-controller(@[0-9a-f,]+)*$'
--- arch/arm/boot/dts/socfpga.dtsi | 2 +- arch/arm/boot/dts/socfpga_arria10.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/socfpga.dtsi +1 -1
@@ -46,7 +46,7 @@ <0xff113000 0x1000>; }; - intc: intc@fffed000 { + intc: interrupt-controller@fffed000 { compatible = "arm,cortex-a9-gic"; #interrupt-cells = <3>; interrupt-controller;
arch/arm/boot/dts/socfpga_arria10.dtsi +1 -1
@@ -38,7 +38,7 @@ <0xff113000 0x1000>; }; - intc: intc@ffffd000 { + intc: interrupt-controller@ffffd000 { compatible = "arm,cortex-a9-gic"; #interrupt-cells = <3>; interrupt-controller;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 213/879 ARM: dts: s5pv210: align DMA channels with dtschema
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit 9e916fb9bc3d16066286f19fc9c51d26a6aec6bd ]
dtschema expects DMA channels in specific order (tx, rx and tx-sec). The order actually should not matter because dma-names is used however let's make it aligned with dtschema to suppress warnings like:
i2s@eee30000: dma-names: ['rx', 'tx', 'tx-sec'] is not valid under any of the given schemas
--- arch/arm/boot/dts/s5pv210-aries.dtsi | 2 +- arch/arm/boot/dts/s5pv210.dtsi | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-)
arch/arm/boot/dts/s5pv210-aries.dtsi +1 -1
@@ -636,7 +636,7 @@ }; &i2s0 { - dmas = <&pdma0 9>, <&pdma0 10>, <&pdma0 11>; + dmas = <&pdma0 10>, <&pdma0 9>, <&pdma0 11>; status = "okay"; };
arch/arm/boot/dts/s5pv210.dtsi +6 -6
@@ -239,8 +239,8 @@ reg = <0xeee30000 0x1000>; interrupt-parent = <&vic2>; interrupts = <16>; - dma-names = "rx", "tx", "tx-sec"; - dmas = <&pdma1 9>, <&pdma1 10>, <&pdma1 11>; + dma-names = "tx", "rx", "tx-sec"; + dmas = <&pdma1 10>, <&pdma1 9>, <&pdma1 11>; clock-names = "iis", "i2s_opclk0", "i2s_opclk1";
@@ -259,8 +259,8 @@ reg = <0xe2100000 0x1000>; interrupt-parent = <&vic2>; interrupts = <17>; - dma-names = "rx", "tx"; - dmas = <&pdma1 12>, <&pdma1 13>; + dma-names = "tx", "rx"; + dmas = <&pdma1 13>, <&pdma1 12>; clock-names = "iis", "i2s_opclk0"; clocks = <&clocks CLK_I2S1>, <&clocks SCLK_AUDIO1>; pinctrl-names = "default";
@@ -274,8 +274,8 @@ reg = <0xe2a00000 0x1000>; interrupt-parent = <&vic2>; interrupts = <18>; - dma-names = "rx", "tx"; - dmas = <&pdma1 14>, <&pdma1 15>; + dma-names = "tx", "rx"; + dmas = <&pdma1 15>, <&pdma1 14>; clock-names = "iis", "i2s_opclk0"; clocks = <&clocks CLK_I2S2>, <&clocks SCLK_AUDIO2>; pinctrl-names = "default";
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 214/879 ASoC: amd: Add driver data to acp6x machine driver
In reply to Greg Kroah-HartmanFrom: Mario Limonciello <[email protected]>
[ Upstream commit e521f087780d07731e8c950f2f34d08358c86bc9 ]
Currently all of the quirked systems use the same card and so the DMI quirk list doesn't contain driver data.
Add driver data to these quirks and then check the data was present or not. This will allow potentially setting quirks for systems with faulty firmware that claims to have a DMIC but doesn't really.
--- sound/soc/amd/yc/acp6x-mach.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-)
sound/soc/amd/yc/acp6x-mach.c +25 -4
@@ -45,108 +45,126 @@ static struct snd_soc_card acp6x_card = {static const struct dmi_system_id yc_acp_quirk_table[] = { { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21D2" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21D3" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21D4" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21D5" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21CF" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21CG" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21CQ" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21CR" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21AW" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21AX" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21BN" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21BQ" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21CH" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21CJ" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21CK" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21CL" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21D8" ), } }, { + .driver_data = &acp6x_card, .matches = {DMI_MATCH (DMI_BOARD_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_NAME ,"21D9" ),
@@ -157,18 +175,21 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {static int acp6x_probe (struct platform_device *pdev) { +const struct dmi_system_id *dmi_id;struct acp6x_pdm *machine =NULL ;struct snd_soc_card *card;int ret; -const struct dmi_system_id *dmi_id; +/* check for any DMI overrides */ dmi_id =dmi_first_match (yc_acp_quirk_table); -if (!dmi_id) +if (dmi_id) +platform_set_drvdata (pdev, dmi_id->driver_data); + + card =platform_get_drvdata (pdev); +if (!card)return -ENODEV ; - card = &acp6x_card; acp6x_card.dev = &pdev->dev; -platform_set_drvdata (pdev, card);snd_soc_card_set_drvdata (card, machine); ret =devm_snd_soc_register_card (&pdev->dev, card);if (ret) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 215/879 arm64: dts: qcom: msm8994: Fix the cont_splash_mem address
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 049c46f31a726bf8d202ff1681661513447fac84 ]
The default memory map places cont_splash_mem at 3401000, which was overlooked.. Fix it!
--- arch/arm64/boot/dts/qcom/msm8994.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8994.dtsi +2 -2
@@ -183,8 +183,8 @@ no-map; }; - cont_splash_mem: memory@3800000 { - reg = <0 0x03800000 0 0x2400000>; + cont_splash_mem: memory@3401000 { + reg = <0 0x03401000 0 0x2200000>; no-map; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 216/879 arm64: dts: qcom: msm8994: Fix BLSP[12]_DMA channels count
In reply to Greg Kroah-HartmanFrom: Konrad Dybcio <[email protected]>
[ Upstream commit 1ae438d26b620979ed004d559c304d31c42173ae ]
MSM8994 actually features 24 DMA channels for each BLSP, fix it!
--- arch/arm64/boot/dts/qcom/msm8994.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm64/boot/dts/qcom/msm8994.dtsi +2 -2
@@ -498,7 +498,7 @@ #dma-cells = <1>; qcom,ee = <0>; qcom,controlled-remotely; - num-channels = <18>; + num-channels = <24>; qcom,num-ees = <4>; };
@@ -634,7 +634,7 @@ #dma-cells = <1>; qcom,ee = <0>; qcom,controlled-remotely; - num-channels = <18>; + num-channels = <24>; qcom,num-ees = <4>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 217/879 PM / devfreq: rk3399_dmc: Disable edev on remove()
In reply to Greg Kroah-HartmanFrom: Brian Norris <[email protected]>
[ Upstream commit 2fccf9e6050e0e3b8b4cd275d41daf7f7fa22804 ]
Otherwise we hit an unablanced enable-count when unbinding the DFI device:
[ 1279.659119] ------------[ cut here ]------------ [ 1279.659179] WARNING: CPU: 2 PID: 5638 at drivers/devfreq/devfreq-event.c:360 devfreq_event_remove_edev+0x84/0x8c ... [ 1279.659352] Hardware name: Google Kevin (DT) [ 1279.659363] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO BTYPE=--) [ 1279.659371] pc : devfreq_event_remove_edev+0x84/0x8c [ 1279.659380] lr : devm_devfreq_event_release+0x1c/0x28 ... [ 1279.659571] Call trace: [ 1279.659582] devfreq_event_remove_edev+0x84/0x8c [ 1279.659590] devm_devfreq_event_release+0x1c/0x28 [ 1279.659602] release_nodes+0x1cc/0x244 [ 1279.659611] devres_release_all+0x44/0x60 [ 1279.659621] device_release_driver_internal+0x11c/0x1ac [ 1279.659629] device_driver_detach+0x20/0x2c [ 1279.659641] unbind_store+0x7c/0xb0 [ 1279.659650] drv_attr_store+0x2c/0x40 [ 1279.659663] sysfs_kf_write+0x44/0x58 [ 1279.659672] kernfs_fop_write_iter+0xf4/0x190 [ 1279.659684] vfs_write+0x2b0/0x2e4 [ 1279.659693] ksys_write+0x80/0xec [ 1279.659701] __arm64_sys_write+0x24/0x30 [ 1279.659714] el0_svc_common+0xf0/0x1d8 [ 1279.659724] do_el0_svc_compat+0x28/0x3c [ 1279.659738] el0_svc_compat+0x10/0x1c [ 1279.659746] el0_sync_compat_handler+0xa8/0xcc [ 1279.659758] el0_sync_compat+0x188/0x1c0 [ 1279.659768] ---[ end trace cec200e5094155b4 ]---
--- drivers/devfreq/rk3399_dmc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/devfreq/rk3399_dmc.c +2 -0
@@ -477,6 +477,8 @@ static int rk3399_dmcfreq_remove(struct platform_device *pdev) {struct rk3399_dmcfreq *dmcfreq =dev_get_drvdata (&pdev->dev); +devfreq_event_disable_edev (dmcfreq->edev); +/* * Before remove the opp table we need to unregister the opp notifier. */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 218/879 crypto: ccree - use fine grained DMA mapping dir
In reply to Greg Kroah-HartmanFrom: Gilad Ben-Yossef <[email protected]>
[ Upstream commit a260436c98171cd825955a84a7f6e62bc8f4f00d ]
Use a fine grained specification of DMA mapping directions in certain cases, allowing both a more optimized operation as well as shushing out a harmless, though persky dma-debug warning.
--- drivers/crypto/ccree/cc_buffer_mgr.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/crypto/ccree/cc_buffer_mgr.c +15 -12
@@ -356,12 +356,14 @@ void cc_unmap_cipher_request(struct device *dev, void *ctx, req_ctx->mlli_params.mlli_dma_addr); } -dma_unmap_sg (dev, src, req_ctx->in_nents,DMA_BIDIRECTIONAL ); -dev_dbg (dev,"Unmapped req->src=%pK\n" ,sg_virt (src)); -if (src != dst) { -dma_unmap_sg (dev, dst, req_ctx->out_nents,DMA_BIDIRECTIONAL ); +dma_unmap_sg (dev, src, req_ctx->in_nents,DMA_TO_DEVICE ); +dma_unmap_sg (dev, dst, req_ctx->out_nents,DMA_FROM_DEVICE );dev_dbg (dev,"Unmapped req->dst=%pK\n" ,sg_virt (dst)); +dev_dbg (dev,"Unmapped req->src=%pK\n" ,sg_virt (src)); + }else { +dma_unmap_sg (dev, src, req_ctx->in_nents,DMA_BIDIRECTIONAL ); +dev_dbg (dev,"Unmapped req->src=%pK\n" ,sg_virt (src)); } }
@@ -377,6 +379,7 @@ int cc_map_cipher_request(struct cc_drvdata *drvdata, void *ctx,u32 dummy =0 ;int rc =0 ;u32 mapped_nents =0 ; +int src_direction = (src != dst ?DMA_TO_DEVICE :DMA_BIDIRECTIONAL ); req_ctx->dma_buf_type =CC_DMA_BUF_DLLI ; mlli_params->curr_pool =NULL ;
@@ -399,7 +402,7 @@ int cc_map_cipher_request(struct cc_drvdata *drvdata, void *ctx, }/* Map the src SGL */ - rc =cc_map_sg (dev, src, nbytes,DMA_BIDIRECTIONAL , &req_ctx->in_nents, + rc =cc_map_sg (dev, src, nbytes, src_direction, &req_ctx->in_nents,LLI_MAX_NUM_OF_DATA_ENTRIES , &dummy, &mapped_nents);if (rc) goto cipher_exit;
@@ -416,7 +419,7 @@ int cc_map_cipher_request(struct cc_drvdata *drvdata, void *ctx, } }else {/* Map the dst sg */ - rc =cc_map_sg (dev, dst, nbytes,DMA_BIDIRECTIONAL , + rc =cc_map_sg (dev, dst, nbytes,DMA_FROM_DEVICE , &req_ctx->out_nents,LLI_MAX_NUM_OF_DATA_ENTRIES , &dummy, &mapped_nents);if (rc)
@@ -456,6 +459,7 @@ void cc_unmap_aead_request(struct device *dev, struct aead_request *req)struct aead_req_ctx *areq_ctx =aead_request_ctx (req);unsigned int hw_iv_size = areq_ctx->hw_iv_size;struct cc_drvdata *drvdata =dev_get_drvdata (dev); +int src_direction = (req->src != req->dst ?DMA_TO_DEVICE :DMA_BIDIRECTIONAL );if (areq_ctx->mac_buf_dma_addr) { dma_unmap_single(dev, areq_ctx->mac_buf_dma_addr,
@@ -514,13 +518,11 @@ void cc_unmap_aead_request(struct device *dev, struct aead_request *req)sg_virt (req->src), areq_ctx->src.nents, areq_ctx->assoc.nents, areq_ctx->assoclen, req->cryptlen); -dma_unmap_sg (dev, req->src, areq_ctx->src.mapped_nents, -DMA_BIDIRECTIONAL ); +dma_unmap_sg (dev, req->src, areq_ctx->src.mapped_nents, src_direction);if (req->src != req->dst) {dev_dbg (dev,"Unmapping dst sgl: req->dst=%pK\n" ,sg_virt (req->dst)); -dma_unmap_sg (dev, req->dst, areq_ctx->dst.mapped_nents, -DMA_BIDIRECTIONAL ); +dma_unmap_sg (dev, req->dst, areq_ctx->dst.mapped_nents,DMA_FROM_DEVICE ); } if (drvdata->coherent && areq_ctx->gen_ctx.op_type == DRV_CRYPTO_DIRECTION_DECRYPT &&
@@ -843,7 +845,7 @@ static int cc_aead_chain_data(struct cc_drvdata *drvdata,else size_for_map -= authsize; - rc =cc_map_sg (dev, req->dst, size_for_map,DMA_BIDIRECTIONAL , + rc =cc_map_sg (dev, req->dst, size_for_map,DMA_FROM_DEVICE , &areq_ctx->dst.mapped_nents,LLI_MAX_NUM_OF_DATA_ENTRIES , &dst_last_bytes, &dst_mapped_nents);
@@ -1056,7 +1058,8 @@ int cc_map_aead_request(struct cc_drvdata *drvdata, struct aead_request *req) size_to_map += authsize; } - rc = cc_map_sg(dev, req->src, size_to_map, DMA_BIDIRECTIONAL, + rc = cc_map_sg(dev, req->src, size_to_map, + (req->src != req->dst ? DMA_TO_DEVICE : DMA_BIDIRECTIONAL), &areq_ctx->src.mapped_nents, (LLI_MAX_NUM_OF_ASSOC_DATA_ENTRIES + LLI_MAX_NUM_OF_DATA_ENTRIES),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 219/879 crypto: qat - fix off-by-one error in PFVF debug print
In reply to Greg Kroah-HartmanFrom: Marco Chiappero <[email protected]>
[ Upstream commit dd3d081b7ea6754913222ed0313fcf644edcc7e6 ]
PFVF Block Message requests for CRC use 0-based values to indicate amounts, which have to be remapped to 1-based values on the receiving side.
This patch fixes one debug print which was however using the wire value.
--- drivers/crypto/qat/qat_common/adf_pfvf_pf_proto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/crypto/qat/qat_common/adf_pfvf_pf_proto.c +1 -1
@@ -154,7 +154,7 @@ static struct pfvf_message handle_blkmsg_req(struct adf_accel_vf_info *vf_info, if (FIELD_GET(ADF_VF2PF_BLOCK_CRC_REQ_MASK, req.data)) { dev_dbg(&GET_DEV(vf_info->accel_dev), "BlockMsg of type %d for CRC over %d bytes received from VF%d\n", - blk_type, blk_byte, vf_info->vf_nr); + blk_type, blk_byte + 1, vf_info->vf_nr); if (!adf_pf2vf_blkmsg_get_data(vf_info, blk_type, blk_byte, byte_max, &resp_data,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 220/879 soc: ti: ti_sci_pm_domains: Check for null return of devm_kcalloc
In reply to Greg Kroah-HartmanFrom: QintaoShen <[email protected]>
[ Upstream commit ba56291e297d28aa6eb82c5c1964fae2d7594746 ]
The allocation funciton devm_kcalloc may fail and return a null pointer, which would cause a null-pointer dereference later.
It might be better to check it and directly return -ENOMEM just like the usage of devm_kcalloc in previous code.
--- drivers/soc/ti/ti_sci_pm_domains.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/soc/ti/ti_sci_pm_domains.c +2 -0
@@ -183,6 +183,8 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev)devm_kcalloc (dev, max_id +1 ,sizeof (*pd_provider->data.domains),GFP_KERNEL ); +if (!pd_provider->data.domains) +return -ENOMEM ; pd_provider->data.num_domains = max_id +1 ; pd_provider->data.xlate = ti_sci_pd_xlate;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 221/879 fs: jfs: fix possible NULL pointer dereference in dbFree()
In reply to Greg Kroah-HartmanFrom: Zixuan Fu <[email protected]>
[ Upstream commit 0d4837fdb796f99369cf7691d33de1b856bcaf1f ]
In our fault-injection testing, the variable "nblocks" in dbFree() can be zero when kmalloc_array() fails in dtSearch(). In this case, the variable
"mp" in dbFree() would be NULL and then it is dereferenced in
"write_metapage(mp)".
The failure log is listed as follows:
[ 13.824137] BUG: kernel NULL pointer dereference, address: 0000000000000020 ... [ 13.827416] RIP: 0010:dbFree+0x5f7/0x910 [jfs] [ 13.834341] Call Trace: [ 13.834540] <TASK> [ 13.834713] txFreeMap+0x7b4/0xb10 [jfs] [ 13.835038] txUpdateMap+0x311/0x650 [jfs] [ 13.835375] jfs_lazycommit+0x5f2/0xc70 [jfs] [ 13.835726] ? sched_dynamic_update+0x1b0/0x1b0 [ 13.836092] kthread+0x3c2/0x4a0 [ 13.836355] ? txLockFree+0x160/0x160 [jfs] [ 13.836763] ? kthread_unuse_mm+0x160/0x160 [ 13.837106] ret_from_fork+0x1f/0x30 [ 13.837402] </TASK>
...
This patch adds a NULL check of "mp" before "write_metapage(mp)" is called.
--- fs/jfs/jfs_dmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/jfs/jfs_dmap.c +2 -1
@@ -385,7 +385,8 @@ int dbFree(struct inode *ip, s64 blkno, s64 nblocks) }/* write the last buffer. */ -write_metapage (mp); +if (mp) +write_metapage (mp);IREAD_UNLOCK (ipbmap);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 222/879 arm64: dts: qcom: sdm845-xiaomi-beryllium: fix typo in panels vddio-supply property
In reply to Greg Kroah-HartmanFrom: Joel Selvaraj <[email protected]>
[ Upstream commit 1f1c494082a1f10d03ce4ee1485ee96d212e22ff ]
vddio is misspelled with a "0" instead of "o". Fix it.
--- arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium.dts +1 -1
@@ -218,7 +218,7 @@ panel@0 { compatible = "tianma,fhd-video"; reg = <0>; - vddi0-supply = <&vreg_l14a_1p8>; + vddio-supply = <&vreg_l14a_1p8>; vddpos-supply = <&lab>; vddneg-supply = <&ibb>;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 223/879 ALSA: usb-audio: Add quirk bits for enabling/disabling generic implicit fb
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 0f1f7a6661394fe4a53db254c346d6aa2dd64397 ]
For making easier to test, add the new quirk_flags bits 17 and 18 to enable and disable the generic implicit feedback mode. The bit 17 is equivalent with implicit_fb=1 option, applying the generic implicit feedback sync mode. OTOH, the bit 18 disables the implicit fb mode forcibly.
--- Documentation/sound/alsa-configuration.rst | 4 +++- sound/usb/implicit.c | 5 ++++- sound/usb/usbaudio.h | 6 ++++++ 3 files changed, 13 insertions(+), 2 deletions(-)
Documentation/sound/alsa-configuration.rst +3 -1
@@ -2246,7 +2246,7 @@ implicit_fb Apply the generic implicit feedback sync mode. When this is set and the playback stream sync mode is ASYNC, the driver tries to tie an adjacent ASYNC capture stream as the implicit feedback - source. + source. This is equivalent with quirk_flags bit 17. use_vmalloc Use vmalloc() for allocations of the PCM buffers (default: yes). For architectures with non-coherent memory like ARM or MIPS, the
@@ -2288,6 +2288,8 @@ quirk_flags * bit 14: Ignore errors for mixer access * bit 15: Support generic DSD raw U32_BE format * bit 16: Set up the interface at first like UAC1 + * bit 17: Apply the generic implicit feedback sync mode + * bit 18: Don't apply implicit feedback sync mode This module supports multiple devices, autoprobe and hotplugging.
sound/usb/implicit.c +4 -1
@@ -350,7 +350,8 @@ static int audioformat_implicit_fb_quirk(struct snd_usb_audio *chip, }/* Try the generic implicit fb if available */ -if (chip->generic_implicit_fb) +if (chip->generic_implicit_fb || + (chip->quirk_flags &QUIRK_FLAG_GENERIC_IMPLICIT_FB ))return add_generic_implicit_fb (chip, fmt, alts);/* No quirk */
@@ -387,6 +388,8 @@ int snd_usb_parse_implicit_fb_quirk(struct snd_usb_audio *chip, struct audioformat *fmt, struct usb_host_interface *alts) { +if (chip->quirk_flags &QUIRK_FLAG_SKIP_IMPLICIT_FB ) +return 0 ;if (fmt->endpoint &USB_DIR_IN )return audioformat_capture_quirk (chip, fmt, alts);else
sound/usb/usbaudio.h +6 -0
@@ -164,6 +164,10 @@ extern bool snd_usb_skip_validation;* Support generic DSD raw U32_BE format * QUIRK_FLAG_SET_IFACE_FIRST: * Set up the interface at first like UAC1 +* QUIRK_FLAG_GENERIC_IMPLICIT_FB +* Apply the generic implicit feedback sync mode (same as implicit_fb=1 option) +* QUIRK_FLAG_SKIP_IMPLICIT_FB +* Don't apply implicit feedback sync mode */ #define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0)
@@ -183,5 +187,7 @@ extern bool snd_usb_skip_validation;#define QUIRK_FLAG_IGNORE_CTL_ERROR (1U << 14)#define QUIRK_FLAG_DSD_RAW (1U << 15)#define QUIRK_FLAG_SET_IFACE_FIRST (1U << 16) +#define QUIRK_FLAG_GENERIC_IMPLICIT_FB (1U << 17) +#define QUIRK_FLAG_SKIP_IMPLICIT_FB (1U << 18)#endif /* __USBAUDIO_H */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 224/879 ALSA: usb-audio: Move generic implicit fb quirk entries into quirks.c
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 67d64069bc0867e52e73a1e255b17462005ca9b4 ]
Use the new quirk bits to manage the generic implicit fb quirk entries. This makes easier to compare with other devices.
--- sound/usb/implicit.c | 5 ----- sound/usb/quirks.c | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-)
sound/usb/implicit.c +0 -5
@@ -45,11 +45,6 @@ struct snd_usb_implicit_fb_match {/* Implicit feedback quirk table for playback */ static const struct snd_usb_implicit_fb_match playback_implicit_fb_quirks[] = { -/* Generic matching */ -IMPLICIT_FB_GENERIC_DEV (0x0499 ,0x1509 ),/* Steinberg UR22 */ -IMPLICIT_FB_GENERIC_DEV (0x0763 ,0x2030 ),/* M-Audio Fast Track C400 */ -IMPLICIT_FB_GENERIC_DEV (0x0763 ,0x2031 ),/* M-Audio Fast Track C600 */ -/* Fixed EP */ /* FIXME: check the availability of generic matching */ IMPLICIT_FB_FIXED_DEV (0x0763 ,0x2080 ,0x81 ,2 ),/* M-Audio FastTrack Ultra */
sound/usb/quirks.c +6 -0
@@ -1793,6 +1793,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_CTL_MSG_DELAY_1M | QUIRK_FLAG_IGNORE_CTL_ERROR),DEVICE_FLG (0x046d ,0x09a4 ,/* Logitech QuickCam E 3500 */ QUIRK_FLAG_CTL_MSG_DELAY_1M |QUIRK_FLAG_IGNORE_CTL_ERROR ), +DEVICE_FLG (0x0499 ,0x1509 ,/* Steinberg UR22 */ +QUIRK_FLAG_GENERIC_IMPLICIT_FB ),DEVICE_FLG (0x04d8 ,0xfeea ,/* Benchmark DAC1 Pre */ QUIRK_FLAG_GET_SAMPLE_RATE ), DEVICE_FLG(0x04e8, 0xa051, /* Samsung USBC Headset (AKG) */
@@ -1826,6 +1828,10 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_GET_SAMPLE_RATE),DEVICE_FLG (0x074d ,0x3553 ,/* Outlaw RR2150 (Micronas UAC3553B) */ QUIRK_FLAG_GET_SAMPLE_RATE ), +DEVICE_FLG (0x0763 ,0x2030 ,/* M-Audio Fast Track C400 */ +QUIRK_FLAG_GENERIC_IMPLICIT_FB ), +DEVICE_FLG (0x0763 ,0x2031 ,/* M-Audio Fast Track C600 */ +QUIRK_FLAG_GENERIC_IMPLICIT_FB ),DEVICE_FLG (0x08bb ,0x2702 ,/* LineX FM Transmitter */ QUIRK_FLAG_IGNORE_CTL_ERROR ), DEVICE_FLG(0x0951, 0x16ad, /* Kingston HyperX */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 225/879 ARM: OMAP1: clock: Fix UART rate reporting algorithm
In reply to Greg Kroah-HartmanFrom: Janusz Krzysztofik <[email protected]>
[ Upstream commit 338d5d476cde853dfd97378d20496baabc2ce3c0 ]
Since its introduction to the mainline kernel, omap1_uart_recalc() helper makes incorrect use of clk->enable_bit as a ready to use bitmap mask while it only provides the bit number. Fix it.
--- arch/arm/mach-omap1/clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-omap1/clock.c +1 -1
@@ -41,7 +41,7 @@ static DEFINE_SPINLOCK(clockfw_lock);unsigned long omap1_uart_recalc (struct clk *clk) {unsigned int val =__raw_readl (clk->enable_reg); -return val & clk->enable_bit ?48000000 :12000000 ; +return val &1 << clk->enable_bit ?48000000 :12000000 ; }unsigned long omap1_sossi_recalc (struct clk *clk)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 226/879 powerpc/fadump: Fix fadump to work with a different endian capture kernel
In reply to Greg Kroah-HartmanFrom: Hari Bathini <[email protected]>
[ Upstream commit b74196af372f7cb4902179009265fe63ac81824f ]
Dump capture would fail if capture kernel is not of the endianess as the production kernel, because the in-memory data structure (struct opal_fadump_mem_struct) shared across production kernel and capture kernel assumes the same endianess for both the kernels, which doesn't have to be true always. Fix it by having a well-defined endianess for struct opal_fadump_mem_struct.
--- arch/powerpc/platforms/powernv/opal-fadump.c | 94 +++++++++++--------- arch/powerpc/platforms/powernv/opal-fadump.h | 10 +-- 2 files changed, 57 insertions(+), 47 deletions(-)
arch/powerpc/platforms/powernv/opal-fadump.c +52 -42
@@ -60,7 +60,7 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadump_conf, u64 node) addr =be64_to_cpu (addr);pr_debug ("Kernel metadata addr: %llx\n" , addr); opal_fdm_active = (void *)addr; -if (opal_fdm_active->registered_regions ==0 ) +if (be16_to_cpu (opal_fdm_active->registered_regions) ==0 )return ; ret =opal_mpipl_query_tag (OPAL_MPIPL_TAG_BOOT_MEM , &addr);
@@ -95,17 +95,17 @@ static int opal_fadump_unregister(struct fw_dump *fadump_conf);static void opal_fadump_update_config (struct fw_dump *fadump_conf,const struct opal_fadump_mem_struct *fdm) { -pr_debug ("Boot memory regions count: %d\n" , fdm->region_cnt); +pr_debug ("Boot memory regions count: %d\n" ,be16_to_cpu (fdm->region_cnt));/* * The destination address of the first boot memory region is the * destination address of boot memory regions. */ - fadump_conf->boot_mem_dest_addr = fdm->rgn[0 ].dest; + fadump_conf->boot_mem_dest_addr =be64_to_cpu (fdm->rgn[0 ].dest);pr_debug ("Destination address of boot memory regions: %#016llx\n" , fadump_conf->boot_mem_dest_addr); - fadump_conf->fadumphdr_addr = fdm->fadumphdr_addr; + fadump_conf->fadumphdr_addr =be64_to_cpu (fdm->fadumphdr_addr); }/*
@@ -126,9 +126,9 @@ static void __init opal_fadump_get_config(struct fw_dump *fadump_conf, fadump_conf->boot_memory_size =0 ;pr_debug ("Boot memory regions:\n" ); -for (i =0 ; i < fdm->region_cnt; i++) { - base = fdm->rgn[i].src; - size = fdm->rgn[i].size; +for (i =0 ; i <be16_to_cpu (fdm->region_cnt); i++) { + base =be64_to_cpu (fdm->rgn[i].src); + size =be64_to_cpu (fdm->rgn[i].size);pr_debug ("\t[%03d] base: 0x%lx, size: 0x%lx\n" , i, base, size); fadump_conf->boot_mem_addr[i] = base;
@@ -143,7 +143,7 @@ static void __init opal_fadump_get_config(struct fw_dump *fadump_conf,* Start address of reserve dump area (permanent reservation) for * re-registering FADump after dump capture. */ - fadump_conf->reserve_dump_area_start = fdm->rgn[0 ].dest; + fadump_conf->reserve_dump_area_start =be64_to_cpu (fdm->rgn[0 ].dest);/* * Rarely, but it can so happen that system crashes before all
@@ -155,13 +155,14 @@ static void __init opal_fadump_get_config(struct fw_dump *fadump_conf,* Hope the memory that could not be preserved only has pages * that are usually filtered out while saving the vmcore. */ -if (fdm->region_cnt > fdm->registered_regions) { +if (be16_to_cpu (fdm->region_cnt) >be16_to_cpu (fdm->registered_regions)) {pr_warn ("Not all memory regions were saved!!!\n" );pr_warn (" Unsaved memory regions:\n" ); - i = fdm->registered_regions; -while (i < fdm->region_cnt) { + i =be16_to_cpu (fdm->registered_regions); +while (i <be16_to_cpu (fdm->region_cnt)) {pr_warn ("\t[%03d] base: 0x%llx, size: 0x%llx\n" , - i, fdm->rgn[i].src, fdm->rgn[i].size); + i,be64_to_cpu (fdm->rgn[i].src), +be64_to_cpu (fdm->rgn[i].size)); i++; }
@@ -170,7 +171,7 @@ static void __init opal_fadump_get_config(struct fw_dump *fadump_conf, } fadump_conf->boot_mem_top = (fadump_conf->boot_memory_size + hole_size); - fadump_conf->boot_mem_regs_cnt = fdm->region_cnt; + fadump_conf->boot_mem_regs_cnt =be16_to_cpu (fdm->region_cnt);opal_fadump_update_config (fadump_conf, fdm); }
@@ -178,35 +179,38 @@ static void __init opal_fadump_get_config(struct fw_dump *fadump_conf,static void opal_fadump_init_metadata (struct opal_fadump_mem_struct *fdm) { fdm->version =OPAL_FADUMP_VERSION ; - fdm->region_cnt =0 ; - fdm->registered_regions =0 ; - fdm->fadumphdr_addr =0 ; + fdm->region_cnt =cpu_to_be16 (0 ); + fdm->registered_regions =cpu_to_be16 (0 ); + fdm->fadumphdr_addr =cpu_to_be64 (0 ); }static u64 opal_fadump_init_mem_struct (struct fw_dump *fadump_conf) {u64 addr = fadump_conf->reserve_dump_area_start; +u16 reg_cnt;int i; opal_fdm =__va (fadump_conf->kernel_metadata);opal_fadump_init_metadata (opal_fdm);/* Boot memory regions */ + reg_cnt =be16_to_cpu (opal_fdm->region_cnt);for (i =0 ; i < fadump_conf->boot_mem_regs_cnt; i++) { - opal_fdm->rgn[i].src = fadump_conf->boot_mem_addr[i]; - opal_fdm->rgn[i].dest = addr; - opal_fdm->rgn[i].size = fadump_conf->boot_mem_sz[i]; + opal_fdm->rgn[i].src =cpu_to_be64 (fadump_conf->boot_mem_addr[i]); + opal_fdm->rgn[i].dest =cpu_to_be64 (addr); + opal_fdm->rgn[i].size =cpu_to_be64 (fadump_conf->boot_mem_sz[i]); - opal_fdm->region_cnt++; + reg_cnt++; addr += fadump_conf->boot_mem_sz[i]; } + opal_fdm->region_cnt =cpu_to_be16 (reg_cnt);/* * Kernel metadata is passed to f/w and retrieved in capture kerenl. * So, use it to save fadump header address instead of calculating it. */ - opal_fdm->fadumphdr_addr = (opal_fdm->rgn[0 ].dest + - fadump_conf->boot_memory_size); + opal_fdm->fadumphdr_addr =cpu_to_be64 (be64_to_cpu (opal_fdm->rgn[0 ].dest) + + fadump_conf->boot_memory_size);opal_fadump_update_config (fadump_conf, opal_fdm);
@@ -269,18 +273,21 @@ static u64 opal_fadump_get_bootmem_min(void)static int opal_fadump_register (struct fw_dump *fadump_conf) {s64 rc =OPAL_PARAMETER ; +u16 registered_regs;int i, err = -EIO ; -for (i =0 ; i < opal_fdm->region_cnt; i++) { + registered_regs =be16_to_cpu (opal_fdm->registered_regions); +for (i =0 ; i <be16_to_cpu (opal_fdm->region_cnt); i++) { rc =opal_mpipl_update (OPAL_MPIPL_ADD_RANGE , - opal_fdm->rgn[i].src, - opal_fdm->rgn[i].dest, - opal_fdm->rgn[i].size); +be64_to_cpu (opal_fdm->rgn[i].src), +be64_to_cpu (opal_fdm->rgn[i].dest), +be64_to_cpu (opal_fdm->rgn[i].size));if (rc !=OPAL_SUCCESS )break ; - opal_fdm->registered_regions++; + registered_regs++; } + opal_fdm->registered_regions =cpu_to_be16 (registered_regs);switch (rc) {case OPAL_SUCCESS :
@@ -291,7 +298,8 @@ static int opal_fadump_register(struct fw_dump *fadump_conf)case OPAL_RESOURCE :/* If MAX regions limit in f/w is hit, warn and proceed. */ pr_warn ("%d regions could not be registered for MPIPL as MAX limit is reached!\n" , - (opal_fdm->region_cnt - opal_fdm->registered_regions)); + (be16_to_cpu (opal_fdm->region_cnt) - +be16_to_cpu (opal_fdm->registered_regions))); fadump_conf->dump_registered =1 ; err =0 ;break ;
@@ -312,7 +320,7 @@ static int opal_fadump_register(struct fw_dump *fadump_conf)* If some regions were registered before OPAL_MPIPL_ADD_RANGE * OPAL call failed, unregister all regions. */ -if ((err <0 ) && (opal_fdm->registered_regions >0 )) +if ((err <0 ) && (be16_to_cpu (opal_fdm->registered_regions) >0 ))opal_fadump_unregister (fadump_conf);return err;
@@ -328,7 +336,7 @@ static int opal_fadump_unregister(struct fw_dump *fadump_conf)return -EIO ; } - opal_fdm->registered_regions =0 ; + opal_fdm->registered_regions =cpu_to_be16 (0 ); fadump_conf->dump_registered =0 ;return 0 ; }
@@ -563,19 +571,20 @@ static void opal_fadump_region_show(struct fw_dump *fadump_conf,else fdm_ptr = opal_fdm; -for (i =0 ; i < fdm_ptr->region_cnt; i++) { +for (i =0 ; i <be16_to_cpu (fdm_ptr->region_cnt); i++) {/* * Only regions that are registered for MPIPL * would have dump data. */ if ((fadump_conf->dump_active) && - (i < fdm_ptr->registered_regions)) - dumped_bytes = fdm_ptr->rgn[i].size; + (i <be16_to_cpu (fdm_ptr->registered_regions))) + dumped_bytes =be64_to_cpu (fdm_ptr->rgn[i].size);seq_printf (m,"DUMP: Src: %#016llx, Dest: %#016llx, " , - fdm_ptr->rgn[i].src, fdm_ptr->rgn[i].dest); +be64_to_cpu (fdm_ptr->rgn[i].src), +be64_to_cpu (fdm_ptr->rgn[i].dest));seq_printf (m,"Size: %#llx, Dumped: %#llx bytes\n" , - fdm_ptr->rgn[i].size, dumped_bytes); +be64_to_cpu (fdm_ptr->rgn[i].size), dumped_bytes); }/* Dump is active. Show reserved area start address. */
@@ -624,6 +633,7 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadump_conf, u64 node) {const __be32 *prop;unsigned long dn; +__be64 be_addr;u64 addr =0 ;int i, len;s64 ret;
@@ -680,13 +690,13 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadump_conf, u64 node)if (!prop)return ; - ret =opal_mpipl_query_tag (OPAL_MPIPL_TAG_KERNEL , &addr); -if ((ret !=OPAL_SUCCESS ) || !addr) { + ret =opal_mpipl_query_tag (OPAL_MPIPL_TAG_KERNEL , &be_addr); +if ((ret !=OPAL_SUCCESS ) || !be_addr) {pr_err ("Failed to get Kernel metadata (%lld)\n" , ret);return ; } - addr =be64_to_cpu (addr); + addr =be64_to_cpu (be_addr);pr_debug ("Kernel metadata addr: %llx\n" , addr); opal_fdm_active =__va (addr);
@@ -697,14 +707,14 @@ void __init opal_fadump_dt_scan(struct fw_dump *fadump_conf, u64 node) }/* Kernel regions not registered with f/w for MPIPL */ -if (opal_fdm_active->registered_regions ==0 ) { +if (be16_to_cpu (opal_fdm_active->registered_regions) ==0 ) { opal_fdm_active =NULL ;return ; } - ret =opal_mpipl_query_tag (OPAL_MPIPL_TAG_CPU , &addr); -if (addr) { - addr =be64_to_cpu (addr); + ret =opal_mpipl_query_tag (OPAL_MPIPL_TAG_CPU , &be_addr); +if (be_addr) { + addr =be64_to_cpu (be_addr);pr_debug ("CPU metadata addr: %llx\n" , addr); opal_cpu_metadata =__va (addr); }
arch/powerpc/platforms/powernv/opal-fadump.h +5 -5
@@ -31,14 +31,14 @@* OPAL FADump kernel metadata * * The address of this structure will be registered with f/w for retrieving -* and processing during crash dump. +* in the capture kernel to process the crash dump. */ struct opal_fadump_mem_struct {u8 version;u8 reserved[3 ]; -u16 region_cnt;/* number of regions */ -u16 registered_regions;/* Regions registered for MPIPL */ -u64 fadumphdr_addr; +__be16 region_cnt;/* number of regions */ +__be16 registered_regions;/* Regions registered for MPIPL */ +__be64 fadumphdr_addr;struct opal_mpipl_region rgn[FADUMP_MAX_MEM_REGS ]; } __packed;
@@ -135,7 +135,7 @@ static inline void opal_fadump_read_regs(char *bufp, unsigned int regs_cnt,for (i =0 ; i < regs_cnt; i++, bufp += reg_entry_size) { reg_entry = (struct hdat_fadump_reg_entry *)bufp; val = (cpu_endian ?be64_to_cpu (reg_entry->reg_val) : - reg_entry->reg_val); + (u64)(reg_entry->reg_val)); opal_fadump_set_regval_regnum(regs, be32_to_cpu(reg_entry->reg_type), be32_to_cpu(reg_entry->reg_num),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 227/879 fat: add ratelimit to fat*_ent_bread()
In reply to Greg Kroah-HartmanFrom: OGAWA Hirofumi <[email protected]>
[ Upstream commit 183c3237c928109d2008c0456dff508baf692b20 ]
fat*_ent_bread() can be the cause of too many report on I/O error path. So use fat_msg_ratelimit() instead.
--- fs/fat/fatent.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
fs/fat/fatent.c +4 -3
@@ -94,7 +94,8 @@ static int fat12_ent_bread(struct super_block *sb, struct fat_entry *fatent, err_brelse:brelse (bhs[0 ]); err: -fat_msg (sb,KERN_ERR ,"FAT read failed (blocknr %llu)" , (llu )blocknr); +fat_msg_ratelimit (sb,KERN_ERR ,"FAT read failed (blocknr %llu)" , + (llu )blocknr);return -EIO ; }
@@ -107,8 +108,8 @@ static int fat_ent_bread(struct super_block *sb, struct fat_entry *fatent, fatent->fat_inode =MSDOS_SB (sb)->fat_inode; fatent->bhs[0 ] =sb_bread (sb, blocknr);if (!fatent->bhs[0 ]) { -fat_msg (sb,KERN_ERR ,"FAT read failed (blocknr %llu)" , - (llu )blocknr); +fat_msg_ratelimit (sb,KERN_ERR ,"FAT read failed (blocknr %llu)" , + (llu )blocknr);return -EIO ; } fatent->nr_bhs =1 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 228/879 pinctrl: renesas: rzn1: Fix possible null-ptr-deref in sh_pfc_map_resources()
In reply to Greg Kroah-HartmanFrom: Yang Yingliang <[email protected]>
[ Upstream commit 2f661477c2bb8068194dbba9738d05219f111c6e ]
It will cause null-ptr-deref when using 'res', if platform_get_resource() returns NULL, so move using 'res' after devm_ioremap_resource() that will check it to avoid null-ptr-deref.
And use devm_platform_get_and_ioremap_resource() to simplify code.
--- drivers/pinctrl/renesas/pinctrl-rzn1.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/pinctrl/renesas/pinctrl-rzn1.c +4 -6
@@ -865,17 +865,15 @@ static int rzn1_pinctrl_probe(struct platform_device *pdev) ipctl->mdio_func[0 ] =-1 ; ipctl->mdio_func[1 ] =-1 ; - res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); - ipctl->lev1_protect_phys = (u32 )res->start +0x400 ; - ipctl->lev1 =devm_ioremap_resource (&pdev->dev, res); + ipctl->lev1 =devm_platform_get_and_ioremap_resource (pdev,0 , &res);if (IS_ERR (ipctl->lev1))return PTR_ERR (ipctl->lev1); + ipctl->lev1_protect_phys = (u32 )res->start +0x400 ; - res =platform_get_resource (pdev,IORESOURCE_MEM ,1 ); - ipctl->lev2_protect_phys = (u32 )res->start +0x400 ; - ipctl->lev2 =devm_ioremap_resource (&pdev->dev, res); + ipctl->lev2 =devm_platform_get_and_ioremap_resource (pdev,1 , &res);if (IS_ERR (ipctl->lev2))return PTR_ERR (ipctl->lev2); + ipctl->lev2_protect_phys = (u32 )res->start +0x400 ; ipctl->clk =devm_clk_get (&pdev->dev,NULL );if (IS_ERR (ipctl->clk))
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 229/879 ARM: versatile: Add missing of_node_put in dcscb_init
In reply to Greg Kroah-HartmanFrom: Peng Wu <[email protected]>
[ Upstream commit 23b44f9c649bbef10b45fa33080cd8b4166800ae ]
The device_node pointer is returned by of_find_compatible_node with refcount incremented. We should use of_node_put() to avoid the refcount leak.
--- arch/arm/mach-vexpress/dcscb.c | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-vexpress/dcscb.c +1 -0
@@ -144,6 +144,7 @@ static int __init dcscb_init(void)if (!node)return -ENODEV ; dcscb_base =of_iomap (node,0 ); +of_node_put (node);if (!dcscb_base)return -EADDRNOTAVAIL ; cfg =readl_relaxed (dcscb_base +DCS_CFG_R );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 230/879 ARM: dts: exynos: add atmel,24c128 fallback to Samsung EEPROM
In reply to Greg Kroah-HartmanFrom: Krzysztof Kozlowski <[email protected]>
[ Upstream commit f038e8186fbc5723d7d38c6fa1d342945107347e ]
The Samsung s524ad0xd1 EEPROM should use atmel,24c128 fallback, according to the AT24 EEPROM bindings.
--- arch/arm/boot/dts/exynos5250-smdk5250.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/boot/dts/exynos5250-smdk5250.dts +2 -2
@@ -129,7 +129,7 @@ samsung,i2c-max-bus-freq = <20000>; eeprom@50 { - compatible = "samsung,s524ad0xd1"; + compatible = "samsung,s524ad0xd1", "atmel,24c128"; reg = <0x50>; };
@@ -289,7 +289,7 @@ samsung,i2c-max-bus-freq = <20000>; eeprom@51 { - compatible = "samsung,s524ad0xd1"; + compatible = "samsung,s524ad0xd1", "atmel,24c128"; reg = <0x51>; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 231/879 arm64: dts: qcom: sc7280-idp: Configure CTS pin to bias-bus-hold for bluetooth
In reply to Greg Kroah-HartmanFrom: Vijaya Krishna Nivarthi <[email protected]>
[ Upstream commit 497b272759986af1aa5a25b5e903d082c67bd8f6 ]
WLAN rail was leaking power during RBSC/sleep even after turning BT off. Change active and sleep pinctrl configurations to handle same.
--- arch/arm64/boot/dts/qcom/sc7280-idp.dtsi | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/qcom/sc7280-idp.dtsi +12 -6
@@ -400,10 +400,13 @@ &qup_uart7_cts { /* - * Configure a pull-down on CTS to match the pull of - * the Bluetooth module. + * Configure a bias-bus-hold on CTS to lower power + * usage when Bluetooth is turned off. Bus hold will + * maintain a low power state regardless of whether + * the Bluetooth module drives the pin in either + * direction or leaves the pin fully unpowered. */ - bias-pull-down; + bias-bus-hold; }; &qup_uart7_rts {
@@ -495,10 +498,13 @@ pins = "gpio28"; function = "gpio"; /* - * Configure a pull-down on CTS to match the pull of - * the Bluetooth module. + * Configure a bias-bus-hold on CTS to lower power + * usage when Bluetooth is turned off. Bus hold will + * maintain a low power state regardless of whether + * the Bluetooth module drives the pin in either + * direction or leaves the pin fully unpowered. */ - bias-pull-down; + bias-bus-hold; }; qup_uart7_sleep_rts: qup-uart7-sleep-rts {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 232/879 arm64: dts: qcom: sc7280-qcard: Configure CTS pin to bias-bus-hold for bluetooth
In reply to Greg Kroah-HartmanFrom: Vijaya Krishna Nivarthi <[email protected]>
[ Upstream commit 3d0e375bae55c2dfa6dd0762f45ad71f0b192f71 ]
WLAN rail was leaking power during RBSC/sleep even after turning BT off. Change active and sleep pinctrl configurations to handle same.
--- arch/arm64/boot/dts/qcom/sc7280-qcard.dtsi | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/qcom/sc7280-qcard.dtsi +14 -5
@@ -398,8 +398,14 @@ mos_bt_uart: &uart7 { /* For mos_bt_uart */ &qup_uart7_cts { - /* Configure a pull-down on CTS to match the pull of the Bluetooth module. */ - bias-pull-down; + /* + * Configure a bias-bus-hold on CTS to lower power + * usage when Bluetooth is turned off. Bus hold will + * maintain a low power state regardless of whether + * the Bluetooth module drives the pin in either + * direction or leaves the pin fully unpowered. + */ + bias-bus-hold; }; /* For mos_bt_uart */
@@ -490,10 +496,13 @@ mos_bt_uart: &uart7 { pins = "gpio28"; function = "gpio"; /* - * Configure a pull-down on CTS to match the pull of - * the Bluetooth module. + * Configure a bias-bus-hold on CTS to lower power + * usage when Bluetooth is turned off. Bus hold will + * maintain a low power state regardless of whether + * the Bluetooth module drives the pin in either + * direction or leaves the pin fully unpowered. */ - bias-pull-down; + bias-bus-hold; }; /* For mos_bt_uart */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 233/879 ARM: hisi: Add missing of_node_put after of_find_compatible_node
In reply to Greg Kroah-HartmanFrom: Peng Wu <[email protected]>
[ Upstream commit 9bc72e47d4630d58a840a66a869c56b29554cfe4 ]
of_find_compatible_node will increment the refcount of the returned device_node. Calling of_node_put() to avoid the refcount leak
--- arch/arm/mach-hisi/platsmp.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/mach-hisi/platsmp.c +4 -0
@@ -67,14 +67,17 @@ static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus) } ctrl_base =of_iomap (np,0 );if (!ctrl_base) { +of_node_put (np);pr_err ("failed to map address\n" );return ; }if (of_property_read_u32 (np,"smp-offset" , &offset) <0 ) { +of_node_put (np);pr_err ("failed to find smp-offset property\n" );return ; } ctrl_base += offset; +of_node_put (np); } }
@@ -160,6 +163,7 @@ static int hip01_boot_secondary(unsigned int cpu, struct task_struct *idle)if (WARN_ON (!node))return -1 ; ctrl_base =of_iomap (node,0 ); +of_node_put (node);/* set the secondary core boot from DDR */ remap_reg_value =readl_relaxed (ctrl_base +REG_SC_CTRL );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 234/879 cpufreq: Avoid unnecessary frequency updates due to mismatch
In reply to Greg Kroah-HartmanFrom: Viresh Kumar <[email protected]>
[ Upstream commit f55ae08c89873e140c7cac2a7fa161d31a0d60cf ]
For some platforms, the frequency returned by hardware may be slightly different from what is provided in the frequency table. For example, hardware may return 499 MHz instead of 500 MHz. In such cases it is better to avoid getting into unnecessary frequency updates, as we may end up switching policy->cur between the two and sending unnecessary pre/post update notifications, etc.
This patch has chosen allows the hardware frequency and table frequency to deviate by 1 MHz for now, we may want to increase it a bit later on if someone still complains.
--- drivers/cpufreq/cpufreq.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/cpufreq/cpufreq.c +11 -0
@@ -28,6 +28,7 @@#include <linux/suspend.h> #include <linux/syscore_ops.h> #include <linux/tick.h> +#include <linux/units.h> #include <trace/events/power.h> static LIST_HEAD (cpufreq_policy_list);
@@ -1707,6 +1708,16 @@ static unsigned int cpufreq_verify_current_freq(struct cpufreq_policy *policy, breturn new_freq;if (policy->cur != new_freq) { +/* +* For some platforms, the frequency returned by hardware may be +* slightly different from what is provided in the frequency +* table, for example hardware may return 499 MHz instead of 500 +* MHz. In such cases it is better to avoid getting into +* unnecessary frequency updates. +*/ +if (abs (policy->cur - new_freq) <HZ_PER_MHZ ) +return policy->cur; +cpufreq_out_of_sync (policy, new_freq);if (update)schedule_work (&policy->update);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 235/879 PCI: microchip: Add missing chained_irq_enter()/exit() calls
In reply to Greg Kroah-HartmanFrom: Conor Dooley <[email protected]>
[ Upstream commit 30097efa334a706f9021b9aee6efcddcfa44a78a ]
Two of the chained IRQ handlers miss their chained_irq_enter()/chained_irq_exit() calls, so add them in to avoid potentially lost interrupts.
Reported by: Bjorn Helgaas <[email protected]>
--- drivers/pci/controller/pcie-microchip-host.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/pci/controller/pcie-microchip-host.c +10 -0
@@ -406,6 +406,7 @@ static void mc_pcie_enable_msi(struct mc_pcie *port, void __iomem *base)static void mc_handle_msi (struct irq_desc *desc) {struct mc_pcie *port =irq_desc_get_handler_data (desc); +struct irq_chip *chip =irq_desc_get_chip (desc);struct device *dev = port->dev;struct mc_msi *msi = &port->msi; void __iomem *bridge_base_addr =
@@ -414,6 +415,8 @@ static void mc_handle_msi(struct irq_desc *desc)u32 bit;int ret; +chained_irq_enter (chip, desc); + status =readl_relaxed (bridge_base_addr +ISTATUS_LOCAL );if (status &PM_MSI_INT_MSI_MASK ) { status =readl_relaxed (bridge_base_addr +ISTATUS_MSI );
@@ -424,6 +427,8 @@ static void mc_handle_msi(struct irq_desc *desc) bit); } } + +chained_irq_exit (chip, desc); }static void mc_msi_bottom_irq_ack (struct irq_data *data)
@@ -563,6 +568,7 @@ static int mc_allocate_msi_domains(struct mc_pcie *port)static void mc_handle_intx (struct irq_desc *desc) {struct mc_pcie *port =irq_desc_get_handler_data (desc); +struct irq_chip *chip =irq_desc_get_chip (desc);struct device *dev = port->dev;void __iomem *bridge_base_addr = port->axi_base_addr +MC_PCIE_BRIDGE_ADDR ;
@@ -570,6 +576,8 @@ static void mc_handle_intx(struct irq_desc *desc)u32 bit;int ret; +chained_irq_enter (chip, desc); + status =readl_relaxed (bridge_base_addr +ISTATUS_LOCAL );if (status &PM_MSI_INT_INTX_MASK ) { status &=PM_MSI_INT_INTX_MASK ;
@@ -581,6 +589,8 @@ static void mc_handle_intx(struct irq_desc *desc) bit); } } + +chained_irq_exit (chip, desc); }static void mc_ack_intx_irq (struct irq_data *data)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 236/879 powerpc/rtas: Keep MSR[RI] set when calling RTAS
In reply to Greg Kroah-HartmanFrom: Laurent Dufour <[email protected]>
[ Upstream commit b6b1c3ce06ca438eb24e0f45bf0e63ecad0369f5 ]
RTAS runs in real mode (MSR[DR] and MSR[IR] unset) and in 32-bit big endian mode (MSR[SF,LE] unset).
The change in MSR is done in enter_rtas() in a relatively complex way, since the MSR value could be hardcoded.
Furthermore, a panic has been reported when hitting the watchdog interrupt while running in RTAS, this leads to the following stack trace:
watchdog: CPU 24 Hard LOCKUP
watchdog: CPU 24 TB:997512652051031, last heartbeat TB:997504470175378 (15980ms ago)
...
Supported: No, Unreleased kernel
CPU: 24 PID: 87504 Comm: drmgr Kdump: loaded Tainted: G E X 5.14.21-150400.71.1.bz196362_2-default #1 SLE15-SP4 (unreleased) 0d821077ef4faa8dfaf370efb5fdca1fa35f4e2c NIP: 000000001fb41050 LR: 000000001fb4104c CTR: 0000000000000000 REGS: c00000000fc33d60 TRAP: 0100 Tainted: G E X (5.14.21-150400.71.1.bz196362_2-default) MSR: 8000000002981000 <SF,VEC,VSX,ME> CR: 48800002 XER: 20040020 CFAR: 000000000000011c IRQMASK: 1 GPR00: 0000000000000003 ffffffffffffffff 0000000000000001 00000000000050dc GPR04: 000000001ffb6100 0000000000000020 0000000000000001 000000001fb09010 GPR08: 0000000020000000 0000000000000000 0000000000000000 0000000000000000 GPR12: 80040000072a40a8 c00000000ff8b680 0000000000000007 0000000000000034 GPR16: 000000001fbf6e94 000000001fbf6d84 000000001fbd1db0 000000001fb3f008 GPR20: 000000001fb41018 ffffffffffffffff 000000000000017f fffffffffffff68f GPR24: 000000001fb18fe8 000000001fb3e000 000000001fb1adc0 000000001fb1cf40 GPR28: 000000001fb26000 000000001fb460f0 000000001fb17f18 000000001fb17000 NIP [000000001fb41050] 0x1fb41050 LR [000000001fb4104c] 0x1fb4104c Call Trace: Instruction dump: XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX Oops: Unrecoverable System Reset, sig: 6 [#1] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries ... Supported: No, Unreleased kernel CPU: 24 PID: 87504 Comm: drmgr Kdump: loaded Tainted: G E X 5.14.21-150400.71.1.bz196362_2-default #1 SLE15-SP4 (unreleased) 0d821077ef4faa8dfaf370efb5fdca1fa35f4e2c NIP: 000000001fb41050 LR: 000000001fb4104c CTR: 0000000000000000 REGS: c00000000fc33d60 TRAP: 0100 Tainted: G E X (5.14.21-150400.71.1.bz196362_2-default) MSR: 8000000002981000 <SF,VEC,VSX,ME> CR: 48800002 XER: 20040020 CFAR: 000000000000011c IRQMASK: 1 GPR00: 0000000000000003 ffffffffffffffff 0000000000000001 00000000000050dc GPR04: 000000001ffb6100 0000000000000020 0000000000000001 000000001fb09010 GPR08: 0000000020000000 0000000000000000 0000000000000000 0000000000000000 GPR12: 80040000072a40a8 c00000000ff8b680 0000000000000007 0000000000000034 GPR16: 000000001fbf6e94 000000001fbf6d84 000000001fbd1db0 000000001fb3f008 GPR20: 000000001fb41018 ffffffffffffffff 000000000000017f fffffffffffff68f GPR24: 000000001fb18fe8 000000001fb3e000 000000001fb1adc0 000000001fb1cf40 GPR28: 000000001fb26000 000000001fb460f0 000000001fb17f18 000000001fb17000 NIP [000000001fb41050] 0x1fb41050 LR [000000001fb4104c] 0x1fb4104c Call Trace: Instruction dump: XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX XXXXXXXX ---[ end trace 3ddec07f638c34a2 ]---
This happens because MSR[RI] is unset when entering RTAS but there is no valid reason to not set it here.
RTAS is expected to be called with MSR[RI] as specified in PAPR+ section "7.2.1 Machine State":
R1–7.2.1–9. If called with MSR[RI] equal to 1, then RTAS must protect its own critical regions from recursion by setting the MSR[RI] bit to 0 when in the critical regions.
Fixing this by reviewing the way MSR is compute before calling RTAS. Now a hardcoded value meaning real mode, 32 bits big endian mode and Recoverable Interrupt is loaded. In the case MSR[S] is set, it will remain set while entering RTAS as only urfid can unset it (thanks Fabiano).
In addition a check is added in do_enter_rtas() to detect calls made with MSR[RI] unset, as we are forcing it on later.
This patch has been tested on the following machines:
Power KVM Guest
P8 S822L (host Ubuntu kernel 5.11.0-49-generic)
PowerVM LPAR
P8 9119-MME (FW860.A1)
p9 9008-22L (FW950.00)
P10 9080-HEX (FW1010.00)
--- arch/powerpc/kernel/entry_64.S | 24 ++++++++++++------------ arch/powerpc/kernel/rtas.c | 9 +++++++++ 2 files changed, 21 insertions(+), 12 deletions(-)
arch/powerpc/kernel/entry_64.S +12 -12
@@ -330,22 +330,22 @@ _GLOBAL(enter_rtas) clrldi r4,r4,2 /* convert to realmode address */ mtlr r4 - li r0,0 - ori r0,r0,MSR_EE|MSR_SE|MSR_BE|MSR_RI - andc r0,r6,r0 - - li r9,1 - rldicr r9,r9,MSR_SF_LG,(63-MSR_SF_LG) - ori r9,r9,MSR_IR|MSR_DR|MSR_FE0|MSR_FE1|MSR_FP|MSR_RI|MSR_LE - andc r6,r0,r9 - __enter_rtas: - sync /* disable interrupts so SRR0/1 */ - mtmsrd r0 /* don't get trashed */ - LOAD_REG_ADDR(r4, rtas) ld r5,RTASENTRY(r4) /* get the rtas->entry value */ ld r4,RTASBASE(r4) /* get the rtas->base value */ + + /* + * RTAS runs in 32-bit big endian real mode, but leave MSR[RI] on as we + * may hit NMI (SRESET or MCE) while in RTAS. RTAS should disable RI in + * its critical regions (as specified in PAPR+ section 7.2.1). MSR[S] + * is not impacted by RFI_TO_KERNEL (only urfid can unset it). So if + * MSR[S] is set, it will remain when entering RTAS. + */ + LOAD_REG_IMMEDIATE(r6, MSR_ME | MSR_RI) + + li r0,0 + mtmsrd r0,1 /* disable RI before using SRR0/1 */ mtspr SPRN_SRR0,r5 mtspr SPRN_SRR1,r6
arch/powerpc/kernel/rtas.c +9 -0
@@ -49,6 +49,15 @@ void enter_rtas(unsigned long);static inline void do_enter_rtas (unsigned long args) { +unsigned long msr; + +/* +* Make sure MSR[RI] is currently enabled as it will be forced later +* in enter_rtas. +*/ + msr =mfmsr (); +BUG_ON (!(msr &MSR_RI )); +enter_rtas (args);srr_regs_clobbered ();/* rtas uses SRRs, invalidate */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 237/879 PCI: Avoid pci_dev_lock() AB/BA deadlock with sriov_numvfs_store()
In reply to Greg Kroah-HartmanFrom: Yicong Yang <[email protected]>
[ Upstream commit a91ee0e9fca9d7501286cfbced9b30a33e52740a ]
The sysfs sriov_numvfs_store() path acquires the device lock before the config space access lock:
sriov_numvfs_store
device_lock # A (1) acquire device lock
sriov_configure
vfio_pci_sriov_configure # (for example)
vfio_pci_core_sriov_configure
pci_disable_sriov
sriov_disable
pci_cfg_access_lock
pci_wait_cfg # B (4) wait for dev->block_cfg_access == 0
Previously, pci_dev_lock() acquired the config space access lock before the device lock:
pci_dev_lock
pci_cfg_access_lock
dev->block_cfg_access = 1 # B (2) set dev->block_cfg_access = 1
device_lock # A (3) wait for device lock
Any path that uses pci_dev_lock(), e.g., pci_reset_function(), may deadlock with sriov_numvfs_store() if the operations occur in the sequence
(1) (2) (3) (4).
Avoid the deadlock by reversing the order in pci_dev_lock() so it acquires the device lock before the config space access lock, the same as the sriov_numvfs_store() path.
[bhelgaas: combined and adapted commit log from Jay Zhou's independent subsequent posting:
https://lore.kernel.org/r/[email protected]]
--- drivers/pci/pci.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/pci/pci.c +5 -5
@@ -5113,19 +5113,19 @@ static int pci_reset_bus_function(struct pci_dev *dev, bool probe)void pci_dev_lock (struct pci_dev *dev) { -pci_cfg_access_lock (dev);/* block PM suspend, driver probe, etc. */ device_lock (&dev->dev); +pci_cfg_access_lock (dev); }EXPORT_SYMBOL_GPL (pci_dev_lock);/* Return 1 on successful lock, 0 on contention */ int pci_dev_trylock (struct pci_dev *dev) { -if (pci_cfg_access_trylock (dev)) { -if (device_trylock (&dev->dev)) +if (device_trylock (&dev->dev)) { +if (pci_cfg_access_trylock (dev))return 1 ; -pci_cfg_access_unlock (dev); +device_unlock (&dev->dev); }return 0 ;
@@ -5134,8 +5134,8 @@ EXPORT_SYMBOL_GPL(pci_dev_trylock);void pci_dev_unlock (struct pci_dev *dev) { -device_unlock (&dev->dev);pci_cfg_access_unlock (dev); +device_unlock (&dev->dev); }EXPORT_SYMBOL_GPL (pci_dev_unlock);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 238/879 PCI: cadence: Clear FLR in device capabilities register
In reply to Greg Kroah-HartmanFrom: Parshuram Thombare <[email protected]>
[ Upstream commit 95b00f68209e2bc9f2ee9126afcebab451e0e9d8 ]
Clear FLR (Function Level Reset) from device capabilities registers for all physical functions.
During FLR, the Margining Lane Status and Margining Lane Control registers should not be reset, as per PCIe specification. However, the controller incorrectly resets these registers upon FLR. This causes PCISIG compliance FLR test to fail. Hence preventing all functions from advertising FLR support if flag quirk_disable_flr is set.
--- drivers/pci/controller/cadence/pci-j721e.c | 3 +++ .../pci/controller/cadence/pcie-cadence-ep.c | 18 +++++++++++++++++- drivers/pci/controller/cadence/pcie-cadence.h | 3 +++ 3 files changed, 23 insertions(+), 1 deletion(-)
drivers/pci/controller/cadence/pci-j721e.c +3 -0
@@ -69,6 +69,7 @@ struct j721e_pcie_data {enum j721e_pcie_mode mode; unsigned int quirk_retrain_flag:1; unsigned int quirk_detect_quiet_flag:1; + unsigned int quirk_disable_flr:1;u32 linkdown_irq_regfield; unsigned int byte_access_allowed:1; };
@@ -307,6 +308,7 @@ static const struct j721e_pcie_data j7200_pcie_rc_data = {static const struct j721e_pcie_data j7200_pcie_ep_data = { .mode =PCI_MODE_EP , .quirk_detect_quiet_flag = true, + .quirk_disable_flr = true, };static const struct j721e_pcie_data am64_pcie_rc_data = {
@@ -405,6 +407,7 @@ static int j721e_pcie_probe(struct platform_device *pdev)return -ENOMEM ; ep->quirk_detect_quiet_flag = data->quirk_detect_quiet_flag; + ep->quirk_disable_flr = data->quirk_disable_flr; cdns_pcie = &ep->pcie; cdns_pcie->dev = dev;
drivers/pci/controller/cadence/pcie-cadence-ep.c +17 -1
@@ -565,7 +565,8 @@ static int cdns_pcie_ep_start(struct pci_epc *epc)struct cdns_pcie_ep *ep =epc_get_drvdata (epc);struct cdns_pcie *pcie = &ep->pcie;struct device *dev = pcie->dev; -int ret; +int max_epfs =sizeof (epc->function_num_map) *8 ; +int ret, value, epf;/* * BIT(0) is hardwired to 1, hence function 0 is always enabled
@@ -573,6 +574,21 @@ static int cdns_pcie_ep_start(struct pci_epc *epc)*/ cdns_pcie_writel (pcie,CDNS_PCIE_LM_EP_FUNC_CFG , epc->function_num_map); +if (ep->quirk_disable_flr) { +for (epf =0 ; epf < max_epfs; epf++) { +if (!(epc->function_num_map &BIT (epf))) +continue ; + + value =cdns_pcie_ep_fn_readl (pcie, epf, +CDNS_PCIE_EP_FUNC_DEV_CAP_OFFSET + +PCI_EXP_DEVCAP ); + value &= ~PCI_EXP_DEVCAP_FLR ; +cdns_pcie_ep_fn_writel (pcie, epf, +CDNS_PCIE_EP_FUNC_DEV_CAP_OFFSET + +PCI_EXP_DEVCAP , value); + } + } + ret =cdns_pcie_start_link (pcie);if (ret) {dev_err (dev,"Failed to start link\n" );
drivers/pci/controller/cadence/pcie-cadence.h +3 -0
@@ -123,6 +123,7 @@#define CDNS_PCIE_EP_FUNC_MSI_CAP_OFFSET 0x90#define CDNS_PCIE_EP_FUNC_MSIX_CAP_OFFSET 0xb0 +#define CDNS_PCIE_EP_FUNC_DEV_CAP_OFFSET 0xc0#define CDNS_PCIE_EP_FUNC_SRIOV_CAP_OFFSET 0x200/*
@@ -357,6 +358,7 @@ struct cdns_pcie_epf {* minimize time between read and write * @epf: Structure to hold info about endpoint function * @quirk_detect_quiet_flag: LTSSM Detect Quiet min delay set as quirk +* @quirk_disable_flr: Disable FLR (Function Level Reset) quirk flag */ struct cdns_pcie_ep {struct cdns_pcie pcie;
@@ -372,6 +374,7 @@ struct cdns_pcie_ep {spinlock_t lock;struct cdns_pcie_epf *epf; unsigned int quirk_detect_quiet_flag:1; + unsigned int quirk_disable_flr:1; };
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 239/879 KVM: PPC: Book3S HV Nested: L2 LPCR should inherit L1 LPES setting
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 2852ebfa10afdcefff35ec72c8da97141df9845c ]
The L1 should not be able to adjust LPES mode for the L2. Setting LPES if the L0 needs it clear would cause external interrupts to be sent to L2 and missed by the L0.
Clearing LPES when it may be set, as typically happens with XIVE enabled could cause a performance issue despite having no native XIVE support in the guest, because it will cause mediated interrupts for the L2 to be taken in HV mode, which then have to be injected.
--- arch/powerpc/kvm/book3s_hv.c | 4 ++++ arch/powerpc/kvm/book3s_hv_nested.c | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-)
arch/powerpc/kvm/book3s_hv.c +4 -0
@@ -5283,6 +5283,10 @@ static int kvmppc_core_init_vm_hv(struct kvm *kvm) kvm->arch.host_lpcr = lpcr =mfspr (SPRN_LPCR ); lpcr &=LPCR_PECE |LPCR_LPES ; }else { +/* +* The L2 LPES mode will be set by the L0 according to whether +* or not it needs to take external interrupts in HV mode. +*/ lpcr =0 ; } lpcr |= (4UL << LPCR_DPFD_SH) | LPCR_HDICE |
arch/powerpc/kvm/book3s_hv_nested.c +1 -2
@@ -261,8 +261,7 @@ static void load_l2_hv_regs(struct kvm_vcpu *vcpu,/* * Don't let L1 change LPCR bits for the L2 except these: */ - mask =LPCR_DPFD |LPCR_ILE |LPCR_TC |LPCR_AIL |LPCR_LD | -LPCR_LPES |LPCR_MER ; + mask =LPCR_DPFD |LPCR_ILE |LPCR_TC |LPCR_AIL |LPCR_LD |LPCR_MER ;/* * Additional filtering is required depending on hardware
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 240/879 alpha: fix alloc_zeroed_user_highpage_movable()
In reply to Greg Kroah-HartmanFrom: Matthew Wilcox (Oracle) <[email protected]>
[ Upstream commit f9c668d281aa20e38c9bda3b7b0adeb8891aa15e ]
Due to a typo, the final argument to alloc_page_vma() didn't refer to a real variable. This only affected CONFIG_NUMA, which was marked BROKEN in 2006 and removed from alpha in 2021. Found due to a refactoring patch.
--- arch/alpha/include/asm/page.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/alpha/include/asm/page.h +1 -1
@@ -18,7 +18,7 @@ extern void clear_page(void *page);#define clear_user_page (page, vaddr, pg) clear_page(page)#define alloc_zeroed_user_highpage_movable (vma, vaddr) \ - alloc_page_vma(GFP_HIGHUSER_MOVABLE | __GFP_ZERO, vma, vmaddr) + alloc_page_vma(GFP_HIGHUSER_MOVABLE | __GFP_ZERO, vma, vaddr)#define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE_MOVABLEextern void copy_page (void * _to,void * _from);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 241/879 tracing: incorrect isolate_mote_t cast in mm_vmscan_lru_isolate
In reply to Greg Kroah-HartmanFrom: Vasily Averin <[email protected]>
[ Upstream commit 2b132903de7124dd9a758be0c27562e91a510848 ]
Fixes following sparse warnings:
CHECK mm/vmscan.cmm/vmscan.c: note: in included file (through include/trace/trace_events.h, include/trace/define_trace.h, include/trace/events/vmscan.h):./include/trace/events/vmscan.h:281:1: sparse: warning:
cast to restricted isolate_mode_t./include/trace/events/vmscan.h:281:1: sparse: warning:
restricted isolate_mode_t degrades to integer
--- include/trace/events/vmscan.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/trace/events/vmscan.h +2 -2
@@ -297,7 +297,7 @@ TRACE_EVENT(mm_vmscan_lru_isolate, __field(unsigned long, nr_scanned) __field(unsigned long, nr_skipped) __field(unsigned long, nr_taken) - __field(isolate_mode_t, isolate_mode) + __field(unsigned int, isolate_mode) __field(int, lru) ),
@@ -308,7 +308,7 @@ TRACE_EVENT(mm_vmscan_lru_isolate, __entry->nr_scanned = nr_scanned; __entry->nr_skipped = nr_skipped; __entry->nr_taken = nr_taken; - __entry->isolate_mode = isolate_mode; + __entry->isolate_mode = (__force unsigned int )isolate_mode; __entry->lru = lru; ),
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 242/879 cifs: return ENOENT for DFS lookup_cache_entry()
In reply to Greg Kroah-HartmanFrom: Enzo Matsumiya <[email protected]>
[ Upstream commit 337b8b0e4343567221ef8d88aac5e418208d4ac1 ]
EEXIST didn't make sense to use when dfs_cache_find() couldn't find a cache entry nor retrieve a referral target.
It also doesn't make sense cifs_dfs_query_info_nonascii_quirk() to emulate ENOENT anymore.
--- fs/cifs/connect.c | 6 ++++-- fs/cifs/dfs_cache.c | 6 +++--- fs/cifs/misc.c | 6 +----- 3 files changed, 8 insertions(+), 10 deletions(-)
fs/cifs/connect.c +4 -2
@@ -3406,8 +3406,9 @@ cifs_are_all_path_components_accessible(struct TCP_Server_Info *server, }/* -* Check if path is remote (e.g. a DFS share). Return -EREMOTE if it is, -* otherwise 0. +* Check if path is remote (i.e. a DFS share). +* +* Return -EREMOTE if it is, otherwise 0 or -errno. */ static int is_path_remote (struct mount_ctx *mnt_ctx) {
@@ -3697,6 +3698,7 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)if (!isdfs) goto out; +/* proceed as DFS mount */ uuid_gen (&mnt_ctx.mount_id); rc =connect_dfs_root (&mnt_ctx, &tl);dfs_cache_free_tgts (&tl);
fs/cifs/dfs_cache.c +3 -3
@@ -654,7 +654,7 @@ static struct cache_entry *__lookup_cache_entry(const char *path, unsigned int hreturn ce; } } -return ERR_PTR (-EEXIST ); +return ERR_PTR (-ENOENT ); }/*
@@ -662,7 +662,7 @@ static struct cache_entry *__lookup_cache_entry(const char *path, unsigned int h* * Use whole path components in the match. Must be called with htable_rw_lock held. * -* Return ERR_PTR(-EEXIST) if the entry is not found. +* Return ERR_PTR(-ENOENT) if the entry is not found. */ static struct cache_entry *lookup_cache_entry (const char *path) {
@@ -710,7 +710,7 @@ static struct cache_entry *lookup_cache_entry(const char *path)while (e > s && *e != sep) e--; } -return ERR_PTR (-EEXIST ); +return ERR_PTR (-ENOENT ); }/**
fs/cifs/misc.c +1 -5
@@ -1308,7 +1308,7 @@ int cifs_update_super_prepath(struct cifs_sb_info *cifs_sb, char *prefix)* for "\<server>\<dfsname>\<linkpath>" DFS reference, * where <dfsname> contains non-ASCII unicode symbols. * -* Check such DFS reference and emulate -ENOENT if it is actual. +* Check such DFS reference. */ int cifs_dfs_query_info_nonascii_quirk(const unsigned int xid, struct cifs_tcon *tcon,
@@ -1340,10 +1340,6 @@ int cifs_dfs_query_info_nonascii_quirk(const unsigned int xid,cifs_dbg (FYI ,"DFS ref '%s' is found, emulate -EREMOTE\n" , dfspath); rc = -EREMOTE ; - }else if (rc == -EEXIST ) { -cifs_dbg (FYI ,"DFS ref '%s' is not found, emulate -ENOENT\n" , - dfspath); - rc = -ENOENT ; }else {cifs_dbg (FYI ,"%s: dfs_cache_find returned %d\n" , __func__, rc); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 243/879 powerpc/powernv/vas: Assign real address to rx_fifo in vas_rx_win_attr
In reply to Greg Kroah-HartmanFrom: Haren Myneni <[email protected]>
[ Upstream commit c127d130f6d59fa81701f6b04023cf7cd1972fb3 ]
In init_winctx_regs(), __pa() is called on winctx->rx_fifo and this function is called to initialize registers for receive and fault windows. But the real address is passed in winctx->rx_fifo for receive windows and the virtual address for fault windows which causes errors with DEBUG_VIRTUAL enabled. Fixes this issue by assigning only real address to rx_fifo in vas_rx_win_attr struct for both receive and fault windows.
--- arch/powerpc/include/asm/vas.h | 2 +- arch/powerpc/platforms/powernv/vas-fault.c | 2 +- arch/powerpc/platforms/powernv/vas-window.c | 4 ++-- arch/powerpc/platforms/powernv/vas.h | 2 +- drivers/crypto/nx/nx-common-powernv.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/include/asm/vas.h +1 -1
@@ -126,7 +126,7 @@ static inline void vas_user_win_add_mm_context(struct vas_user_win_ref *ref)* Receive window attributes specified by the (in-kernel) owner of window. */ struct vas_rx_win_attr { -void *rx_fifo; +u64 rx_fifo;int rx_fifo_size;int wcreds_max;
arch/powerpc/platforms/powernv/vas-fault.c +1 -1
@@ -216,7 +216,7 @@ int vas_setup_fault_window(struct vas_instance *vinst)vas_init_rx_win_attr (&attr,VAS_COP_TYPE_FAULT ); attr.rx_fifo_size = vinst->fault_fifo_size; - attr.rx_fifo = vinst->fault_fifo; + attr.rx_fifo =__pa (vinst->fault_fifo);/* * Max creds is based on number of CRBs can fit in the FIFO.
arch/powerpc/platforms/powernv/vas-window.c +2 -2
@@ -404,7 +404,7 @@ static void init_winctx_regs(struct pnv_vas_window *window,* * See also: Design note in function header. */ - val =__pa (winctx->rx_fifo); + val = winctx->rx_fifo; val =SET_FIELD (VAS_PAGE_MIGRATION_SELECT , val,0 );write_hvwc_reg (window,VREG (LFIFO_BAR ), val);
@@ -739,7 +739,7 @@ static void init_winctx_for_rxwin(struct pnv_vas_window *rxwin,*/ winctx->fifo_disable = true; winctx->intr_disable = true; - winctx->rx_fifo =NULL ; + winctx->rx_fifo =0 ; } winctx->lnotify_lpid = rxattr->lnotify_lpid;
arch/powerpc/platforms/powernv/vas.h +1 -1
@@ -376,7 +376,7 @@ struct pnv_vas_window {* is a container for the register fields in the window context. */ struct vas_winctx { -void *rx_fifo; +u64 rx_fifo;int rx_fifo_size;int wcreds_max;int rsvd_txbuf_count;
drivers/crypto/nx/nx-common-powernv.c +1 -1
@@ -827,7 +827,7 @@ static int __init vas_cfg_coproc_info(struct device_node *dn, int chip_id, goto err_out;vas_init_rx_win_attr (&rxattr, coproc->ct); - rxattr.rx_fifo = (void *)rx_fifo; + rxattr.rx_fifo = rx_fifo; rxattr.rx_fifo_size = fifo_size; rxattr.lnotify_lpid = lpid; rxattr.lnotify_pid = pid;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 244/879 powerpc/xics: fix refcount leak in icp_opal_init()
In reply to Greg Kroah-HartmanFrom: Lv Ruyi <[email protected]>
[ Upstream commit 5dd9e27ea4a39f7edd4bf81e9e70208e7ac0b7c9 ]
The of_find_compatible_node() function returns a node pointer with refcount incremented, use of_node_put() on it when done.
--- arch/powerpc/sysdev/xics/icp-opal.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/sysdev/xics/icp-opal.c +1 -0
@@ -196,6 +196,7 @@ int __init icp_opal_init(void)printk ("XICS: Using OPAL ICP fallbacks\n" ); +of_node_put (np);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 245/879 powerpc/powernv: fix missing of_node_put in uv_init()
In reply to Greg Kroah-HartmanFrom: Lv Ruyi <[email protected]>
[ Upstream commit 3ffa9fd471f57f365bc54fc87824c530422f64a5 ]
of_find_compatible_node() returns node pointer with refcount incremented, use of_node_put() on it when done.
--- arch/powerpc/platforms/powernv/ultravisor.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/powernv/ultravisor.c +1 -0
@@ -55,6 +55,7 @@ static int __init uv_init(void)return -ENODEV ; uv_memcons =memcons_init (node,"memcons" ); +of_node_put (node);if (!uv_memcons)return -ENOENT ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 246/879 macintosh/via-pmu: Fix build failure when CONFIG_INPUT is disabled
In reply to Greg Kroah-HartmanFrom: Finn Thain <[email protected]>
[ Upstream commit 86ce436e30d86327c9f5260f718104ae7b21f506 ]
drivers/macintosh/via-pmu-event.o: In function `via_pmu_event':
via-pmu-event.c:(.text+0x44): undefined reference to input_event' via-pmu-event.c:(.text+0x68): undefined reference to input_event' via-pmu-event.c:(.text+0x94): undefined reference to input_event' via-pmu-event.c:(.text+0xb8): undefined reference to input_event' drivers/macintosh/via-pmu-event.o: In function `via_pmu_event_init':
via-pmu-event.c:(.init.text+0x20): undefined reference to input_allocate_device' via-pmu-event.c:(.init.text+0xc4): undefined reference to input_register_device' via-pmu-event.c:(.init.text+0xd4): undefined reference to `input_free_device' make[1]: *** [Makefile:1155: vmlinux] Error 1
make: *** [Makefile:350: __build_one_by_one] Error 2
Don't call into the input subsystem unless CONFIG_INPUT is built-in.
--- drivers/macintosh/Kconfig | 4 ++++ drivers/macintosh/Makefile | 3 ++- drivers/macintosh/via-pmu.c | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-)
drivers/macintosh/Kconfig +4 -0
@@ -67,6 +67,10 @@ config ADB_PMU this device; you should do so if your machine is one of those mentioned above. +config ADB_PMU_EVENT + def_bool y + depends on ADB_PMU && INPUT=y + config ADB_PMU_LED bool "Support for the Power/iBook front LED" depends on PPC_PMAC && ADB_PMU
drivers/macintosh/Makefile +2 -1
@@ -12,7 +12,8 @@ obj-$(CONFIG_MAC_EMUMOUSEBTN) += mac_hid.o obj-$(CONFIG_INPUT_ADBHID) += adbhid.o obj-$(CONFIG_ANSLCD) += ans-lcd.o -obj-$(CONFIG_ADB_PMU) += via-pmu.o via-pmu-event.o +obj-$(CONFIG_ADB_PMU) += via-pmu.o +obj-$(CONFIG_ADB_PMU_EVENT) += via-pmu-event.o obj-$(CONFIG_ADB_PMU_LED) += via-pmu-led.o obj-$(CONFIG_PMAC_BACKLIGHT) += via-pmu-backlight.o obj-$(CONFIG_ADB_CUDA) += via-cuda.o
drivers/macintosh/via-pmu.c +1 -1
@@ -1459,7 +1459,7 @@ pmu_handle_data(unsigned char *data, int len)pmu_pass_intr (data, len);/* len == 6 is probably a bad check. But how do I * know what PMU versions send what events here? */ -if (len ==6 ) { +if (IS_ENABLED (CONFIG_ADB_PMU_EVENT ) && len ==6 ) {via_pmu_event (PMU_EVT_POWER , !!(data[1 ]&8 ));via_pmu_event (PMU_EVT_LID , data[1 ]&1 ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 247/879 powerpc/iommu: Add missing of_node_put in iommu_init_early_dart
In reply to Greg Kroah-HartmanFrom: Peng Wu <[email protected]>
[ Upstream commit 57b742a5b8945118022973e6416b71351df512fb ]
The device_node pointer is returned by of_find_compatible_node with refcount incremented. We should use of_node_put() to avoid the refcount leak.
--- arch/powerpc/sysdev/dart_iommu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/sysdev/dart_iommu.c +4 -2
@@ -404,9 +404,10 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops) }/* Initialize the DART HW */ -if (dart_init (dn) !=0 ) +if (dart_init (dn) !=0 ) { +of_node_put (dn);return ; - + }/* * U4 supports a DART bypass, we use it for 64-bit capable devices to * improve performance. However, that only works for devices connected
@@ -419,6 +420,7 @@ void __init iommu_init_early_dart(struct pci_controller_ops *controller_ops)/* Setup pci_dma ops */ set_pci_dma_ops (&dma_iommu_ops); +of_node_put (dn); }#ifdef CONFIG_PM
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 248/879 fanotify: fix incorrect fmode_t casts
In reply to Greg Kroah-HartmanFrom: Vasily Averin <[email protected]>
[ Upstream commit dccd855771b37820b6d976a99729c88259549f85 ]
Fixes sparce warnings:fs/notify/fanotify/fanotify_user.c:267:63: sparse:
warning: restricted fmode_t degrades to integerfs/notify/fanotify/fanotify_user.c:1351:28: sparse:
warning: restricted fmode_t degrades to integer
FMODE_NONTIFY have bitwise fmode_t type and requires __force attribute for any casts.
--- fs/notify/fanotify/fanotify_user.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/notify/fanotify/fanotify_user.c +2 -2
@@ -264,7 +264,7 @@ static int create_fd(struct fsnotify_group *group, struct path *path,* originally opened O_WRONLY. */ new_file =dentry_open (path, - group->fanotify_data.f_flags |FMODE_NONOTIFY , + group->fanotify_data.f_flags | __FMODE_NONOTIFY,current_cred ());if (IS_ERR (new_file)) {/*
@@ -1348,7 +1348,7 @@ SYSCALL_DEFINE2(fanotify_init, unsigned int, flags, unsigned int, event_f_flags) (!(fid_mode & FAN_REPORT_NAME) || !(fid_mode & FAN_REPORT_FID)))return -EINVAL ; - f_flags =O_RDWR |FMODE_NONOTIFY ; + f_flags =O_RDWR | __FMODE_NONOTIFY;if (flags &FAN_CLOEXEC ) f_flags |=O_CLOEXEC ;if (flags &FAN_NONBLOCK )
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 249/879 smb3: check for null tcon
In reply to Greg Kroah-HartmanFrom: Steve French <[email protected]>
[ Upstream commit bbdf6cf56c88845fb0b713cbf5c6623c53fe40d8 ]
Although unlikely to be null, it is confusing to use a pointer before checking for it to be null so move the use down after null check.
Addresses-Coverity: 1517586 ("Null pointer dereferences (REVERSE_INULL)")
--- fs/cifs/smb2ops.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/cifs/smb2ops.c +5 -2
@@ -760,8 +760,8 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,struct cifs_sb_info *cifs_sb, struct cached_fid **cfid) { - struct cifs_ses *ses = tcon->ses; -struct TCP_Server_Info *server = ses->server; + struct cifs_ses *ses; +struct TCP_Server_Info *server;struct cifs_open_parms oparms;struct smb2_create_rsp *o_rsp =NULL ;struct smb2_query_info_rsp *qi_rsp =NULL ;
@@ -779,6 +779,9 @@ int open_cached_dir(unsigned int xid, struct cifs_tcon *tcon,if (tcon->nohandlecache)return -ENOTSUPP ; + ses = tcon->ses; + server = ses->server; +if (cifs_sb->root ==NULL )return -ENOENT ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 250/879 RDMA/hfi1: Prevent panic when SDMA is disabled
In reply to Greg Kroah-HartmanFrom: Douglas Miller <[email protected]>
[ Upstream commit 629e052d0c98e46dde9f0824f0aa437f678d9b8f ]
If the hfi1 module is loaded with HFI1_CAP_SDMA off, a call to hfi1_write_iter() will dereference a NULL pointer and panic. A typical stack frame is:
sdma_select_user_engine [hfi1]
hfi1_user_sdma_process_request [hfi1]
hfi1_write_iter [hfi1]
do_iter_readv_writev
do_iter_write
vfs_writev
do_writev
do_syscall_64
The fix is to test for SDMA in hfi1_write_iter() and fail the I/O with EINVAL.
--- drivers/infiniband/hw/hfi1/file_ops.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/infiniband/hw/hfi1/file_ops.c +2 -0
@@ -265,6 +265,8 @@ static ssize_t hfi1_write_iter(struct kiocb *kiocb, struct iov_iter *from)unsigned long dim = from->nr_segs;int idx; +if (!HFI1_CAP_IS_KSET (SDMA )) +return -EINVAL ; idx =srcu_read_lock (&fd->pq_srcu); pq =srcu_dereference (fd->pq, &fd->pq_srcu);if (!cq || !pq) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 251/879 cifs: do not use tcpStatus after negotiate completes
In reply to Greg Kroah-HartmanFrom: Shyam Prasad N <[email protected]>
[ Upstream commit 1a6a41d4cedd9b302e2200e6f0e3c44dbbe13689 ]
Recent changes to multichannel to allow channel reconnects to work in parallel and independent of each other did so by making use of tcpStatus for the connection, and status for the session. However, this did not take into account the multiuser scenario, where same connection is used by multiple connections.
However, tcpStatus should be tracked only till the end of negotiate exchange, and not used for session setup. This change fixes this.
--- fs/cifs/connect.c | 23 +++++++++++------------ fs/cifs/smb2pdu.c | 3 ++- fs/cifs/smb2transport.c | 3 ++- 3 files changed, 15 insertions(+), 14 deletions(-)
fs/cifs/connect.c +11 -12
@@ -3956,7 +3956,7 @@ cifs_negotiate_protocol(const unsigned int xid, struct cifs_ses *ses,if (rc ==0 ) {spin_lock (&cifs_tcp_ses_lock);if (server->tcpStatus == CifsInNegotiate) - server->tcpStatus = CifsNeedSessSetup; + server->tcpStatus = CifsGood;else rc = -EHOSTDOWN ;spin_unlock (&cifs_tcp_ses_lock);
@@ -3979,19 +3979,18 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,bool is_binding = false;/* only send once per connect */ +spin_lock (&ses->chan_lock); + is_binding = !CIFS_ALL_CHANS_NEED_RECONNECT (ses); +spin_unlock (&ses->chan_lock); +spin_lock (&cifs_tcp_ses_lock); -if ((server->tcpStatus != CifsNeedSessSetup) && - (ses->status == CifsGood)) { +if (ses->status == CifsExiting) {spin_unlock (&cifs_tcp_ses_lock);return 0 ; } - server->tcpStatus = CifsInSessSetup; + ses->status = CifsInSessSetup;spin_unlock (&cifs_tcp_ses_lock); -spin_lock (&ses->chan_lock); - is_binding = !CIFS_ALL_CHANS_NEED_RECONNECT (ses); -spin_unlock (&ses->chan_lock); -if (!is_binding) { ses->capabilities = server->capabilities;if (!linuxExtEnabled)
@@ -4015,13 +4014,13 @@ cifs_setup_session(const unsigned int xid, struct cifs_ses *ses,if (rc) {cifs_server_dbg (VFS ,"Send error in SessSetup = %d\n" , rc);spin_lock (&cifs_tcp_ses_lock); -if (server->tcpStatus == CifsInSessSetup) - server->tcpStatus = CifsNeedSessSetup; +if (ses->status == CifsInSessSetup) + ses->status = CifsNeedSessSetup;spin_unlock (&cifs_tcp_ses_lock); }else {spin_lock (&cifs_tcp_ses_lock); -if (server->tcpStatus == CifsInSessSetup) - server->tcpStatus = CifsGood; +if (ses->status == CifsInSessSetup) + ses->status = CifsGood;/* Even if one channel is active, session is in good state */ ses->status = CifsGood;spin_unlock (&cifs_tcp_ses_lock);
fs/cifs/smb2pdu.c +2 -1
@@ -3899,7 +3899,8 @@ SMB2_echo(struct TCP_Server_Info *server)cifs_dbg (FYI ,"In echo request for conn_id %lld\n" , server->conn_id);spin_lock (&cifs_tcp_ses_lock); -if (server->tcpStatus == CifsNeedNegotiate) { +if (server->ops->need_neg && + server->ops->need_neg (server)) {spin_unlock (&cifs_tcp_ses_lock);/* No need to send echo on newly established connections */ mod_delayed_work (cifsiod_wq, &server->reconnect,0 );
fs/cifs/smb2transport.c +2 -1
@@ -641,7 +641,8 @@ smb2_sign_rqst(struct smb_rqst *rqst, struct TCP_Server_Info *server)if (!is_signed)return 0 ;spin_lock (&cifs_tcp_ses_lock); -if (server->tcpStatus == CifsNeedNegotiate) { +if (server->ops->need_neg && + server->ops->need_neg (server)) {spin_unlock (&cifs_tcp_ses_lock);return 0 ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 252/879 Input: gpio-keys - cancel delayed work only in case of GPIO
In reply to Greg Kroah-HartmanFrom: Lad Prabhakar <[email protected]>
[ Upstream commit cee409bbba0d1bd3fb73064fb480ff365f453b5d ]
gpio_keys module can either accept gpios or interrupts. The module initializes delayed work in case of gpios only and is only used if debounce timer is not used, so make sure cancel_delayed_work_sync() is called only when its gpio-backed and debounce_use_hrtimer is false.
This fixes the issue seen below when the gpio_keys module is unloaded and an interrupt pin is used instead of GPIO:
[ 360.297569] ------------[ cut here ]------------ [ 360.302303] WARNING: CPU: 0 PID: 237 at kernel/workqueue.c:3066 __flush_work+0x414/0x470 [ 360.310531] Modules linked in: gpio_keys(-) [ 360.314797] CPU: 0 PID: 237 Comm: rmmod Not tainted 5.18.0-rc5-arm64-renesas-00116-g73636105874d-dirty #166 [ 360.324662] Hardware name: Renesas SMARC EVK based on r9a07g054l2 (DT) [ 360.331270] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 360.338318] pc : __flush_work+0x414/0x470 [ 360.342385] lr : __cancel_work_timer+0x140/0x1b0 [ 360.347065] sp : ffff80000a7fba00 [ 360.350423] x29: ffff80000a7fba00 x28: ffff000012b9c5c0 x27: 0000000000000000 [ 360.357664] x26: ffff80000a7fbb80 x25: ffff80000954d0a8 x24: 0000000000000001 [ 360.364904] x23: ffff800009757000 x22: 0000000000000000 x21: ffff80000919b000 [ 360.372143] x20: ffff00000f5974e0 x19: ffff00000f5974e0 x18: ffff8000097fcf48 [ 360.379382] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000053f40 [ 360.386622] x14: ffff800009850e88 x13: 0000000000000002 x12: 000000000000a60c [ 360.393861] x11: 000000000000a610 x10: 0000000000000000 x9 : 0000000000000008 [ 360.401100] x8 : 0101010101010101 x7 : 00000000a473c394 x6 : 0080808080808080 [ 360.408339] x5 : 0000000000000001 x4 : 0000000000000000 x3 : ffff80000919b458 [ 360.415578] x2 : ffff8000097577f0 x1 : 0000000000000001 x0 : 0000000000000000 [ 360.422818] Call trace: [ 360.425299] __flush_work+0x414/0x470 [ 360.429012] __cancel_work_timer+0x140/0x1b0 [ 360.433340] cancel_delayed_work_sync+0x10/0x18 [ 360.437931] gpio_keys_quiesce_key+0x28/0x58 [gpio_keys] [ 360.443327] devm_action_release+0x10/0x18 [ 360.447481] release_nodes+0x8c/0x1a0 [ 360.451194] devres_release_all+0x90/0x100 [ 360.455346] device_unbind_cleanup+0x14/0x60 [ 360.459677] device_release_driver_internal+0xe8/0x168 [ 360.464883] driver_detach+0x4c/0x90 [ 360.468509] bus_remove_driver+0x54/0xb0 [ 360.472485] driver_unregister+0x2c/0x58 [ 360.476462] platform_driver_unregister+0x10/0x18 [ 360.481230] gpio_keys_exit+0x14/0x828 [gpio_keys] [ 360.486088] __arm64_sys_delete_module+0x1e0/0x270 [ 360.490945] invoke_syscall+0x40/0xf8 [ 360.494661] el0_svc_common.constprop.3+0xf0/0x110 [ 360.499515] do_el0_svc+0x20/0x78 [ 360.502877] el0_svc+0x48/0xf8 [ 360.505977] el0t_64_sync_handler+0x88/0xb0 [ 360.510216] el0t_64_sync+0x148/0x14c [ 360.513930] irq event stamp: 4306 [ 360.517288] hardirqs last enabled at (4305): [<ffff8000080b0300>] __cancel_work_timer+0x130/0x1b0 [ 360.526359] hardirqs last disabled at (4306): [<ffff800008d194fc>] el1_dbg+0x24/0x88 [ 360.534204] softirqs last enabled at (4278): [<ffff8000080104a0>] _stext+0x4a0/0x5e0 [ 360.542133] softirqs last disabled at (4267): [<ffff8000080932ac>] irq_exit_rcu+0x18c/0x1b0 [ 360.550591] ---[ end trace 0000000000000000 ]---
--- drivers/input/keyboard/gpio_keys.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/keyboard/gpio_keys.c +1 -1
@@ -131,7 +131,7 @@ static void gpio_keys_quiesce_key(void *data)if (!bdata->gpiod)hrtimer_cancel (&bdata->release_timer); -if (bdata->debounce_use_hrtimer) +else if (bdata->debounce_use_hrtimer)hrtimer_cancel (&bdata->debounce_timer);else cancel_delayed_work_sync (&bdata->work);
Signature · 1 line
2.35.1